HubSpot – Free Marketing Plugin for WordPress - Version 4.1

Version Description

Download this release

Release Info

Developer leadin
Plugin Icon 128x128 HubSpot – Free Marketing Plugin for WordPress
Version 4.1
Comparing to
See all releases

Code changes from version 3.1.9 to 4.1

Files changed (75) hide show
  1. admin/inc/class-leadin-contact.php +0 -863
  2. admin/inc/class-leadin-list-table.php +0 -707
  3. admin/inc/class-leadin-tag-editor.php +0 -241
  4. admin/inc/class-leadin-tags-list-table.php +0 -250
  5. admin/inc/class-leadin-viewers.php +0 -72
  6. admin/inc/class-stats-dashboard.php +0 -335
  7. admin/inc/sources/Snowplow/RefererParser/Config/LI_ConfigFileReaderTrait.php +0 -54
  8. admin/inc/sources/Snowplow/RefererParser/Config/LI_ConfigReaderInterface.php +0 -15
  9. admin/inc/sources/Snowplow/RefererParser/Config/LI_JsonConfigReader.php +0 -57
  10. admin/inc/sources/Snowplow/RefererParser/Exception/LI_InvalidArgumentException.php +0 -9
  11. admin/inc/sources/Snowplow/RefererParser/LI_Medium.php +0 -16
  12. admin/inc/sources/Snowplow/RefererParser/LI_Parser.php +0 -121
  13. admin/inc/sources/Snowplow/RefererParser/LI_Referer.php +0 -78
  14. admin/inc/sources/referers.json +0 -3890
  15. admin/leadin-admin.php +87 -1898
  16. assets/css/build/leadin-admin.css +0 -1
  17. assets/css/build/leadin-lead-notifcation.css +0 -1
  18. assets/css/build/leadin-subscribe.css +0 -1
  19. assets/css/select2.css +0 -601
  20. assets/js/build/leadin-admin.js +0 -4385
  21. assets/js/build/leadin-admin.min.js +0 -8
  22. assets/js/build/leadin-lazyload.js +0 -0
  23. assets/js/build/leadin-lazyload.min.js +0 -0
  24. assets/js/build/leadin-subscribe.js +0 -520
  25. assets/js/build/leadin-subscribe.min.js +0 -1
  26. assets/js/build/leadin-tracking.js +0 -800
  27. assets/js/build/leadin-tracking.min.js +0 -1
  28. images/Leadin_logo.png +0 -0
  29. images/checkmark.png +0 -0
  30. images/leadin-icon-16x16-white.png +0 -0
  31. images/popup-bottom.png +0 -0
  32. images/popup-over.png +0 -0
  33. images/popup-top.png +0 -0
  34. images/power-up-icon-aweber-connect.png +0 -0
  35. images/power-up-icon-aweber-connect@2x.png +0 -0
  36. images/power-up-icon-aweber-connect_small.png +0 -0
  37. images/power-up-icon-aweber-connect_small@2x.png +0 -0
  38. images/power-up-icon-campaign-monitor-connect.png +0 -0
  39. images/power-up-icon-campaign-monitor-connect@2x.png +0 -0
  40. images/power-up-icon-campaign-monitor-connect_small.png +0 -0
  41. images/power-up-icon-campaign-monitor-connect_small@2x.png +0 -0
  42. images/power-up-icon-constant-contact-connect.png +0 -0
  43. images/power-up-icon-constant-contact-connect@2x.png +0 -0
  44. images/power-up-icon-constant-contact-connect_small.png +0 -0
  45. images/power-up-icon-constant-contact-connect_small@2x.png +0 -0
  46. images/power-up-icon-constant-contact-list-sync@2x.png +0 -0
  47. images/power-up-icon-constant-contact-list-sync_small@2x.png +0 -0
  48. images/power-up-icon-getresponse-connect.png +0 -0
  49. images/power-up-icon-getresponse-connect@2x.png +0 -0
  50. images/power-up-icon-getresponse-connect_small.png +0 -0
  51. images/power-up-icon-getresponse-connect_small@2x.png +0 -0
  52. images/power-up-icon-getresponse-list-sync_small.png +0 -0
  53. images/power-up-icon-getresponse-list-sync_small@2x.png +0 -0
  54. images/power-up-icon-mailchimp-connect.png +0 -0
  55. images/power-up-icon-mailchimp-connect@2x.png +0 -0
  56. images/power-up-icon-mailchimp-connect_small.png +0 -0
  57. images/power-up-icon-mailchimp-connect_small@2x.png +0 -0
  58. images/power-up-icon-mailchimp-list-sync@2x.png +0 -0
  59. images/power-up-icon-mailchimp-list-sync_small@2x.png +0 -0
  60. images/powerup-icon-analytics.png +0 -0
  61. images/powerup-icon-analytics@2x.png +0 -0
  62. images/powerup-icon-ideas.png +0 -0
  63. images/powerup-icon-ideas@2x.png +0 -0
  64. images/powerup-icon-leads.png +0 -0
  65. images/powerup-icon-leads@2x.png +0 -0
  66. images/powerup-icon-lookups.png +0 -0
  67. images/powerup-icon-lookups@2x.png +0 -0
  68. images/powerup-icon-subscribe.png +0 -0
  69. images/powerup-icon-subscribe@2x.png +0 -0
  70. images/powerup-icon-vip.png +0 -0
  71. images/powerup-icon-vip@2x.png +0 -0
  72. images/powerups.png +0 -0
  73. images/select2-spinner.gif +0 -0
  74. images/triangle.png +0 -0
  75. inc/class-emailer.php +0 -190
admin/inc/class-leadin-contact.php DELETED
@@ -1,863 +0,0 @@
1
- <?php
2
-
3
- //=============================================
4
- // Include Needed Files
5
- //=============================================
6
-
7
- require_once(LEADIN_PLUGIN_DIR . '/power-ups/lookups/admin/inc/blacklist_domains.php');
8
-
9
- //=============================================
10
- // LI_Contact Class
11
- //=============================================
12
- class LI_Contact {
13
-
14
- /**
15
- * Variables
16
- */
17
- var $hashkey;
18
- var $history;
19
-
20
- /**
21
- * Class constructor
22
- */
23
- function __construct ()
24
- {
25
-
26
- }
27
-
28
- /**
29
- * Gets hashkey from lead id
30
- *
31
- * @param int
32
- * @return string
33
- */
34
- function set_hashkey_by_id ( $lead_id )
35
- {
36
- global $wpdb;
37
-
38
- $q = $wpdb->prepare("SELECT hashkey FROM $wpdb->li_leads WHERE lead_id = %d", $lead_id);
39
- $this->hashkey = $wpdb->get_var($q);
40
-
41
- return $this->hashkey;
42
- }
43
-
44
- /**
45
- * Gets contact history from the database (pageviews, form submissions, and lead details)
46
- *
47
- * @param string
48
- * @return object $history (pageviews_by_session, submission, lead)
49
- */
50
- function get_contact_history ()
51
- {
52
- global $wpdb;
53
-
54
- $lead = (object)NULL;
55
- $pageviews = (object)NULL;
56
- $submissions = (object)NULL;
57
- $tags = (object)NULL;
58
-
59
- $lead = $this->get_contact_details($this->hashkey);
60
- $pageviews = $this->get_contact_pageviews($this->hashkey, 'ARRAY_A');
61
- $submissions = $this->get_contact_submissions($this->hashkey, 'ARRAY_A');
62
- $tags = $this->get_contact_tags($this->hashkey);
63
-
64
- // Merge the page views array and submissions array and reorder by date
65
- $events_array = array_merge($pageviews, $submissions);
66
- usort($events_array, array('LI_Contact','sort_by_event_date'));
67
-
68
- $sessions = array();
69
- $cur_array = '0';
70
- $first_iteration = TRUE;
71
- $count = 0;
72
- $cur_event = 0;
73
- $prev_form_event = FALSE;
74
- $total_visits = 0;
75
- $total_pageviews = 0;
76
- $total_submissions = 0;
77
- $new_session = TRUE;
78
-
79
- $array_tags = array();
80
- if ( count($tags) )
81
- {
82
- foreach ( $tags as $tag )
83
- {
84
- array_push($array_tags, array (
85
- 'form_hashkey' => $tag->form_hashkey,
86
- 'tag_text' => $tag->tag_text,
87
- 'tag_slug' => $tag->tag_slug
88
- )
89
- );
90
- }
91
- }
92
-
93
- foreach ( $events_array as $event_name => $event )
94
- {
95
- // Create a new session array if pageview started a new session
96
- if ( $new_session )
97
- {
98
- $cur_array = $count;
99
-
100
- $sessions['session_' . $cur_array] = array();
101
- $sessions['session_' . $cur_array]['session_date'] = $event['event_date'];
102
- $sessions['session_' . $cur_array]['events'] = array();
103
-
104
- $cur_event = $count;
105
- $sessions['session_' . $cur_array]['events']['event_' . $cur_event] = array();
106
- $sessions['session_' . $cur_array]['events']['event_' . $cur_event]['event_type'] = 'pageview';
107
- $sessions['session_' . $cur_array]['events']['event_' . $cur_event]['event_date'] = $event['event_date'];
108
-
109
- // Set the first submission if it's not set and then leave it alone
110
- if ( ! isset($lead->last_visit) )
111
- $lead->last_visit = $event['event_date'];
112
-
113
- // Used for $lead->total_visits
114
- $total_visits++;
115
- $new_session = FALSE;
116
- }
117
-
118
- // Pageview activity
119
- if ( !isset($event['form_fields']) )
120
- {
121
- $cur_event = $count;
122
- $sessions['session_' . $cur_array]['events']['event_' . $cur_event] = array();
123
- $sessions['session_' . $cur_array]['events']['event_' . $cur_event]['event_type'] = 'pageview';
124
- $sessions['session_' . $cur_array]['events']['event_' . $cur_event]['event_date'] = $event['event_date'];
125
- $sessions['session_' . $cur_array]['events']['event_' . $cur_event]['activities'][] = $event;
126
- $total_pageviews++;
127
-
128
- // Always overwrite first_visit which will end as last pageview date
129
- $lead->first_visit = $event['event_date'];
130
- $lead->lead_source = $event['pageview_source'];
131
- }
132
- else
133
- {
134
- // Always overwrite the last_submission date which will end as last submission date
135
- $lead->first_submission = $event['event_date'];
136
-
137
- $event['form_name'] = 'form';
138
- if ( $event['form_selector_id'] )
139
- $event['form_name'] = '#' . $event['form_selector_id'];
140
- else if ( $event['form_selector_classes'] )
141
- {
142
- if ( strstr($event['form_selector_classes'], ',') )
143
- {
144
- $classes = explode(',', $event['form_selector_classes']);
145
- $event['form_name'] = ( isset($classes[0]) ? '.' . $classes[0] : 'form' );
146
- }
147
- else
148
- $event['form_name'] = '.' . $event['form_selector_classes'];
149
- }
150
-
151
- // Run through all the tags and see if the form_hashkey triggered the tag relationship
152
- $form_tags = array();
153
- if ( count($array_tags) )
154
- {
155
- foreach ( $array_tags as $at )
156
- {
157
- if ( $at['form_hashkey'] == $event['form_hashkey'] )
158
- array_push($form_tags, $at);
159
- }
160
- }
161
-
162
- $cur_event = $count;
163
- $sessions['session_' . $cur_array]['events']['event_' . $cur_event] = array();
164
- $sessions['session_' . $cur_array]['events']['event_' . $cur_event]['event_type'] = 'form';
165
- $sessions['session_' . $cur_array]['events']['event_' . $cur_event]['event_date'] = $event['event_date'];
166
- $sessions['session_' . $cur_array]['events']['event_' . $cur_event]['form_name'] = $event['form_name'];
167
- $sessions['session_' . $cur_array]['events']['event_' . $cur_event]['form_tags'] = $form_tags;
168
- $sessions['session_' . $cur_array]['events']['event_' . $cur_event]['activities'][] = $event;
169
-
170
- // Set the first submission if it's not set and then leave it alone
171
- if ( ! isset($lead->last_submission) )
172
- $lead->last_submission = $sessions['session_' . $cur_array]['events']['event_' . $cur_event];
173
-
174
- // Used for $lead->total_submissions
175
- $total_submissions++;
176
- }
177
-
178
- if ( (isset($event['pageview_session_start'])) && $event['pageview_session_start'] )
179
- {
180
- $new_session = TRUE;
181
- }
182
-
183
- $count++;
184
- }
185
-
186
- $lead->social_data = '';
187
- $lead->company_data = '';
188
-
189
- if ( WPLeadIn::is_power_up_active('lookups') )
190
- {
191
- $lead->social_data = $this->get_social_details($lead);
192
- $lead->company_data = $this->get_company_details($lead);
193
- }
194
-
195
- $lead->total_visits = $total_visits;
196
- $lead->total_pageviews = $total_pageviews;
197
- $lead->total_submissions = $total_submissions;
198
-
199
- $this->history = (object)NULL;
200
- $this->history->submission = ( isset($submissions[0]) ? $submissions[0] : '');
201
- $this->history->sessions = $sessions;
202
- $this->history->lead = $lead;
203
- $this->history->tags = $tags;
204
-
205
- return stripslashes_deep($this->history);
206
- }
207
-
208
- /**
209
- * Gets all the submissions for a contact
210
- *
211
- * @param string
212
- * @param string
213
- * @return array/object
214
- */
215
- function get_contact_submissions ( $hashkey, $output_type = 'OBJECT' )
216
- {
217
- global $wpdb;
218
-
219
- $q = $wpdb->prepare("
220
- SELECT
221
- DATE_SUB(form_date, INTERVAL %d HOUR) AS event_date,
222
- DATE_FORMAT(DATE_SUB(form_date, INTERVAL %d HOUR), %s) AS form_date,
223
- form_page_title,
224
- form_hashkey,
225
- form_page_url,
226
- form_fields,
227
- form_selector_id,
228
- form_selector_classes
229
- FROM
230
- $wpdb->li_submissions
231
- WHERE
232
- form_deleted = 0 AND
233
- lead_hashkey = %s ORDER BY event_date DESC", $wpdb->db_hour_offset, $wpdb->db_hour_offset, '%b %D %l:%i%p', $hashkey);
234
-
235
- $submissions = $wpdb->get_results($q, $output_type);
236
-
237
- return $submissions;
238
- }
239
-
240
- /**
241
- * Gets all the pageviews for a contact
242
- *
243
- * @param string
244
- * @param string
245
- * @return array/object
246
- */
247
- function get_contact_pageviews ( $hashkey, $output_type = 'OBJECT' )
248
- {
249
- global $wpdb;
250
-
251
- $q = $wpdb->prepare("
252
- SELECT
253
- pageview_id,
254
- DATE_SUB(pageview_date, INTERVAL %d HOUR) AS event_date,
255
- DATE_FORMAT(DATE_SUB(pageview_date, INTERVAL %d HOUR), %s) AS pageview_day,
256
- DATE_FORMAT(DATE_SUB(pageview_date, INTERVAL %d HOUR), %s) AS pageview_date,
257
- lead_hashkey, pageview_title, pageview_url, pageview_source, pageview_session_start
258
- FROM
259
- $wpdb->li_pageviews
260
- WHERE
261
- pageview_deleted = 0 AND
262
- lead_hashkey LIKE %s ORDER BY event_date DESC", $wpdb->db_hour_offset, $wpdb->db_hour_offset, '%b %D', $wpdb->db_hour_offset, '%b %D %l:%i%p', $hashkey);
263
-
264
- $pageviews = $wpdb->get_results($q, $output_type);
265
-
266
- return $pageviews;
267
- }
268
-
269
- /**
270
- * Gets the details row for a contact
271
- *
272
- * @param string
273
- * @param string
274
- * @return array/object
275
- */
276
- function get_contact_details ( $hashkey, $output_type = 'OBJECT' )
277
- {
278
- global $wpdb;
279
-
280
- $q = $wpdb->prepare("
281
- SELECT
282
- DATE_FORMAT(DATE_SUB(lead_date, INTERVAL %d HOUR), %s) AS lead_date,
283
- lead_id,
284
- lead_ip,
285
- lead_email,
286
- lead_first_name,
287
- lead_last_name,
288
- social_data,
289
- company_data,
290
- lead_deleted
291
- FROM
292
- $wpdb->li_leads
293
- WHERE hashkey LIKE %s", $wpdb->db_hour_offset, '%b %D %l:%i%p', $hashkey);
294
-
295
- $contact_details = $wpdb->get_row($q, $output_type);
296
-
297
- return $contact_details;
298
- }
299
-
300
- /**
301
- * Sets the social_data on a contact object
302
- *
303
- * @param object
304
- * @return object
305
- */
306
- function get_social_details ( $lead )
307
- {
308
- // Grab the social intel lookup
309
- $response = json_decode($this->query_social_lookup_endpoint(strtolower($lead->lead_email), site_url()));
310
- $social_data = (Object)NULL;
311
- $social_data_exists = FALSE;
312
-
313
- /*
314
- - Create a null object
315
- - If no response, return false
316
- - If response, set all defaults
317
- - Overwrite defaults
318
- - Loop through response, if no values set, then return false
319
- */
320
-
321
- if ( isset($response->status) && $response->status == 'error' )
322
- {
323
- return FALSE;
324
- }
325
- else if ( ! isset($response->status) )
326
- {
327
- $social_data->company_name = '';
328
- $social_data->title = '';
329
- $social_data->description = '';
330
- $social_data->social_profiles = '';
331
-
332
- $update_name = FALSE;
333
-
334
- // Updates the contact first name with the API value if it isn't set yet on the contact row
335
- if ( ! $lead->lead_first_name )
336
- {
337
- if ( isset($response->fullcontactDetails->contactinfo->givenname) )
338
- {
339
- $first_name = $response->fullcontactDetails->contactinfo->givenname;
340
- $update_name = TRUE;
341
- }
342
- else if ( isset($response->fullcontactDetails->contactinfo->fullname) )
343
- {
344
- // Grab the first section of the full name
345
- $first_name = reset(explode(' ', $response->fullcontactDetails->contactinfo->fullname));
346
- $update_name = TRUE;
347
- }
348
- }
349
-
350
- // Updates the contact last name with the API value if it isn't set yet on the contact row
351
- if ( ! $lead->lead_last_name )
352
- {
353
- if ( isset($response->fullcontactDetails->contactinfo->familyname) )
354
- {
355
- $last_name = $response->fullcontactDetails->contactinfo->familyname;
356
- $update_name = TRUE;
357
- }
358
- else if ( isset($response->fullcontactDetails->contactinfo->fullname) )
359
- {
360
- // Grab the last section of the full name
361
- $last_name = end(explode(' ', $response->fullcontactDetails->contactinfo->fullname));
362
- $update_name = TRUE;
363
- }
364
- }
365
-
366
- if ( $update_name )
367
- $this->update_contact_full_name($this->hashkey, $first_name, $last_name);
368
- }
369
-
370
- // Figure out the job title and company name
371
- if ( isset($response->fullcontactDetails) )
372
- {
373
- $fullcontactDetails = $response->fullcontactDetails;
374
-
375
- if ( isset($fullcontactDetails->organizations) )
376
- {
377
- if ( count($fullcontactDetails->organizations) )
378
- {
379
- foreach ( $fullcontactDetails->organizations as $org )
380
- {
381
- if ( isset($org->isprimary) && $org->isprimary )
382
- {
383
- $social_data->company_name = ( isset($org->name) ? $org->name : '' );
384
- $social_data->title = ( isset($org->title) ? $org->title : '' );
385
- $social_data_exists = TRUE;
386
- break;
387
- }
388
- }
389
- }
390
- }
391
-
392
- // Set the description
393
- if ( isset($response->twitterDetails->description) )
394
- {
395
- if ( $response->twitterDetails->description )
396
- {
397
- $social_data->description = $response->twitterDetails->description;
398
- $social_data_exists = TRUE;
399
- }
400
- }
401
-
402
- // Set social profiles
403
- if ( count($fullcontactDetails->socialprofiles) )
404
- {
405
- $social_profiles = array();
406
-
407
- foreach ( $fullcontactDetails->socialprofiles as $key => $profile )
408
- {
409
- $whitelisted_profiles = array('twitter', 'facebook', 'linkedin', 'googleplus');
410
- if ( in_array($profile->typeid, $whitelisted_profiles) && ! empty($profile->username) )
411
- {
412
- $social_profile = (object)NULL;
413
- $social_profile->typename = $profile->typename;
414
- $social_profile->url = leadin_safe_social_profile_url($profile->url);
415
- $social_profile->typeid = $profile->typeid;
416
- $social_profile->username = $profile->username;
417
-
418
- $social_profiles[] = $social_profile;
419
- }
420
-
421
- // Default Twitter bio fallback if twitterDetails in API response
422
- if ( $profile->typeid == 'twitter' && ! isset($social_data->description) )
423
- {
424
- if ( isset($profile->bio) )
425
- {
426
- $social_data->description = $profile->bio;
427
- $social_data_exists = TRUE;
428
- }
429
- }
430
- }
431
-
432
- if ( count($social_profiles) )
433
- {
434
- $social_data->social_profiles = $social_profiles;
435
- $social_data_exists = TRUE;
436
- }
437
- }
438
- }
439
-
440
- if ( $social_data_exists )
441
- return $social_data;
442
- else
443
- return FALSE;
444
- }
445
-
446
- /**
447
- * Sets the company_data on a contact
448
- *
449
- * @param object
450
- * @return object
451
- */
452
- function get_company_details ( $lead )
453
- {
454
- global $blacklist_freemail_domains;
455
- global $blacklist_nonmail_domains;
456
-
457
- $site_url = site_url();
458
- $email_domain = end(explode('@', $lead->lead_email));
459
- $leadin_user = leadin_get_current_user();
460
- $company_data = (Object)NULL;
461
-
462
- if ( strstr($leadin_user['email'], ',') )
463
- $leadin_user_email = reset(explode(',', $leadin_user['email']));
464
- else
465
- $leadin_user_email = $leadin_user['email'];
466
-
467
- if ( ! in_array($email_domain, $blacklist_nonmail_domains) && ! in_array($email_domain, $blacklist_freemail_domains) )
468
- {
469
- // Grab the company intel lookup
470
- $response = json_decode($this->query_company_lookup_endpoint($email_domain, $leadin_user_email, $site_url));
471
-
472
- if ( isset($response->status) && $response->status == 'error' )
473
- {
474
- return FALSE;
475
- }
476
- else if ( ! isset($response->status) )
477
- {
478
- $company_data_exists = FALSE;
479
-
480
- if ( isset($response->properties->name) )
481
- $company_data->name = $response->properties->name;
482
- else
483
- $company_data->name = '';
484
-
485
- if ( isset($response->properties->overview) )
486
- {
487
- $company_data->overview = $response->properties->overview;
488
- $company_data_exists = TRUE;
489
- }
490
- else
491
- $company_data->overview = '';
492
-
493
- if ( isset($response->properties->employees) )
494
- {
495
- $company_data->employees = $response->properties->employees;
496
- $company_data_exists = TRUE;
497
- }
498
- else
499
- $company_data->employees = '';
500
-
501
- if ( isset($response->properties->revenue) )
502
- {
503
- $company_data->revenue = $response->properties->revenue;
504
- $company_data_exists = TRUE;
505
- }
506
- else
507
- $company_data->revenue = '';
508
-
509
-
510
- if ( isset($response->properties->country) )
511
- {
512
- $company_data->country = $response->properties->country;
513
- $company_data_exists = TRUE;
514
- }
515
- else
516
- $company_data->country = '';
517
-
518
- if ( isset($response->properties->city) )
519
- {
520
- $company_data->city = $response->properties->city;
521
- $company_data_exists = TRUE;
522
- }
523
- else
524
- $company_data->city = '';
525
-
526
- if ( isset($response->properties->state) )
527
- {
528
- $company_data->state = $response->properties->state;
529
- $company_data_exists = TRUE;
530
- }
531
- else
532
- $company_data->state = '';
533
-
534
- if ( isset($response->properties->founded) )
535
- {
536
- $company_data->founded = $response->properties->founded;
537
- $company_data_exists = TRUE;
538
- }
539
- else
540
- $company_data->founded = '';
541
-
542
- if ( isset($response->properties->facebookpageurl) )
543
- {
544
- $company_data->facebookpageurl = $response->properties->facebookpageurl;
545
- $company_data_exists = TRUE;
546
- }
547
- else
548
- $company_data->facebookpageurl = '';
549
-
550
- if ( isset($response->properties->twitterusername) )
551
- {
552
- $company_data->twitterusername = $response->properties->twitterusername;
553
- $company_data_exists = TRUE;
554
- }
555
- else
556
- $company_data->twitterusername = '';
557
-
558
- if ( isset($response->properties->twitterurl) )
559
- {
560
- $company_data->twitterurl = $response->properties->twitterurl;
561
- $company_data_exists = TRUE;
562
- }
563
- else
564
- $company_data->twitterurl = '';
565
-
566
- if ( isset($response->properties->linkedinurl) )
567
- {
568
- $company_data->linkedinurl = $response->properties->linkedinurl;
569
- $company_data_exists = TRUE;
570
- }
571
- else
572
- $company_data->linkedinurl = '';
573
-
574
- if ( isset($response->properties->address) )
575
- {
576
- $company_data->address = $response->properties->address;
577
- $company_data_exists = TRUE;
578
- }
579
- else
580
- $company_data->address = '';
581
-
582
- if ( $company_data_exists )
583
- return $company_data;
584
- else
585
- return FALSE;
586
-
587
- }
588
- }
589
- else
590
- return FALSE;
591
- }
592
-
593
- /**
594
- * Gets all the tags for a contact
595
- *
596
- * @param string
597
- * @param string
598
- * @return array/object
599
- */
600
- function get_contact_tags ( $hashkey = '', $output_type = 'OBJECT' )
601
- {
602
- global $wpdb;
603
-
604
- $q = $wpdb->prepare("
605
- SELECT
606
- lt.tag_text, lt.tag_slug, lt.tag_order, lt.tag_id, ( ltr.tag_id IS NOT NULL AND ltr.tag_relationship_deleted = 0 ) AS tag_set, lt.tag_form_selectors, ltr.form_hashkey
607
- FROM
608
- $wpdb->li_tags lt
609
- LEFT OUTER JOIN
610
- $wpdb->li_tag_relationships ltr ON lt.tag_id = ltr.tag_id AND ltr.contact_hashkey = %s
611
- WHERE
612
- lt.tag_deleted = 0
613
- GROUP BY lt.tag_slug
614
- ORDER BY lt.tag_order ASC", $hashkey);
615
-
616
- $tags = $wpdb->get_results($q, $output_type);
617
-
618
- return $tags;
619
- }
620
-
621
- /**
622
- * Set the tags on a contact
623
- *
624
- * @param int
625
- * @param array
626
- * @return bool rows deleted or not
627
- */
628
- function update_contact_tags ( $contact_id, $update_tags )
629
- {
630
- global $wpdb;
631
-
632
- $esp_power_ups = array(
633
- 'MailChimp' => 'mailchimp_connect',
634
- 'Constant Contact' => 'constant_contact_connect',
635
- 'AWeber' => 'aweber_connect',
636
- 'GetResponse' => 'getresponse_connect',
637
- 'MailPoet' => 'mailpoet_connect',
638
- 'Campaign Monitor' => 'campaign_monitor_connect'
639
- );
640
-
641
- $safe_tags = $tags_to_update = '';
642
-
643
- if ( ! isset($this->hashkey) )
644
- $this->hashkey = $this->set_hashkey_by_id($contact_id);
645
-
646
- if ( ! isset($this->history) )
647
- $this->history = $this->get_contact_history();
648
-
649
- $q = $wpdb->prepare("
650
- SELECT
651
- lt.tag_text, lt.tag_slug, lt.tag_order, lt.tag_id, lt.tag_synced_lists, ltr.tag_relationship_id, ltr.tag_relationship_deleted, ( ltr.tag_id IS NOT NULL ) AS tag_set
652
- FROM
653
- $wpdb->li_tags lt
654
- LEFT OUTER JOIN
655
- $wpdb->li_tag_relationships ltr ON lt.tag_id = ltr.tag_id AND ltr.contact_hashkey = %s
656
- WHERE
657
- lt.tag_deleted = 0
658
- ORDER BY lt.tag_order ASC", $this->hashkey);
659
-
660
- $tags = $wpdb->get_results($q);
661
-
662
-
663
- // Start looping through all the tags that exist
664
- foreach ( $tags as $tag )
665
- {
666
- // Check if the tag is in the list of tags to update and hit the li_tag_relationships table accordingly
667
- $update_tag = in_array($tag->tag_id, $update_tags);
668
- if ( $update_tag )
669
- {
670
- if ( ! $tag->tag_set )
671
- {
672
- $wpdb->insert(
673
- $wpdb->li_tag_relationships,
674
- array (
675
- 'tag_id' => $tag->tag_id,
676
- 'contact_hashkey' => $this->hashkey
677
- ),
678
- array (
679
- '%d', '%s'
680
- )
681
- );
682
-
683
- $safe_tags .= $wpdb->insert_id . ',';
684
-
685
- leadin_track_plugin_activity('Tag Added - Contact Timeline');
686
- }
687
- else
688
- {
689
- $safe_tags .= $tag->tag_relationship_id . ',';
690
- $tags_to_update .= $tag->tag_relationship_id . ',';
691
- }
692
- }
693
-
694
- $synced_lists = array();
695
- //$removed_lists = array();
696
-
697
- // Only sync update contacts are deleted or were newly inserted
698
- if ( $tag->tag_synced_lists && $update_tag && ( $tag->tag_relationship_deleted || ! $tag->tag_set ) )
699
- {
700
- foreach ( unserialize($tag->tag_synced_lists) as $list )
701
- {
702
- // Skip syncing this list because the contact is already synced through another list
703
- if ( in_array($list['list_id'], $synced_lists) )
704
- continue;
705
-
706
- $power_up_global = 'leadin_' . $list['esp'] . '_connect' . '_wp';
707
- if ( array_key_exists($power_up_global, $GLOBALS) )
708
- {
709
- global ${$power_up_global};
710
-
711
- if ( ! ${$power_up_global}->activated )
712
- continue;
713
-
714
- ${$power_up_global}->push_contact_to_list($list['list_id'], $this->history->lead->lead_email, $this->history->lead->lead_first_name, $this->history->lead->lead_last_name);
715
- }
716
-
717
- array_push($synced_lists, $list['list_id']);
718
- }
719
- }
720
- }
721
-
722
- if ( $tags_to_update )
723
- {
724
- $q = $wpdb->prepare("UPDATE $wpdb->li_tag_relationships SET tag_relationship_deleted = 0 WHERE contact_hashkey = %s AND tag_relationship_id IN ( " . rtrim($tags_to_update, ',') . " ) ", $this->hashkey);
725
- $tag_updated = $wpdb->query($q);
726
-
727
- leadin_track_plugin_activity('Tag Restored - Contact Timeline');
728
- }
729
-
730
- $q = $wpdb->prepare("UPDATE $wpdb->li_tag_relationships SET tag_relationship_deleted = 1 WHERE contact_hashkey = %s " . ( $safe_tags ? "AND tag_relationship_id NOT IN ( " . rtrim($safe_tags, ',') . " ) " : '' ) . " AND tag_relationship_deleted = 0 ", $this->hashkey);
731
- $deleted_tags = $wpdb->query($q);
732
-
733
- if ( $deleted_tags )
734
- {
735
- leadin_track_plugin_activity('Tag Removed - Contact Timeline');
736
- }
737
- }
738
-
739
- /**
740
- * usort helper function to sort array by event date
741
- *
742
- * @param string
743
- * @return array
744
- */
745
- function sort_by_event_date ( $a, $b )
746
- {
747
- $val_a = strtotime($a['event_date']);
748
- $val_b = strtotime($b['event_date']);
749
-
750
- return $val_a < $val_b;
751
- }
752
-
753
- /**
754
- * Query the social lookup endpoint on Leadin.com
755
- *
756
- * @param string
757
- * @param string
758
- * @return array
759
- */
760
- function query_social_lookup_endpoint ( $lookup_email, $caller_domain )
761
- {
762
- if ( ! function_exists('curl_init') )
763
- return FALSE;
764
-
765
- $api_endpoint = 'http://leadin.com/enrichment/v1/profile/email/email_lookup.php';
766
- $params = '?lookup_email=' . $lookup_email . '&caller_domain=' . $caller_domain;
767
-
768
- $curl_handle = curl_init();
769
- curl_setopt($curl_handle,CURLOPT_URL, $api_endpoint . $params);
770
- curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
771
- curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
772
- $data = curl_exec($curl_handle);
773
- curl_close($curl_handle);
774
-
775
-
776
- return htmlspecialchars_decode($data);
777
-
778
- }
779
-
780
- /**
781
- * Query the company lookup endpoint on Leadin.com
782
- *
783
- * @param string
784
- * @param string
785
- * @param string
786
- * @return array
787
- */
788
- function query_company_lookup_endpoint ( $lookup_company_url, $caller_email, $caller_domain )
789
- {
790
- if ( ! function_exists('curl_init') )
791
- return FALSE;
792
-
793
- $caller_domain = str_replace(array('http://', 'https://'), '', $caller_domain);
794
- $caller_domain = 'leadin.com';
795
-
796
- $api_endpoint = 'http://leadin.com/enrichment/v1/company/company_lookup.php';
797
- $params = '?lookup_company_url=' . $lookup_company_url . '&caller_email=' . $caller_email . '&caller_domain=' . $caller_domain;
798
-
799
- $curl_handle = curl_init();
800
- curl_setopt($curl_handle,CURLOPT_URL, $api_endpoint . $params);
801
- curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
802
- curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
803
- $data = curl_exec($curl_handle);
804
- curl_close($curl_handle);
805
-
806
-
807
- return htmlspecialchars_decode($data);
808
- }
809
-
810
- /**
811
- * Queries for the company_data and social_data fields on the contact in li_leads
812
- *
813
- * @param string
814
- * @return object
815
- */
816
- function get_cached_lookup_data ( $hashkey )
817
- {
818
- global $wpdb;
819
-
820
- $q = $wpdb->prepare("SELECT social_data, company_data FROM $wpdb->li_leads WHERE hashkey = %s", $hashkey);
821
- $result = $wpdb->get_row($q);
822
-
823
- return $result;
824
- }
825
-
826
- /**
827
- * Update the first + last name on a contact row in li_leads
828
- *
829
- * @param string
830
- * @param string
831
- * @param string
832
- * @return bool
833
- */
834
- function update_contact_full_name ( $hashkey, $first_name, $last_name )
835
- {
836
- global $wpdb;
837
-
838
- $q = $wpdb->prepare("UPDATE $wpdb->li_leads SET lead_first_name = %s, lead_last_name = %s WHERE hashkey = %s", $first_name, $last_name, $hashkey);
839
- $result = $wpdb->query($q);
840
-
841
- return $result;
842
- }
843
-
844
- /**
845
- * Redirects the user to a merged contact when the current contact has been deleted
846
- *
847
- * @param string
848
- *
849
- */
850
- function display_error_message_for_merged_contact ( $lead_email )
851
- {
852
- global $wpdb;
853
-
854
- $q = $wpdb->prepare("SELECT lead_id FROM $wpdb->li_leads WHERE lead_email = %s AND lead_deleted = 0 ORDER BY lead_date DESC LIMIT 1", $lead_email);
855
- $lead_id = $wpdb->get_var($q);
856
-
857
- if ( $lead_id )
858
- {
859
- echo '<div style="background: #fff; border-left: 4px solid #dd3d36; padding: 1px 12px; margin-bottom: 20px;" ><p>This contact record was merged with a more recent entry and is out of date... <br/><br/> <a class="button" href="' . get_admin_url() . 'admin.php?page=leadin_contacts&action=view&lead=' . $lead_id . '">View the latest timeline</a></p></div>';
860
- }
861
- }
862
- }
863
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/inc/class-leadin-list-table.php DELETED
@@ -1,707 +0,0 @@
1
- <?php
2
-
3
- //=============================================
4
- // Include Needed Files
5
- //=============================================
6
-
7
- if ( !class_exists('WP_List_Table') )
8
- require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
9
-
10
- require_once(LEADIN_PLUGIN_DIR . '/inc/leadin-functions.php');
11
-
12
- //=============================================
13
- // LI_List_Table Class
14
- //=============================================
15
- class LI_List_Table extends WP_List_Table {
16
-
17
- /**
18
- * Variables
19
- */
20
- public $data = array();
21
- private $current_view;
22
- public $view_label;
23
- private $view_count;
24
- private $views;
25
- private $total_contacts;
26
- private $total_filtered;
27
- public $tags;
28
-
29
- /**
30
- * Class constructor
31
- */
32
- function __construct ()
33
- {
34
- global $status, $page;
35
-
36
- //Set parent defaults
37
- parent::__construct( array(
38
- 'singular' => 'contact',
39
- 'plural' => 'contacts',
40
- 'ajax' => false
41
- ));
42
- }
43
-
44
- /**
45
- * Prints text for no rows found in table
46
- */
47
- function no_items ()
48
- {
49
- _e('No contacts found.');
50
- }
51
-
52
- /**
53
- * Prints values for columns for which no column function has been defined
54
- *
55
- * @param object
56
- * @param string
57
- * @return * item value's type
58
- */
59
- function column_default ( $item, $column_name )
60
- {
61
- switch ( $column_name )
62
- {
63
- case 'email':
64
-
65
- case 'date':
66
- return $item[$column_name];
67
- case 'last_visit':
68
- return $item[$column_name];
69
- case 'submissions':
70
- return $item[$column_name];
71
- case 'pageviews':
72
- return $item[$column_name];
73
- case 'visits':
74
- return $item[$column_name];
75
- case 'source':
76
- return $item[$column_name];
77
- default:
78
- return print_r($item,true);
79
- }
80
- }
81
-
82
- /**
83
- * Prints text for email column
84
- *
85
- * @param object
86
- * @return string
87
- */
88
- function column_email ( $item )
89
- {
90
- //Build row actions
91
- $actions = array(
92
- 'view' => sprintf('<div style="clear:both; padding-top: 4px;"></div><a href="?page=%s&action=%s&lead=%s">View</a>',$_REQUEST['page'],'view',$item['ID']),
93
- 'delete' => sprintf('<a href="?page=%s&action=%s&lead=%s">Delete</a>',$_REQUEST['page'],'delete',$item['ID'])
94
- );
95
-
96
- //Return the title contents
97
- return sprintf('%1$s<br/>%2$s',
98
- /*$1%s*/ $item['email'],
99
- /*$2%s*/ $this->row_actions($actions)
100
- );
101
- }
102
-
103
- /**
104
- * Prints checkbox column
105
- *
106
- * @param object
107
- * @return string
108
- */
109
- function column_cb ( $item )
110
- {
111
- return sprintf(
112
- '<input type="checkbox" name="%1$s[]" value="%2$s" />',
113
- /*$1%s*/ $this->_args['singular'],
114
- /*$2%s*/ $item['ID']
115
- );
116
- }
117
-
118
- /**
119
- * Get all the columns for the list table
120
- *
121
- * @param object
122
- * @param string
123
- * @return array associative array of columns
124
- */
125
- function get_columns ()
126
- {
127
- $columns = array(
128
- 'cb' => '<input type="checkbox" />',
129
- 'email' => 'Email',
130
- 'source' => 'Original source',
131
- 'visits' => 'Visits',
132
- 'pageviews' => 'Page views',
133
- 'submissions' => 'Forms',
134
- 'last_visit' => 'Last visit',
135
- 'date' => 'Created on'
136
- );
137
- return $columns;
138
- }
139
-
140
- /**
141
- * Defines sortable columns for table
142
- *
143
- * @param object
144
- * @param string
145
- * @return array associative array of columns
146
- */
147
- function get_sortable_columns ()
148
- {
149
- $sortable_columns = array(
150
- 'email' => array('email',false), // presorted if true
151
- 'pageviews' => array('pageviews',false),
152
- 'visits' => array('visits',false),
153
- 'submissions' => array('submissions',false),
154
- 'date' => array('date',true),
155
- 'last_visit' => array('last_visit',false),
156
- 'source' => array('source',false)
157
- );
158
- return $sortable_columns;
159
- }
160
-
161
- /**
162
- * Get the bulk actions
163
- *
164
- * @return array associative array of actions
165
- */
166
- function get_bulk_actions ()
167
- {
168
- $contact_type = strtolower($this->view_label);
169
- $filtered = ( isset($_GET['filter_action']) ? 'filtered ' : '' );
170
- $actions = array(
171
- 'add_tag_to_all' => 'Add a tag to every one tagged "' . $filtered . $contact_type . '"',
172
- 'add_tag_to_selected' => 'Add a tag to selected "' . $contact_type,
173
- 'remove_tag_from_all' => 'Remove a tag from every one tagged "' . $filtered . $contact_type . '"',
174
- 'remove_tag_from_selected' => 'Remove a tag from selected "' . $contact_type . '"',
175
- 'delete_all' => 'Delete every one tagged "' . $contact_type . '" from Leadin',
176
- 'delete_selected' => 'Delete selected ' . $contact_type . ' from Leadin'
177
- );
178
-
179
- return $actions;
180
- }
181
-
182
- /**
183
- * Process bulk actions for deleting
184
- */
185
- function process_bulk_action ()
186
- {
187
- global $wpdb;
188
-
189
- $ids_for_action = '';
190
- $hashes_for_action = '';
191
-
192
- if ( strstr($this->current_action(), 'delete') )
193
- {
194
- if ( 'delete_selected' === $this->current_action() )
195
- {
196
- for ( $i = 0; $i < count($_GET['contact']); $i++ )
197
- {
198
- $ids_for_action .= $_GET['contact'][$i];;
199
-
200
- if ( $i != (count($_GET['contact'])-1) )
201
- $ids_for_action .= ',';
202
- }
203
-
204
- leadin_track_plugin_activity('Bulk Contacts Deleted', array( "contact_type" => 'selected'));
205
- }
206
- else if ( 'delete_all' === $this->current_action() )
207
- {
208
- $contacts = $this->get_contacts();
209
- foreach ( $contacts as $contact )
210
- $ids_for_action .= $contact['ID'] . ',';
211
-
212
- $ids_for_action = rtrim($ids_for_action, ',');
213
-
214
- leadin_track_plugin_activity('Bulk Contacts Deleted', array( "contact_type" => 'all'));
215
- }
216
- else // default case for when it's not actually processing a bulk action
217
- return FALSE;
218
-
219
- $q = $wpdb->prepare("SELECT hashkey FROM $wpdb->li_leads WHERE lead_id IN ( " . $ids_for_action . " ) ", "");
220
- $hashes = $wpdb->get_results($q);
221
-
222
- if ( count($hashes) )
223
- {
224
- foreach ( $hashes as $hash )
225
- $hashes_for_action .= "'" . $hash->hashkey . "',";
226
-
227
- $hashes_for_action = rtrim($hashes_for_action, ',');
228
-
229
- $q = $wpdb->prepare("UPDATE $wpdb->li_pageviews SET pageview_deleted = 1 WHERE lead_hashkey IN (" . $hashes_for_action . ") ", "");
230
- $delete_pageviews = $wpdb->query($q);
231
-
232
- $q = $wpdb->prepare("UPDATE $wpdb->li_submissions SET form_deleted = 1 WHERE lead_hashkey IN (" . $hashes_for_action . ") ", "");
233
- $delete_submissions = $wpdb->query($q);
234
-
235
- $q = $wpdb->prepare("UPDATE $wpdb->li_leads SET lead_deleted = 1 WHERE lead_id IN (" . $ids_for_action . ") ", "");
236
- $delete_leads = $wpdb->query($q);
237
-
238
- $q = $wpdb->prepare("UPDATE $wpdb->li_tag_relationships SET tag_relationship_deleted = 1 WHERE contact_hashkey IN (" . $hashes_for_action . ") ", "");
239
- $delete_tags = $wpdb->query($q);
240
- }
241
- }
242
-
243
- if ( isset($_POST['bulk_edit_tags']) )
244
- {
245
- $q = $wpdb->prepare("SELECT tag_id FROM $wpdb->li_tags WHERE tag_slug = %s ", $_POST['bulk_selected_tag']);
246
- $tag_id = $wpdb->get_var($q);
247
-
248
- if ( empty($_POST['leadin_selected_contacts']) )
249
- {
250
- $contacts = $this->get_contacts();
251
- foreach ( $contacts as $contact )
252
- $ids_for_action .= $contact['ID'] . ',';
253
-
254
- $ids_for_action = rtrim($ids_for_action, ',');
255
- }
256
- else
257
- $ids_for_action = $_POST['leadin_selected_contacts'];
258
-
259
- $q = $wpdb->prepare("
260
- SELECT
261
- l.hashkey, l.lead_email,
262
- ( SELECT ltr.tag_id FROM $wpdb->li_tag_relationships ltr WHERE ltr.tag_id = %d AND ltr.contact_hashkey = l.hashkey GROUP BY ltr.contact_hashkey ) AS tag_set
263
- FROM
264
- $wpdb->li_leads l
265
- WHERE
266
- l.lead_id IN ( " . $ids_for_action . " ) AND l.lead_deleted = 0 GROUP BY l.lead_id", $tag_id);
267
-
268
- $contacts = $wpdb->get_results($q);
269
-
270
- $insert_values = '';
271
- $contacts_to_update = '';
272
-
273
- if ( count($contacts) )
274
- {
275
- foreach ( $contacts as $contact )
276
- {
277
- if ( $contact->tag_set === NULL )
278
- $insert_values .= '(' . $tag_id . ', "' . $contact->hashkey . '"),';
279
- else
280
- $contacts_to_update .= "'" . $contact->hashkey . "',";
281
- }
282
- }
283
-
284
- if ( $_POST['bulk_edit_tag_action'] == 'add_tag' )
285
- {
286
- if ( $insert_values )
287
- {
288
- $q = "INSERT INTO $wpdb->li_tag_relationships ( tag_id, contact_hashkey ) VALUES " . rtrim($insert_values, ',');
289
- $wpdb->query($q);
290
- }
291
-
292
- if ( $contacts_to_update )
293
- {
294
- // update the relationships for the contacts that exist already making sure to set all the tag_relationship_deleted = 0
295
- $q = $wpdb->prepare("UPDATE $wpdb->li_tag_relationships SET tag_relationship_deleted = 0 WHERE tag_id = %d AND contact_hashkey IN ( " . rtrim($contacts_to_update, ',') . ") ", $tag_id);
296
- $wpdb->query($q);
297
- }
298
-
299
- leadin_track_plugin_activity('Bulk Tag Added', array( "contact_type" => ( empty($_POST['leadin_selected_contacts']) ? 'all' : 'selected' )));
300
-
301
- // Bulk push all the email addresses for the tag to the MailChimp API
302
- $tagger = new LI_Tag_Editor($tag_id);
303
- $tagger->push_contacts_to_tagged_list($tag_id);
304
- }
305
- else
306
- {
307
- if ( $contacts_to_update )
308
- {
309
- // "Delete" the existing tags only
310
- $q = $wpdb->prepare("UPDATE $wpdb->li_tag_relationships SET tag_relationship_deleted = 1 WHERE tag_id = %d AND contact_hashkey IN ( " . rtrim($contacts_to_update, ',') . ") ", $tag_id);
311
- $wpdb->query($q);
312
-
313
- leadin_track_plugin_activity('Bulk Tag Removed', array( "contact_type" => ( empty($_POST['leadin_selected_contacts']) ? 'all' : 'selected' )));
314
- }
315
- }
316
- }
317
- }
318
-
319
- /**
320
- * Get the leads for the contacts table based on $GET_['contact_type'] or $_GET['s'] (search)
321
- *
322
- * @return array associative array of all contacts
323
- */
324
- function get_contacts ()
325
- {
326
- /***
327
- == FILTER ARGS ==
328
- - filter_action (visited) = visited a specific page url (filter_action)
329
- - filter_action (submitted) = submitted a form on specific page url (filter_action)
330
- - filter_content = content for filter_action
331
- - filter_form = selector id/class
332
- - num_pageviews = visited at least #n pages
333
- - s = search query on lead_email/lead_source
334
- */
335
-
336
- global $wpdb;
337
-
338
- $mysql_search_filter = '';
339
- $mysql_contact_type_filter = '';
340
- $mysql_action_filter = '';
341
- $filter_action_set = FALSE;
342
-
343
- // search filter
344
- if ( isset($_GET['s']) )
345
- {
346
- $escaped_query = '';
347
- if ( $wp_version >= 4 )
348
- $escaped_query = $wpdb->esc_like($_GET['s']);
349
- else
350
- $escaped_query = like_escape($_GET['s']);
351
-
352
- $search_query = $_GET['s'];
353
- $mysql_search_filter = $wpdb->prepare(" AND ( l.lead_email LIKE '%%%s%%' OR l.lead_source LIKE '%%%s%%' ) ", $escaped_query, $escaped_query);
354
-
355
- leadin_track_plugin_activity('Filtered List', array ( "filter_type" => "search" ));
356
- }
357
-
358
- $filtered_contacts = array();
359
-
360
- // contact type filter
361
- if ( isset($_GET['contact_type']) )
362
- {
363
- // Query for the tag_id, then find all hashkeys with that tag ID tied to them. Use those hashkeys to modify the query
364
- $q = $wpdb->prepare("
365
- SELECT
366
- DISTINCT ltr.contact_hashkey as lead_hashkey
367
- FROM
368
- $wpdb->li_tag_relationships ltr, $wpdb->li_tags lt
369
- WHERE
370
- lt.tag_id = ltr.tag_id AND
371
- ltr.tag_relationship_deleted = 0 AND
372
- lt.tag_slug = %s GROUP BY ltr.contact_hashkey", $_GET['contact_type']);
373
-
374
- $filtered_contacts = $wpdb->get_results($q, 'ARRAY_A');
375
- $num_contacts = count($filtered_contacts);
376
- }
377
-
378
- if ( isset($_GET['filter_action']) && $_GET['filter_action'] == 'visited' )
379
- {
380
- if ( isset($_GET['filter_content']) && $_GET['filter_content'] != 'any page' )
381
- {
382
- $q = $wpdb->prepare("SELECT lead_hashkey FROM $wpdb->li_pageviews WHERE pageview_title LIKE '%%%s%%' GROUP BY lead_hashkey", htmlspecialchars(urldecode($_GET['filter_content'])));
383
- $filtered_contacts = leadin_merge_filtered_contacts($wpdb->get_results($q, 'ARRAY_A'), $filtered_contacts);
384
- $filter_action_set = TRUE;
385
-
386
- leadin_track_plugin_activity('Filtered List', array ( "filter_type" => "page" ));
387
- }
388
- }
389
-
390
- // filter for a form submitted on a specific page
391
- if ( isset($_GET['filter_action']) && $_GET['filter_action'] == 'submitted' )
392
- {
393
- $filter_form = '';
394
- if ( isset($_GET['filter_form']) && $_GET['filter_form'] && $_GET['filter_form'] != 'any form' )
395
- {
396
- $filter_form = str_replace(array('#', '.'), '', htmlspecialchars(urldecode($_GET['filter_form'])));
397
- $filter_form_query = $wpdb->prepare(" AND ( form_selector_id LIKE '%%%s%%' OR form_selector_classes LIKE '%%%s%%' )", $filter_form, $filter_form);
398
-
399
- leadin_track_plugin_activity('Filtered List', array ( "filter_type" => "form" ));
400
- }
401
-
402
- $q = $wpdb->prepare("SELECT lead_hashkey FROM $wpdb->li_submissions WHERE form_page_title LIKE '%%%s%%' ", ( $_GET['filter_content'] != 'any page' ? htmlspecialchars(urldecode($_GET['filter_content'])): '' ));
403
- $q .= ( $filter_form_query ? $filter_form_query : '' );
404
- $q .= " GROUP BY lead_hashkey";
405
- $filtered_contacts = leadin_merge_filtered_contacts($wpdb->get_results($q, 'ARRAY_A'), $filtered_contacts);
406
- $filter_action_set = TRUE;
407
- }
408
-
409
- $filtered_hashkeys = leadin_explode_filtered_contacts($filtered_contacts);
410
-
411
- $mysql_action_filter = '';
412
- if ( $filter_action_set ) // If a filter action is set and there are no contacts, do a blank
413
- $mysql_action_filter = " AND l.hashkey IN ( " . ( $filtered_hashkeys ? $filtered_hashkeys : "''" ) . " ) ";
414
- else
415
- $mysql_action_filter = ( $filtered_hashkeys ? " AND l.hashkey IN ( " . $filtered_hashkeys . " ) " : '' ); // If a filter action isn't set, use the filtered hashkeys if they exist, else, don't include the statement
416
-
417
- // There's a filter and leads are in it
418
- if ( ( isset($_GET['contact_type']) && ( $num_contacts || ! $_GET['contact_type'] ) ) || ! isset($_GET['contact_type']) )
419
- {
420
- $q = $wpdb->prepare("
421
- SELECT
422
- l.lead_id AS lead_id,
423
- LOWER(DATE_SUB(l.lead_date, INTERVAL %d HOUR)) AS lead_date, l.lead_ip, l.lead_source, l.lead_email, l.hashkey, l.lead_first_name, l.lead_last_name,
424
- COUNT(DISTINCT s.form_id) AS lead_form_submissions,
425
- COUNT(DISTINCT p.pageview_id) AS lead_pageviews,
426
- LOWER(DATE_SUB(MAX(p.pageview_date), INTERVAL %d HOUR)) AS last_visit,
427
- ( SELECT COUNT(DISTINCT pageview_id) FROM $wpdb->li_pageviews WHERE lead_hashkey = l.hashkey AND pageview_session_start = 1 AND pageview_deleted = 0 ) AS visits,
428
- ( SELECT MIN(pageview_source) AS pageview_source FROM $wpdb->li_pageviews WHERE lead_hashkey = l.hashkey AND pageview_session_start = 1 AND pageview_deleted = 0 ) AS pageview_source
429
- FROM
430
- $wpdb->li_leads l
431
- LEFT JOIN $wpdb->li_submissions s ON l.hashkey = s.lead_hashkey
432
- LEFT JOIN $wpdb->li_pageviews p ON l.hashkey = p.lead_hashkey
433
- WHERE l.lead_email != '' AND l.lead_deleted = 0 AND l.hashkey != '' ", $wpdb->db_hour_offset, $wpdb->db_hour_offset);
434
-
435
- $q .= $mysql_contact_type_filter;
436
- $q .= ( $mysql_search_filter ? $mysql_search_filter : "" );
437
- $q .= ( $mysql_action_filter ? $mysql_action_filter : "" );
438
- $q .= " GROUP BY l.hashkey";
439
- $leads = $wpdb->get_results($q);
440
- }
441
- else
442
- {
443
- $leads = array();
444
- }
445
-
446
- $all_leads = array();
447
-
448
- $contact_count = 0;
449
-
450
- if ( count($leads) )
451
- {
452
- foreach ( $leads as $key => $lead )
453
- {
454
- // filter for number of page views and skipping lead if it doesn't meet the minimum
455
- if ( isset($_GET['filter_action']) && $_GET['filter_action'] == 'num_pageviews' )
456
- {
457
- if ( $lead->lead_pageviews < $_GET['filter_content'] )
458
- continue;
459
- }
460
-
461
- $url = leadin_strip_params_from_url($lead->lead_source);
462
-
463
- $redirect_url = '';
464
- if ( isset($_GET['contact_type']) || isset($_GET['filter_action']) || isset($_GET['filter_form']) || isset($_GET['filter_content']) || isset($_GET['num_pageviews']) || isset($_GET['s']) || isset($_GET['paged']) )
465
- $redirect_url = urlencode(leadin_get_current_url());
466
-
467
- $lead_array = array(
468
- 'ID' => $lead->lead_id,
469
- 'hashkey' => $lead->hashkey,
470
- 'email' => sprintf('<a href="?page=%s&action=%s&lead=%s%s">' . "<img class='pull-left leadin-contact-avatar leadin-dynamic-avatar_" . substr($lead->lead_id, -1) . "' src='https://api.hubapi.com/socialintel/v1/avatars?email=" . $lead->lead_email . "' width='35' height='35' style='margin-top: 2px;'/> " . '</a>', $_REQUEST['page'], 'view', $lead->lead_id, ( $redirect_url ? '&redirect_to=' . $redirect_url : '' )) . sprintf('<a href="?page=%s&action=%s&lead=%s%s">%s' . $lead->lead_email . '</a>', $_REQUEST['page'], 'view', $lead->lead_id, ( $redirect_url ? '&redirect_to=' . $redirect_url : '' ), ( strlen($lead->lead_first_name) || strlen($lead->lead_last_name)? '<b>' . $lead->lead_first_name . ' ' . $lead->lead_last_name . '</b><br>' : '' )),
471
- 'visits' => ( !isset($lead->visits) ? 1 : $lead->visits ),
472
- 'submissions' => $lead->lead_form_submissions,
473
- 'pageviews' => $lead->lead_pageviews,
474
- 'date' => date('Y-m-d g:ia', strtotime($lead->lead_date)),
475
- 'source' => ( $lead->pageview_source ? "<a title='Visit page' href='" . $lead->pageview_source . "' target='_blank'>" . leadin_strip_params_from_url($lead->pageview_source) . "</a>" : 'Direct' ),
476
- 'last_visit' => date('Y-m-d g:ia', strtotime($lead->last_visit)),
477
- 'source' => ( $lead->lead_source ? "<a title='Visit page' href='" . $lead->lead_source . "' target='_blank'>" . leadin_strip_params_from_url($lead->lead_source) . "</a>" : 'Direct' )
478
- );
479
-
480
- array_push($all_leads, $lead_array);
481
- $contact_count++;
482
- }
483
- }
484
-
485
- $this->total_filtered = count($all_leads);
486
-
487
- return $all_leads;
488
- }
489
-
490
- /**
491
- * Gets the total number of contacts, comments and subscribers for above the table
492
- */
493
- function get_total_contacts ()
494
- {
495
- global $wpdb;
496
-
497
- $q = "
498
- SELECT
499
- COUNT(DISTINCT hashkey) AS total_contacts
500
- FROM
501
- $wpdb->li_leads
502
- WHERE
503
- lead_email != '' AND lead_deleted = 0 AND hashkey != '' ";
504
-
505
- $total_contacts = $wpdb->get_var($q);
506
-
507
- return $total_contacts;
508
- }
509
-
510
- /**
511
- * Gets the current view based off $_GET['contact_type']
512
- *
513
- * @return string
514
- */
515
- function get_view ()
516
- {
517
- $current_contact_type = ( !empty($_GET['contact_type']) ? html_entity_decode($_GET['contact_type']) : 'contacts' );
518
- return $current_contact_type;
519
- }
520
-
521
- /**
522
- * Gets the current action filter based off $_GET['contact_type']
523
- *
524
- * @return string
525
- */
526
- function get_filters ()
527
- {
528
- $current_filters = array();
529
-
530
- $current_filters['contact_type'] = ( !empty($_GET['contact_type']) ? html_entity_decode($_GET['contact_type']) : 'all' );
531
- $current_filters['action'] = ( !empty($_GET['filter_action']) ? html_entity_decode($_GET['filter_action']) : 'all' );
532
- $current_filters['content'] = ( !empty($_GET['filter_content']) ? html_entity_decode($_GET['filter_content']) : 'all' );
533
-
534
- return $current_filters;
535
- }
536
-
537
- /**
538
- * Get the contact tags
539
- *
540
- * @return string
541
- */
542
- function get_tags ()
543
- {
544
- global $wpdb;
545
-
546
- $q = "
547
- SELECT
548
- lt.tag_text, lt.tag_slug, lt.tag_synced_lists, lt.tag_form_selectors, lt.tag_order, lt.tag_id,
549
- ( SELECT COUNT(DISTINCT contact_hashkey) FROM $wpdb->li_tag_relationships ltr, $wpdb->li_leads ll WHERE ltr.tag_id = lt.tag_id AND ltr.tag_relationship_deleted = 0 AND ltr.contact_hashkey != '' AND ll.hashkey = ltr.contact_hashkey AND ll.hashkey != '' AND ll.lead_deleted = 0 GROUP BY tag_id ) AS tag_count
550
- FROM
551
- $wpdb->li_tags lt
552
- WHERE
553
- lt.tag_deleted = 0
554
- ORDER BY lt.tag_order ASC";
555
-
556
- return $wpdb->get_results($q);
557
- }
558
-
559
- /**
560
- * Prints contacts menu next to contacts table
561
- */
562
- function views ()
563
- {
564
- $this->tags = stripslashes_deep($this->get_tags());
565
-
566
- $current = ( !empty($_GET['contact_type']) ? html_entity_decode($_GET['contact_type']) : 'all' );
567
- $all_params = array( 'contact_type', 's', 'paged', '_wpnonce', '_wpreferrer', '_wp_http_referer', 'action', 'action2', 'filter_form', 'filter_action', 'filter_content', 'contact');
568
-
569
- $all_url = remove_query_arg($all_params);
570
-
571
- $this->total_contacts = $this->get_total_contacts();
572
-
573
-
574
-
575
- echo "<ul class='leadin-contacts__type-picker'>";
576
- echo "<li><a href='$all_url' class='" . ( $current == 'all' ? 'current' :'' ) . "'><span class='icon-user'></span>" . $this->total_contacts . " Total</a></li>";
577
- echo "</ul>";
578
-
579
- if ( $current == "all" ) {
580
- $this->view_label = "Contacts";
581
- $this->view_count = $this->total_contacts;
582
- }
583
-
584
- if ( empty( $this->tags ) ) {
585
- echo "<h3 class='leadin-contacts__tags-header'>No Tags</h3>";
586
- }
587
- else {
588
- echo "<h3 class='leadin-contacts__tags-header'>Tags</h3>";
589
- }
590
-
591
- echo "<ul class='leadin-contacts__type-picker'>";
592
- foreach ( $this->tags as $tag ) {
593
-
594
- if ( $current == $tag->tag_slug ) {
595
- $currentTag = true;
596
- $this->view_label = $tag->tag_text;
597
- $this->view_count = $tag->tag_count;
598
- } else {
599
- $currentTag = false;
600
- }
601
-
602
- echo "<li><a href='" . $all_url . "&contact_type=" . $tag->tag_slug . "' class='" . ( $currentTag ? 'current' :'' ) . "''><span class='icon-tag'></span>" . ( $tag->tag_count ? $tag->tag_count : '0' ) . " " . $tag->tag_text . "</a></li>";
603
- }
604
- echo "</ul>";
605
-
606
- echo "<a href='" . get_bloginfo('wpurl') . "/wp-admin/admin.php?page=leadin_tags" . "' class='button'>Manage tags</a>";
607
- }
608
-
609
-
610
- /**
611
- * Prints contacts filter above contacts table
612
- */
613
- function filters ()
614
- {
615
- $filters = $this->get_filters();
616
-
617
- ?>
618
- <form id="leadin-contacts-filter" class="leadin-contacts__filter" method="GET">
619
-
620
- <h3 class="leadin-contacts__filter-text">
621
-
622
- <span class="leadin-contacts__filter-count"><?php echo ( $this->total_filtered != $this->view_count ? '<span id="contact-count">' . $this->total_filtered . '</span>' . '/' : '' ) . '<span id="contact-count">' . ( $this->view_count ? $this->view_count : '0' ) . '</span>' . ' ' . strtolower($this->view_label); ?></span> who
623
-
624
- <select class="select2" name="filter_action" id="filter_action" style="width:125px">
625
- <option value="visited" <?php echo ( $filters['action']=='visited' ? 'selected' : '' ) ?> >viewed</option>
626
- <option value="submitted" <?php echo ( $filters['action']=='submitted' ? 'selected' : '' ) ?> >submitted</option>
627
- </select>
628
-
629
- <span id="form-filter-input" <?php echo ( ! isset($_GET['filter_form']) || ( isset($_GET['filter_action']) && $_GET['filter_action'] != 'submitted' ) ? 'style="display: none;"' : ''); ?>>
630
- <input type="hidden" name="filter_form" class="bigdrop" id="filter_form" style="width:250px" value="<?php echo ( isset($_GET['filter_form']) ? stripslashes($_GET['filter_form']) : '' ); ?>"/> on
631
- </span>
632
-
633
- <input type="hidden" name="filter_content" class="bigdrop" id="filter_content" style="width:250px" value="<?php echo ( isset($_GET['filter_content']) ? stripslashes($_GET['filter_content']) : '' ); ?>"/>
634
-
635
- <input type="submit" name="" id="leadin-contacts-filter-button" class="button action" value="Apply">
636
-
637
- <?php if ( isset($_GET['filter_action']) || isset($_GET['filter_content']) ) : ?>
638
- <a href="<?php echo get_bloginfo('wpurl') . '/wp-admin/admin.php?page=leadin_contacts' . ( isset($_GET['contact_type']) ? '&contact_type=' . $_GET['contact_type'] : '' ); ?>" id="clear-filter">clear filter</a>
639
- <?php endif; ?>
640
-
641
- </h3>
642
-
643
- <?php if ( isset($_GET['contact_type']) ) : ?>
644
- <input type="hidden" name="contact_type" value="<?php echo $_GET['contact_type']; ?>"/>
645
- <?php endif; ?>
646
-
647
- <input type="hidden" name="page" value="leadin_contacts"/>
648
- </form>
649
- <?php
650
- }
651
-
652
- /**
653
- * Gets + prepares the contacts for the list table
654
- */
655
- function prepare_items ()
656
- {
657
- $per_page = 10;
658
-
659
- $columns = $this->get_columns();
660
- $hidden = array();
661
- $sortable = $this->get_sortable_columns();
662
- $this->_column_headers = array($columns, $hidden, $sortable);
663
-
664
- $orderby = ( !empty($_REQUEST['orderby']) ? $_REQUEST['orderby'] : 'last_visit' );
665
- $order = ( !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'desc' );
666
-
667
- usort($this->data, array($this, 'usort_reorder'));
668
-
669
- $current_page = $this->get_pagenum();
670
- $total_items = count($this->data);
671
- $this->data = array_slice($this->data, (($current_page-1)*$per_page), $per_page);
672
-
673
- $this->items = $this->data;
674
-
675
- $this->set_pagination_args( array(
676
- 'total_items' => $total_items,
677
- 'per_page' => $per_page,
678
- 'total_pages' => ceil($total_items/$per_page)
679
- ) );
680
- }
681
-
682
- /**
683
- * Sorting function for usort
684
- *
685
- * @param array
686
- * @param array
687
- * @return array sorted array
688
- */
689
- function usort_reorder ( $a, $b )
690
- {
691
- $orderby = ( !empty($_REQUEST['orderby']) ? $_REQUEST['orderby'] : 'last_visit' );
692
- $order = ( !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'desc' );
693
-
694
- // Timestamp columns need to be convereted to integers to sort correctly
695
- $val_a = ( $orderby == 'last_visit' || $orderby == 'date' ? strtotime($a[$orderby]) : $a[$orderby] );
696
- $val_b = ( $orderby == 'last_visit' || $orderby == 'date' ? strtotime($b[$orderby]) : $b[$orderby] );
697
-
698
- if ( $val_a == $val_b )
699
- $result = 0;
700
- else if ( $val_a < $val_b )
701
- $result = -1;
702
- else
703
- $result = 1;
704
-
705
- return ( $order === 'asc' ? $result : -$result );
706
- }
707
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/inc/class-leadin-tag-editor.php DELETED
@@ -1,241 +0,0 @@
1
- <?php
2
- //=============================================
3
- // LI_Contact Class
4
- //=============================================
5
- class LI_Tag_Editor {
6
-
7
- /**
8
- * Variables
9
- */
10
- var $tag_id;
11
- var $details;
12
- var $selectors;
13
-
14
- /**
15
- * Class constructor
16
- */
17
- function __construct ( $tag_id = FALSE )
18
- {
19
- if ( $tag_id )
20
- $this->tag_id = $tag_id;
21
-
22
- $this->selectors = $this->get_form_selectors();
23
- }
24
-
25
- /**
26
- * Get all the details for a tag
27
- *
28
- * @param int
29
- * @return object
30
- */
31
- function get_tag_details ( $tag_id )
32
- {
33
- global $wpdb;
34
-
35
- $q = $wpdb->prepare("SELECT * FROM $wpdb->li_tags WHERE tag_id = %d", $this->tag_id);
36
- $this->details = $wpdb->get_row($q);
37
- }
38
-
39
- /**
40
- * Get all the existing form selectors sorted by frequency
41
- *
42
- * @return array
43
- */
44
- function get_form_selectors ( )
45
- {
46
- global $wpdb;
47
- $selectors = array();
48
-
49
- $q = "SELECT COUNT(form_selector_classes) AS freq, form_selector_classes FROM $wpdb->li_submissions WHERE form_selector_classes != '' GROUP BY form_selector_classes ORDER BY freq DESC";
50
- $classes = $wpdb->get_results($q);
51
-
52
- if ( count($classes) )
53
- {
54
- foreach ( $classes as $class )
55
- {
56
- foreach ( explode(',', $class->form_selector_classes) as $class_selector )
57
- {
58
- if ( ! in_array('.' . $class_selector, $selectors) && $class_selector )
59
- array_push($selectors, '.' . $class_selector);
60
- }
61
- }
62
- }
63
-
64
- $q = "SELECT COUNT(form_selector_id) AS freq, form_selector_id FROM $wpdb->li_submissions WHERE form_selector_id != '' GROUP BY form_selector_id ORDER BY freq DESC";
65
- $ids = $wpdb->get_results($q);
66
-
67
- if ( count($ids) )
68
- {
69
- foreach ( $ids as $id )
70
- {
71
- if ( ! in_array('#' . $id->form_selector_id, $selectors) && $id->form_selector_id )
72
- array_push($selectors, '#' . $id->form_selector_id);
73
- }
74
- }
75
-
76
- return $selectors;
77
- }
78
-
79
- /**
80
- * Add a new tag in the li_tags table
81
- *
82
- * @param string
83
- * @param string
84
- * @param string
85
- * @return int tag_id of last inserted tag
86
- */
87
- function add_tag ( $tag_text, $tag_form_selectors, $tag_synced_lists )
88
- {
89
- global $wpdb;
90
-
91
- $q = "SELECT MAX(tag_order) FROM $wpdb->li_tags";
92
- $tag_order = $wpdb->get_var($q);
93
- $tag_order = ( $tag_order ? $tag_order + 1 : 1 );
94
- $tag_slug = $this->generate_slug($tag_text);
95
-
96
- $q = $wpdb->prepare("
97
- INSERT INTO $wpdb->li_tags ( tag_text, tag_slug, tag_form_selectors, tag_synced_lists, tag_order )
98
- VALUES ( %s, %s, %s, %s, %d )", $tag_text, $tag_slug, $tag_form_selectors, $tag_synced_lists, $tag_order);
99
- $wpdb->query($q);
100
-
101
- return $wpdb->insert_id;
102
- }
103
-
104
- /**
105
- * Update an existing tag in the li_tags table
106
- *
107
- * @param int
108
- * @param string
109
- * @param string
110
- * @param string serialized array(array('esp' => 'mailchimp', 'list_id' => 'abc123'))
111
- * @return bool
112
- */
113
- function save_tag ( $tag_id, $tag_text, $tag_form_selectors, $tag_synced_lists )
114
- {
115
- global $wpdb;
116
-
117
- $tag_slug = $this->generate_slug($tag_text, $tag_id);
118
-
119
- $this->push_contacts_to_tagged_list($tag_id, $tag_synced_lists);
120
-
121
- $q = $wpdb->prepare("
122
- UPDATE $wpdb->li_tags
123
- SET tag_text = %s, tag_slug = %s, tag_form_selectors = %s, tag_synced_lists = %s
124
- WHERE tag_id = %d", $tag_text, $tag_slug, $tag_form_selectors, $tag_synced_lists, $tag_id);
125
- $result = $wpdb->query($q);
126
-
127
- // Add a method to loop through all the lists here and
128
-
129
- return $result;
130
- }
131
-
132
- /**
133
- * Delete a tag from the li_tags table
134
- *
135
- * @param int
136
- * @param string
137
- * @return bool
138
- */
139
- function delete_tag ( $tag_id )
140
- {
141
- global $wpdb;
142
-
143
- $q = $wpdb->prepare("
144
- UPDATE $wpdb->li_tags
145
- SET tag_deleted = 1
146
- WHERE tag_id = %d", $tag_id);
147
-
148
- $result = $wpdb->query($q);
149
-
150
- return $result;
151
- }
152
-
153
- /**
154
- * Generates a slug based off a string. If slug exists, then appends -N until the slug is free
155
- *
156
- * @param string
157
- * @param int
158
- * @return string
159
- */
160
- function generate_slug ( $tag_text, $tag_id = 0 )
161
- {
162
- global $wpdb;
163
-
164
- $tag_slug = sanitize_title($tag_text);
165
- $slug_used = TRUE;
166
- $slug_int_check = 0;
167
-
168
- while ( $slug_used )
169
- {
170
- // slug_int_check is set to 1, but we only want to use it if the slug exists, so kill it in the first iteration
171
-
172
- if ( $slug_int_check )
173
- $tag_slug_modified = $tag_slug . '-' . $slug_int_check;
174
- else
175
- $tag_slug_modified = $tag_slug;
176
-
177
- $q = $wpdb->prepare("SELECT tag_slug FROM $wpdb->li_tags WHERE tag_slug = %s " . ( $tag_id ? $wpdb->prepare(" AND tag_id != %d ", $tag_id) : '' ), $tag_slug_modified);
178
- $slug_used = $wpdb->get_var($q);
179
-
180
- if ( $slug_used )
181
- $slug_int_check++;
182
- else
183
- $tag_slug = $tag_slug_modified;
184
- }
185
-
186
- return $tag_slug;
187
- }
188
-
189
- /**
190
- * Gets all the contacts in a list given a tag_id
191
- *
192
- * @param int
193
- * @return object
194
- */
195
- function get_contacts_in_tagged_list ( $tag_id = 0 )
196
- {
197
- global $wpdb;
198
- $q = $wpdb->prepare("SELECT contact_hashkey, lead_email, lead_first_name, lead_last_name FROM $wpdb->li_tag_relationships ltr, $wpdb->li_leads ll WHERE ltr.contact_hashkey = ll.hashkey AND ltr.tag_id = %d AND ltr.tag_relationship_deleted = 0", $tag_id);
199
- $contacts = $wpdb->get_results($q);
200
- return $contacts;
201
- }
202
-
203
- /**
204
- * Gets all the contacts in a list given a tag_id
205
- *
206
- * @param int
207
- * @param string serialized array
208
- * @return object
209
- */
210
- function push_contacts_to_tagged_list ( $tag_id = 0, $tag_synced_lists = '' )
211
- {
212
- global $wpdb;
213
-
214
- if ( ! $tag_synced_lists )
215
- {
216
- $this->get_tag_details($tag_id);
217
- $tag_synced_lists = $this->details->tag_synced_lists;
218
- }
219
-
220
- $contacts = $this->get_contacts_in_tagged_list($tag_id);
221
-
222
- if ( count($contacts) && $tag_synced_lists )
223
- {
224
- $synced_lists = unserialize($tag_synced_lists);
225
-
226
- if ( count($synced_lists) )
227
- {
228
- foreach ( $synced_lists as $synced_list )
229
- {
230
- $power_up_slug = $synced_list['esp'] . '_connect'; // e.g leadin_mailchimp_connect_wp
231
- if ( WPLeadIn::is_power_up_active($power_up_slug) )
232
- {
233
- global ${'leadin_' . $power_up_slug . '_wp'}; // e.g leadin_mailchimp_connect_wp
234
- ${'leadin_' . $power_up_slug . '_wp'}->bulk_push_contact_to_list($synced_list['list_id'], $contacts);
235
- }
236
- }
237
- }
238
- }
239
- }
240
- }
241
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/inc/class-leadin-tags-list-table.php DELETED
@@ -1,250 +0,0 @@
1
- <?php
2
-
3
- //=============================================
4
- // Include Needed Files
5
- //=============================================
6
-
7
- if ( !class_exists('WP_List_Table') )
8
- require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
9
-
10
- require_once(LEADIN_PLUGIN_DIR . '/inc/leadin-functions.php');
11
-
12
- //=============================================
13
- // LI_List_Table Class
14
- //=============================================
15
- class LI_Tags_Table extends WP_List_Table {
16
-
17
- /**
18
- * Variables
19
- */
20
- public $data = array();
21
-
22
- /**
23
- * Class constructor
24
- */
25
- function __construct ()
26
- {
27
- global $status, $page;
28
-
29
- //Set parent defaults
30
- parent::__construct( array(
31
- 'singular' => 'tag',
32
- 'plural' => 'tags',
33
- 'ajax' => false
34
- ));
35
- }
36
-
37
- /**
38
- * Prints text for no rows found in table
39
- */
40
- function no_items ()
41
- {
42
- _e('No tags found.');
43
- }
44
-
45
- /**
46
- * Prints values for columns for which no column function has been defined
47
- *
48
- * @param object
49
- * @param string
50
- * @return * item value's type
51
- */
52
- function column_default ( $item, $column_name )
53
- {
54
- switch ( $column_name )
55
- {
56
- //case 'tag_order':
57
- //return $item[$column_name];
58
- case 'tag_text':
59
- return $item[$column_name];
60
- case 'tag_count':
61
- return $item[$column_name];
62
- case 'tag_form_selectors':
63
- return $item[$column_name];
64
- case 'tag_synced_lists':
65
- return $item[$column_name];
66
-
67
- case 'reorder' :
68
- return '<span class="icon-mover"></span>';
69
-
70
- default:
71
- return print_r($item,true);
72
- }
73
- }
74
-
75
- /**
76
- * Prints text for email column
77
- *
78
- * @param object
79
- * @return string
80
- */
81
- function column_tag_text ( $item )
82
- {
83
- //Build row actions
84
- $actions = array(
85
- 'edit' => sprintf('<div style="clear:both;"></div><a href="?page=%s&action=%s&tag=%s">Edit</a>', $_REQUEST['page'], 'edit_tag',$item['tag_id']),
86
- 'delete' => sprintf('<a href="?page=%s&action=%s&tag=%s">Delete</a>',$_REQUEST['page'],'delete_tag',$item['tag_id'])
87
- );
88
-
89
- //Return the title contents
90
- return sprintf('%1$s<br/>%2$s',
91
- /*$1%s*/ sprintf('<a class="row-title" href="?page=%s&action=edit_tag&tag=%s">%s</a>', $_REQUEST['page'], $item['tag_id'], $item['tag_text']),
92
- /*$2%s*/ $this->row_actions($actions)
93
- );
94
- }
95
-
96
- /**
97
- * Get all the columns for the list table
98
- *
99
- * @param object
100
- * @param string
101
- * @return array associative array of columns
102
- */
103
- function get_columns ()
104
- {
105
- $columns = array(
106
- 'tag_text' => 'Tag',
107
- 'tag_count' => 'Contacts',
108
- 'tag_form_selectors' => 'CSS Selectors',
109
- 'tag_synced_lists' => 'Synced lists'
110
- );
111
- return $columns;
112
- }
113
-
114
- /**
115
- * Defines sortable columns for table
116
- *
117
- * @param object
118
- * @param string
119
- * @return array associative array of columns
120
- */
121
- function get_sortable_columns ()
122
- {
123
- $sortable_columns = array(
124
- 'tag_text' => array('tag_text',false),
125
- 'tag_count' => array('tag_count',false),
126
- 'tag_form_selectors' => array('tag_form_selectors',false),
127
- 'tag_synced_lists' => array('tag_synced_lists',false)
128
- );
129
- return $sortable_columns;
130
- }
131
-
132
- /**
133
- * Get the bulk actions
134
- *
135
- * @return array associative array of actions
136
- */
137
- function get_bulk_actions ()
138
- {
139
- return array();
140
- }
141
-
142
- /**
143
- * Process bulk actions for deleting
144
- */
145
- function process_bulk_action ()
146
- {
147
-
148
- }
149
-
150
- /**
151
- * Get the contact tags
152
- *
153
- * @return string
154
- */
155
- function get_tags ()
156
- {
157
- global $wpdb;
158
-
159
- $q = "
160
- SELECT
161
- lt.tag_text, lt.tag_slug, lt.tag_synced_lists, lt.tag_form_selectors, lt.tag_order, lt.tag_id,
162
- ( SELECT COUNT(DISTINCT contact_hashkey) FROM $wpdb->li_tag_relationships ltr, $wpdb->li_leads ll WHERE tag_id = lt.tag_id AND ltr.tag_relationship_deleted = 0 AND ltr.contact_hashkey != '' AND ll.hashkey = ltr.contact_hashkey AND ll.lead_deleted = 0 AND ll.hashkey != '' GROUP BY tag_id ) AS tag_count
163
- FROM
164
- $wpdb->li_tags lt
165
- WHERE
166
- lt.tag_deleted = 0
167
- GROUP BY lt.tag_slug
168
- ORDER BY lt.tag_order ASC";
169
-
170
- $tags = $wpdb->get_results($q);
171
-
172
- $all_tags = array();
173
- if ( count($tags) )
174
- {
175
- foreach ( $tags as $key => $tag )
176
- {
177
- $tag_synced_lists = '';
178
- if ( $tag->tag_synced_lists )
179
- {
180
- foreach ( unserialize($tag->tag_synced_lists) as $list )
181
- $tag_synced_lists .= $list['list_name'] . '<br/>';
182
- }
183
-
184
- $tag_array = array(
185
- 'tag_id' => $tag->tag_id,
186
- 'tag_count' => sprintf('<a href="?page=%s&contact_type=%s">%d</a>', 'leadin_contacts', $tag->tag_slug, ( $tag->tag_count ? $tag->tag_count : 0 )),
187
- 'tag_text' => $tag->tag_text,
188
- 'tag_slug' => $tag->tag_slug,
189
- 'tag_form_selectors' => str_replace(',', '<br/>', $tag->tag_form_selectors),
190
- 'tag_synced_lists' => $tag_synced_lists,
191
- 'tag_order' => $tag->tag_order
192
- );
193
-
194
- array_push($all_tags, $tag_array);
195
- }
196
- }
197
-
198
- return stripslashes_deep($all_tags);
199
- }
200
-
201
- /**
202
- * Gets + prepares the contacts for the list table
203
- */
204
- function prepare_items ()
205
- {
206
- $per_page = 10;
207
-
208
- $columns = $this->get_columns();
209
-
210
- $hidden = array();
211
- $sortable = $this->get_sortable_columns();
212
- $this->_column_headers = array($columns, $hidden, $sortable);
213
-
214
- usort($this->data, array($this, 'usort_reorder'));
215
-
216
- $current_page = $this->get_pagenum();
217
- $total_items = count($this->data);
218
- $this->data = array_slice($this->data, (($current_page-1)*$per_page), $per_page);
219
-
220
- $this->items = $this->data;
221
-
222
- $this->set_pagination_args( array(
223
- 'total_items' => $total_items,
224
- 'per_page' => $per_page,
225
- 'total_pages' => ceil($total_items/$per_page)
226
- ) );
227
- }
228
-
229
- /**
230
- * Sorting function for usort
231
- *
232
- * @param array
233
- * @param array
234
- * @return array sorted array
235
- */
236
- function usort_reorder ( $a, $b )
237
- {
238
- $orderby = ( !empty($_REQUEST['orderby']) ? $_REQUEST['orderby'] : 'tag_order' );
239
- $order = ( !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'asc' );
240
-
241
- if ( $a[$orderby] == $b[$orderby] )
242
- $result = 0;
243
- else if ( $a[$orderby] < $b[$orderby] )
244
- $result = -1;
245
- else
246
- $result = 1;
247
-
248
- return ( $order === 'asc' ? $result : -$result );
249
- }
250
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/inc/class-leadin-viewers.php DELETED
@@ -1,72 +0,0 @@
1
- <?php
2
- //=============================================
3
- // LI_Viewers Class
4
- //=============================================
5
- class LI_Viewers {
6
-
7
- /**
8
- * Variables
9
- */
10
- var $viewers;
11
- var $submissions;
12
-
13
- /**
14
- * Class constructor
15
- */
16
- function __construct ()
17
- {
18
-
19
- }
20
-
21
- /**
22
- * Get identified readers from a url
23
- * @param string
24
- * @return array
25
- */
26
- function get_identified_viewers ( $pageview_url )
27
- {
28
- global $wpdb;
29
- $q = $wpdb->prepare(
30
- "SELECT
31
- ll.lead_email, ll.lead_id, MAX(lpv.pageview_date) AS pageview_date
32
- FROM
33
- $wpdb->li_leads ll, $wpdb->li_pageviews lpv
34
- WHERE
35
- lpv.pageview_url = %s AND
36
- lpv.lead_hashkey = ll.hashkey AND
37
- ll.lead_deleted = 0 AND
38
- ll.lead_email != ''
39
- GROUP BY
40
- ll.lead_id
41
- ORDER BY
42
- pageview_date DESC", $pageview_url);
43
- $this->viewers = $wpdb->get_results($q);
44
- return $this->viewers;
45
- }
46
-
47
- /**
48
- * Get identified readers from a url
49
- * @param string
50
- * @return array
51
- */
52
- function get_submissions ( $pageview_url )
53
- {
54
- global $wpdb;
55
- $q = $wpdb->prepare(
56
- "SELECT
57
- ll.lead_email, ll.lead_id, MAX(ls.form_date) AS form_date
58
- FROM
59
- $wpdb->li_leads ll, $wpdb->li_submissions ls
60
- WHERE
61
- ls.form_page_url = %s AND
62
- ls.lead_hashkey = ll.hashkey AND
63
- ll.lead_deleted = 0 AND
64
- ls.form_deleted = 0
65
- GROUP BY
66
- ll.lead_id
67
- ORDER BY
68
- form_date DESC", $pageview_url);
69
- $this->submissions = $wpdb->get_results($q);
70
- return $this->submissions;
71
- }
72
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/inc/class-stats-dashboard.php DELETED
@@ -1,335 +0,0 @@
1
- <?php
2
-
3
- //=============================================
4
- // Include Needed Files
5
- //=============================================
6
-
7
- include_once(LEADIN_PLUGIN_DIR . '/admin/inc/sources/Snowplow/RefererParser/LI_Parser.php');
8
- include_once(LEADIN_PLUGIN_DIR . '/admin/inc/sources/Snowplow/RefererParser/LI_Referer.php');
9
- include_once(LEADIN_PLUGIN_DIR . '/admin/inc/sources/Snowplow/RefererParser/LI_Medium.php');
10
-
11
- //=============================================
12
- // WPStatsDashboard Class
13
- //=============================================
14
- class LI_StatsDashboard {
15
-
16
- /**
17
- * Variables
18
- */
19
- var $total_contacts = 0;
20
- var $total_new_contacts = 0;
21
- var $best_day_ever = 0;
22
- var $avg_contacts_last_90_days = 0;
23
- var $total_contacts_last_30_days = 0;
24
- var $total_contacts_last_90_days = 0;
25
- var $total_returning_contacts = 0;
26
- var $max_source = 0;
27
-
28
- /**
29
- * Arrays
30
- */
31
- var $returning_contacts;
32
- var $new_contacts;
33
-
34
- /**
35
- * Sources counts
36
- */
37
- var $organic_count = 0;
38
- var $referral_count = 0;
39
- var $social_count = 0;
40
- var $email_count = 0;
41
- var $paid_count = 0;
42
- var $direct_count = 0;
43
-
44
- var $x_axis_labels = '';
45
- var $column_colors = '';
46
- var $column_data = '';
47
- var $average_data = '';
48
- var $weekend_column_data = '';
49
-
50
- var $parser;
51
-
52
- function __construct ()
53
- {
54
- $this->parser = new LI_Parser();
55
- $this->get_data_last_30_days_graph();
56
- $this->get_sources();
57
-
58
- $this->returning_contacts = $this->get_returning_contacts();
59
- $this->total_returning_contacts = count($this->returning_contacts);
60
-
61
- $this->new_contacts = $this->get_new_contacts();
62
- $this->total_new_contacts = count($this->new_contacts);
63
- }
64
-
65
- function get_data_last_30_days_graph ()
66
- {
67
- global $wpdb;
68
-
69
- $q = "
70
- SELECT
71
- COUNT(DISTINCT hashkey) AS total_contacts
72
- FROM
73
- $wpdb->li_leads
74
- WHERE
75
- lead_email != '' AND lead_deleted = 0 AND hashkey != '' ";
76
-
77
- $this->total_contacts = $wpdb->get_var($q);
78
-
79
-
80
- $q = "SELECT DATE(lead_date) as lead_date, COUNT(DISTINCT hashkey) contacts FROM $wpdb->li_leads WHERE lead_email != '' AND hashkey != '' AND lead_deleted = 0 GROUP BY DATE(lead_date)";
81
- $contacts = $wpdb->get_results($q);
82
-
83
- for ( $i = count($contacts)-1; $i >= 0; $i-- )
84
- {
85
- $this->best_day_ever = ( $contacts[$i]->contacts && $contacts[$i]->contacts > $this->best_day_ever ? $contacts[$i]->contacts : $this->best_day_ever);
86
- }
87
-
88
- for ( $i = 90; $i >= 0; $i-- )
89
- {
90
- $array_key = leadin_search_object_by_value($contacts, date('Y-m-d', strtotime('-'. $i .' days')), 'lead_date');
91
- $this->total_contacts_last_90_days += ( $array_key ? $contacts[$array_key]->contacts : 0);
92
- }
93
-
94
- $this->avg_contacts_last_90_days = floor($this->total_contacts_last_90_days/90);
95
-
96
- for ( $i = 31; $i >= 0; $i-- )
97
- {
98
- $array_key = leadin_search_object_by_value($contacts, date('Y-m-d', strtotime('-'. $i .' days')), 'lead_date');
99
-
100
- $this->total_contacts_last_30_days += ( $array_key ? $contacts[$array_key]->contacts : 0);
101
-
102
- // x axis labels
103
- $this->x_axis_labels .= "'" . strtoupper(date('M j', strtotime('-'. $i .' days'))) . "'". ( $i != 0 ? "," : "" );
104
-
105
- // colors for chart columns
106
- $this->column_colors .= ( $array_key && $contacts[$array_key]->contacts > $this->avg_contacts_last_90_days ? "'#9de596'" : "'#d8d8d8'" ) . ( $i != 0 ? "," : "");
107
-
108
- // column data points
109
- $this->column_data .= "{ name: '" . strtoupper(date('M j', strtotime('-'. $i .' days'))) . "', y: " . ( $array_key ? $contacts[$array_key]->contacts : '0' ) . " }" . ( $i != 0 ? ", " : "" );
110
-
111
- // weekend background column points
112
- if ( leadin_is_weekend(date('M j', strtotime('-'. $i .' days'))) )
113
- $this->weekend_column_data .= "{ name: '" . strtoupper(date('M j', strtotime('-'. $i .' days'))) . "', color: 'rgba(0,0,0,.05)', y: " . ( $array_key ? $contacts[$array_key]->contacts : '0' ) . " }" . ( $i != 0 ? ", " : "" );
114
- else
115
- $this->weekend_column_data .= "{ name: '" . strtoupper(date('M j', strtotime('-'. $i .' days'))) . "', color: 'rgba(0,0,0,0)', y: " . ( $array_key ? $contacts[$array_key]->contacts : '0' ) . " }" . ( $i != 0 ? ", " : "" );
116
-
117
- // average line
118
- if ( $this->avg_contacts_last_90_days )
119
- {
120
- $this->average_data .= $this->avg_contacts_last_90_days . ( $i != 0 ? "," : "");
121
- }
122
- }
123
- }
124
-
125
- function get_returning_contacts ()
126
- {
127
- global $wpdb;
128
-
129
- $q = "
130
- SELECT
131
- DISTINCT lead_hashkey lh,
132
- lead_id,
133
- lead_email,
134
- ( SELECT COUNT(*) FROM $wpdb->li_pageviews WHERE lead_hashkey = lh ) as pageviews,
135
- ( SELECT MIN(pageview_source) AS pageview_source FROM $wpdb->li_pageviews WHERE lead_hashkey = lh AND pageview_session_start = 1 AND pageview_deleted = 0 ) AS lead_source,
136
- ( SELECT MIN(pageview_url) AS pageview_url FROM $wpdb->li_pageviews WHERE lead_hashkey = lh AND pageview_session_start = 1 AND pageview_deleted = 0 ) AS lead_origin_url
137
- FROM
138
- $wpdb->li_leads ll, $wpdb->li_pageviews lpv
139
- WHERE
140
- ll.lead_date < CURRENT_DATE() AND
141
- pageview_date >= CURRENT_DATE() AND
142
- ll.hashkey = lpv.lead_hashkey AND
143
- pageview_deleted = 0 AND lead_email != '' AND lead_deleted = 0 ";
144
-
145
- return $wpdb->get_results($q);
146
- }
147
-
148
- function get_new_contacts ()
149
- {
150
- global $wpdb;
151
-
152
- $q = "
153
- SELECT DISTINCT lead_hashkey lh,
154
- lead_id,
155
- lead_email,
156
- ( SELECT COUNT(*) FROM $wpdb->li_pageviews WHERE lead_hashkey = lh ) as pageviews,
157
- ( SELECT MIN(pageview_source) AS pageview_source FROM $wpdb->li_pageviews WHERE lead_hashkey = lh AND pageview_session_start = 1 AND pageview_deleted = 0 ) AS lead_source,
158
- ( SELECT MIN(pageview_url) AS pageview_url FROM $wpdb->li_pageviews WHERE lead_hashkey = lh AND pageview_session_start = 1 AND pageview_deleted = 0 ) AS lead_origin_url
159
- FROM
160
- $wpdb->li_leads ll, $wpdb->li_pageviews lpv
161
- WHERE
162
- lead_date >= CURRENT_DATE() AND
163
- ll.hashkey = lpv.lead_hashkey AND
164
- pageview_deleted = 0 AND lead_email != '' AND lead_deleted = 0 ";
165
-
166
- return $wpdb->get_results($q);
167
- }
168
-
169
- function get_sources ()
170
- {
171
- global $wpdb;
172
-
173
- $q = "SELECT hashkey lh,
174
- ( SELECT MIN(pageview_source) AS pageview_source FROM $wpdb->li_pageviews WHERE lead_hashkey = lh AND pageview_session_start = 1 AND pageview_deleted = 0 ) AS lead_source,
175
- ( SELECT MIN(pageview_url) AS pageview_url FROM $wpdb->li_pageviews WHERE lead_hashkey = lh AND pageview_session_start = 1 AND pageview_deleted = 0 ) AS lead_origin_url
176
- FROM
177
- $wpdb->li_leads
178
- WHERE
179
- lead_date BETWEEN CURDATE() - INTERVAL 30 DAY AND NOW() AND lead_email != '' AND lead_deleted = 0";
180
-
181
- $contacts = $wpdb->get_results($q);
182
-
183
- foreach ( $contacts as $contact )
184
- {
185
- $source = $this->check_lead_source($contact->lead_source, $contact->lead_origin_url);
186
-
187
- switch ( $source )
188
- {
189
- case 'search' :
190
- $this->organic_count++;
191
- break;
192
-
193
- case 'social' :
194
- $this->social_count++;
195
- break;
196
-
197
- case 'email' :
198
- $this->email_count++;
199
- break;
200
-
201
- case 'referral' :
202
- $this->referral_count++;
203
- break;
204
-
205
- case 'paid' :
206
- $this->paid_count++;
207
- break;
208
-
209
- case 'direct' :
210
- $this->direct_count++;
211
- break;
212
- }
213
- }
214
-
215
- $this->max_source = max(array($this->organic_count, $this->referral_count, $this->social_count, $this->email_count, $this->paid_count, $this->direct_count));
216
- }
217
-
218
- function check_lead_source ( $source, $origin_url = '' )
219
- {
220
- if ( $origin_url )
221
- {
222
- $decoded_origin_url = urldecode($origin_url);
223
-
224
- if ( stristr($decoded_origin_url, 'utm_medium=cpc') || stristr($decoded_origin_url, 'utm_medium=ppc') || stristr($decoded_origin_url, 'aclk') || stristr($decoded_origin_url, 'gclid') || stristr($decoded_origin_url, 'utm_medium=paid') )
225
- return 'paid';
226
-
227
- if ( stristr($decoded_origin_url, 'utm_') )
228
- {
229
- $url = $decoded_origin_url;
230
- $url_parts = parse_url($url);
231
- parse_str($url_parts['query'], $path_parts);
232
-
233
- if ( isset($path_parts['adurl']) )
234
- return 'paid';
235
-
236
- if ( isset($path_parts['utm_medium']) )
237
- {
238
- if ( $path_parts['utm_medium'] == 'cpc' || $path_parts['utm_medium'] == 'ppc' )
239
- return 'paid';
240
-
241
- if ( $path_parts['utm_medium'] == 'social' )
242
- return 'social';
243
-
244
- if ( $path_parts['utm_medium'] == 'email' )
245
- return 'email';
246
- }
247
-
248
- if ( isset($path_parts['utm_source']) )
249
- {
250
- if ( stristr($path_parts['utm_source'], 'email') )
251
- return 'email';
252
- }
253
- }
254
- }
255
-
256
- if ( $source )
257
- {
258
- $decoded_source = urldecode($source);
259
-
260
- if ( stristr($decoded_source, 'utm_medium=cpc') || stristr($decoded_source, 'utm_medium=ppc') || stristr($decoded_source, 'aclk') || stristr($decoded_source, 'gclid') )
261
- return 'paid';
262
-
263
- if ( stristr($source, 'utm_') )
264
- {
265
- $url = $source;
266
- $url_parts = parse_url($url);
267
- parse_str($url_parts['query'], $path_parts);
268
-
269
- if ( isset($path_parts['adurl']) )
270
- return 'paid';
271
-
272
- if ( isset($path_parts['utm_medium']) )
273
- {
274
- if ( $path_parts['utm_medium'] == 'cpc' || $path_parts['utm_medium'] == 'ppc' )
275
- return 'paid';
276
-
277
- if ( $path_parts['utm_medium'] == 'social' )
278
- return 'social';
279
-
280
- if ( $path_parts['utm_medium'] == 'email' )
281
- return 'email';
282
- }
283
-
284
- if ( isset($path_parts['utm_source']) )
285
- {
286
- if ( stristr($path_parts['utm_source'], 'email') )
287
- return 'email';
288
- }
289
- }
290
-
291
- $referer = $this->parser->parse(
292
- $source
293
- );
294
-
295
- if ( $referer->isKnown() )
296
- return $referer->getMedium();
297
- else
298
- return 'referral';
299
- }
300
-
301
- return 'direct';
302
- }
303
-
304
- function print_readable_source ( $source )
305
- {
306
- switch ( $source )
307
- {
308
- case 'search' :
309
- return 'Organic Search';
310
- break;
311
-
312
- case 'social' :
313
- return 'Social Media';
314
- break;
315
-
316
- case 'email' :
317
- return 'Email Marketing';
318
- break;
319
-
320
- case 'referral' :
321
- return 'Referral';
322
- break;
323
-
324
- case 'paid' :
325
- return 'Paid';
326
- break;
327
-
328
- case 'direct' :
329
- return 'Direct';
330
- break;
331
- }
332
- }
333
- }
334
-
335
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/inc/sources/Snowplow/RefererParser/Config/LI_ConfigFileReaderTrait.php DELETED
@@ -1,54 +0,0 @@
1
- <?php
2
-
3
- abstract class LI_ConfigFileReaderTrait
4
- {
5
- /** @var string */
6
- private $fileName;
7
-
8
- /** @var array */
9
- private $referers = array();
10
-
11
- public function __construct ()
12
- {
13
-
14
- }
15
-
16
- private function init($fileName)
17
- {
18
- if (!file_exists($fileName)) {
19
- throw LI_InvalidArgumentException::fileNotExists($fileName);
20
- }
21
-
22
- $this->fileName = $fileName;
23
- }
24
-
25
- abstract protected function parse($content);
26
-
27
- private function read()
28
- {
29
- if ($this->referers) {
30
- return;
31
- }
32
-
33
- $hash = $this->parse(file_get_contents($this->fileName));
34
-
35
- foreach ($hash as $medium => $referers) {
36
- foreach ($referers as $source => $referer) {
37
- foreach ($referer['domains'] as $domain) {
38
- $this->referers[$domain] = array(
39
- 'source' => $source,
40
- 'medium' => $medium,
41
- 'parameters' => isset($referer['parameters']) ? $referer['parameters'] : array(),
42
- );
43
- }
44
- }
45
- }
46
- }
47
-
48
- public function lookup($lookupString)
49
- {
50
- $this->read();
51
-
52
- return isset($this->referers[$lookupString]) ? $this->referers[$lookupString] : null;
53
- }
54
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/inc/sources/Snowplow/RefererParser/Config/LI_ConfigReaderInterface.php DELETED
@@ -1,15 +0,0 @@
1
- <?php
2
-
3
- include('LI_ConfigFileReaderTrait.php');
4
-
5
- abstract class LI_ConfigReaderInterface extends LI_ConfigFileReaderTrait
6
- {
7
- /**
8
- * @param string $lookupString
9
- * @return array
10
- */
11
- public function lookup($lookupString)
12
- {
13
-
14
- }
15
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/inc/sources/Snowplow/RefererParser/Config/LI_JsonConfigReader.php DELETED
@@ -1,57 +0,0 @@
1
- <?php
2
-
3
- class LI_JsonConfigReader extends LI_ConfigReaderInterface
4
- {
5
- /** @var string */
6
- private $fileName;
7
-
8
- /** @var array */
9
- private $referers = array();
10
-
11
- public function __construct ( $fileName )
12
- {
13
- $this->fileName = $fileName;
14
- }
15
-
16
- private function init($fileName)
17
- {
18
- if (!file_exists($fileName)) {
19
- throw LI_InvalidArgumentException::fileNotExists($fileName);
20
- }
21
-
22
- $this->fileName = $fileName;
23
- }
24
-
25
- private function read()
26
- {
27
- if ($this->referers) {
28
- return;
29
- }
30
-
31
- $hash = $this->parse(file_get_contents($this->fileName));
32
-
33
- foreach ($hash as $medium => $referers) {
34
- foreach ($referers as $source => $referer) {
35
- foreach ($referer['domains'] as $domain) {
36
- $this->referers[$domain] = array(
37
- 'source' => $source,
38
- 'medium' => $medium,
39
- 'parameters' => isset($referer['parameters']) ? $referer['parameters'] : array(),
40
- );
41
- }
42
- }
43
- }
44
- }
45
-
46
- public function lookup($lookupString)
47
- {
48
- $this->read();
49
-
50
- return isset($this->referers[$lookupString]) ? $this->referers[$lookupString] : null;
51
- }
52
-
53
- protected function parse($content)
54
- {
55
- return json_decode($content, true);
56
- }
57
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/inc/sources/Snowplow/RefererParser/Exception/LI_InvalidArgumentException.php DELETED
@@ -1,9 +0,0 @@
1
- <?php
2
-
3
- class LI_InvalidArgumentException extends BaseInvalidArgumentException
4
- {
5
- public static function fileNotExists($fileName)
6
- {
7
- return new static(sprintf('File "%s" does not exist', $fileName));
8
- }
9
- }
 
 
 
 
 
 
 
 
 
admin/inc/sources/Snowplow/RefererParser/LI_Medium.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
-
3
- final class LI_Medium
4
- {
5
- const SEARCH = 'search';
6
-
7
- const SOCIAL = 'social';
8
-
9
- const UNKNOWN = 'unknown';
10
-
11
- const INTERNAL = 'internal';
12
-
13
- const EMAIL = 'email';
14
-
15
- const INVALID = 'invalid';
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/inc/sources/Snowplow/RefererParser/LI_Parser.php DELETED
@@ -1,121 +0,0 @@
1
- <?php
2
-
3
- include_once('Config/LI_ConfigReaderInterface.php');
4
- include_once('Config/LI_JsonConfigReader.php');
5
-
6
- class LI_Parser
7
- {
8
- /** @var ConfigReaderInterface */
9
- private $configReader;
10
-
11
- /**
12
- * @var string[]
13
- */
14
- private $internalHosts = array();
15
-
16
- public function __construct(LI_ConfigReaderInterface $configReader = null, array $internalHosts = array() )
17
- {
18
- $this->configReader = $configReader ? $configReader : self::createDefaultConfigReader();
19
- $this->internalHosts = $internalHosts;
20
- }
21
-
22
- /**
23
- * Parse referer URL
24
- *
25
- * @param string $refererUrl
26
- * @param string $pageUrl
27
- * @return Referer
28
- */
29
- public function parse($refererUrl, $pageUrl = null)
30
- {
31
- $refererParts = $this->parseUrl($refererUrl);
32
- if (!$refererParts) {
33
- return LI_Referer::createInvalid();
34
- }
35
-
36
- $pageUrlParts = $this->parseUrl($pageUrl);
37
-
38
- //print_r($refererParts);
39
-
40
- if ($pageUrlParts
41
- && $pageUrlParts['host'] === $refererParts['host']
42
- || in_array($refererParts['host'], $this->internalHosts)) {
43
- return LI_Referer::createInternal();
44
- }
45
-
46
- $referer = $this->lookup($refererParts['host'], $refererParts['path']);
47
-
48
- if (!$referer) {
49
- return LI_Referer::createUnknown();
50
- }
51
-
52
- $searchTerm = null;
53
-
54
- if (is_array($referer['parameters'])) {
55
- parse_str($refererParts['query'], $queryParts);
56
-
57
- //foreach ($queryParts as $key => $parameter) {
58
- $searchTerm = isset($queryParts['q']) ? $queryParts['q'] : $searchTerm;
59
- //}
60
- }
61
-
62
- return LI_Referer::createKnown($referer['medium'], $referer['source'], $searchTerm);
63
- }
64
-
65
- private static function parseUrl($url)
66
- {
67
- if ($url === null) {
68
- return null;
69
- }
70
-
71
- $parts = parse_url($url);
72
- if (!isset($parts['scheme']) || !in_array(strtolower($parts['scheme']), array('http', 'https'))) {
73
- return null;
74
- }
75
-
76
- return array_merge(array('query' => null, 'path' => '/'), $parts);
77
- }
78
-
79
- private function lookup($host, $path)
80
- {
81
- $referer = $this->lookupPath($host, $path);
82
-
83
- if ($referer) {
84
- return $referer;
85
- }
86
-
87
- return $this->lookupHost($host);
88
- }
89
-
90
- private function lookupPath($host, $path)
91
- {
92
- $referer = $this->lookupHost($host, $path);
93
-
94
- if ($referer) {
95
- return $referer;
96
- }
97
-
98
- $path = substr($path, 0, strrpos($path, '/'));
99
-
100
- if (!$path) {
101
- return null;
102
- }
103
-
104
- return $this->lookupPath($host, $path);
105
- }
106
-
107
- private function lookupHost($host, $path = null)
108
- {
109
- do {
110
- $referer = $this->configReader->lookup($host . $path);
111
- $host = substr($host, strpos($host, '.') + 1);
112
- } while (!$referer && substr_count($host, '.') > 0);
113
-
114
- return $referer;
115
- }
116
-
117
- private static function createDefaultConfigReader()
118
- {
119
- return new LI_JsonConfigReader(LEADIN_PLUGIN_DIR . '/admin/inc/sources/referers.json');
120
- }
121
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/inc/sources/Snowplow/RefererParser/LI_Referer.php DELETED
@@ -1,78 +0,0 @@
1
- <?php
2
-
3
- class LI_Referer
4
- {
5
- /** @var string */
6
- private $medium;
7
-
8
- /** @var string */
9
- private $source;
10
-
11
- /** @var string|null */
12
- private $searchTerm;
13
-
14
- private function __construct()
15
- {}
16
-
17
- public static function createKnown($medium, $source, $searchTerm = null)
18
- {
19
- $referer = new self();
20
- $referer->medium = $medium;
21
- $referer->source = $source;
22
- $referer->searchTerm = $searchTerm;
23
-
24
- return $referer;
25
- }
26
-
27
- public static function createUnknown()
28
- {
29
- $referer = new self();
30
- $referer->medium = LI_Medium::UNKNOWN;
31
-
32
- return $referer;
33
- }
34
-
35
- public static function createInternal()
36
- {
37
- $referer = new self();
38
- $referer->medium = LI_Medium::INTERNAL;
39
-
40
- return $referer;
41
- }
42
-
43
- public static function createInvalid()
44
- {
45
- $referer = new self();
46
- $referer->medium = LI_Medium::INVALID;
47
-
48
- return $referer;
49
- }
50
-
51
- /** @return boolean */
52
- public function isValid()
53
- {
54
- return $this->medium !== LI_Medium::INVALID;
55
- }
56
-
57
- /** @return boolean */
58
- public function isKnown()
59
- {
60
- return !in_array($this->medium, array(LI_Medium::UNKNOWN, LI_Medium::INTERNAL, LI_Medium::INVALID), true);
61
- }
62
-
63
- /** @return string */
64
- public function getMedium()
65
- {
66
- return $this->medium;
67
- }
68
-
69
- public function getSource()
70
- {
71
- return $this->source;
72
- }
73
-
74
- public function getSearchTerm()
75
- {
76
- return $this->searchTerm;
77
- }
78
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/inc/sources/referers.json DELETED
@@ -1,3890 +0,0 @@
1
- {
2
- "unknown": {
3
- "Google": {
4
- "domains": [
5
- "support.google.com",
6
- "developers.google.com",
7
- "maps.google.com",
8
- "accounts.google.com",
9
- "drive.google.com",
10
- "sites.google.com",
11
- "groups.google.com",
12
- "groups.google.co.uk",
13
- "news.google.co.uk"
14
- ]
15
- },
16
- "Yahoo!": {
17
- "domains": [
18
- "finance.yahoo.com",
19
- "news.yahoo.com",
20
- "eurosport.yahoo.com",
21
- "sports.yahoo.com",
22
- "astrology.yahoo.com",
23
- "travel.yahoo.com",
24
- "answers.yahoo.com",
25
- "screen.yahoo.com",
26
- "weather.yahoo.com",
27
- "messenger.yahoo.com",
28
- "games.yahoo.com",
29
- "shopping.yahoo.net",
30
- "movies.yahoo.com",
31
- "cars.yahoo.com",
32
- "lifestyle.yahoo.com",
33
- "omg.yahoo.com",
34
- "match.yahoo.net"
35
- ]
36
- }
37
- },
38
- "search": {
39
- "TalkTalk": {
40
- "domains": [
41
- "www.talktalk.co.uk"
42
- ],
43
- "parameters": [
44
- "query"
45
- ]
46
- },
47
- "1.cz": {
48
- "domains": [
49
- "1.cz"
50
- ],
51
- "parameters": [
52
- "q"
53
- ]
54
- },
55
- "Softonic": {
56
- "domains": [
57
- "search.softonic.com"
58
- ],
59
- "parameters": [
60
- "q"
61
- ]
62
- },
63
- "GAIS": {
64
- "domains": [
65
- "gais.cs.ccu.edu.tw"
66
- ],
67
- "parameters": [
68
- "q"
69
- ]
70
- },
71
- "Freecause": {
72
- "domains": [
73
- "search.freecause.com"
74
- ],
75
- "parameters": [
76
- "p"
77
- ]
78
- },
79
- "RPMFind": {
80
- "domains": [
81
- "rpmfind.net",
82
- "fr2.rpmfind.net"
83
- ],
84
- "parameters": [
85
- "rpmfind.net",
86
- "fr2.rpmfind.net"
87
- ]
88
- },
89
- "Comcast": {
90
- "domains": [
91
- "serach.comcast.net"
92
- ],
93
- "parameters": [
94
- "q"
95
- ]
96
- },
97
- "Voila": {
98
- "domains": [
99
- "search.ke.voila.fr",
100
- "www.lemoteur.fr"
101
- ],
102
- "parameters": [
103
- "rdata"
104
- ]
105
- },
106
- "Nifty": {
107
- "domains": [
108
- "search.nifty.com"
109
- ],
110
- "parameters": [
111
- "q"
112
- ]
113
- },
114
- "Atlas": {
115
- "domains": [
116
- "searchatlas.centrum.cz"
117
- ],
118
- "parameters": [
119
- "q"
120
- ]
121
- },
122
- "Lo.st": {
123
- "domains": [
124
- "lo.st"
125
- ],
126
- "parameters": [
127
- "x_query"
128
- ]
129
- },
130
- "DasTelefonbuch": {
131
- "domains": [
132
- "www1.dastelefonbuch.de"
133
- ],
134
- "parameters": [
135
- "kw"
136
- ]
137
- },
138
- "Fireball": {
139
- "domains": [
140
- "www.fireball.de"
141
- ],
142
- "parameters": [
143
- "q"
144
- ]
145
- },
146
- "1und1": {
147
- "domains": [
148
- "search.1und1.de"
149
- ],
150
- "parameters": [
151
- "su"
152
- ]
153
- },
154
- "Virgilio": {
155
- "domains": [
156
- "ricerca.virgilio.it",
157
- "ricercaimmagini.virgilio.it",
158
- "ricercavideo.virgilio.it",
159
- "ricercanews.virgilio.it",
160
- "mobile.virgilio.it"
161
- ],
162
- "parameters": [
163
- "qs"
164
- ]
165
- },
166
- "Web.nl": {
167
- "domains": [
168
- "www.web.nl"
169
- ],
170
- "parameters": [
171
- "zoekwoord"
172
- ]
173
- },
174
- "Plazoo": {
175
- "domains": [
176
- "www.plazoo.com"
177
- ],
178
- "parameters": [
179
- "q"
180
- ]
181
- },
182
- "Goyellow.de": {
183
- "domains": [
184
- "www.goyellow.de"
185
- ],
186
- "parameters": [
187
- "MDN"
188
- ]
189
- },
190
- "AOL": {
191
- "domains": [
192
- "search.aol.com",
193
- "search.aol.it",
194
- "aolsearch.aol.com",
195
- "aolsearch.com",
196
- "www.aolrecherche.aol.fr",
197
- "www.aolrecherches.aol.fr",
198
- "www.aolimages.aol.fr",
199
- "aim.search.aol.com",
200
- "www.recherche.aol.fr",
201
- "find.web.aol.com",
202
- "recherche.aol.ca",
203
- "aolsearch.aol.co.uk",
204
- "search.aol.co.uk",
205
- "aolrecherche.aol.fr",
206
- "sucheaol.aol.de",
207
- "suche.aol.de",
208
- "suche.aolsvc.de",
209
- "aolbusqueda.aol.com.mx",
210
- "alicesuche.aol.de",
211
- "alicesuchet.aol.de",
212
- "suchet2.aol.de",
213
- "search.hp.my.aol.com.au",
214
- "search.hp.my.aol.de",
215
- "search.hp.my.aol.it",
216
- "search-intl.netscape.com"
217
- ],
218
- "parameters": [
219
- "q",
220
- "query"
221
- ]
222
- },
223
- "Acoon": {
224
- "domains": [
225
- "www.acoon.de"
226
- ],
227
- "parameters": [
228
- "begriff"
229
- ]
230
- },
231
- "Free": {
232
- "domains": [
233
- "search.free.fr",
234
- "search1-2.free.fr",
235
- "search1-1.free.fr"
236
- ],
237
- "parameters": [
238
- "q"
239
- ]
240
- },
241
- "Apollo Latvia": {
242
- "domains": [
243
- "apollo.lv/portal/search/"
244
- ],
245
- "parameters": [
246
- "q"
247
- ]
248
- },
249
- "HighBeam": {
250
- "domains": [
251
- "www.highbeam.com"
252
- ],
253
- "parameters": [
254
- "q"
255
- ]
256
- },
257
- "I-play": {
258
- "domains": [
259
- "start.iplay.com"
260
- ],
261
- "parameters": [
262
- "q"
263
- ]
264
- },
265
- "FriendFeed": {
266
- "domains": [
267
- "friendfeed.com"
268
- ],
269
- "parameters": [
270
- "q"
271
- ]
272
- },
273
- "Yasni": {
274
- "domains": [
275
- "www.yasni.de",
276
- "www.yasni.com",
277
- "www.yasni.co.uk",
278
- "www.yasni.ch",
279
- "www.yasni.at"
280
- ],
281
- "parameters": [
282
- "query"
283
- ]
284
- },
285
- "Gigablast": {
286
- "domains": [
287
- "www.gigablast.com",
288
- "dir.gigablast.com"
289
- ],
290
- "parameters": [
291
- "q"
292
- ]
293
- },
294
- "arama": {
295
- "domains": [
296
- "arama.com"
297
- ],
298
- "parameters": [
299
- "q"
300
- ]
301
- },
302
- "Fixsuche": {
303
- "domains": [
304
- "www.fixsuche.de"
305
- ],
306
- "parameters": [
307
- "q"
308
- ]
309
- },
310
- "Apontador": {
311
- "domains": [
312
- "apontador.com.br",
313
- "www.apontador.com.br"
314
- ],
315
- "parameters": [
316
- "q"
317
- ]
318
- },
319
- "Search.com": {
320
- "domains": [
321
- "www.search.com"
322
- ],
323
- "parameters": [
324
- "q"
325
- ]
326
- },
327
- "Monstercrawler": {
328
- "domains": [
329
- "www.monstercrawler.com"
330
- ],
331
- "parameters": [
332
- "qry"
333
- ]
334
- },
335
- "Google Images": {
336
- "domains": [
337
- "google.ac/imgres",
338
- "google.ad/imgres",
339
- "google.ae/imgres",
340
- "google.am/imgres",
341
- "google.as/imgres",
342
- "google.at/imgres",
343
- "google.az/imgres",
344
- "google.ba/imgres",
345
- "google.be/imgres",
346
- "google.bf/imgres",
347
- "google.bg/imgres",
348
- "google.bi/imgres",
349
- "google.bj/imgres",
350
- "google.bs/imgres",
351
- "google.by/imgres",
352
- "google.ca/imgres",
353
- "google.cat/imgres",
354
- "google.cc/imgres",
355
- "google.cd/imgres",
356
- "google.cf/imgres",
357
- "google.cg/imgres",
358
- "google.ch/imgres",
359
- "google.ci/imgres",
360
- "google.cl/imgres",
361
- "google.cm/imgres",
362
- "google.cn/imgres",
363
- "google.co.bw/imgres",
364
- "google.co.ck/imgres",
365
- "google.co.cr/imgres",
366
- "google.co.id/imgres",
367
- "google.co.il/imgres",
368
- "google.co.in/imgres",
369
- "google.co.jp/imgres",
370
- "google.co.ke/imgres",
371
- "google.co.kr/imgres",
372
- "google.co.ls/imgres",
373
- "google.co.ma/imgres",
374
- "google.co.mz/imgres",
375
- "google.co.nz/imgres",
376
- "google.co.th/imgres",
377
- "google.co.tz/imgres",
378
- "google.co.ug/imgres",
379
- "google.co.uk/imgres",
380
- "google.co.uz/imgres",
381
- "google.co.ve/imgres",
382
- "google.co.vi/imgres",
383
- "google.co.za/imgres",
384
- "google.co.zm/imgres",
385
- "google.co.zw/imgres",
386
- "google.com/imgres",
387
- "google.com.af/imgres",
388
- "google.com.ag/imgres",
389
- "google.com.ai/imgres",
390
- "google.com.ar/imgres",
391
- "google.com.au/imgres",
392
- "google.com.bd/imgres",
393
- "google.com.bh/imgres",
394
- "google.com.bn/imgres",
395
- "google.com.bo/imgres",
396
- "google.com.br/imgres",
397
- "google.com.by/imgres",
398
- "google.com.bz/imgres",
399
- "google.com.co/imgres",
400
- "google.com.cu/imgres",
401
- "google.com.cy/imgres",
402
- "google.com.do/imgres",
403
- "google.com.ec/imgres",
404
- "google.com.eg/imgres",
405
- "google.com.et/imgres",
406
- "google.com.fj/imgres",
407
- "google.com.gh/imgres",
408
- "google.com.gi/imgres",
409
- "google.com.gt/imgres",
410
- "google.com.hk/imgres",
411
- "google.com.jm/imgres",
412
- "google.com.kh/imgres",
413
- "google.com.kh/imgres",
414
- "google.com.kw/imgres",
415
- "google.com.lb/imgres",
416
- "google.com.lc/imgres",
417
- "google.com.ly/imgres",
418
- "google.com.mt/imgres",
419
- "google.com.mx/imgres",
420
- "google.com.my/imgres",
421
- "google.com.na/imgres",
422
- "google.com.nf/imgres",
423
- "google.com.ng/imgres",
424
- "google.com.ni/imgres",
425
- "google.com.np/imgres",
426
- "google.com.om/imgres",
427
- "google.com.pa/imgres",
428
- "google.com.pe/imgres",
429
- "google.com.ph/imgres",
430
- "google.com.pk/imgres",
431
- "google.com.pr/imgres",
432
- "google.com.py/imgres",
433
- "google.com.qa/imgres",
434
- "google.com.sa/imgres",
435
- "google.com.sb/imgres",
436
- "google.com.sg/imgres",
437
- "google.com.sl/imgres",
438
- "google.com.sv/imgres",
439
- "google.com.tj/imgres",
440
- "google.com.tn/imgres",
441
- "google.com.tr/imgres",
442
- "google.com.tw/imgres",
443
- "google.com.ua/imgres",
444
- "google.com.uy/imgres",
445
- "google.com.vc/imgres",
446
- "google.com.vn/imgres",
447
- "google.cv/imgres",
448
- "google.cz/imgres",
449
- "google.de/imgres",
450
- "google.dj/imgres",
451
- "google.dk/imgres",
452
- "google.dm/imgres",
453
- "google.dz/imgres",
454
- "google.ee/imgres",
455
- "google.es/imgres",
456
- "google.fi/imgres",
457
- "google.fm/imgres",
458
- "google.fr/imgres",
459
- "google.ga/imgres",
460
- "google.gd/imgres",
461
- "google.ge/imgres",
462
- "google.gf/imgres",
463
- "google.gg/imgres",
464
- "google.gl/imgres",
465
- "google.gm/imgres",
466
- "google.gp/imgres",
467
- "google.gr/imgres",
468
- "google.gy/imgres",
469
- "google.hn/imgres",
470
- "google.hr/imgres",
471
- "google.ht/imgres",
472
- "google.hu/imgres",
473
- "google.ie/imgres",
474
- "google.im/imgres",
475
- "google.io/imgres",
476
- "google.iq/imgres",
477
- "google.is/imgres",
478
- "google.it/imgres",
479
- "google.it.ao/imgres",
480
- "google.je/imgres",
481
- "google.jo/imgres",
482
- "google.kg/imgres",
483
- "google.ki/imgres",
484
- "google.kz/imgres",
485
- "google.la/imgres",
486
- "google.li/imgres",
487
- "google.lk/imgres",
488
- "google.lt/imgres",
489
- "google.lu/imgres",
490
- "google.lv/imgres",
491
- "google.md/imgres",
492
- "google.me/imgres",
493
- "google.mg/imgres",
494
- "google.mk/imgres",
495
- "google.ml/imgres",
496
- "google.mn/imgres",
497
- "google.ms/imgres",
498
- "google.mu/imgres",
499
- "google.mv/imgres",
500
- "google.mw/imgres",
501
- "google.ne/imgres",
502
- "google.nl/imgres",
503
- "google.no/imgres",
504
- "google.nr/imgres",
505
- "google.nu/imgres",
506
- "google.pl/imgres",
507
- "google.pn/imgres",
508
- "google.ps/imgres",
509
- "google.pt/imgres",
510
- "google.ro/imgres",
511
- "google.rs/imgres",
512
- "google.ru/imgres",
513
- "google.rw/imgres",
514
- "google.sc/imgres",
515
- "google.se/imgres",
516
- "google.sh/imgres",
517
- "google.si/imgres",
518
- "google.sk/imgres",
519
- "google.sm/imgres",
520
- "google.sn/imgres",
521
- "google.so/imgres",
522
- "google.st/imgres",
523
- "google.td/imgres",
524
- "google.tg/imgres",
525
- "google.tk/imgres",
526
- "google.tl/imgres",
527
- "google.tm/imgres",
528
- "google.to/imgres",
529
- "google.tt/imgres",
530
- "google.us/imgres",
531
- "google.vg/imgres",
532
- "google.vu/imgres",
533
- "images.google.ws",
534
- "images.google.ac",
535
- "images.google.ad",
536
- "images.google.ae",
537
- "images.google.am",
538
- "images.google.as",
539
- "images.google.at",
540
- "images.google.az",
541
- "images.google.ba",
542
- "images.google.be",
543
- "images.google.bf",
544
- "images.google.bg",
545
- "images.google.bi",
546
- "images.google.bj",
547
- "images.google.bs",
548
- "images.google.by",
549
- "images.google.ca",
550
- "images.google.cat",
551
- "images.google.cc",
552
- "images.google.cd",
553
- "images.google.cf",
554
- "images.google.cg",
555
- "images.google.ch",
556
- "images.google.ci",
557
- "images.google.cl",
558
- "images.google.cm",
559
- "images.google.cn",
560
- "images.google.co.bw",
561
- "images.google.co.ck",
562
- "images.google.co.cr",
563
- "images.google.co.id",
564
- "images.google.co.il",
565
- "images.google.co.in",
566
- "images.google.co.jp",
567
- "images.google.co.ke",
568
- "images.google.co.kr",
569
- "images.google.co.ls",
570
- "images.google.co.ma",
571
- "images.google.co.mz",
572
- "images.google.co.nz",
573
- "images.google.co.th",
574
- "images.google.co.tz",
575
- "images.google.co.ug",
576
- "images.google.co.uk",
577
- "images.google.co.uz",
578
- "images.google.co.ve",
579
- "images.google.co.vi",
580
- "images.google.co.za",
581
- "images.google.co.zm",
582
- "images.google.co.zw",
583
- "images.google.com",
584
- "images.google.com.af",
585
- "images.google.com.ag",
586
- "images.google.com.ai",
587
- "images.google.com.ar",
588
- "images.google.com.au",
589
- "images.google.com.bd",
590
- "images.google.com.bh",
591
- "images.google.com.bn",
592
- "images.google.com.bo",
593
- "images.google.com.br",
594
- "images.google.com.by",
595
- "images.google.com.bz",
596
- "images.google.com.co",
597
- "images.google.com.cu",
598
- "images.google.com.cy",
599
- "images.google.com.do",
600
- "images.google.com.ec",
601
- "images.google.com.eg",
602
- "images.google.com.et",
603
- "images.google.com.fj",
604
- "images.google.com.gh",
605
- "images.google.com.gi",
606
- "images.google.com.gt",
607
- "images.google.com.hk",
608
- "images.google.com.jm",
609
- "images.google.com.kh",
610
- "images.google.com.kh",
611
- "images.google.com.kw",
612
- "images.google.com.lb",
613
- "images.google.com.lc",
614
- "images.google.com.ly",
615
- "images.google.com.mt",
616
- "images.google.com.mx",
617
- "images.google.com.my",
618
- "images.google.com.na",
619
- "images.google.com.nf",
620
- "images.google.com.ng",
621
- "images.google.com.ni",
622
- "images.google.com.np",
623
- "images.google.com.om",
624
- "images.google.com.pa",
625
- "images.google.com.pe",
626
- "images.google.com.ph",
627
- "images.google.com.pk",
628
- "images.google.com.pr",
629
- "images.google.com.py",
630
- "images.google.com.qa",
631
- "images.google.com.sa",
632
- "images.google.com.sb",
633
- "images.google.com.sg",
634
- "images.google.com.sl",
635
- "images.google.com.sv",
636
- "images.google.com.tj",
637
- "images.google.com.tn",
638
- "images.google.com.tr",
639
- "images.google.com.tw",
640
- "images.google.com.ua",
641
- "images.google.com.uy",
642
- "images.google.com.vc",
643
- "images.google.com.vn",
644
- "images.google.cv",
645
- "images.google.cz",
646
- "images.google.de",
647
- "images.google.dj",
648
- "images.google.dk",
649
- "images.google.dm",
650
- "images.google.dz",
651
- "images.google.ee",
652
- "images.google.es",
653
- "images.google.fi",
654
- "images.google.fm",
655
- "images.google.fr",
656
- "images.google.ga",
657
- "images.google.gd",
658
- "images.google.ge",
659
- "images.google.gf",
660
- "images.google.gg",
661
- "images.google.gl",
662
- "images.google.gm",
663
- "images.google.gp",
664
- "images.google.gr",
665
- "images.google.gy",
666
- "images.google.hn",
667
- "images.google.hr",
668
- "images.google.ht",
669
- "images.google.hu",
670
- "images.google.ie",
671
- "images.google.im",
672
- "images.google.io",
673
- "images.google.iq",
674
- "images.google.is",
675
- "images.google.it",
676
- "images.google.it.ao",
677
- "images.google.je",
678
- "images.google.jo",
679
- "images.google.kg",
680
- "images.google.ki",
681
- "images.google.kz",
682
- "images.google.la",
683
- "images.google.li",
684
- "images.google.lk",
685
- "images.google.lt",
686
- "images.google.lu",
687
- "images.google.lv",
688
- "images.google.md",
689
- "images.google.me",
690
- "images.google.mg",
691
- "images.google.mk",
692
- "images.google.ml",
693
- "images.google.mn",
694
- "images.google.ms",
695
- "images.google.mu",
696
- "images.google.mv",
697
- "images.google.mw",
698
- "images.google.ne",
699
- "images.google.nl",
700
- "images.google.no",
701
- "images.google.nr",
702
- "images.google.nu",
703
- "images.google.pl",
704
- "images.google.pn",
705
- "images.google.ps",
706
- "images.google.pt",
707
- "images.google.ro",
708
- "images.google.rs",
709
- "images.google.ru",
710
- "images.google.rw",
711
- "images.google.sc",
712
- "images.google.se",
713
- "images.google.sh",
714
- "images.google.si",
715
- "images.google.sk",
716
- "images.google.sm",
717
- "images.google.sn",
718
- "images.google.so",
719
- "images.google.st",
720
- "images.google.td",
721
- "images.google.tg",
722
- "images.google.tk",
723
- "images.google.tl",
724
- "images.google.tm",
725
- "images.google.to",
726
- "images.google.tt",
727
- "images.google.us",
728
- "images.google.vg",
729
- "images.google.vu",
730
- "images.google.ws"
731
- ],
732
- "parameters": [
733
- "q"
734
- ]
735
- },
736
- "ABCs\u00f8k": {
737
- "domains": [
738
- "abcsolk.no",
739
- "verden.abcsok.no"
740
- ],
741
- "parameters": [
742
- "q"
743
- ]
744
- },
745
- "Google Product Search": {
746
- "domains": [
747
- "google.ac/products",
748
- "google.ad/products",
749
- "google.ae/products",
750
- "google.am/products",
751
- "google.as/products",
752
- "google.at/products",
753
- "google.az/products",
754
- "google.ba/products",
755
- "google.be/products",
756
- "google.bf/products",
757
- "google.bg/products",
758
- "google.bi/products",
759
- "google.bj/products",
760
- "google.bs/products",
761
- "google.by/products",
762
- "google.ca/products",
763
- "google.cat/products",
764
- "google.cc/products",
765
- "google.cd/products",
766
- "google.cf/products",
767
- "google.cg/products",
768
- "google.ch/products",
769
- "google.ci/products",
770
- "google.cl/products",
771
- "google.cm/products",
772
- "google.cn/products",
773
- "google.co.bw/products",
774
- "google.co.ck/products",
775
- "google.co.cr/products",
776
- "google.co.id/products",
777
- "google.co.il/products",
778
- "google.co.in/products",
779
- "google.co.jp/products",
780
- "google.co.ke/products",
781
- "google.co.kr/products",
782
- "google.co.ls/products",
783
- "google.co.ma/products",
784
- "google.co.mz/products",
785
- "google.co.nz/products",
786
- "google.co.th/products",
787
- "google.co.tz/products",
788
- "google.co.ug/products",
789
- "google.co.uk/products",
790
- "google.co.uz/products",
791
- "google.co.ve/products",
792
- "google.co.vi/products",
793
- "google.co.za/products",
794
- "google.co.zm/products",
795
- "google.co.zw/products",
796
- "google.com/products",
797
- "google.com.af/products",
798
- "google.com.ag/products",
799
- "google.com.ai/products",
800
- "google.com.ar/products",
801
- "google.com.au/products",
802
- "google.com.bd/products",
803
- "google.com.bh/products",
804
- "google.com.bn/products",
805
- "google.com.bo/products",
806
- "google.com.br/products",
807
- "google.com.by/products",
808
- "google.com.bz/products",
809
- "google.com.co/products",
810
- "google.com.cu/products",
811
- "google.com.cy/products",
812
- "google.com.do/products",
813
- "google.com.ec/products",
814
- "google.com.eg/products",
815
- "google.com.et/products",
816
- "google.com.fj/products",
817
- "google.com.gh/products",
818
- "google.com.gi/products",
819
- "google.com.gt/products",
820
- "google.com.hk/products",
821
- "google.com.jm/products",
822
- "google.com.kh/products",
823
- "google.com.kh/products",
824
- "google.com.kw/products",
825
- "google.com.lb/products",
826
- "google.com.lc/products",
827
- "google.com.ly/products",
828
- "google.com.mt/products",
829
- "google.com.mx/products",
830
- "google.com.my/products",
831
- "google.com.na/products",
832
- "google.com.nf/products",
833
- "google.com.ng/products",
834
- "google.com.ni/products",
835
- "google.com.np/products",
836
- "google.com.om/products",
837
- "google.com.pa/products",
838
- "google.com.pe/products",
839
- "google.com.ph/products",
840
- "google.com.pk/products",
841
- "google.com.pr/products",
842
- "google.com.py/products",
843
- "google.com.qa/products",
844
- "google.com.sa/products",
845
- "google.com.sb/products",
846
- "google.com.sg/products",
847
- "google.com.sl/products",
848
- "google.com.sv/products",
849
- "google.com.tj/products",
850
- "google.com.tn/products",
851
- "google.com.tr/products",
852
- "google.com.tw/products",
853
- "google.com.ua/products",
854
- "google.com.uy/products",
855
- "google.com.vc/products",
856
- "google.com.vn/products",
857
- "google.cv/products",
858
- "google.cz/products",
859
- "google.de/products",
860
- "google.dj/products",
861
- "google.dk/products",
862
- "google.dm/products",
863
- "google.dz/products",
864
- "google.ee/products",
865
- "google.es/products",
866
- "google.fi/products",
867
- "google.fm/products",
868
- "google.fr/products",
869
- "google.ga/products",
870
- "google.gd/products",
871
- "google.ge/products",
872
- "google.gf/products",
873
- "google.gg/products",
874
- "google.gl/products",
875
- "google.gm/products",
876
- "google.gp/products",
877
- "google.gr/products",
878
- "google.gy/products",
879
- "google.hn/products",
880
- "google.hr/products",
881
- "google.ht/products",
882
- "google.hu/products",
883
- "google.ie/products",
884
- "google.im/products",
885
- "google.io/products",
886
- "google.iq/products",
887
- "google.is/products",
888
- "google.it/products",
889
- "google.it.ao/products",
890
- "google.je/products",
891
- "google.jo/products",
892
- "google.kg/products",
893
- "google.ki/products",
894
- "google.kz/products",
895
- "google.la/products",
896
- "google.li/products",
897
- "google.lk/products",
898
- "google.lt/products",
899
- "google.lu/products",
900
- "google.lv/products",
901
- "google.md/products",
902
- "google.me/products",
903
- "google.mg/products",
904
- "google.mk/products",
905
- "google.ml/products",
906
- "google.mn/products",
907
- "google.ms/products",
908
- "google.mu/products",
909
- "google.mv/products",
910
- "google.mw/products",
911
- "google.ne/products",
912
- "google.nl/products",
913
- "google.no/products",
914
- "google.nr/products",
915
- "google.nu/products",
916
- "google.pl/products",
917
- "google.pn/products",
918
- "google.ps/products",
919
- "google.pt/products",
920
- "google.ro/products",
921
- "google.rs/products",
922
- "google.ru/products",
923
- "google.rw/products",
924
- "google.sc/products",
925
- "google.se/products",
926
- "google.sh/products",
927
- "google.si/products",
928
- "google.sk/products",
929
- "google.sm/products",
930
- "google.sn/products",
931
- "google.so/products",
932
- "google.st/products",
933
- "google.td/products",
934
- "google.tg/products",
935
- "google.tk/products",
936
- "google.tl/products",
937
- "google.tm/products",
938
- "google.to/products",
939
- "google.tt/products",
940
- "google.us/products",
941
- "google.vg/products",
942
- "google.vu/products",
943
- "google.ws/products",
944
- "www.google.ac/products",
945
- "www.google.ad/products",
946
- "www.google.ae/products",
947
- "www.google.am/products",
948
- "www.google.as/products",
949
- "www.google.at/products",
950
- "www.google.az/products",
951
- "www.google.ba/products",
952
- "www.google.be/products",
953
- "www.google.bf/products",
954
- "www.google.bg/products",
955
- "www.google.bi/products",
956
- "www.google.bj/products",
957
- "www.google.bs/products",
958
- "www.google.by/products",
959
- "www.google.ca/products",
960
- "www.google.cat/products",
961
- "www.google.cc/products",
962
- "www.google.cd/products",
963
- "www.google.cf/products",
964
- "www.google.cg/products",
965
- "www.google.ch/products",
966
- "www.google.ci/products",
967
- "www.google.cl/products",
968
- "www.google.cm/products",
969
- "www.google.cn/products",
970
- "www.google.co.bw/products",
971
- "www.google.co.ck/products",
972
- "www.google.co.cr/products",
973
- "www.google.co.id/products",
974
- "www.google.co.il/products",
975
- "www.google.co.in/products",
976
- "www.google.co.jp/products",
977
- "www.google.co.ke/products",
978
- "www.google.co.kr/products",
979
- "www.google.co.ls/products",
980
- "www.google.co.ma/products",
981
- "www.google.co.mz/products",
982
- "www.google.co.nz/products",
983
- "www.google.co.th/products",
984
- "www.google.co.tz/products",
985
- "www.google.co.ug/products",
986
- "www.google.co.uk/products",
987
- "www.google.co.uz/products",
988
- "www.google.co.ve/products",
989
- "www.google.co.vi/products",
990
- "www.google.co.za/products",
991
- "www.google.co.zm/products",
992
- "www.google.co.zw/products",
993
- "www.google.com/products",
994
- "www.google.com.af/products",
995
- "www.google.com.ag/products",
996
- "www.google.com.ai/products",
997
- "www.google.com.ar/products",
998
- "www.google.com.au/products",
999
- "www.google.com.bd/products",
1000
- "www.google.com.bh/products",
1001
- "www.google.com.bn/products",
1002
- "www.google.com.bo/products",
1003
- "www.google.com.br/products",
1004
- "www.google.com.by/products",
1005
- "www.google.com.bz/products",
1006
- "www.google.com.co/products",
1007
- "www.google.com.cu/products",
1008
- "www.google.com.cy/products",
1009
- "www.google.com.do/products",
1010
- "www.google.com.ec/products",
1011
- "www.google.com.eg/products",
1012
- "www.google.com.et/products",
1013
- "www.google.com.fj/products",
1014
- "www.google.com.gh/products",
1015
- "www.google.com.gi/products",
1016
- "www.google.com.gt/products",
1017
- "www.google.com.hk/products",
1018
- "www.google.com.jm/products",
1019
- "www.google.com.kh/products",
1020
- "www.google.com.kh/products",
1021
- "www.google.com.kw/products",
1022
- "www.google.com.lb/products",
1023
- "www.google.com.lc/products",
1024
- "www.google.com.ly/products",
1025
- "www.google.com.mt/products",
1026
- "www.google.com.mx/products",
1027
- "www.google.com.my/products",
1028
- "www.google.com.na/products",
1029
- "www.google.com.nf/products",
1030
- "www.google.com.ng/products",
1031
- "www.google.com.ni/products",
1032
- "www.google.com.np/products",
1033
- "www.google.com.om/products",
1034
- "www.google.com.pa/products",
1035
- "www.google.com.pe/products",
1036
- "www.google.com.ph/products",
1037
- "www.google.com.pk/products",
1038
- "www.google.com.pr/products",
1039
- "www.google.com.py/products",
1040
- "www.google.com.qa/products",
1041
- "www.google.com.sa/products",
1042
- "www.google.com.sb/products",
1043
- "www.google.com.sg/products",
1044
- "www.google.com.sl/products",
1045
- "www.google.com.sv/products",
1046
- "www.google.com.tj/products",
1047
- "www.google.com.tn/products",
1048
- "www.google.com.tr/products",
1049
- "www.google.com.tw/products",
1050
- "www.google.com.ua/products",
1051
- "www.google.com.uy/products",
1052
- "www.google.com.vc/products",
1053
- "www.google.com.vn/products",
1054
- "www.google.cv/products",
1055
- "www.google.cz/products",
1056
- "www.google.de/products",
1057
- "www.google.dj/products",
1058
- "www.google.dk/products",
1059
- "www.google.dm/products",
1060
- "www.google.dz/products",
1061
- "www.google.ee/products",
1062
- "www.google.es/products",
1063
- "www.google.fi/products",
1064
- "www.google.fm/products",
1065
- "www.google.fr/products",
1066
- "www.google.ga/products",
1067
- "www.google.gd/products",
1068
- "www.google.ge/products",
1069
- "www.google.gf/products",
1070
- "www.google.gg/products",
1071
- "www.google.gl/products",
1072
- "www.google.gm/products",
1073
- "www.google.gp/products",
1074
- "www.google.gr/products",
1075
- "www.google.gy/products",
1076
- "www.google.hn/products",
1077
- "www.google.hr/products",
1078
- "www.google.ht/products",
1079
- "www.google.hu/products",
1080
- "www.google.ie/products",
1081
- "www.google.im/products",
1082
- "www.google.io/products",
1083
- "www.google.iq/products",
1084
- "www.google.is/products",
1085
- "www.google.it/products",
1086
- "www.google.it.ao/products",
1087
- "www.google.je/products",
1088
- "www.google.jo/products",
1089
- "www.google.kg/products",
1090
- "www.google.ki/products",
1091
- "www.google.kz/products",
1092
- "www.google.la/products",
1093
- "www.google.li/products",
1094
- "www.google.lk/products",
1095
- "www.google.lt/products",
1096
- "www.google.lu/products",
1097
- "www.google.lv/products",
1098
- "www.google.md/products",
1099
- "www.google.me/products",
1100
- "www.google.mg/products",
1101
- "www.google.mk/products",
1102
- "www.google.ml/products",
1103
- "www.google.mn/products",
1104
- "www.google.ms/products",
1105
- "www.google.mu/products",
1106
- "www.google.mv/products",
1107
- "www.google.mw/products",
1108
- "www.google.ne/products",
1109
- "www.google.nl/products",
1110
- "www.google.no/products",
1111
- "www.google.nr/products",
1112
- "www.google.nu/products",
1113
- "www.google.pl/products",
1114
- "www.google.pn/products",
1115
- "www.google.ps/products",
1116
- "www.google.pt/products",
1117
- "www.google.ro/products",
1118
- "www.google.rs/products",
1119
- "www.google.ru/products",
1120
- "www.google.rw/products",
1121
- "www.google.sc/products",
1122
- "www.google.se/products",
1123
- "www.google.sh/products",
1124
- "www.google.si/products",
1125
- "www.google.sk/products",
1126
- "www.google.sm/products",
1127
- "www.google.sn/products",
1128
- "www.google.so/products",
1129
- "www.google.st/products",
1130
- "www.google.td/products",
1131
- "www.google.tg/products",
1132
- "www.google.tk/products",
1133
- "www.google.tl/products",
1134
- "www.google.tm/products",
1135
- "www.google.to/products",
1136
- "www.google.tt/products",
1137
- "www.google.us/products",
1138
- "www.google.vg/products",
1139
- "www.google.vu/products",
1140
- "www.google.ws/products"
1141
- ],
1142
- "parameters": [
1143
- "q"
1144
- ]
1145
- },
1146
- "DasOertliche": {
1147
- "domains": [
1148
- "www.dasoertliche.de"
1149
- ],
1150
- "parameters": [
1151
- "kw"
1152
- ]
1153
- },
1154
- "InfoSpace": {
1155
- "domains": [
1156
- "infospace.com",
1157
- "dogpile.com",
1158
- "www.dogpile.com",
1159
- "metacrawler.com",
1160
- "webfetch.com",
1161
- "webcrawler.com",
1162
- "search.kiwee.com",
1163
- "isearch.babylon.com",
1164
- "start.facemoods.com",
1165
- "search.magnetic.com",
1166
- "search.searchcompletion.com",
1167
- "clusty.com"
1168
- ],
1169
- "parameters": [
1170
- "q",
1171
- "s"
1172
- ]
1173
- },
1174
- "Weborama": {
1175
- "domains": [
1176
- "www.weborama.com"
1177
- ],
1178
- "parameters": [
1179
- "QUERY"
1180
- ]
1181
- },
1182
- "Bluewin": {
1183
- "domains": [
1184
- "search.bluewin.ch"
1185
- ],
1186
- "parameters": [
1187
- "searchTerm"
1188
- ]
1189
- },
1190
- "Neti": {
1191
- "domains": [
1192
- "www.neti.ee"
1193
- ],
1194
- "parameters": [
1195
- "query"
1196
- ]
1197
- },
1198
- "Winamp": {
1199
- "domains": [
1200
- "search.winamp.com"
1201
- ],
1202
- "parameters": [
1203
- "q"
1204
- ]
1205
- },
1206
- "Nigma": {
1207
- "domains": [
1208
- "nigma.ru"
1209
- ],
1210
- "parameters": [
1211
- "s"
1212
- ]
1213
- },
1214
- "Yahoo! Images": {
1215
- "domains": [
1216
- "image.yahoo.cn",
1217
- "images.search.yahoo.com"
1218
- ],
1219
- "parameters": [
1220
- "p",
1221
- "q"
1222
- ]
1223
- },
1224
- "Exalead": {
1225
- "domains": [
1226
- "www.exalead.fr",
1227
- "www.exalead.com"
1228
- ],
1229
- "parameters": [
1230
- "q"
1231
- ]
1232
- },
1233
- "Teoma": {
1234
- "domains": [
1235
- "www.teoma.com"
1236
- ],
1237
- "parameters": [
1238
- "q"
1239
- ]
1240
- },
1241
- "Needtofind": {
1242
- "domains": [
1243
- "ko.search.need2find.com"
1244
- ],
1245
- "parameters": [
1246
- "searchfor"
1247
- ]
1248
- },
1249
- "Looksmart": {
1250
- "domains": [
1251
- "www.looksmart.com"
1252
- ],
1253
- "parameters": [
1254
- "key"
1255
- ]
1256
- },
1257
- "Wirtualna Polska": {
1258
- "domains": [
1259
- "szukaj.wp.pl"
1260
- ],
1261
- "parameters": [
1262
- "szukaj"
1263
- ]
1264
- },
1265
- "Toolbarhome": {
1266
- "domains": [
1267
- "www.toolbarhome.com",
1268
- "vshare.toolbarhome.com"
1269
- ],
1270
- "parameters": [
1271
- "q"
1272
- ]
1273
- },
1274
- "Searchalot": {
1275
- "domains": [
1276
- "searchalot.com"
1277
- ],
1278
- "parameters": [
1279
- "q"
1280
- ]
1281
- },
1282
- "Yandex": {
1283
- "domains": [
1284
- "yandex.ru",
1285
- "yandex.ua",
1286
- "yandex.com",
1287
- "www.yandex.ru",
1288
- "www.yandex.ua",
1289
- "www.yandex.com"
1290
- ],
1291
- "parameters": [
1292
- "text"
1293
- ]
1294
- },
1295
- "canoe.ca": {
1296
- "domains": [
1297
- "web.canoe.ca"
1298
- ],
1299
- "parameters": [
1300
- "q"
1301
- ]
1302
- },
1303
- "Compuserve": {
1304
- "domains": [
1305
- "websearch.cs.com"
1306
- ],
1307
- "parameters": [
1308
- "query"
1309
- ]
1310
- },
1311
- "Startpagina": {
1312
- "domains": [
1313
- "startgoogle.startpagina.nl"
1314
- ],
1315
- "parameters": [
1316
- "q"
1317
- ]
1318
- },
1319
- "eo": {
1320
- "domains": [
1321
- "eo.st"
1322
- ],
1323
- "parameters": [
1324
- "x_query"
1325
- ]
1326
- },
1327
- "Zhongsou": {
1328
- "domains": [
1329
- "p.zhongsou.com"
1330
- ],
1331
- "parameters": [
1332
- "w"
1333
- ]
1334
- },
1335
- "La Toile Du Quebec Via Google": {
1336
- "domains": [
1337
- "www.toile.com",
1338
- "web.toile.com"
1339
- ],
1340
- "parameters": [
1341
- "q"
1342
- ]
1343
- },
1344
- "Paperball": {
1345
- "domains": [
1346
- "www.paperball.de"
1347
- ],
1348
- "parameters": [
1349
- "q"
1350
- ]
1351
- },
1352
- "Jungle Spider": {
1353
- "domains": [
1354
- "www.jungle-spider.de"
1355
- ],
1356
- "parameters": [
1357
- "q"
1358
- ]
1359
- },
1360
- "PeoplePC": {
1361
- "domains": [
1362
- "search.peoplepc.com"
1363
- ],
1364
- "parameters": [
1365
- "q"
1366
- ]
1367
- },
1368
- "MetaCrawler.de": {
1369
- "domains": [
1370
- "s1.metacrawler.de",
1371
- "s2.metacrawler.de",
1372
- "s3.metacrawler.de"
1373
- ],
1374
- "parameters": [
1375
- "qry"
1376
- ]
1377
- },
1378
- "Orange": {
1379
- "domains": [
1380
- "busca.orange.es",
1381
- "search.orange.co.uk"
1382
- ],
1383
- "parameters": [
1384
- "q"
1385
- ]
1386
- },
1387
- "Gule Sider": {
1388
- "domains": [
1389
- "www.gulesider.no"
1390
- ],
1391
- "parameters": [
1392
- "q"
1393
- ]
1394
- },
1395
- "Francite": {
1396
- "domains": [
1397
- "recherche.francite.com"
1398
- ],
1399
- "parameters": [
1400
- "name"
1401
- ]
1402
- },
1403
- "Ask Toolbar": {
1404
- "domains": [
1405
- "search.tb.ask.com"
1406
- ],
1407
- "parameters": [
1408
- "searchfor"
1409
- ]
1410
- },
1411
- "Aport": {
1412
- "domains": [
1413
- "sm.aport.ru"
1414
- ],
1415
- "parameters": [
1416
- "r"
1417
- ]
1418
- },
1419
- "Trusted-Search": {
1420
- "domains": [
1421
- "www.trusted--search.com"
1422
- ],
1423
- "parameters": [
1424
- "w"
1425
- ]
1426
- },
1427
- "goo": {
1428
- "domains": [
1429
- "search.goo.ne.jp",
1430
- "ocnsearch.goo.ne.jp"
1431
- ],
1432
- "parameters": [
1433
- "MT"
1434
- ]
1435
- },
1436
- "Fast Browser Search": {
1437
- "domains": [
1438
- "www.fastbrowsersearch.com"
1439
- ],
1440
- "parameters": [
1441
- "q"
1442
- ]
1443
- },
1444
- "Blogpulse": {
1445
- "domains": [
1446
- "www.blogpulse.com"
1447
- ],
1448
- "parameters": [
1449
- "query"
1450
- ]
1451
- },
1452
- "Volny": {
1453
- "domains": [
1454
- "web.volny.cz"
1455
- ],
1456
- "parameters": [
1457
- "search"
1458
- ]
1459
- },
1460
- "Icerockeet": {
1461
- "domains": [
1462
- "blogs.icerocket.com"
1463
- ],
1464
- "parameters": [
1465
- "q"
1466
- ]
1467
- },
1468
- "Terra": {
1469
- "domains": [
1470
- "buscador.terra.es",
1471
- "buscador.terra.cl",
1472
- "buscador.terra.com.br"
1473
- ],
1474
- "parameters": [
1475
- "query"
1476
- ]
1477
- },
1478
- "Searchy": {
1479
- "domains": [
1480
- "www.searchy.co.uk"
1481
- ],
1482
- "parameters": [
1483
- "q"
1484
- ]
1485
- },
1486
- "Onet": {
1487
- "domains": [
1488
- "szukaj.onet.pl"
1489
- ],
1490
- "parameters": [
1491
- "qt"
1492
- ]
1493
- },
1494
- "Digg": {
1495
- "domains": [
1496
- "digg.com"
1497
- ],
1498
- "parameters": [
1499
- "s"
1500
- ]
1501
- },
1502
- "Abacho": {
1503
- "domains": [
1504
- "www.abacho.de",
1505
- "www.abacho.com",
1506
- "www.abacho.co.uk",
1507
- "www.se.abacho.com",
1508
- "www.tr.abacho.com",
1509
- "www.abacho.at",
1510
- "www.abacho.fr",
1511
- "www.abacho.es",
1512
- "www.abacho.ch",
1513
- "www.abacho.it"
1514
- ],
1515
- "parameters": [
1516
- "q"
1517
- ]
1518
- },
1519
- "maailm": {
1520
- "domains": [
1521
- "www.maailm.com"
1522
- ],
1523
- "parameters": [
1524
- "tekst"
1525
- ]
1526
- },
1527
- "Flix": {
1528
- "domains": [
1529
- "www.flix.de"
1530
- ],
1531
- "parameters": [
1532
- "keyword"
1533
- ]
1534
- },
1535
- "Suchnase": {
1536
- "domains": [
1537
- "www.suchnase.de"
1538
- ],
1539
- "parameters": [
1540
- "q"
1541
- ]
1542
- },
1543
- "Freenet": {
1544
- "domains": [
1545
- "suche.freenet.de"
1546
- ],
1547
- "parameters": [
1548
- "query",
1549
- "Keywords"
1550
- ]
1551
- },
1552
- "DuckDuckGoL": {
1553
- "domains": [
1554
- "duckduckgo.com"
1555
- ],
1556
- "parameters": [
1557
- "q"
1558
- ]
1559
- },
1560
- "Poisk.ru": {
1561
- "domains": [
1562
- "www.plazoo.com"
1563
- ],
1564
- "parameters": [
1565
- "q"
1566
- ]
1567
- },
1568
- "Sharelook": {
1569
- "domains": [
1570
- "www.sharelook.fr"
1571
- ],
1572
- "parameters": [
1573
- "keyword"
1574
- ]
1575
- },
1576
- "Najdi": {
1577
- "domains": [
1578
- "www.najdi.si"
1579
- ],
1580
- "parameters": [
1581
- "q"
1582
- ]
1583
- },
1584
- "Picsearch": {
1585
- "domains": [
1586
- "www.picsearch.com"
1587
- ],
1588
- "parameters": [
1589
- "q"
1590
- ]
1591
- },
1592
- "Mail.ru": {
1593
- "domains": [
1594
- "go.mail.ru"
1595
- ],
1596
- "parameters": [
1597
- "q"
1598
- ]
1599
- },
1600
- "Alexa": {
1601
- "domains": [
1602
- "alexa.com",
1603
- "search.toolbars.alexa.com"
1604
- ],
1605
- "parameters": [
1606
- "q"
1607
- ]
1608
- },
1609
- "Metager": {
1610
- "domains": [
1611
- "meta.rrzn.uni-hannover.de",
1612
- "www.metager.de"
1613
- ],
1614
- "parameters": [
1615
- "eingabe"
1616
- ]
1617
- },
1618
- "Technorati": {
1619
- "domains": [
1620
- "technorati.com"
1621
- ],
1622
- "parameters": [
1623
- "q"
1624
- ]
1625
- },
1626
- "WWW": {
1627
- "domains": [
1628
- "search.www.ee"
1629
- ],
1630
- "parameters": [
1631
- "query"
1632
- ]
1633
- },
1634
- "Trouvez.com": {
1635
- "domains": [
1636
- "www.trouvez.com"
1637
- ],
1638
- "parameters": [
1639
- "query"
1640
- ]
1641
- },
1642
- "IXquick": {
1643
- "domains": [
1644
- "ixquick.com",
1645
- "www.eu.ixquick.com",
1646
- "ixquick.de",
1647
- "www.ixquick.de",
1648
- "us.ixquick.com",
1649
- "s1.us.ixquick.com",
1650
- "s2.us.ixquick.com",
1651
- "s3.us.ixquick.com",
1652
- "s4.us.ixquick.com",
1653
- "s5.us.ixquick.com",
1654
- "eu.ixquick.com",
1655
- "s8-eu.ixquick.com",
1656
- "s1-eu.ixquick.de"
1657
- ],
1658
- "parameters": [
1659
- "query"
1660
- ]
1661
- },
1662
- "Zapmeta": {
1663
- "domains": [
1664
- "www.zapmeta.com",
1665
- "www.zapmeta.nl",
1666
- "www.zapmeta.de",
1667
- "uk.zapmeta.com"
1668
- ],
1669
- "parameters": [
1670
- "q",
1671
- "query"
1672
- ]
1673
- },
1674
- "Yippy": {
1675
- "domains": [
1676
- "search.yippy.com"
1677
- ],
1678
- "parameters": [
1679
- "q",
1680
- "query"
1681
- ]
1682
- },
1683
- "Gomeo": {
1684
- "domains": [
1685
- "www.gomeo.com"
1686
- ],
1687
- "parameters": [
1688
- "Keywords"
1689
- ]
1690
- },
1691
- "Walhello": {
1692
- "domains": [
1693
- "www.walhello.info",
1694
- "www.walhello.com",
1695
- "www.walhello.de",
1696
- "www.walhello.nl"
1697
- ],
1698
- "parameters": [
1699
- "key"
1700
- ]
1701
- },
1702
- "Meta": {
1703
- "domains": [
1704
- "meta.ua"
1705
- ],
1706
- "parameters": [
1707
- "q"
1708
- ]
1709
- },
1710
- "Skynet": {
1711
- "domains": [
1712
- "www.skynet.be"
1713
- ],
1714
- "parameters": [
1715
- "q"
1716
- ]
1717
- },
1718
- "Blogdigger": {
1719
- "domains": [
1720
- "www.blogdigger.com"
1721
- ],
1722
- "parameters": [
1723
- "q"
1724
- ]
1725
- },
1726
- "WebSearch": {
1727
- "domains": [
1728
- "www.websearch.com"
1729
- ],
1730
- "parameters": [
1731
- "qkw",
1732
- "q"
1733
- ]
1734
- },
1735
- "Rambler": {
1736
- "domains": [
1737
- "nova.rambler.ru"
1738
- ],
1739
- "parameters": [
1740
- "query",
1741
- "words"
1742
- ]
1743
- },
1744
- "Latne": {
1745
- "domains": [
1746
- "www.latne.lv"
1747
- ],
1748
- "parameters": [
1749
- "q"
1750
- ]
1751
- },
1752
- "MySearch": {
1753
- "domains": [
1754
- "www.mysearch.com",
1755
- "ms114.mysearch.com",
1756
- "ms146.mysearch.com",
1757
- "kf.mysearch.myway.com",
1758
- "ki.mysearch.myway.com",
1759
- "search.myway.com",
1760
- "search.mywebsearch.com"
1761
- ],
1762
- "parameters": [
1763
- "searchfor",
1764
- "searchFor"
1765
- ]
1766
- },
1767
- "Cuil": {
1768
- "domains": [
1769
- "www.cuil.com"
1770
- ],
1771
- "parameters": [
1772
- "q"
1773
- ]
1774
- },
1775
- "Tixuma": {
1776
- "domains": [
1777
- "www.tixuma.de"
1778
- ],
1779
- "parameters": [
1780
- "sc"
1781
- ]
1782
- },
1783
- "Sapo": {
1784
- "domains": [
1785
- "pesquisa.sapo.pt"
1786
- ],
1787
- "parameters": [
1788
- "q"
1789
- ]
1790
- },
1791
- "Gnadenmeer": {
1792
- "domains": [
1793
- "www.gnadenmeer.de"
1794
- ],
1795
- "parameters": [
1796
- "keyword"
1797
- ]
1798
- },
1799
- "Arcor": {
1800
- "domains": [
1801
- "www.arcor.de"
1802
- ],
1803
- "parameters": [
1804
- "Keywords"
1805
- ]
1806
- },
1807
- "Naver": {
1808
- "domains": [
1809
- "search.naver.com"
1810
- ],
1811
- "parameters": [
1812
- "query"
1813
- ]
1814
- },
1815
- "Zoeken": {
1816
- "domains": [
1817
- "www.zoeken.nl"
1818
- ],
1819
- "parameters": [
1820
- "q"
1821
- ]
1822
- },
1823
- "Yam": {
1824
- "domains": [
1825
- "search.yam.com"
1826
- ],
1827
- "parameters": [
1828
- "k"
1829
- ]
1830
- },
1831
- "Eniro": {
1832
- "domains": [
1833
- "www.eniro.se"
1834
- ],
1835
- "parameters": [
1836
- "q",
1837
- "search_word"
1838
- ]
1839
- },
1840
- "APOLL07": {
1841
- "domains": [
1842
- "apollo7.de"
1843
- ],
1844
- "parameters": [
1845
- "query"
1846
- ]
1847
- },
1848
- "Biglobe": {
1849
- "domains": [
1850
- "cgi.search.biglobe.ne.jp"
1851
- ],
1852
- "parameters": [
1853
- "q"
1854
- ]
1855
- },
1856
- "Mozbot": {
1857
- "domains": [
1858
- "www.mozbot.fr",
1859
- "www.mozbot.co.uk",
1860
- "www.mozbot.com"
1861
- ],
1862
- "parameters": [
1863
- "q"
1864
- ]
1865
- },
1866
- "ICQ": {
1867
- "domains": [
1868
- "www.icq.com",
1869
- "search.icq.com"
1870
- ],
1871
- "parameters": [
1872
- "q"
1873
- ]
1874
- },
1875
- "Baidu": {
1876
- "domains": [
1877
- "www.baidu.com",
1878
- "www1.baidu.com",
1879
- "zhidao.baidu.com",
1880
- "tieba.baidu.com",
1881
- "news.baidu.com",
1882
- "web.gougou.com"
1883
- ],
1884
- "parameters": [
1885
- "wd",
1886
- "word",
1887
- "kw",
1888
- "k"
1889
- ]
1890
- },
1891
- "Conduit": {
1892
- "domains": [
1893
- "search.conduit.com"
1894
- ],
1895
- "parameters": [
1896
- "q"
1897
- ]
1898
- },
1899
- "Austronaut": {
1900
- "domains": [
1901
- "www2.austronaut.at",
1902
- "www1.astronaut.at"
1903
- ],
1904
- "parameters": [
1905
- "q"
1906
- ]
1907
- },
1908
- "Vindex": {
1909
- "domains": [
1910
- "www.vindex.nl",
1911
- "search.vindex.nl"
1912
- ],
1913
- "parameters": [
1914
- "search_for"
1915
- ]
1916
- },
1917
- "TrovaRapido": {
1918
- "domains": [
1919
- "www.trovarapido.com"
1920
- ],
1921
- "parameters": [
1922
- "q"
1923
- ]
1924
- },
1925
- "Suchmaschine.com": {
1926
- "domains": [
1927
- "www.suchmaschine.com"
1928
- ],
1929
- "parameters": [
1930
- "suchstr"
1931
- ]
1932
- },
1933
- "Lycos": {
1934
- "domains": [
1935
- "search.lycos.com",
1936
- "www.lycos.com",
1937
- "lycos.com"
1938
- ],
1939
- "parameters": [
1940
- "query"
1941
- ]
1942
- },
1943
- "Vinden": {
1944
- "domains": [
1945
- "www.vinden.nl"
1946
- ],
1947
- "parameters": [
1948
- "q"
1949
- ]
1950
- },
1951
- "Altavista": {
1952
- "domains": [
1953
- "www.altavista.com",
1954
- "search.altavista.com",
1955
- "listings.altavista.com",
1956
- "altavista.de",
1957
- "altavista.fr",
1958
- "be-nl.altavista.com",
1959
- "be-fr.altavista.com"
1960
- ],
1961
- "parameters": [
1962
- "q"
1963
- ]
1964
- },
1965
- "dmoz": {
1966
- "domains": [
1967
- "dmoz.org",
1968
- "editors.dmoz.org"
1969
- ],
1970
- "parameters": [
1971
- "q"
1972
- ]
1973
- },
1974
- "Ecosia": {
1975
- "domains": [
1976
- "ecosia.org"
1977
- ],
1978
- "parameters": [
1979
- "q"
1980
- ]
1981
- },
1982
- "Maxwebsearch": {
1983
- "domains": [
1984
- "maxwebsearch.com"
1985
- ],
1986
- "parameters": [
1987
- "query"
1988
- ]
1989
- },
1990
- "Euroseek": {
1991
- "domains": [
1992
- "www.euroseek.com"
1993
- ],
1994
- "parameters": [
1995
- "string"
1996
- ]
1997
- },
1998
- "Bing": {
1999
- "domains": [
2000
- "bing.com",
2001
- "www.bing.com",
2002
- "msnbc.msn.com",
2003
- "dizionario.it.msn.com",
2004
- "cc.bingj.com",
2005
- "m.bing.com"
2006
- ],
2007
- "parameters": [
2008
- "q",
2009
- "Q"
2010
- ]
2011
- },
2012
- "X-recherche": {
2013
- "domains": [
2014
- "www.x-recherche.com"
2015
- ],
2016
- "parameters": [
2017
- "MOTS"
2018
- ]
2019
- },
2020
- "Yandex Images": {
2021
- "domains": [
2022
- "images.yandex.ru",
2023
- "images.yandex.ua",
2024
- "images.yandex.com"
2025
- ],
2026
- "parameters": [
2027
- "text"
2028
- ]
2029
- },
2030
- "GMX": {
2031
- "domains": [
2032
- "suche.gmx.net"
2033
- ],
2034
- "parameters": [
2035
- "su"
2036
- ]
2037
- },
2038
- "Daemon search": {
2039
- "domains": [
2040
- "daemon-search.com",
2041
- "my.daemon-search.com"
2042
- ],
2043
- "parameters": [
2044
- "q"
2045
- ]
2046
- },
2047
- "Jungle Key": {
2048
- "domains": [
2049
- "junglekey.com",
2050
- "junglekey.fr"
2051
- ],
2052
- "parameters": [
2053
- "query"
2054
- ]
2055
- },
2056
- "Firstfind": {
2057
- "domains": [
2058
- "www.firstsfind.com"
2059
- ],
2060
- "parameters": [
2061
- "qry"
2062
- ]
2063
- },
2064
- "Crawler": {
2065
- "domains": [
2066
- "www.crawler.com"
2067
- ],
2068
- "parameters": [
2069
- "q"
2070
- ]
2071
- },
2072
- "Holmes": {
2073
- "domains": [
2074
- "holmes.ge"
2075
- ],
2076
- "parameters": [
2077
- "q"
2078
- ]
2079
- },
2080
- "Charter": {
2081
- "domains": [
2082
- "www.charter.net"
2083
- ],
2084
- "parameters": [
2085
- "q"
2086
- ]
2087
- },
2088
- "Ilse": {
2089
- "domains": [
2090
- "www.ilse.nl"
2091
- ],
2092
- "parameters": [
2093
- "search_for"
2094
- ]
2095
- },
2096
- "earthlink": {
2097
- "domains": [
2098
- "search.earthlink.net"
2099
- ],
2100
- "parameters": [
2101
- "q"
2102
- ]
2103
- },
2104
- "Qualigo": {
2105
- "domains": [
2106
- "www.qualigo.at",
2107
- "www.qualigo.ch",
2108
- "www.qualigo.de",
2109
- "www.qualigo.nl"
2110
- ],
2111
- "parameters": [
2112
- "q"
2113
- ]
2114
- },
2115
- "El Mundo": {
2116
- "domains": [
2117
- "ariadna.elmundo.es"
2118
- ],
2119
- "parameters": [
2120
- "q"
2121
- ]
2122
- },
2123
- "Metager2": {
2124
- "domains": [
2125
- "metager2.de"
2126
- ],
2127
- "parameters": [
2128
- "q"
2129
- ]
2130
- },
2131
- "Forestle": {
2132
- "domains": [
2133
- "forestle.org",
2134
- "www.forestle.org",
2135
- "forestle.mobi"
2136
- ],
2137
- "parameters": [
2138
- "q"
2139
- ]
2140
- },
2141
- "Search.ch": {
2142
- "domains": [
2143
- "www.search.ch"
2144
- ],
2145
- "parameters": [
2146
- "q"
2147
- ]
2148
- },
2149
- "Meinestadt": {
2150
- "domains": [
2151
- "www.meinestadt.de"
2152
- ],
2153
- "parameters": [
2154
- "words"
2155
- ]
2156
- },
2157
- "Freshweather": {
2158
- "domains": [
2159
- "www.fresh-weather.com"
2160
- ],
2161
- "parameters": [
2162
- "q"
2163
- ]
2164
- },
2165
- "AllTheWeb": {
2166
- "domains": [
2167
- "www.alltheweb.com"
2168
- ],
2169
- "parameters": [
2170
- "q"
2171
- ]
2172
- },
2173
- "Zoek": {
2174
- "domains": [
2175
- "www3.zoek.nl"
2176
- ],
2177
- "parameters": [
2178
- "q"
2179
- ]
2180
- },
2181
- "Daum": {
2182
- "domains": [
2183
- "search.daum.net"
2184
- ],
2185
- "parameters": [
2186
- "q"
2187
- ]
2188
- },
2189
- "Marktplaats": {
2190
- "domains": [
2191
- "www.marktplaats.nl"
2192
- ],
2193
- "parameters": [
2194
- "query"
2195
- ]
2196
- },
2197
- "suche.info": {
2198
- "domains": [
2199
- "suche.info"
2200
- ],
2201
- "parameters": [
2202
- "q"
2203
- ]
2204
- },
2205
- "Google News": {
2206
- "domains": [
2207
- "news.google.ac",
2208
- "news.google.ad",
2209
- "news.google.ae",
2210
- "news.google.am",
2211
- "news.google.as",
2212
- "news.google.at",
2213
- "news.google.az",
2214
- "news.google.ba",
2215
- "news.google.be",
2216
- "news.google.bf",
2217
- "news.google.bg",
2218
- "news.google.bi",
2219
- "news.google.bj",
2220
- "news.google.bs",
2221
- "news.google.by",
2222
- "news.google.ca",
2223
- "news.google.cat",
2224
- "news.google.cc",
2225
- "news.google.cd",
2226
- "news.google.cf",
2227
- "news.google.cg",
2228
- "news.google.ch",
2229
- "news.google.ci",
2230
- "news.google.cl",
2231
- "news.google.cm",
2232
- "news.google.cn",
2233
- "news.google.co.bw",
2234
- "news.google.co.ck",
2235
- "news.google.co.cr",
2236
- "news.google.co.id",
2237
- "news.google.co.il",
2238
- "news.google.co.in",
2239
- "news.google.co.jp",
2240
- "news.google.co.ke",
2241
- "news.google.co.kr",
2242
- "news.google.co.ls",
2243
- "news.google.co.ma",
2244
- "news.google.co.mz",
2245
- "news.google.co.nz",
2246
- "news.google.co.th",
2247
- "news.google.co.tz",
2248
- "news.google.co.ug",
2249
- "news.google.co.uk",
2250
- "news.google.co.uz",
2251
- "news.google.co.ve",
2252
- "news.google.co.vi",
2253
- "news.google.co.za",
2254
- "news.google.co.zm",
2255
- "news.google.co.zw",
2256
- "news.google.com",
2257
- "news.google.com.af",
2258
- "news.google.com.ag",
2259
- "news.google.com.ai",
2260
- "news.google.com.ar",
2261
- "news.google.com.au",
2262
- "news.google.com.bd",
2263
- "news.google.com.bh",
2264
- "news.google.com.bn",
2265
- "news.google.com.bo",
2266
- "news.google.com.br",
2267
- "news.google.com.by",
2268
- "news.google.com.bz",
2269
- "news.google.com.co",
2270
- "news.google.com.cu",
2271
- "news.google.com.cy",
2272
- "news.google.com.do",
2273
- "news.google.com.ec",
2274
- "news.google.com.eg",
2275
- "news.google.com.et",
2276
- "news.google.com.fj",
2277
- "news.google.com.gh",
2278
- "news.google.com.gi",
2279
- "news.google.com.gt",
2280
- "news.google.com.hk",
2281
- "news.google.com.jm",
2282
- "news.google.com.kh",
2283
- "news.google.com.kh",
2284
- "news.google.com.kw",
2285
- "news.google.com.lb",
2286
- "news.google.com.lc",
2287
- "news.google.com.ly",
2288
- "news.google.com.mt",
2289
- "news.google.com.mx",
2290
- "news.google.com.my",
2291
- "news.google.com.na",
2292
- "news.google.com.nf",
2293
- "news.google.com.ng",
2294
- "news.google.com.ni",
2295
- "news.google.com.np",
2296
- "news.google.com.om",
2297
- "news.google.com.pa",
2298
- "news.google.com.pe",
2299
- "news.google.com.ph",
2300
- "news.google.com.pk",
2301
- "news.google.com.pr",
2302
- "news.google.com.py",
2303
- "news.google.com.qa",
2304
- "news.google.com.sa",
2305
- "news.google.com.sb",
2306
- "news.google.com.sg",
2307
- "news.google.com.sl",
2308
- "news.google.com.sv",
2309
- "news.google.com.tj",
2310
- "news.google.com.tn",
2311
- "news.google.com.tr",
2312
- "news.google.com.tw",
2313
- "news.google.com.ua",
2314
- "news.google.com.uy",
2315
- "news.google.com.vc",
2316
- "news.google.com.vn",
2317
- "news.google.cv",
2318
- "news.google.cz",
2319
- "news.google.de",
2320
- "news.google.dj",
2321
- "news.google.dk",
2322
- "news.google.dm",
2323
- "news.google.dz",
2324
- "news.google.ee",
2325
- "news.google.es",
2326
- "news.google.fi",
2327
- "news.google.fm",
2328
- "news.google.fr",
2329
- "news.google.ga",
2330
- "news.google.gd",
2331
- "news.google.ge",
2332
- "news.google.gf",
2333
- "news.google.gg",
2334
- "news.google.gl",
2335
- "news.google.gm",
2336
- "news.google.gp",
2337
- "news.google.gr",
2338
- "news.google.gy",
2339
- "news.google.hn",
2340
- "news.google.hr",
2341
- "news.google.ht",
2342
- "news.google.hu",
2343
- "news.google.ie",
2344
- "news.google.im",
2345
- "news.google.io",
2346
- "news.google.iq",
2347
- "news.google.is",
2348
- "news.google.it",
2349
- "news.google.it.ao",
2350
- "news.google.je",
2351
- "news.google.jo",
2352
- "news.google.kg",
2353
- "news.google.ki",
2354
- "news.google.kz",
2355
- "news.google.la",
2356
- "news.google.li",
2357
- "news.google.lk",
2358
- "news.google.lt",
2359
- "news.google.lu",
2360
- "news.google.lv",
2361
- "news.google.md",
2362
- "news.google.me",
2363
- "news.google.mg",
2364
- "news.google.mk",
2365
- "news.google.ml",
2366
- "news.google.mn",
2367
- "news.google.ms",
2368
- "news.google.mu",
2369
- "news.google.mv",
2370
- "news.google.mw",
2371
- "news.google.ne",
2372
- "news.google.nl",
2373
- "news.google.no",
2374
- "news.google.nr",
2375
- "news.google.nu",
2376
- "news.google.pl",
2377
- "news.google.pn",
2378
- "news.google.ps",
2379
- "news.google.pt",
2380
- "news.google.ro",
2381
- "news.google.rs",
2382
- "news.google.ru",
2383
- "news.google.rw",
2384
- "news.google.sc",
2385
- "news.google.se",
2386
- "news.google.sh",
2387
- "news.google.si",
2388
- "news.google.sk",
2389
- "news.google.sm",
2390
- "news.google.sn",
2391
- "news.google.so",
2392
- "news.google.st",
2393
- "news.google.td",
2394
- "news.google.tg",
2395
- "news.google.tk",
2396
- "news.google.tl",
2397
- "news.google.tm",
2398
- "news.google.to",
2399
- "news.google.tt",
2400
- "news.google.us",
2401
- "news.google.vg",
2402
- "news.google.vu",
2403
- "news.google.ws"
2404
- ],
2405
- "parameters": [
2406
- "q"
2407
- ]
2408
- },
2409
- "Zoohoo": {
2410
- "domains": [
2411
- "zoohoo.cz"
2412
- ],
2413
- "parameters": [
2414
- "q"
2415
- ]
2416
- },
2417
- "Seznam": {
2418
- "domains": [
2419
- "search.seznam.cz"
2420
- ],
2421
- "parameters": [
2422
- "q"
2423
- ]
2424
- },
2425
- "Online.no": {
2426
- "domains": [
2427
- "online.no"
2428
- ],
2429
- "parameters": [
2430
- "q"
2431
- ]
2432
- },
2433
- "Eurip": {
2434
- "domains": [
2435
- "www.eurip.com"
2436
- ],
2437
- "parameters": [
2438
- "q"
2439
- ]
2440
- },
2441
- "all.by": {
2442
- "domains": [
2443
- "all.by"
2444
- ],
2445
- "parameters": [
2446
- "query"
2447
- ]
2448
- },
2449
- "Road Runner Search": {
2450
- "domains": [
2451
- "search.rr.com"
2452
- ],
2453
- "parameters": [
2454
- "q"
2455
- ]
2456
- },
2457
- "Opplysningen 1881": {
2458
- "domains": [
2459
- "www.1881.no"
2460
- ],
2461
- "parameters": [
2462
- "Query"
2463
- ]
2464
- },
2465
- "YouGoo": {
2466
- "domains": [
2467
- "www.yougoo.fr"
2468
- ],
2469
- "parameters": [
2470
- "q"
2471
- ]
2472
- },
2473
- "Bing Images": {
2474
- "domains": [
2475
- "bing.com/images/search",
2476
- "www.bing.com/images/search"
2477
- ],
2478
- "parameters": [
2479
- "q",
2480
- "Q"
2481
- ]
2482
- },
2483
- "Geona": {
2484
- "domains": [
2485
- "geona.net"
2486
- ],
2487
- "parameters": [
2488
- "q"
2489
- ]
2490
- },
2491
- "Nate": {
2492
- "domains": [
2493
- "search.nate.com"
2494
- ],
2495
- "parameters": [
2496
- "q"
2497
- ]
2498
- },
2499
- "T-Online": {
2500
- "domains": [
2501
- "suche.t-online.de",
2502
- "brisbane.t-online.de",
2503
- "navigationshilfe.t-online.de"
2504
- ],
2505
- "parameters": [
2506
- "q"
2507
- ]
2508
- },
2509
- "Hotbot": {
2510
- "domains": [
2511
- "www.hotbot.com"
2512
- ],
2513
- "parameters": [
2514
- "query"
2515
- ]
2516
- },
2517
- "Kvasir": {
2518
- "domains": [
2519
- "www.kvasir.no"
2520
- ],
2521
- "parameters": [
2522
- "q"
2523
- ]
2524
- },
2525
- "Babylon": {
2526
- "domains": [
2527
- "search.babylon.com",
2528
- "searchassist.babylon.com"
2529
- ],
2530
- "parameters": [
2531
- "q"
2532
- ]
2533
- },
2534
- "Excite": {
2535
- "domains": [
2536
- "search.excite.it",
2537
- "search.excite.fr",
2538
- "search.excite.de",
2539
- "search.excite.co.uk",
2540
- "serach.excite.es",
2541
- "search.excite.nl",
2542
- "msxml.excite.com",
2543
- "www.excite.co.jp"
2544
- ],
2545
- "parameters": [
2546
- "q",
2547
- "search"
2548
- ]
2549
- },
2550
- "qip": {
2551
- "domains": [
2552
- "search.qip.ru"
2553
- ],
2554
- "parameters": [
2555
- "query"
2556
- ]
2557
- },
2558
- "Yahoo!": {
2559
- "domains": [
2560
- "search.yahoo.com",
2561
- "yahoo.com",
2562
- "ar.search.yahoo.com",
2563
- "ar.yahoo.com",
2564
- "au.search.yahoo.com",
2565
- "au.yahoo.com",
2566
- "br.search.yahoo.com",
2567
- "br.yahoo.com",
2568
- "cade.searchde.yahoo.com",
2569
- "cade.yahoo.com",
2570
- "chinese.searchinese.yahoo.com",
2571
- "chinese.yahoo.com",
2572
- "cn.search.yahoo.com",
2573
- "cn.yahoo.com",
2574
- "de.search.yahoo.com",
2575
- "de.yahoo.com",
2576
- "dk.search.yahoo.com",
2577
- "dk.yahoo.com",
2578
- "es.search.yahoo.com",
2579
- "es.yahoo.com",
2580
- "espanol.searchpanol.yahoo.com",
2581
- "espanol.searchpanol.yahoo.com",
2582
- "espanol.yahoo.com",
2583
- "espanol.yahoo.com",
2584
- "fr.search.yahoo.com",
2585
- "fr.yahoo.com",
2586
- "ie.search.yahoo.com",
2587
- "ie.yahoo.com",
2588
- "it.search.yahoo.com",
2589
- "it.yahoo.com",
2590
- "kr.search.yahoo.com",
2591
- "kr.yahoo.com",
2592
- "mx.search.yahoo.com",
2593
- "mx.yahoo.com",
2594
- "no.search.yahoo.com",
2595
- "no.yahoo.com",
2596
- "nz.search.yahoo.com",
2597
- "nz.yahoo.com",
2598
- "one.cn.yahoo.com",
2599
- "one.searchn.yahoo.com",
2600
- "qc.search.yahoo.com",
2601
- "qc.search.yahoo.com",
2602
- "qc.search.yahoo.com",
2603
- "qc.yahoo.com",
2604
- "qc.yahoo.com",
2605
- "se.search.yahoo.com",
2606
- "se.search.yahoo.com",
2607
- "se.yahoo.com",
2608
- "search.searcharch.yahoo.com",
2609
- "search.yahoo.com",
2610
- "uk.search.yahoo.com",
2611
- "uk.yahoo.com",
2612
- "www.yahoo.co.jp",
2613
- "search.yahoo.co.jp",
2614
- "www.cercato.it",
2615
- "search.offerbox.com",
2616
- "ys.mirostart.com"
2617
- ],
2618
- "parameters": [
2619
- "p",
2620
- "q"
2621
- ]
2622
- },
2623
- "URL.ORGanizier": {
2624
- "domains": [
2625
- "www.url.org"
2626
- ],
2627
- "parameters": [
2628
- "q"
2629
- ]
2630
- },
2631
- "Witch": {
2632
- "domains": [
2633
- "www.witch.de"
2634
- ],
2635
- "parameters": [
2636
- "search"
2637
- ]
2638
- },
2639
- "Mister Wong": {
2640
- "domains": [
2641
- "www.mister-wong.com",
2642
- "www.mister-wong.de"
2643
- ],
2644
- "parameters": [
2645
- "Keywords"
2646
- ]
2647
- },
2648
- "Startsiden": {
2649
- "domains": [
2650
- "www.startsiden.no"
2651
- ],
2652
- "parameters": [
2653
- "q"
2654
- ]
2655
- },
2656
- "Web.de": {
2657
- "domains": [
2658
- "suche.web.de"
2659
- ],
2660
- "parameters": [
2661
- "su"
2662
- ]
2663
- },
2664
- "Ask": {
2665
- "domains": [
2666
- "ask.com",
2667
- "www.ask.com",
2668
- "web.ask.com",
2669
- "int.ask.com",
2670
- "mws.ask.com",
2671
- "uk.ask.com",
2672
- "images.ask.com",
2673
- "ask.reference.com",
2674
- "www.askkids.com",
2675
- "iwon.ask.com",
2676
- "www.ask.co.uk",
2677
- "www.qbyrd.com",
2678
- "search-results.com",
2679
- "uk.search-results.com",
2680
- "www.search-results.com",
2681
- "int.search-results.com"
2682
- ],
2683
- "parameters": [
2684
- "q"
2685
- ]
2686
- },
2687
- "Centrum": {
2688
- "domains": [
2689
- "serach.centrum.cz",
2690
- "morfeo.centrum.cz"
2691
- ],
2692
- "parameters": [
2693
- "q"
2694
- ]
2695
- },
2696
- "Everyclick": {
2697
- "domains": [
2698
- "www.everyclick.com"
2699
- ],
2700
- "parameters": [
2701
- "keyword"
2702
- ]
2703
- },
2704
- "Google Video": {
2705
- "domains": [
2706
- "video.google.com"
2707
- ],
2708
- "parameters": [
2709
- "q"
2710
- ]
2711
- },
2712
- "Delfi": {
2713
- "domains": [
2714
- "otsing.delfi.ee"
2715
- ],
2716
- "parameters": [
2717
- "q"
2718
- ]
2719
- },
2720
- "blekko": {
2721
- "domains": [
2722
- "blekko.com"
2723
- ],
2724
- "parameters": [
2725
- "q"
2726
- ]
2727
- },
2728
- "Jyxo": {
2729
- "domains": [
2730
- "jyxo.1188.cz"
2731
- ],
2732
- "parameters": [
2733
- "q"
2734
- ]
2735
- },
2736
- "Kataweb": {
2737
- "domains": [
2738
- "www.kataweb.it"
2739
- ],
2740
- "parameters": [
2741
- "q"
2742
- ]
2743
- },
2744
- "uol.com.br": {
2745
- "domains": [
2746
- "busca.uol.com.br"
2747
- ],
2748
- "parameters": [
2749
- "q"
2750
- ]
2751
- },
2752
- "Arianna": {
2753
- "domains": [
2754
- "arianna.libero.it",
2755
- "www.arianna.com"
2756
- ],
2757
- "parameters": [
2758
- "query"
2759
- ]
2760
- },
2761
- "Mamma": {
2762
- "domains": [
2763
- "www.mamma.com",
2764
- "mamma75.mamma.com"
2765
- ],
2766
- "parameters": [
2767
- "query"
2768
- ]
2769
- },
2770
- "Yatedo": {
2771
- "domains": [
2772
- "www.yatedo.com",
2773
- "www.yatedo.fr"
2774
- ],
2775
- "parameters": [
2776
- "q"
2777
- ]
2778
- },
2779
- "Twingly": {
2780
- "domains": [
2781
- "www.twingly.com"
2782
- ],
2783
- "parameters": [
2784
- "q"
2785
- ]
2786
- },
2787
- "Delfi latvia": {
2788
- "domains": [
2789
- "smart.delfi.lv"
2790
- ],
2791
- "parameters": [
2792
- "q"
2793
- ]
2794
- },
2795
- "PriceRunner": {
2796
- "domains": [
2797
- "www.pricerunner.co.uk"
2798
- ],
2799
- "parameters": [
2800
- "q"
2801
- ]
2802
- },
2803
- "Rakuten": {
2804
- "domains": [
2805
- "websearch.rakuten.co.jp"
2806
- ],
2807
- "parameters": [
2808
- "qt"
2809
- ]
2810
- },
2811
- "Google": {
2812
- "domains": [
2813
- "www.google.com",
2814
- "www.google.ac",
2815
- "www.google.ad",
2816
- "www.google.com.af",
2817
- "www.google.com.ag",
2818
- "www.google.com.ai",
2819
- "www.google.am",
2820
- "www.google.it.ao",
2821
- "www.google.com.ar",
2822
- "www.google.as",
2823
- "www.google.at",
2824
- "www.google.com.au",
2825
- "www.google.az",
2826
- "www.google.ba",
2827
- "www.google.com.bd",
2828
- "www.google.be",
2829
- "www.google.bf",
2830
- "www.google.bg",
2831
- "www.google.com.bh",
2832
- "www.google.bi",
2833
- "www.google.bj",
2834
- "www.google.com.bn",
2835
- "www.google.com.bo",
2836
- "www.google.com.br",
2837
- "www.google.bs",
2838
- "www.google.co.bw",
2839
- "www.google.com.by",
2840
- "www.google.by",
2841
- "www.google.com.bz",
2842
- "www.google.ca",
2843
- "www.google.com.kh",
2844
- "www.google.cc",
2845
- "www.google.cd",
2846
- "www.google.cf",
2847
- "www.google.cat",
2848
- "www.google.cg",
2849
- "www.google.ch",
2850
- "www.google.ci",
2851
- "www.google.co.ck",
2852
- "www.google.cl",
2853
- "www.google.cm",
2854
- "www.google.cn",
2855
- "www.google.com.co",
2856
- "www.google.co.cr",
2857
- "www.google.com.cu",
2858
- "www.google.cv",
2859
- "www.google.com.cy",
2860
- "www.google.cz",
2861
- "www.google.de",
2862
- "www.google.dj",
2863
- "www.google.dk",
2864
- "www.google.dm",
2865
- "www.google.com.do",
2866
- "www.google.dz",
2867
- "www.google.com.ec",
2868
- "www.google.ee",
2869
- "www.google.com.eg",
2870
- "www.google.es",
2871
- "www.google.com.et",
2872
- "www.google.fi",
2873
- "www.google.com.fj",
2874
- "www.google.fm",
2875
- "www.google.fr",
2876
- "www.google.ga",
2877
- "www.google.gd",
2878
- "www.google.ge",
2879
- "www.google.gf",
2880
- "www.google.gg",
2881
- "www.google.com.gh",
2882
- "www.google.com.gi",
2883
- "www.google.gl",
2884
- "www.google.gm",
2885
- "www.google.gp",
2886
- "www.google.gr",
2887
- "www.google.com.gt",
2888
- "www.google.gy",
2889
- "www.google.com.hk",
2890
- "www.google.hn",
2891
- "www.google.hr",
2892
- "www.google.ht",
2893
- "www.google.hu",
2894
- "www.google.co.id",
2895
- "www.google.iq",
2896
- "www.google.ie",
2897
- "www.google.co.il",
2898
- "www.google.im",
2899
- "www.google.co.in",
2900
- "www.google.io",
2901
- "www.google.is",
2902
- "www.google.it",
2903
- "www.google.je",
2904
- "www.google.com.jm",
2905
- "www.google.jo",
2906
- "www.google.co.jp",
2907
- "www.google.co.ke",
2908
- "www.google.com.kh",
2909
- "www.google.ki",
2910
- "www.google.kg",
2911
- "www.google.co.kr",
2912
- "www.google.com.kw",
2913
- "www.google.kz",
2914
- "www.google.la",
2915
- "www.google.com.lb",
2916
- "www.google.com.lc",
2917
- "www.google.li",
2918
- "www.google.lk",
2919
- "www.google.co.ls",
2920
- "www.google.lt",
2921
- "www.google.lu",
2922
- "www.google.lv",
2923
- "www.google.com.ly",
2924
- "www.google.co.ma",
2925
- "www.google.md",
2926
- "www.google.me",
2927
- "www.google.mg",
2928
- "www.google.mk",
2929
- "www.google.ml",
2930
- "www.google.mn",
2931
- "www.google.ms",
2932
- "www.google.com.mt",
2933
- "www.google.mu",
2934
- "www.google.mv",
2935
- "www.google.mw",
2936
- "www.google.com.mx",
2937
- "www.google.com.my",
2938
- "www.google.co.mz",
2939
- "www.google.com.na",
2940
- "www.google.ne",
2941
- "www.google.com.nf",
2942
- "www.google.com.ng",
2943
- "www.google.com.ni",
2944
- "www.google.nl",
2945
- "www.google.no",
2946
- "www.google.com.np",
2947
- "www.google.nr",
2948
- "www.google.nu",
2949
- "www.google.co.nz",
2950
- "www.google.com.om",
2951
- "www.google.com.pa",
2952
- "www.google.com.pe",
2953
- "www.google.com.ph",
2954
- "www.google.com.pk",
2955
- "www.google.pl",
2956
- "www.google.pn",
2957
- "www.google.com.pr",
2958
- "www.google.ps",
2959
- "www.google.pt",
2960
- "www.google.com.py",
2961
- "www.google.com.qa",
2962
- "www.google.ro",
2963
- "www.google.rs",
2964
- "www.google.ru",
2965
- "www.google.rw",
2966
- "www.google.com.sa",
2967
- "www.google.com.sb",
2968
- "www.google.sc",
2969
- "www.google.se",
2970
- "www.google.com.sg",
2971
- "www.google.sh",
2972
- "www.google.si",
2973
- "www.google.sk",
2974
- "www.google.com.sl",
2975
- "www.google.sn",
2976
- "www.google.sm",
2977
- "www.google.so",
2978
- "www.google.st",
2979
- "www.google.com.sv",
2980
- "www.google.td",
2981
- "www.google.tg",
2982
- "www.google.co.th",
2983
- "www.google.com.tj",
2984
- "www.google.tk",
2985
- "www.google.tl",
2986
- "www.google.tm",
2987
- "www.google.to",
2988
- "www.google.com.tn",
2989
- "www.google.com.tr",
2990
- "www.google.tt",
2991
- "www.google.com.tw",
2992
- "www.google.co.tz",
2993
- "www.google.com.ua",
2994
- "www.google.co.ug",
2995
- "www.google.ae",
2996
- "www.google.co.uk",
2997
- "www.google.us",
2998
- "www.google.com.uy",
2999
- "www.google.co.uz",
3000
- "www.google.com.vc",
3001
- "www.google.co.ve",
3002
- "www.google.vg",
3003
- "www.google.co.vi",
3004
- "www.google.com.vn",
3005
- "www.google.vu",
3006
- "www.google.ws",
3007
- "www.google.co.za",
3008
- "www.google.co.zm",
3009
- "www.google.co.zw",
3010
- "google.com",
3011
- "google.ac",
3012
- "google.ad",
3013
- "google.com.af",
3014
- "google.com.ag",
3015
- "google.com.ai",
3016
- "google.am",
3017
- "google.it.ao",
3018
- "google.com.ar",
3019
- "google.as",
3020
- "google.at",
3021
- "google.com.au",
3022
- "google.az",
3023
- "google.ba",
3024
- "google.com.bd",
3025
- "google.be",
3026
- "google.bf",
3027
- "google.bg",
3028
- "google.com.bh",
3029
- "google.bi",
3030
- "google.bj",
3031
- "google.com.bn",
3032
- "google.com.bo",
3033
- "google.com.br",
3034
- "google.bs",
3035
- "google.co.bw",
3036
- "google.com.by",
3037
- "google.by",
3038
- "google.com.bz",
3039
- "google.ca",
3040
- "google.com.kh",
3041
- "google.cc",
3042
- "google.cd",
3043
- "google.cf",
3044
- "google.cat",
3045
- "google.cg",
3046
- "google.ch",
3047
- "google.ci",
3048
- "google.co.ck",
3049
- "google.cl",
3050
- "google.cm",
3051
- "google.cn",
3052
- "google.com.co",
3053
- "google.co.cr",
3054
- "google.com.cu",
3055
- "google.cv",
3056
- "google.com.cy",
3057
- "google.cz",
3058
- "google.de",
3059
- "google.dj",
3060
- "google.dk",
3061
- "google.dm",
3062
- "google.com.do",
3063
- "google.dz",
3064
- "google.com.ec",
3065
- "google.ee",
3066
- "google.com.eg",
3067
- "google.es",
3068
- "google.com.et",
3069
- "google.fi",
3070
- "google.com.fj",
3071
- "google.fm",
3072
- "google.fr",
3073
- "google.ga",
3074
- "google.gd",
3075
- "google.ge",
3076
- "google.gf",
3077
- "google.gg",
3078
- "google.com.gh",
3079
- "google.com.gi",
3080
- "google.gl",
3081
- "google.gm",
3082
- "google.gp",
3083
- "google.gr",
3084
- "google.com.gt",
3085
- "google.gy",
3086
- "google.com.hk",
3087
- "google.hn",
3088
- "google.hr",
3089
- "google.ht",
3090
- "google.hu",
3091
- "google.co.id",
3092
- "google.iq",
3093
- "google.ie",
3094
- "google.co.il",
3095
- "google.im",
3096
- "google.co.in",
3097
- "google.io",
3098
- "google.is",
3099
- "google.it",
3100
- "google.je",
3101
- "google.com.jm",
3102
- "google.jo",
3103
- "google.co.jp",
3104
- "google.co.ke",
3105
- "google.com.kh",
3106
- "google.ki",
3107
- "google.kg",
3108
- "google.co.kr",
3109
- "google.com.kw",
3110
- "google.kz",
3111
- "google.la",
3112
- "google.com.lb",
3113
- "google.com.lc",
3114
- "google.li",
3115
- "google.lk",
3116
- "google.co.ls",
3117
- "google.lt",
3118
- "google.lu",
3119
- "google.lv",
3120
- "google.com.ly",
3121
- "google.co.ma",
3122
- "google.md",
3123
- "google.me",
3124
- "google.mg",
3125
- "google.mk",
3126
- "google.ml",
3127
- "google.mn",
3128
- "google.ms",
3129
- "google.com.mt",
3130
- "google.mu",
3131
- "google.mv",
3132
- "google.mw",
3133
- "google.com.mx",
3134
- "google.com.my",
3135
- "google.co.mz",
3136
- "google.com.na",
3137
- "google.ne",
3138
- "google.com.nf",
3139
- "google.com.ng",
3140
- "google.com.ni",
3141
- "google.nl",
3142
- "google.no",
3143
- "google.com.np",
3144
- "google.nr",
3145
- "google.nu",
3146
- "google.co.nz",
3147
- "google.com.om",
3148
- "google.com.pa",
3149
- "google.com.pe",
3150
- "google.com.ph",
3151
- "google.com.pk",
3152
- "google.pl",
3153
- "google.pn",
3154
- "google.com.pr",
3155
- "google.ps",
3156
- "google.pt",
3157
- "google.com.py",
3158
- "google.com.qa",
3159
- "google.ro",
3160
- "google.rs",
3161
- "google.ru",
3162
- "google.rw",
3163
- "google.com.sa",
3164
- "google.com.sb",
3165
- "google.sc",
3166
- "google.se",
3167
- "google.com.sg",
3168
- "google.sh",
3169
- "google.si",
3170
- "google.sk",
3171
- "google.com.sl",
3172
- "google.sn",
3173
- "google.sm",
3174
- "google.so",
3175
- "google.st",
3176
- "google.com.sv",
3177
- "google.td",
3178
- "google.tg",
3179
- "google.co.th",
3180
- "google.com.tj",
3181
- "google.tk",
3182
- "google.tl",
3183
- "google.tm",
3184
- "google.to",
3185
- "google.com.tn",
3186
- "google.com.tr",
3187
- "google.tt",
3188
- "google.com.tw",
3189
- "google.co.tz",
3190
- "google.com.ua",
3191
- "google.co.ug",
3192
- "google.ae",
3193
- "google.co.uk",
3194
- "google.us",
3195
- "google.com.uy",
3196
- "google.co.uz",
3197
- "google.com.vc",
3198
- "google.co.ve",
3199
- "google.vg",
3200
- "google.co.vi",
3201
- "google.com.vn",
3202
- "google.vu",
3203
- "google.ws",
3204
- "google.co.za",
3205
- "google.co.zm",
3206
- "google.co.zw",
3207
- "search.avg.com",
3208
- "isearch.avg.com",
3209
- "www.cnn.com",
3210
- "darkoogle.com",
3211
- "search.darkoogle.com",
3212
- "search.foxtab.com",
3213
- "www.gooofullsearch.com",
3214
- "search.hiyo.com",
3215
- "search.incredimail.com",
3216
- "search1.incredimail.com",
3217
- "search2.incredimail.com",
3218
- "search3.incredimail.com",
3219
- "search4.incredimail.com",
3220
- "search.incredibar.com",
3221
- "search.sweetim.com",
3222
- "www.fastweb.it",
3223
- "search.juno.com",
3224
- "find.tdc.dk",
3225
- "searchresults.verizon.com",
3226
- "search.walla.co.il",
3227
- "search.alot.com",
3228
- "www.googleearth.de",
3229
- "www.googleearth.fr",
3230
- "webcache.googleusercontent.com",
3231
- "encrypted.google.com",
3232
- "googlesyndicatedsearch.com"
3233
- ],
3234
- "parameters": [
3235
- "q",
3236
- "query",
3237
- "Keywords"
3238
- ]
3239
- },
3240
- "Google Blogsearch": {
3241
- "domains": [
3242
- "blogsearch.google.ac",
3243
- "blogsearch.google.ad",
3244
- "blogsearch.google.ae",
3245
- "blogsearch.google.am",
3246
- "blogsearch.google.as",
3247
- "blogsearch.google.at",
3248
- "blogsearch.google.az",
3249
- "blogsearch.google.ba",
3250
- "blogsearch.google.be",
3251
- "blogsearch.google.bf",
3252
- "blogsearch.google.bg",
3253
- "blogsearch.google.bi",
3254
- "blogsearch.google.bj",
3255
- "blogsearch.google.bs",
3256
- "blogsearch.google.by",
3257
- "blogsearch.google.ca",
3258
- "blogsearch.google.cat",
3259
- "blogsearch.google.cc",
3260
- "blogsearch.google.cd",
3261
- "blogsearch.google.cf",
3262
- "blogsearch.google.cg",
3263
- "blogsearch.google.ch",
3264
- "blogsearch.google.ci",
3265
- "blogsearch.google.cl",
3266
- "blogsearch.google.cm",
3267
- "blogsearch.google.cn",
3268
- "blogsearch.google.co.bw",
3269
- "blogsearch.google.co.ck",
3270
- "blogsearch.google.co.cr",
3271
- "blogsearch.google.co.id",
3272
- "blogsearch.google.co.il",
3273
- "blogsearch.google.co.in",
3274
- "blogsearch.google.co.jp",
3275
- "blogsearch.google.co.ke",
3276
- "blogsearch.google.co.kr",
3277
- "blogsearch.google.co.ls",
3278
- "blogsearch.google.co.ma",
3279
- "blogsearch.google.co.mz",
3280
- "blogsearch.google.co.nz",
3281
- "blogsearch.google.co.th",
3282
- "blogsearch.google.co.tz",
3283
- "blogsearch.google.co.ug",
3284
- "blogsearch.google.co.uk",
3285
- "blogsearch.google.co.uz",
3286
- "blogsearch.google.co.ve",
3287
- "blogsearch.google.co.vi",
3288
- "blogsearch.google.co.za",
3289
- "blogsearch.google.co.zm",
3290
- "blogsearch.google.co.zw",
3291
- "blogsearch.google.com",
3292
- "blogsearch.google.com.af",
3293
- "blogsearch.google.com.ag",
3294
- "blogsearch.google.com.ai",
3295
- "blogsearch.google.com.ar",
3296
- "blogsearch.google.com.au",
3297
- "blogsearch.google.com.bd",
3298
- "blogsearch.google.com.bh",
3299
- "blogsearch.google.com.bn",
3300
- "blogsearch.google.com.bo",
3301
- "blogsearch.google.com.br",
3302
- "blogsearch.google.com.by",
3303
- "blogsearch.google.com.bz",
3304
- "blogsearch.google.com.co",
3305
- "blogsearch.google.com.cu",
3306
- "blogsearch.google.com.cy",
3307
- "blogsearch.google.com.do",
3308
- "blogsearch.google.com.ec",
3309
- "blogsearch.google.com.eg",
3310
- "blogsearch.google.com.et",
3311
- "blogsearch.google.com.fj",
3312
- "blogsearch.google.com.gh",
3313
- "blogsearch.google.com.gi",
3314
- "blogsearch.google.com.gt",
3315
- "blogsearch.google.com.hk",
3316
- "blogsearch.google.com.jm",
3317
- "blogsearch.google.com.kh",
3318
- "blogsearch.google.com.kh",
3319
- "blogsearch.google.com.kw",
3320
- "blogsearch.google.com.lb",
3321
- "blogsearch.google.com.lc",
3322
- "blogsearch.google.com.ly",
3323
- "blogsearch.google.com.mt",
3324
- "blogsearch.google.com.mx",
3325
- "blogsearch.google.com.my",
3326
- "blogsearch.google.com.na",
3327
- "blogsearch.google.com.nf",
3328
- "blogsearch.google.com.ng",
3329
- "blogsearch.google.com.ni",
3330
- "blogsearch.google.com.np",
3331
- "blogsearch.google.com.om",
3332
- "blogsearch.google.com.pa",
3333
- "blogsearch.google.com.pe",
3334
- "blogsearch.google.com.ph",
3335
- "blogsearch.google.com.pk",
3336
- "blogsearch.google.com.pr",
3337
- "blogsearch.google.com.py",
3338
- "blogsearch.google.com.qa",
3339
- "blogsearch.google.com.sa",
3340
- "blogsearch.google.com.sb",
3341
- "blogsearch.google.com.sg",
3342
- "blogsearch.google.com.sl",
3343
- "blogsearch.google.com.sv",
3344
- "blogsearch.google.com.tj",
3345
- "blogsearch.google.com.tn",
3346
- "blogsearch.google.com.tr",
3347
- "blogsearch.google.com.tw",
3348
- "blogsearch.google.com.ua",
3349
- "blogsearch.google.com.uy",
3350
- "blogsearch.google.com.vc",
3351
- "blogsearch.google.com.vn",
3352
- "blogsearch.google.cv",
3353
- "blogsearch.google.cz",
3354
- "blogsearch.google.de",
3355
- "blogsearch.google.dj",
3356
- "blogsearch.google.dk",
3357
- "blogsearch.google.dm",
3358
- "blogsearch.google.dz",
3359
- "blogsearch.google.ee",
3360
- "blogsearch.google.es",
3361
- "blogsearch.google.fi",
3362
- "blogsearch.google.fm",
3363
- "blogsearch.google.fr",
3364
- "blogsearch.google.ga",
3365
- "blogsearch.google.gd",
3366
- "blogsearch.google.ge",
3367
- "blogsearch.google.gf",
3368
- "blogsearch.google.gg",
3369
- "blogsearch.google.gl",
3370
- "blogsearch.google.gm",
3371
- "blogsearch.google.gp",
3372
- "blogsearch.google.gr",
3373
- "blogsearch.google.gy",
3374
- "blogsearch.google.hn",
3375
- "blogsearch.google.hr",
3376
- "blogsearch.google.ht",
3377
- "blogsearch.google.hu",
3378
- "blogsearch.google.ie",
3379
- "blogsearch.google.im",
3380
- "blogsearch.google.io",
3381
- "blogsearch.google.iq",
3382
- "blogsearch.google.is",
3383
- "blogsearch.google.it",
3384
- "blogsearch.google.it.ao",
3385
- "blogsearch.google.je",
3386
- "blogsearch.google.jo",
3387
- "blogsearch.google.kg",
3388
- "blogsearch.google.ki",
3389
- "blogsearch.google.kz",
3390
- "blogsearch.google.la",
3391
- "blogsearch.google.li",
3392
- "blogsearch.google.lk",
3393
- "blogsearch.google.lt",
3394
- "blogsearch.google.lu",
3395
- "blogsearch.google.lv",
3396
- "blogsearch.google.md",
3397
- "blogsearch.google.me",
3398
- "blogsearch.google.mg",
3399
- "blogsearch.google.mk",
3400
- "blogsearch.google.ml",
3401
- "blogsearch.google.mn",
3402
- "blogsearch.google.ms",
3403
- "blogsearch.google.mu",
3404
- "blogsearch.google.mv",
3405
- "blogsearch.google.mw",
3406
- "blogsearch.google.ne",
3407
- "blogsearch.google.nl",
3408
- "blogsearch.google.no",
3409
- "blogsearch.google.nr",
3410
- "blogsearch.google.nu",
3411
- "blogsearch.google.pl",
3412
- "blogsearch.google.pn",
3413
- "blogsearch.google.ps",
3414
- "blogsearch.google.pt",
3415
- "blogsearch.google.ro",
3416
- "blogsearch.google.rs",
3417
- "blogsearch.google.ru",
3418
- "blogsearch.google.rw",
3419
- "blogsearch.google.sc",
3420
- "blogsearch.google.se",
3421
- "blogsearch.google.sh",
3422
- "blogsearch.google.si",
3423
- "blogsearch.google.sk",
3424
- "blogsearch.google.sm",
3425
- "blogsearch.google.sn",
3426
- "blogsearch.google.so",
3427
- "blogsearch.google.st",
3428
- "blogsearch.google.td",
3429
- "blogsearch.google.tg",
3430
- "blogsearch.google.tk",
3431
- "blogsearch.google.tl",
3432
- "blogsearch.google.tm",
3433
- "blogsearch.google.to",
3434
- "blogsearch.google.tt",
3435
- "blogsearch.google.us",
3436
- "blogsearch.google.vg",
3437
- "blogsearch.google.vu",
3438
- "blogsearch.google.ws"
3439
- ],
3440
- "parameters": [
3441
- "q"
3442
- ]
3443
- },
3444
- "Amazon": {
3445
- "domains": [
3446
- "amazon.com",
3447
- "www.amazon.com"
3448
- ],
3449
- "parameters": [
3450
- "keywords"
3451
- ]
3452
- },
3453
- "Hooseek.com": {
3454
- "domains": [
3455
- "www.hooseek.com"
3456
- ],
3457
- "parameters": [
3458
- "recherche"
3459
- ]
3460
- },
3461
- "Dalesearch": {
3462
- "domains": [
3463
- "www.dalesearch.com"
3464
- ],
3465
- "parameters": [
3466
- "q"
3467
- ]
3468
- },
3469
- "Alice Adsl": {
3470
- "domains": [
3471
- "rechercher.aliceadsl.fr"
3472
- ],
3473
- "parameters": [
3474
- "q"
3475
- ]
3476
- },
3477
- "soso.com": {
3478
- "domains": [
3479
- "www.soso.com"
3480
- ],
3481
- "parameters": [
3482
- "w"
3483
- ]
3484
- },
3485
- "Sogou": {
3486
- "domains": [
3487
- "www.sougou.com"
3488
- ],
3489
- "parameters": [
3490
- "query"
3491
- ]
3492
- },
3493
- "Hit-Parade": {
3494
- "domains": [
3495
- "req.-hit-parade.com",
3496
- "class.hit-parade.com",
3497
- "www.hit-parade.com"
3498
- ],
3499
- "parameters": [
3500
- "p7"
3501
- ]
3502
- },
3503
- "SearchCanvas": {
3504
- "domains": [
3505
- "www.searchcanvas.com"
3506
- ],
3507
- "parameters": [
3508
- "q"
3509
- ]
3510
- },
3511
- "Interia": {
3512
- "domains": [
3513
- "www.google.interia.pl"
3514
- ],
3515
- "parameters": [
3516
- "q"
3517
- ]
3518
- },
3519
- "Tiscali": {
3520
- "domains": [
3521
- "search.tiscali.it",
3522
- "search-dyn.tiscali.it",
3523
- "hledani.tiscali.cz"
3524
- ],
3525
- "parameters": [
3526
- "q",
3527
- "key"
3528
- ]
3529
- },
3530
- "Clix": {
3531
- "domains": [
3532
- "pesquisa.clix.pt"
3533
- ],
3534
- "parameters": [
3535
- "question"
3536
- ]
3537
- }
3538
- },
3539
- "email": {
3540
- "Outlook.com": {
3541
- "domains": [
3542
- "mail.live.com"
3543
- ]
3544
- },
3545
- "Orange Webmail": {
3546
- "domains": [
3547
- "orange.fr/webmail"
3548
- ]
3549
- },
3550
- "Yahoo! Mail": {
3551
- "domains": [
3552
- "mail.yahoo.net",
3553
- "mail.yahoo.com",
3554
- "mail.yahoo.co.uk"
3555
- ]
3556
- },
3557
- "Gmail": {
3558
- "domains": [
3559
- "mail.google.com"
3560
- ]
3561
- }
3562
- },
3563
- "social": {
3564
- "hi5": {
3565
- "domains": [
3566
- "hi5.com"
3567
- ]
3568
- },
3569
- "Friendster": {
3570
- "domains": [
3571
- "friendster.com"
3572
- ]
3573
- },
3574
- "Weibo": {
3575
- "domains": [
3576
- "weibo.com",
3577
- "t.cn"
3578
- ]
3579
- },
3580
- "Xanga": {
3581
- "domains": [
3582
- "xanga.com"
3583
- ]
3584
- },
3585
- "Myspace": {
3586
- "domains": [
3587
- "myspace.com"
3588
- ]
3589
- },
3590
- "Buzznet": {
3591
- "domains": [
3592
- "wayn.com"
3593
- ]
3594
- },
3595
- "MyLife": {
3596
- "domains": [
3597
- "mylife.ru"
3598
- ]
3599
- },
3600
- "Flickr": {
3601
- "domains": [
3602
- "flickr.com"
3603
- ]
3604
- },
3605
- "Sonico.com": {
3606
- "domains": [
3607
- "sonico.com"
3608
- ]
3609
- },
3610
- "Odnoklassniki": {
3611
- "domains": [
3612
- "odnoklassniki.ru"
3613
- ]
3614
- },
3615
- "GitHub": {
3616
- "domains": [
3617
- "github.com"
3618
- ]
3619
- },
3620
- "Classmates": {
3621
- "domains": [
3622
- "classmates.com"
3623
- ]
3624
- },
3625
- "Friends Reunited": {
3626
- "domains": [
3627
- "friendsreunited.com"
3628
- ]
3629
- },
3630
- "Renren": {
3631
- "domains": [
3632
- "renren.com"
3633
- ]
3634
- },
3635
- "vKruguDruzei.ru": {
3636
- "domains": [
3637
- "vkrugudruzei.ru"
3638
- ]
3639
- },
3640
- "Gaia Online": {
3641
- "domains": [
3642
- "gaiaonline.com"
3643
- ]
3644
- },
3645
- "Netlog": {
3646
- "domains": [
3647
- "netlog.com"
3648
- ]
3649
- },
3650
- "Orkut": {
3651
- "domains": [
3652
- "orkut.com"
3653
- ]
3654
- },
3655
- "MyHeritage": {
3656
- "domains": [
3657
- "myheritage.com"
3658
- ]
3659
- },
3660
- "Multiply": {
3661
- "domains": [
3662
- "multiply.com"
3663
- ]
3664
- },
3665
- "myYearbook": {
3666
- "domains": [
3667
- "myyearbook.com"
3668
- ]
3669
- },
3670
- "WeeWorld": {
3671
- "domains": [
3672
- "weeworld.com"
3673
- ]
3674
- },
3675
- "Geni": {
3676
- "domains": [
3677
- "geni.com"
3678
- ]
3679
- },
3680
- "SourceForge": {
3681
- "domains": [
3682
- "sourceforge.net"
3683
- ]
3684
- },
3685
- "Plaxo": {
3686
- "domains": [
3687
- "plaxo.com"
3688
- ]
3689
- },
3690
- "Taringa!": {
3691
- "domains": [
3692
- "taringa.net"
3693
- ]
3694
- },
3695
- "Tagged": {
3696
- "domains": [
3697
- "login.tagged.com"
3698
- ]
3699
- },
3700
- "XING": {
3701
- "domains": [
3702
- "xing.com"
3703
- ]
3704
- },
3705
- "Vkontakte": {
3706
- "domains": [
3707
- "vk.com",
3708
- "vkontakte.ru"
3709
- ]
3710
- },
3711
- "Twitter": {
3712
- "domains": [
3713
- "twitter.com",
3714
- "t.co"
3715
- ]
3716
- },
3717
- "WAYN": {
3718
- "domains": [
3719
- "wayn.com"
3720
- ]
3721
- },
3722
- "Tuenti": {
3723
- "domains": [
3724
- "tuenti.com"
3725
- ]
3726
- },
3727
- "Mail.ru": {
3728
- "domains": [
3729
- "my.mail.ru"
3730
- ]
3731
- },
3732
- "Badoo": {
3733
- "domains": [
3734
- "badoo.com"
3735
- ]
3736
- },
3737
- "Habbo": {
3738
- "domains": [
3739
- "habbo.com"
3740
- ]
3741
- },
3742
- "Pinterest": {
3743
- "domains": [
3744
- "pinterest.com"
3745
- ]
3746
- },
3747
- "LinkedIn": {
3748
- "domains": [
3749
- "linkedin.com"
3750
- ]
3751
- },
3752
- "Foursquare": {
3753
- "domains": [
3754
- "foursquare.com"
3755
- ]
3756
- },
3757
- "Flixster": {
3758
- "domains": [
3759
- "flixster.com"
3760
- ]
3761
- },
3762
- "Windows Live Spaces": {
3763
- "domains": [
3764
- "login.live.com"
3765
- ]
3766
- },
3767
- "BlackPlanet": {
3768
- "domains": [
3769
- "blackplanet.com"
3770
- ]
3771
- },
3772
- "Cyworld": {
3773
- "domains": [
3774
- "global.cyworld.com"
3775
- ]
3776
- },
3777
- "Skyrock": {
3778
- "domains": [
3779
- "skyrock.com"
3780
- ]
3781
- },
3782
- "Facebook": {
3783
- "domains": [
3784
- "facebook.com",
3785
- "fb.me"
3786
- ]
3787
- },
3788
- "StudiVZ": {
3789
- "domains": [
3790
- "studivz.net"
3791
- ]
3792
- },
3793
- "Fotolog": {
3794
- "domains": [
3795
- "fotolog.com"
3796
- ]
3797
- },
3798
- "Google+": {
3799
- "domains": [
3800
- "url.google.com",
3801
- "plus.google.com"
3802
- ]
3803
- },
3804
- "Nasza-klasa.pl": {
3805
- "domains": [
3806
- "nk.pl"
3807
- ]
3808
- },
3809
- "Douban": {
3810
- "domains": [
3811
- "douban.com"
3812
- ]
3813
- },
3814
- "Bebo": {
3815
- "domains": [
3816
- "bebo.com"
3817
- ]
3818
- },
3819
- "Reddit": {
3820
- "domains": [
3821
- "reddit.com"
3822
- ]
3823
- },
3824
- "Identi.ca": {
3825
- "domains": [
3826
- "identi.ca"
3827
- ]
3828
- },
3829
- "StackOverflow": {
3830
- "domains": [
3831
- "stackoverflow.com"
3832
- ]
3833
- },
3834
- "Mixi": {
3835
- "domains": [
3836
- "mixi.jp"
3837
- ]
3838
- },
3839
- "StumbleUpon": {
3840
- "domains": [
3841
- "stumbleupon.com"
3842
- ]
3843
- },
3844
- "Viadeo": {
3845
- "domains": [
3846
- "viadeo.com"
3847
- ]
3848
- },
3849
- "Last.fm": {
3850
- "domains": [
3851
- "lastfm.ru"
3852
- ]
3853
- },
3854
- "LiveJournal": {
3855
- "domains": [
3856
- "livejournal.ru"
3857
- ]
3858
- },
3859
- "Tumblr": {
3860
- "domains": [
3861
- "tumblr.com"
3862
- ]
3863
- },
3864
- "Hacker News": {
3865
- "domains": [
3866
- "news.ycombinator.com"
3867
- ]
3868
- },
3869
- "Qzone": {
3870
- "domains": [
3871
- "qzone.qq.com"
3872
- ]
3873
- },
3874
- "Hyves": {
3875
- "domains": [
3876
- "hyves.nl"
3877
- ]
3878
- },
3879
- "Paper.li": {
3880
- "domains": [
3881
- "paper.li"
3882
- ]
3883
- },
3884
- "MoiKrug.ru": {
3885
- "domains": [
3886
- "moikrug.ru"
3887
- ]
3888
- }
3889
- }
3890
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/leadin-admin.php CHANGED
@@ -17,45 +17,24 @@ if ( !defined('LEADIN_ADMIN_PATH') )
17
  // Include Needed Files
18
  //=============================================
19
 
20
- if ( !class_exists('LI_List_Table') )
21
- require_once LEADIN_PLUGIN_DIR . '/admin/inc/class-leadin-list-table.php';
22
-
23
- if ( !class_exists('LI_Contact') )
24
- require_once LEADIN_PLUGIN_DIR . '/admin/inc/class-leadin-contact.php';
25
 
26
  if ( !class_exists('LI_Pointers') )
27
- require_once LEADIN_PLUGIN_DIR . '/admin/inc/class-leadin-pointers.php';
28
-
29
- if ( !class_exists('LI_Viewers') )
30
- require_once LEADIN_PLUGIN_DIR . '/admin/inc/class-leadin-viewers.php';
31
-
32
- if ( !class_exists('LI_StatsDashboard') )
33
- require_once LEADIN_PLUGIN_DIR . '/admin/inc/class-stats-dashboard.php';
34
-
35
- if ( !class_exists('LI_Tags_Table') )
36
- require_once LEADIN_PLUGIN_DIR . '/admin/inc/class-leadin-tags-list-table.php';
37
-
38
- if ( !class_exists('LI_Tag_Editor') )
39
- require_once LEADIN_PLUGIN_DIR . '/admin/inc/class-leadin-tag-editor.php';
40
-
41
- include_once(ABSPATH . 'wp-admin/includes/plugin.php');
42
 
43
  //=============================================
44
  // WPLeadInAdmin Class
45
  //=============================================
46
  class WPLeadInAdmin {
47
 
48
- var $admin_power_ups;
49
  var $li_viewers;
50
- var $power_up_icon;
51
  var $stats_dashboard;
52
  var $action;
53
- var $esp_power_ups;
54
 
55
  /**
56
  * Class constructor
57
  */
58
- function __construct ( $power_ups )
59
  {
60
  //=============================================
61
  // Hooks & Filters
@@ -64,168 +43,13 @@ class WPLeadInAdmin {
64
  $options = get_option('leadin_options');
65
 
66
  $this->action = $this->leadin_current_action();
67
-
68
- // If the plugin version matches the latest version escape the update function
69
- if ( $options['leadin_version'] != LEADIN_PLUGIN_VERSION )
70
- self::leadin_update_check();
71
-
72
- $this->admin_power_ups = $power_ups;
73
 
74
  add_action('admin_menu', array(&$this, 'leadin_add_menu_items'));
75
- add_action('admin_init', array(&$this, 'leadin_build_settings_page'));
76
- add_action('admin_print_styles', array(&$this, 'add_leadin_admin_styles'));
77
  add_filter('plugin_action_links_' . 'leadin/leadin.php', array($this, 'leadin_plugin_settings_link'));
78
 
79
- if ( isset($_GET['page']) && $_GET['page'] == 'leadin_stats' )
80
- {
81
- if ( $this->action == 'restore_tables' )
82
- {
83
- leadin_db_install();
84
- wp_redirect(get_bloginfo('wpurl') . '/wp-admin/admin.php?page=leadin_stats&tables_restored=1');
85
- exit;
86
- }
87
-
88
- add_action('admin_footer', array($this, 'build_contacts_chart'));
89
- }
90
  }
91
 
92
- function leadin_update_check ()
93
- {
94
- $options = get_option('leadin_options');
95
-
96
- // 0.5.1 upgrade - Create active power-ups option if it doesn't exist
97
- $leadin_active_power_ups = get_option('leadin_active_power_ups');
98
-
99
- if ( ! $leadin_active_power_ups )
100
- {
101
- $auto_activate = array(
102
- 'contacts',
103
- 'lookups'
104
- );
105
-
106
- update_option('leadin_active_power_ups', serialize($auto_activate));
107
- }
108
- else
109
- {
110
- // 0.9.2 upgrade - set beta program power-up to auto-activate
111
- $activated_power_ups = unserialize($leadin_active_power_ups);
112
- $update_active_power_ups = FALSE;
113
-
114
- // 0.9.3 bug fix for duplicate beta_program values being stored in the active power-ups array
115
- if ( !in_array('beta_program', $activated_power_ups) )
116
- {
117
- $activated_power_ups[] = 'beta_program';
118
- $update_active_power_ups = TRUE;
119
- }
120
- else
121
- {
122
- $tmp = array_count_values($activated_power_ups);
123
- $count = $tmp['beta_program'];
124
-
125
- if ( $count > 1 )
126
- {
127
- $activated_power_ups = array_unique($activated_power_ups);
128
- $update_active_power_ups = TRUE;
129
- }
130
- }
131
-
132
- // 2.0.1 upgrade - [plugin_slug]_list_sync changed to [plugin_slug]_connect
133
- $mailchimp_list_sync_key = array_search('mailchimp_list_sync', $activated_power_ups);
134
- if ( $mailchimp_list_sync_key !== FALSE )
135
- {
136
- unset($activated_power_ups[$mailchimp_list_sync_key]);
137
- $activated_power_ups[] = 'mailchimp_connect';
138
- $update_active_power_ups = TRUE;
139
- }
140
-
141
- $constant_contact_list_sync_key = array_search('constant_contact_list_sync', $activated_power_ups);
142
- if ( $constant_contact_list_sync_key !== FALSE )
143
- {
144
- unset($activated_power_ups[$constant_contact_list_sync_key]);
145
- $activated_power_ups[] = 'constant_contact_connect';
146
- $update_active_power_ups = TRUE;
147
- }
148
-
149
- if ( $update_active_power_ups )
150
- update_option('leadin_active_power_ups', serialize($activated_power_ups));
151
- }
152
-
153
- // 0.7.2 bug fix - data recovery algorithm for deleted contacts
154
- if ( ! isset($options['data_recovered']) )
155
- {
156
- leadin_recover_contact_data();
157
- }
158
-
159
- // Check if the pro flag is not set and version > 3.0 and if yes, set the pro flag. This resets the Pro flag and takes care of the settings bug from Pro 3.1.3
160
- if ( ! isset($options['pro']) )
161
- {
162
- if ( isset($options['leadin_version']) && version_compare($options['leadin_version'], '3.0.0', '>=') && version_compare($options['leadin_version'], '3.1.4', '<') )
163
- {
164
- leadin_update_option('leadin_options', 'pro', 1);
165
-
166
- // Check to make sure the lookups power-up is activate for Pro users
167
- if ( ! in_array('lookups', $activated_power_ups) )
168
- WPLeadIn::activate_power_up('lookups', FALSE);
169
- }
170
- }
171
- else
172
- {
173
- if ( $options['pro'] )
174
- {
175
- // Check to make sure the lookups power-up is activate for Pro users
176
- if ( ! in_array('lookups', $activated_power_ups) )
177
- WPLeadIn::activate_power_up('lookups', FALSE);
178
- }
179
- }
180
-
181
- // Set the database version if it doesn't exist
182
- if ( isset($options['li_db_version']) )
183
- {
184
- if ( $options['li_db_version'] != LEADIN_DB_VERSION )
185
- {
186
- leadin_db_install();
187
-
188
- // 2.0.0 upgrade
189
- if ( ! isset($options['converted_to_tags']) )
190
- {
191
- leadin_convert_statuses_to_tags();
192
- }
193
-
194
- // 2.2.3 upgrade
195
- if ( ! isset($options['names_added_to_contacts']) )
196
- {
197
- leadin_set_names_retroactively();
198
- }
199
- }
200
- }
201
- else
202
- {
203
- leadin_db_install();
204
- }
205
-
206
- // 0.8.3 bug fix - bug fix for duplicated contacts that should be merged
207
- if ( ! isset($options['delete_flags_fixed']) )
208
- {
209
- leadin_delete_flag_fix();
210
- }
211
-
212
- // Set the plugin version
213
- leadin_update_option('leadin_options', 'leadin_version', LEADIN_PLUGIN_VERSION);
214
-
215
- if ( leadin_check_pro_user() )
216
- {
217
- $leadin_user = leadin_get_current_user();
218
- leadin_set_user_properties(array(
219
- '$wp-url' => get_bloginfo('wpurl'),
220
- '$wp-version' => $leadin_user['wp_version'],
221
- '$li-version' => $leadin_user['li_version']
222
- ));
223
- }
224
-
225
- // Catch all for installs that get their options nixed for whatever reason
226
- leadin_check_missing_options($options);
227
- }
228
-
229
  //=============================================
230
  // Menus
231
  //=============================================
@@ -262,111 +86,27 @@ class WPLeadInAdmin {
262
  }
263
  }
264
 
265
- self::check_admin_action();
266
 
267
- $leadin_icon = LEADIN_PATH . '/images/leadin-icon-16x16.png';
268
 
269
- add_menu_page('Leadin', 'Leadin', $capability, 'leadin_stats', array($this, 'leadin_build_stats_page'), $leadin_icon , '25.100713');
 
270
 
271
- if ( count($this->admin_power_ups) )
272
  {
273
- foreach ( $this->admin_power_ups as $power_up )
274
- {
275
- if ( $power_up->activated )
276
- {
277
- $power_up->admin_init();
278
-
279
- // Creates the menu icon for power-up if it's set. Overrides the main Leadin menu to hit the contacts power-up
280
- if ( $power_up->menu_text )
281
- add_submenu_page('leadin_stats', $power_up->menu_text, $power_up->menu_text, $capability, 'leadin_' . $power_up->menu_link, array($power_up, 'power_up_setup_callback'));
282
- }
283
- }
284
-
285
- add_submenu_page('leadin_stats', 'Tags', 'Tags', $capability, 'leadin_tags', array(&$this, 'leadin_build_tag_page'));
286
- add_submenu_page('leadin_stats', 'Settings', 'Settings', 'activate_plugins', 'leadin_settings', array(&$this, 'leadin_plugin_options'));
287
- add_submenu_page('leadin_stats', 'Power-ups', 'Power-ups', 'activate_plugins', 'leadin_power_ups', array(&$this, 'leadin_power_ups_page'));
288
-
289
- if ( ! leadin_check_pro_user() )
290
- add_submenu_page('leadin_stats', 'Pro Upgrade', 'Pro Upgrade', 'activate_plugins', 'leadin_pro_upgrade', array(&$this, 'leadin_pro_upgrade_page'));
291
-
292
- $submenu['leadin_stats'][0][0] = 'Stats';
293
-
294
- if ( !isset($_GET['page']) || $_GET['page'] != 'leadin_settings' )
295
- {
296
- $options = get_option('leadin_options');
297
- if ( !isset($options['ignore_settings_popup']) || !$options['ignore_settings_popup'] )
298
- $li_pointers = new LI_Pointers();
299
- }
300
  }
301
 
302
-
303
- }
304
-
305
- function leadin_pro_upgrade_page ()
306
- {
307
- global $wp_version;
308
-
309
- echo '<div id="leadin" class=" wrap '. ( $wp_version < 3.8 && !is_plugin_active('mp6/mp6.php') ? 'pre-mp6' : ''). '">';
310
-
311
- $this->leadin_header('Upgrade to Leadin Pro for free');
312
-
313
- ?>
314
- <p>Leadin Pro is the best version of Leadin to date. </p>
315
- <div class="compare">
316
- <div class="title">
317
- <h2>Leadin (current version)</h2>
318
- </div>
319
- <div class="content">
320
- <ul class="features">
321
- <li>&#10003; Contacts Tracking</li>
322
- <p>Learn more about your visitors.</p>
323
-
324
- <li>&#10003; Contacts Analytics</li>
325
- <p>Find out what content and traffic sources convert the best.</p>
326
-
327
- <li>&#10003; Popup Form</li>
328
- <p>Convert more visitors to contacts, faster.</p>
329
-
330
- <li>&#10003; Email Connectors</li>
331
- <p>Push contacts to MailChimp, Constant Contact, Campaign Monitor, GetResponse and AWeber without replacing any of your forms.</p>
332
- </ul>
333
- </div>
334
- </div>
335
- <div class="compare">
336
- <div class="title teal">
337
- <h2>Leadin Pro</h2>
338
- </div>
339
- <div class="content">
340
- <p>All the features you're enjoying now, plus:</p>
341
- <ul class="features">
342
- <li><b>+</b> Contact Enrichment</li>
343
- <p>In addition to seeing the pages your contacts have visited, you'll now be able to see publicly available information about your contacts and their businesses. Info like social accounts, job role, and company location all in your contact reports. </p>
344
-
345
- <li><b>+</b> Improved Email Delivery</li>
346
- <p>Instead of using your default mail server, we'll route your contact notifications through our email delivery service, ensuring you'll be more likely to actually receive your new contact notifications in your inbox.</p>
347
- </ul>
348
-
349
- <p id="agree-pp-error" style="display: none; border-left: 4px solid #dd3d36; padding-left: 12px; margin-bottom: 25px;">
350
- Before you can unlock the awesomeness of Leadin Pro, we need you to agree to our Privacy Policy, because lawyers.
351
- </p>
352
-
353
- <label for="agree-pp">
354
- <input type="checkbox" id="agree-pp" name="agree-pp"/>
355
- I agree to Leadin's <a href="http://leadin.com/legal/privacy-policy" target="_blank">Privacy Policy</a>
356
- </label>
357
-
358
- <a id="pro-upgrade-button" class="big-button--orange">Upgrade to Leadin Pro</a>
359
- </div>
360
- </div>
361
-
362
-
363
- <?php
364
-
365
- $this->leadin_footer();
366
-
367
- //end wrap
368
- echo '</div>';
369
 
 
 
 
 
 
 
 
370
  }
371
 
372
  //=============================================
@@ -381,1665 +121,113 @@ class WPLeadInAdmin {
381
  */
382
  function leadin_plugin_settings_link ( $links )
383
  {
384
- $url = get_admin_url() . 'admin.php?page=leadin_settings';
385
  $settings_link = '<a href="' . $url . '">Settings</a>';
386
  array_unshift($links, $settings_link);
387
  return $links;
388
  }
389
 
390
  /**
391
- * Creates the stats page
392
- */
393
- function leadin_build_stats_page ()
394
- {
395
- global $wp_version;
396
-
397
-
398
- $this->stats_dashboard = new LI_StatsDashboard();
399
-
400
- echo '<div id="leadin" class="li-stats wrap '. ( $wp_version < 3.8 && !is_plugin_active('mp6/mp6.php') ? 'pre-mp6' : ''). '">';
401
-
402
- $this->leadin_header('Leadin Stats: ' . date('F j Y, g:ia', current_time('timestamp')), 'leadin-stats__header', 'Loaded Stats Page');
403
-
404
- echo '<div class="leadin-stats__top-container">';
405
- echo $this->leadin_postbox('leadin-stats__chart', leadin_single_plural_label(number_format($this->stats_dashboard->total_contacts_last_30_days), 'new contact', 'new contacts') . ' last 30 days', $this->leadin_build_contacts_chart_stats());
406
- echo '</div>';
407
-
408
- echo '<div class="leadin-stats__postbox_containter">';
409
- echo $this->leadin_postbox('leadin-stats__new-contacts', leadin_single_plural_label(number_format($this->stats_dashboard->total_new_contacts), 'new contact', 'new contacts') . ' today', $this->leadin_build_new_contacts_postbox());
410
- echo $this->leadin_postbox('leadin-stats__returning-contacts', leadin_single_plural_label(number_format($this->stats_dashboard->total_returning_contacts), 'returning contact', 'returning contacts') . ' today', $this->leadin_build_returning_contacts_postbox());
411
- echo '</div>';
412
-
413
-
414
-
415
- echo '<div class="leadin-stats__postbox_containter">';
416
- echo $this->leadin_postbox('leadin-stats__sources', 'New contact sources last 30 days', $this->leadin_build_sources_postbox());
417
- echo '</div>';
418
-
419
- $this->leadin_footer();
420
- }
421
-
422
-
423
- /**
424
- * Creates the stats page
425
- */
426
- function leadin_build_tag_page ()
427
- {
428
- global $wp_version;
429
-
430
- if ( isset($_POST['tag_name']) )
431
- {
432
- $tag_id = ( isset($_POST['tag_id']) ? $_POST['tag_id'] : FALSE );
433
- $tagger = new LI_Tag_Editor($tag_id);
434
-
435
- $tag_name = $_POST['tag_name'];
436
- $tag_form_selectors = '';
437
- $tag_synced_lists = array();
438
-
439
- foreach ( $_POST as $name => $value )
440
- {
441
- // Create a comma deliniated list of selectors for tag_form_selectors
442
- if ( strstr($name, 'email_form_tags_') )
443
- {
444
- $tag_selector = '';
445
- if ( strstr($name, '_class') )
446
- $tag_selector = str_replace('email_form_tags_class_', '.', $name);
447
- else if ( strstr($name, '_id') )
448
- $tag_selector = str_replace('email_form_tags_id_', '#', $name);
449
-
450
- if ( $tag_selector )
451
- {
452
- if ( ! strstr($tag_form_selectors, $tag_selector) )
453
- $tag_form_selectors .= $tag_selector . ',';
454
- }
455
- } // Create a comma deliniated list of synced lists for tag_synced_lists
456
- else if ( strstr($name, 'email_connect_') )
457
- {
458
- // Name comes through as email_connect_espslug_listid, so replace the beginning of each one with corresponding esp slug, which leaves just the list id
459
- if ( strstr($name, '_mailchimp') )
460
- $synced_list = array('esp' => 'mailchimp', 'list_id' => str_replace('email_connect_mailchimp_', '', $name), 'list_name' => $value);
461
- else if ( strstr($name, '_constant_contact') )
462
- $synced_list = array('esp' => 'constant_contact', 'list_id' => str_replace('email_connect_constant_contact_', '', $name), 'list_name' => $value);
463
- else if ( strstr($name, '_aweber') )
464
- $synced_list = array('esp' => 'aweber', 'list_id' => str_replace('email_connect_aweber_', '', $name), 'list_name' => $value);
465
- else if ( strstr($name, '_campaign_monitor') )
466
- $synced_list = array('esp' => 'campaign_monitor', 'list_id' => str_replace('email_connect_campaign_monitor_', '', $name), 'list_name' => $value);
467
- else if ( strstr($name, '_getresponse') )
468
- $synced_list = array('esp' => 'getresponse', 'list_id' => str_replace('email_connect_getresponse_', '', $name), 'list_name' => $value);
469
-
470
- array_push($tag_synced_lists, $synced_list);
471
- }
472
- }
473
-
474
- if ( $_POST['email_form_tags_custom'] )
475
- {
476
- if ( strstr($_POST['email_form_tags_custom'], ',') )
477
- {
478
- foreach ( explode(',', $_POST['email_form_tags_custom']) as $tag )
479
- {
480
- if ( ! strstr($tag_form_selectors, $tag) )
481
- $tag_form_selectors .= $tag . ',';
482
- }
483
- }
484
- else
485
- {
486
- if ( ! strstr($tag_form_selectors, $_POST['email_form_tags_custom']) )
487
- $tag_form_selectors .= $_POST['email_form_tags_custom'] . ',';
488
- }
489
- }
490
-
491
- // Sanitize the selectors by removing any spaces and any trailing commas
492
- $tag_form_selectors = rtrim(str_replace(' ', '', $tag_form_selectors), ',');
493
-
494
- if ( $tag_id )
495
- {
496
- $tagger->save_tag(
497
- $tag_id,
498
- $tag_name,
499
- $tag_form_selectors,
500
- serialize($tag_synced_lists)
501
- );
502
- }
503
- else
504
- {
505
- $tagger->tag_id = $tagger->add_tag(
506
- $tag_name,
507
- $tag_form_selectors,
508
- serialize($tag_synced_lists)
509
- );
510
- }
511
- }
512
-
513
- echo '<div id="leadin" class="wrap '. ( $wp_version < 3.8 && !is_plugin_active('mp6/mp6.php') ? 'pre-mp6' : ''). '">';
514
-
515
- if ( $this->action == 'edit_tag' || $this->action == 'add_tag' ) {
516
- $this->leadin_render_tag_editor();
517
- }
518
- else
519
- {
520
- $this->leadin_render_tag_list_page();
521
- }
522
-
523
- $this->leadin_footer();
524
-
525
- echo '</div>';
526
- }
527
-
528
- /**
529
- * Creates list table for Contacts page
530
- *
531
  */
532
- function leadin_render_tag_editor ()
533
- {
534
- ?>
535
- <div class="leadin-contacts">
536
- <?php
537
-
538
- if ( $this->action == 'edit_tag' || $this->action == 'add_tag' )
539
- {
540
- $tag_id = ( isset($_GET['tag']) ? $_GET['tag'] : FALSE);
541
- $tagger = new LI_Tag_Editor($tag_id);
542
- }
543
-
544
- if ( $tagger->tag_id )
545
- $tagger->get_tag_details($tagger->tag_id);
546
-
547
- echo '<a href="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=leadin_tags">&larr; Manage tags</a>';
548
-
549
- if ( $this->action == 'edit_tag' ) {
550
- $this->leadin_header('Edit a tag', 'leadin-contacts__header', 'Loaded Tag Editor');
551
- } else {
552
- $this->leadin_header('Add a tag', 'leadin-contacts__header', 'Loaded Add Tag');
553
- }
554
- ?>
555
-
556
- <div class="">
557
- <form id="leadin-tag-settings" action="<?php echo get_bloginfo('wpurl') . '/wp-admin/admin.php?page=leadin_tags'; ?>" method="POST">
558
-
559
- <table class="form-table"><tbody>
560
- <tr>
561
- <th scope="row"><label for="tag_name">Tag name</label></th>
562
- <td><input name="tag_name" type="text" id="tag_name" value="<?php echo ( isset($tagger->details->tag_text) ? $tagger->details->tag_text : '' ); ?>" class="regular-text" placeholder="Tag Name"></td>
563
- </tr>
564
-
565
- <tr>
566
- <th scope="row">Automatically tag contacts who fill out any of these forms</th>
567
- <td>
568
- <fieldset>
569
- <legend class="screen-reader-text"><span>Automatically tag contacts who fill out any of these forms</span></legend>
570
- <?php
571
- $tag_form_selectors = ( isset($tagger->details->tag_form_selectors) ? explode(',', str_replace(' ', '', $tagger->details->tag_form_selectors)) : '');
572
-
573
- foreach ( $tagger->selectors as $selector )
574
- {
575
- $html_id = 'email_form_tags_' . str_replace(array('#', '.'), array('id_', 'class_'), $selector);
576
- $selector_set = FALSE;
577
-
578
- if ( isset($tagger->details->tag_form_selectors) && strstr($tagger->details->tag_form_selectors, $selector) )
579
- {
580
- $selector_set = TRUE;
581
- $key = array_search($selector, $tag_form_selectors);
582
- if ( $key !== FALSE )
583
- unset($tag_form_selectors[$key]);
584
- }
585
-
586
- echo '<label for="' . $html_id . '">';
587
- echo '<input name="' . $html_id . '" type="checkbox" id="' . $html_id . '" value="" ' . ( $selector_set ? 'checked' : '' ) . '>';
588
- echo $selector;
589
- echo '</label><br>';
590
- }
591
- ?>
592
- </fieldset>
593
- <br>
594
- <input name="email_form_tags_custom" type="text" value="<?php echo ( $tag_form_selectors ? implode(', ', $tag_form_selectors) : ''); ?>" class="regular-text" placeholder="#form-id, .form-class">
595
- <p class="description">Include additional form's css selectors.</p>
596
- </td>
597
- </tr>
598
-
599
-
600
- <?php
601
 
602
- foreach ( $this->esp_power_ups as $power_up_name => $power_up_slug )
603
- {
604
- if ( WPLeadIn::is_power_up_active($power_up_slug) )
605
- {
606
- global ${'leadin_' . $power_up_slug . '_wp'}; // e.g leadin_mailchimp_connect_wp
607
- $esp_name = strtolower(str_replace('_connect', '', $power_up_slug)); // e.g. mailchimp
608
-
609
- if ( ${'leadin_' . $power_up_slug . '_wp'}->admin->authed && ! ${'leadin_' . $power_up_slug . '_wp'}->admin->invalid_key )
610
- $lists = ${'leadin_' . $power_up_slug . '_wp'}->admin->li_get_lists();
611
-
612
- $synced_lists = ( isset($tagger->details->tag_synced_lists) ? unserialize($tagger->details->tag_synced_lists) : '' );
613
-
614
- echo '<tr>';
615
- echo '<th scope="row">Push tagged contacts to these ' . $power_up_name . ' lists</th>';
616
- echo '<td>';
617
- echo '<fieldset>';
618
- echo '<legend class="screen-reader-text"><span>Push tagged contacts to these ' . $power_up_name . ' email lists</span></legend>';
619
- //
620
- $esp_name_readable = ucwords(str_replace('_', ' ', $esp_name));
621
- $esp_url = str_replace('_', '', $esp_name) . '.com';
622
-
623
- switch ( $esp_name )
624
- {
625
- case 'mailchimp' :
626
- $esp_list_url = 'http://admin.mailchimp.com/lists/new-list/';
627
- $settings_page_anchor_id = '#li_mls_api_key';
628
- $invalid_key_message = 'It looks like your ' . $esp_name_readable . ' API key is invalid...<br/><br/>';
629
- $invalid_key_link = '<a target="_blank" href="http://kb.mailchimp.com/accounts/management/about-api-keys#Find-or-Generate-Your-API-Key">Get your API key</a> from <a href="http://admin.mailchimp.com/account/api/" target="_blank">MailChimp.com</a>';
630
- break;
631
-
632
- case 'constant_contact' :
633
- $esp_list_url = 'https://login.constantcontact.com/login/login.sdo?goto=https://ui.constantcontact.com/rnavmap/distui/contacts';
634
- $settings_page_anchor_id = '#li_cc_email';
635
- break;
636
-
637
- case 'aweber' :
638
- $esp_list_url = 'https://www.aweber.com/users/newlist#about';
639
- $settings_page_anchor_id = '#li_ac_auth_code';
640
- $invalid_key_message = 'It looks like your ' . $esp_name_readable . ' Authorization Code is invalid...<br/><br/>';
641
- $invalid_key_link = '<a target="_blank" href="https://help.aweber.com/hc/en-us/articles/204031226-How-Do-I-Authorize-an-App-">Get your Authorization Code</a> from <a href="https://auth.aweber.com/1.0/oauth/authorize_app/156b03fb" target="_blank">AWeber.com</a>';
642
- break;
643
-
644
- case 'campaign_monitor' :
645
- $esp_list_url = 'https://login.createsend.com/l';
646
- $settings_page_anchor_id = '#li_cm_api_key';
647
- $invalid_key_message = 'It looks like your ' . $esp_name_readable . ' API key is invalid...<br/><br/>';
648
- $invalid_key_link = '<a target="_blank" href="http://help.campaignmonitor.com/topic.aspx?t=206">Get your API key</a> from <a href="https://login.createsend.com/l" target="_blank">CampaignMonitor.com</a>';
649
- break;
650
-
651
- case 'getresponse' :
652
- $esp_list_url = 'https://app.getresponse.com/create_campaign.html';
653
- $settings_page_anchor_id = '#li_gr_api_key';
654
- $invalid_key_message = 'It looks like your ' . $esp_name_readable . ' API key is invalid...<br/><br/>';
655
- $invalid_key_link = '<a target="_blank" href="http://support.getresponse.com/faq/where-i-find-api-key">Get your API key</a> from <a href="https://app.getresponse.com/account.html#api" target="_blank">GetResponse.com</a>';
656
- break;
657
-
658
- default:
659
- $esp_list_url = '';
660
- $settings_page_anchor_id = '';
661
- break;
662
- }
663
-
664
- if ( ! ${'leadin_' . $power_up_slug . '_wp'}->admin->authed )
665
- {
666
- echo 'It looks like you haven\'t set up your ' . $esp_name_readable . ' integration yet...<br/><br/>';
667
- echo '<a href="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=leadin_settings' . $settings_page_anchor_id . '">Set up your ' . $esp_name_readable . ' integration</a>';
668
- }
669
- else if ( isset(${'leadin_' . $power_up_slug . '_wp'}->admin->invalid_key) && ${'leadin_' . $power_up_slug . '_wp'}->admin->invalid_key )
670
- {
671
- echo $invalid_key_message;
672
- echo '<p>' . $invalid_key_link . ' then try copying and pasting it again in <a href="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=leadin_settings' . $settings_page_anchor_id . '">Leadin → Settings</a></p>';
673
- }
674
- else if ( count($lists) )
675
- {
676
- foreach ( $lists as $list )
677
- {
678
- $list_id = $list->id;
679
-
680
- // Hack for constant contact's list id string (e.g. http://api.constantcontact.com/ws/customers/name%40website.com/lists/1234567890)
681
- if ( $power_up_name == 'Constant Contact' )
682
- $list_id = end(explode('/', $list_id));
683
-
684
- $html_id = 'email_connect_' . $esp_name . '_' . $list_id;
685
- $synced = FALSE;
686
-
687
- if ( $synced_lists )
688
- {
689
-
690
- // Search the synched lists for this tag for the list_id
691
- $key = leadin_array_search_deep($list_id, $synced_lists, 'list_id');
692
-
693
- if ( isset($key) )
694
- {
695
- // Double check that the list is synced with the actual ESP
696
- if ( $synced_lists[$key]['esp'] == $esp_name )
697
- $synced = TRUE;
698
- }
699
- }
700
-
701
- echo '<label for="' . $html_id . '">';
702
- echo '<input name="' . $html_id . '" type="checkbox" id="' . $html_id . '" value="' . $list->name . '" ' . ( $synced ? 'checked' : '' ) . '>';
703
- echo $list->name;
704
- echo '</label><br>';
705
- }
706
- }
707
- else
708
- {
709
- echo 'It looks like you don\'t have any ' . $esp_name_readable . ' lists yet...<br/><br/>';
710
- echo '<a href="' . $esp_list_url . '" target="_blank">Create a list on ' . $esp_url . '</a>';
711
- }
712
- echo '</fieldset>';
713
- echo '</td>';
714
- echo '</tr>';
715
- }
716
- }
717
- ?>
718
-
719
- </tbody></table>
720
- <input type="hidden" name="tag_id" value="<?php echo $tag_id; ?>"/>
721
- <p class="submit">
722
- <input type="submit" name="submit" id="submit" class="button button-primary" value="Save Changes">
723
- </p>
724
- </form>
725
- </div>
726
-
727
- </div>
728
-
729
- <?php
730
- }
731
-
732
- /**
733
- * Creates list table for Contacts page
734
- *
735
- */
736
- function leadin_render_tag_list_page ()
737
- {
738
  global $wp_version;
739
 
740
- if ( $this->action == 'delete_tag')
741
- {
742
- $tag_id = ( isset($_GET['tag']) ? $_GET['tag'] : FALSE);
743
- $tagger = new LI_Tag_Editor($tag_id);
744
- $tagger->delete_tag($tag_id);
745
- }
746
-
747
- //Create an instance of our package class...
748
- $leadinTagsTable = new LI_Tags_Table();
749
-
750
- // Process any bulk actions before the contacts are grabbed from the database
751
- $leadinTagsTable->process_bulk_action();
752
-
753
- //Fetch, prepare, sort, and filter our data...
754
- $leadinTagsTable->data = $leadinTagsTable->get_tags();
755
- $leadinTagsTable->prepare_items();
756
-
757
- ?>
758
- <div class="leadin-contacts">
759
-
760
- <?php
761
- $this->leadin_header('Manage Leadin Tags <a href="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=leadin_tags&action=add_tag" class="add-new-h2">Add New</a>', 'leadin-contacts__header', 'Loaded Tag List');
762
- ?>
763
-
764
- <div class="">
765
-
766
- <!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
767
- <form id="" method="GET">
768
- <input type="hidden" name="page" value="<?php echo $_REQUEST['page'] ?>" />
769
-
770
- <div class="leadin-contacts__table">
771
- <?php $leadinTagsTable->display(); ?>
772
- </div>
773
 
774
- <input type="hidden" name="contact_type" value="<?php echo ( isset($_GET['contact_type']) ? $_GET['contact_type'] : '' ); ?>"/>
775
-
776
- <?php if ( isset($_GET['filter_content']) ) : ?>
777
- <input type="hidden" name="filter_content" value="<?php echo ( isset($_GET['filter_content']) ? stripslashes($_GET['filter_content']) : '' ); ?>"/>
778
- <?php endif; ?>
779
 
780
- <?php if ( isset($_GET['filter_action']) ) : ?>
781
- <input type="hidden" name="filter_action" value="<?php echo ( isset($_GET['filter_action']) ? $_GET['filter_action'] : '' ); ?>"/>
782
- <?php endif; ?>
783
-
784
- </form>
785
-
786
- </div>
787
-
788
- </div>
789
-
790
- <?php
791
- }
792
-
793
-
794
- /**
795
- * Creates contacts chart content
796
- */
797
- function leadin_build_contacts_chart_stats ()
798
- {
799
- $contacts_chart = "";
800
-
801
- $contacts_chart .= "<div class='leadin-stats__chart-container'>";
802
- $contacts_chart .= "<div id='contacts_chart' style='width:100%; height:250px;'></div>";
803
- $contacts_chart .= "</div>";
804
- $contacts_chart .= "<div class='leadin-stats__big-numbers-container'>";
805
- $contacts_chart .= "<div class='leadin-stats__big-number'>";
806
- $contacts_chart .= "<label class='leadin-stats__big-number-top-label'>TODAY</label>";
807
- $contacts_chart .= "<h1 class='leadin-stats__big-number-content'>" . number_format($this->stats_dashboard->total_new_contacts) . "</h1>";
808
- $contacts_chart .= "<label class='leadin-stats__big-number-bottom-label'>new " . ( $this->stats_dashboard->total_new_contacts != 1 ? 'contacts' : 'contact' ) . "</label>";
809
- $contacts_chart .= "</div>";
810
- $contacts_chart .= "<div class='leadin-stats__big-number big-number--average'>";
811
- $contacts_chart .= "<label class='leadin-stats__big-number-top-label'>AVG LAST 90 DAYS</label>";
812
- $contacts_chart .= "<h1 class='leadin-stats__big-number-content'>" . number_format($this->stats_dashboard->avg_contacts_last_90_days) . "</h1>";
813
- $contacts_chart .= "<label class='leadin-stats__big-number-bottom-label'>new " . ( $this->stats_dashboard->avg_contacts_last_90_days != 1 ? 'contacts' : 'contact' ) . "</label>";
814
- $contacts_chart .= "</div>";
815
- $contacts_chart .= "<div class='leadin-stats__big-number'>";
816
- $contacts_chart .= "<label class='leadin-stats__big-number-top-label'>BEST DAY EVER</label>";
817
- $contacts_chart .= "<h1 class='leadin-stats__big-number-content'>" . number_format($this->stats_dashboard->best_day_ever) . "</h1>";
818
- $contacts_chart .= "<label class='leadin-stats__big-number-bottom-label'>new " . ( $this->stats_dashboard->best_day_ever != 1 ? 'contacts' : 'contact' ) . "</label>";
819
- $contacts_chart .= "</div>";
820
- $contacts_chart .= "<div class='leadin-stats__big-number'>";
821
- $contacts_chart .= "<label class='leadin-stats__big-number-top-label'>ALL TIME</label>";
822
- $contacts_chart .= "<h1 class='leadin-stats__big-number-content'>" . number_format($this->stats_dashboard->total_contacts) . "</h1>";
823
- $contacts_chart .= "<label class='leadin-stats__big-number-bottom-label'>total " . ( $this->stats_dashboard->total_contacts != 1 ? 'contacts' : 'contact' ) . "</label>";
824
- $contacts_chart .= "</div>";
825
- $contacts_chart .= "</div>";
826
-
827
- return $contacts_chart;
828
- }
829
-
830
- /**
831
- * Creates contacts chart content
832
- */
833
- function leadin_build_new_contacts_postbox ()
834
- {
835
- $new_contacts_postbox = "";
836
-
837
- if ( count($this->stats_dashboard->new_contacts) )
838
- {
839
- $new_contacts_postbox .= '<table class="leadin-postbox__table"><tbody>';
840
- $new_contacts_postbox .= '<tr>';
841
- $new_contacts_postbox .= '<th>contact</th>';
842
- $new_contacts_postbox .= '<th>pageviews</th>';
843
- $new_contacts_postbox .= '<th>original source</th>';
844
- $new_contacts_postbox .= '</tr>';
845
-
846
- foreach ( $this->stats_dashboard->new_contacts as $contact )
847
- {
848
- $new_contacts_postbox .= '<tr>';
849
- $new_contacts_postbox .= '<td class="">';
850
- $new_contacts_postbox .= '<a href="?page=leadin_contacts&action=view&lead=' . $contact->lead_id . '&stats_dashboard=1"><img class="lazy pull-left leadin-contact-avatar leadin-dynamic-avatar_' . substr($contact->lead_id, -1) .'" src="https://api.hubapi.com/socialintel/v1/avatars?email=' . $contact->lead_email . '" width="35" height="35"><b>' . $contact->lead_email . '</b></a>';
851
- $new_contacts_postbox .= '</td>';
852
- $new_contacts_postbox .= '<td class="">' . $contact->pageviews . '</td>';
853
- $new_contacts_postbox .= '<td class="">' . $this->stats_dashboard->print_readable_source($this->stats_dashboard->check_lead_source($contact->lead_source, $contact->lead_origin_url)) . '</td>';
854
- $new_contacts_postbox .= '</tr>';
855
- }
856
-
857
- $new_contacts_postbox .= '</tbody></table>';
858
- }
859
- else
860
- $new_contacts_postbox .= '<i>No new contacts today...</i>';
861
-
862
- return $new_contacts_postbox;
863
- }
864
-
865
- /**
866
- * Creates contacts chart content
867
- */
868
- function leadin_build_returning_contacts_postbox ()
869
- {
870
- $returning_contacts_postbox = "";
871
-
872
- if ( count($this->stats_dashboard->returning_contacts) )
873
- {
874
- $returning_contacts_postbox .= '<table class="leadin-postbox__table"><tbody>';
875
- $returning_contacts_postbox .= '<tr>';
876
- $returning_contacts_postbox .= '<th>contact</th>';
877
- $returning_contacts_postbox .= '<th>pageviews</th>';
878
- $returning_contacts_postbox .= '<th>original source</th>';
879
- $returning_contacts_postbox .= '</tr>';
880
-
881
- foreach ( $this->stats_dashboard->returning_contacts as $contact )
882
- {
883
- $returning_contacts_postbox .= '<tr>';
884
- $returning_contacts_postbox .= '<td class="">';
885
- $returning_contacts_postbox .= '<a href="?page=leadin_contacts&action=view&lead=' . $contact->lead_id . '&stats_dashboard=1"><img class="lazy pull-left leadin-contact-avatar leadin-dynamic-avatar_' . substr($contact->lead_id, -1) .'" src="https://api.hubapi.com/socialintel/v1/avatars?email=' . $contact->lead_email . '" width="35" height="35"><b>' . $contact->lead_email . '</b></a>';
886
- $returning_contacts_postbox .= '</td>';
887
- $returning_contacts_postbox .= '<td class="">' . $contact->pageviews . '</td>';
888
- $returning_contacts_postbox .= '<td class="">' . $this->stats_dashboard->print_readable_source($this->stats_dashboard->check_lead_source($contact->lead_source, $contact->lead_origin_url)) . '</td>';
889
- $returning_contacts_postbox .= '</tr>';
890
- }
891
-
892
- $returning_contacts_postbox .= '</tbody></table>';
893
- }
894
- else
895
- $returning_contacts_postbox .= '<i>No returning contacts today...</i>';
896
-
897
- return $returning_contacts_postbox;
898
- }
899
-
900
- /**
901
- * Creates contacts chart content
902
- */
903
- function leadin_build_sources_postbox ()
904
- {
905
- $sources_postbox = "";
906
-
907
- $sources_postbox .= '<table class="leadin-postbox__table"><tbody>';
908
- $sources_postbox .= '<tr>';
909
- $sources_postbox .= '<th width="150">source</th>';
910
- $sources_postbox .= '<th width="20">Contacts</th>';
911
- $sources_postbox .= '<th></th>';
912
- $sources_postbox .= '</tr>';
913
- $sources_postbox .= '<tr>';
914
- $sources_postbox .= '<td class="">Direct Traffic</td>';
915
- $sources_postbox .= '<td class="sources-contacts-num">' . $this->stats_dashboard->direct_count . '</td>';
916
- $sources_postbox .= '<td>';
917
- $sources_postbox .= '<div style="background: #f0f0f0; padding: 0px; height: 20px !important;"><div style="background: #f16b18; height: 100%; width: ' . ( $this->stats_dashboard->max_source ? (($this->stats_dashboard->direct_count/$this->stats_dashboard->max_source)*100) : '0' ) . '%;">&nbsp;</div></div>';
918
- $sources_postbox .= '</td>';
919
- $sources_postbox .= '</tr>';
920
- $sources_postbox .= '<tr>';
921
- $sources_postbox .= '<td class="">Organic Search</td>';
922
- $sources_postbox .= '<td class="sources-contacts-num">' . $this->stats_dashboard->organic_count . '</td>';
923
- $sources_postbox .= '<td>';
924
- $sources_postbox .= '<div style="background: #f0f0f0; padding: 0px; height: 20px !important;"><div style="background: #f16b18; height: 100%; width: ' . ( $this->stats_dashboard->max_source ? (($this->stats_dashboard->organic_count/$this->stats_dashboard->max_source)*100) : '0' ) . '%;">&nbsp;</div></div>';
925
- $sources_postbox .= '</td>';
926
- $sources_postbox .= '</tr>';
927
- $sources_postbox .= '<tr>';
928
- $sources_postbox .= '<td class="">Referrals</td>';
929
- $sources_postbox .= '<td class="sources-contacts-num">' . $this->stats_dashboard->referral_count . '</td>';
930
- $sources_postbox .= '<td>';
931
- $sources_postbox .= '<div style="background: #f0f0f0; padding: 0px; height: 20px !important;"><div style="background: #f16b18; height: 100%; width: ' . ( $this->stats_dashboard->max_source ? (($this->stats_dashboard->referral_count/$this->stats_dashboard->max_source)*100) : '0' ) . '%;">&nbsp;</div></div>';
932
- $sources_postbox .= '</td>';
933
- $sources_postbox .= '</tr>';
934
- $sources_postbox .= '<tr>';
935
- $sources_postbox .= '<td class="">Social Media</td>';
936
- $sources_postbox .= '<td class="sources-contacts-num">' . $this->stats_dashboard->social_count . '</td>';
937
- $sources_postbox .= '<td>';
938
- $sources_postbox .= '<div style="background: #f0f0f0; padding: 0px; height: 20px !important;"><div style="background: #f16b18; height: 100%; width: ' . ( $this->stats_dashboard->max_source ? (($this->stats_dashboard->social_count/$this->stats_dashboard->max_source)*100) : '0' ). '%;">&nbsp;</div></div>';
939
- $sources_postbox .= '</td>';
940
- $sources_postbox .= '</tr>';
941
- $sources_postbox .= '<tr>';
942
- $sources_postbox .= '<td class="">Email Marketing</td>';
943
- $sources_postbox .= '<td class="sources-contacts-num">' . $this->stats_dashboard->email_count . '</td>';
944
- $sources_postbox .= '<td>';
945
- $sources_postbox .= '<div style="background: #f0f0f0; padding: 0px; height: 20px !important;"><div style="background: #f16b18; height: 100%; width: ' . ( $this->stats_dashboard->max_source ? (($this->stats_dashboard->email_count/$this->stats_dashboard->max_source)*100) : '0' ) . '%;">&nbsp;</div></div>';
946
- $sources_postbox .= '</td>';
947
- $sources_postbox .= '</tr>';
948
- $sources_postbox .= '<tr>';
949
- $sources_postbox .= '<td class="">Paid Search</td>';
950
- $sources_postbox .= '<td class="sources-contacts-num">' . $this->stats_dashboard->paid_count . '</td>';
951
- $sources_postbox .= '<td>';
952
- $sources_postbox .= '<div style="background: #f0f0f0; padding: 0px; height: 20px !important;"><div style="background: #f16b18; height: 100%; width: ' . ( $this->stats_dashboard->max_source ? (($this->stats_dashboard->paid_count/$this->stats_dashboard->max_source)*100) : '0' ) . '%;">&nbsp;</div></div>';
953
- $sources_postbox .= '</td>';
954
- $sources_postbox .= '</tr>';
955
- $sources_postbox .= '</tbody></table>';
956
-
957
- return $sources_postbox;
958
- }
959
-
960
- /**
961
- * Creates settings options
962
- */
963
- function leadin_build_settings_page ()
964
- {
965
- global $leadin_contacts;
966
-
967
- // Show the settings popup on all pages except the settings page
968
- if ( isset($_GET['page']) && $_GET['page'] == 'leadin_settings' )
969
- {
970
- $options = get_option('leadin_options');
971
- if ( ! isset($options['ignore_settings_popup']) || ! $options['ignore_settings_popup'] )
972
- leadin_update_option('leadin_options', 'ignore_settings_popup', 1);
973
- }
974
-
975
- register_setting(
976
- 'leadin_settings_options',
977
- 'leadin_options',
978
- array($this, 'sanitize')
979
- );
980
-
981
- $visitor_tracking_icon = $leadin_contacts->icon_small;
982
-
983
- add_settings_section(
984
- 'leadin_settings_section',
985
- $visitor_tracking_icon . 'Visitor Tracking',
986
- array($this, 'leadin_options_section_heading'),
987
- LEADIN_ADMIN_PATH
988
- );
989
-
990
- add_settings_field(
991
- 'li_email',
992
- 'Your email',
993
- array($this, 'li_email_callback'),
994
- LEADIN_ADMIN_PATH,
995
- 'leadin_settings_section'
996
- );
997
-
998
- add_settings_field(
999
- 'li_do_not_track',
1000
- 'Do not track logged in',
1001
- array($this, 'li_do_not_track_callback'),
1002
- LEADIN_ADMIN_PATH,
1003
- 'leadin_settings_section'
1004
- );
1005
-
1006
- add_settings_field(
1007
- 'li_grant_access',
1008
- 'Grant Leadin access to',
1009
- array($this, 'li_grant_access_callback'),
1010
- LEADIN_ADMIN_PATH,
1011
- 'leadin_settings_section'
1012
- );
1013
-
1014
- add_filter(
1015
- 'update_option_leadin_options',
1016
- array($this, 'update_option_leadin_options_callback'),
1017
- 10,
1018
- 2
1019
- );
1020
-
1021
- $this->esp_power_ups = array(
1022
- 'MailChimp' => 'mailchimp_connect',
1023
- 'Constant Contact' => 'constant_contact_connect',
1024
- 'AWeber' => 'aweber_connect',
1025
- 'GetResponse' => 'getresponse_connect',
1026
- 'MailPoet' => 'mailpoet_connect',
1027
- 'Campaign Monitor' => 'campaign_monitor_connect'
1028
- );
1029
- }
1030
-
1031
- function leadin_options_section_heading ( )
1032
- {
1033
- $this->print_hidden_settings_fields();
1034
- }
1035
-
1036
- function print_hidden_settings_fields ()
1037
- {
1038
- // Hacky solution to solve the Settings API overwriting the default values
1039
- $options = get_option('leadin_options');
1040
-
1041
- $li_installed = ( isset($options['li_installed']) ? $options['li_installed'] : 1 );
1042
- $li_db_version = ( isset($options['li_db_version']) ? $options['li_db_version'] : LEADIN_DB_VERSION );
1043
- $ignore_settings_popup = ( isset($options['ignore_settings_popup']) ? $options['ignore_settings_popup'] : 0 );
1044
- $onboarding_complete = ( isset($options['onboarding_complete']) ? $options['onboarding_complete'] : 0 );
1045
- $onboarding_step = ( isset($options['onboarding_step']) ? $options['onboarding_step'] : 1 );
1046
- $data_recovered = ( isset($options['data_recovered']) ? $options['data_recovered'] : 0 );
1047
- $delete_flags_fixed = ( isset($options['delete_flags_fixed']) ? $options['delete_flags_fixed'] : 0 );
1048
- $converted_to_tags = ( isset($options['converted_to_tags']) ? $options['converted_to_tags'] : 0 );
1049
- $names_added_to_contacts = ( isset($options['names_added_to_contacts']) ? $options['names_added_to_contacts'] : 0 );
1050
- $leadin_version = ( isset($options['leadin_version']) ? $options['leadin_version'] : LEADIN_PLUGIN_VERSION );
1051
- $pro = ( isset($options['pro']) ? $options['pro'] : 0 );
1052
- $li_updates_subscription = ( isset($options['li_updates_subscription']) ? $options['li_updates_subscription'] : 0 );
1053
-
1054
- printf(
1055
- '<input id="li_installed" type="hidden" name="leadin_options[li_installed]" value="%d"/>',
1056
- $li_installed
1057
- );
1058
-
1059
- printf(
1060
- '<input id="li_db_version" type="hidden" name="leadin_options[li_db_version]" value="%s"/>',
1061
- $li_db_version
1062
- );
1063
-
1064
- printf(
1065
- '<input id="ignore_settings_popup" type="hidden" name="leadin_options[ignore_settings_popup]" value="%d"/>',
1066
- $ignore_settings_popup
1067
- );
1068
-
1069
- printf(
1070
- '<input id="onboarding_step" type="hidden" name="leadin_options[onboarding_step]" value="%d"/>',
1071
- $onboarding_step
1072
- );
1073
-
1074
- printf(
1075
- '<input id="onboarding_complete" type="hidden" name="leadin_options[onboarding_complete]" value="%d"/>',
1076
- $onboarding_complete
1077
- );
1078
-
1079
- printf(
1080
- '<input id="data_recovered" type="hidden" name="leadin_options[data_recovered]" value="%d"/>',
1081
- $data_recovered
1082
- );
1083
-
1084
- printf(
1085
- '<input id="delete_flags_fixed" type="hidden" name="leadin_options[delete_flags_fixed]" value="%d"/>',
1086
- $delete_flags_fixed
1087
- );
1088
-
1089
- printf(
1090
- '<input id="converted_to_tags" type="hidden" name="leadin_options[converted_to_tags]" value="%d"/>',
1091
- $converted_to_tags
1092
- );
1093
-
1094
- printf(
1095
- '<input id="names_added_to_contacts" type="hidden" name="leadin_options[names_added_to_contacts]" value="%d"/>',
1096
- $names_added_to_contacts
1097
- );
1098
-
1099
- printf(
1100
- '<input id="leadin_version" type="hidden" name="leadin_options[leadin_version]" value="%s"/>',
1101
- $leadin_version
1102
- );
1103
-
1104
- printf(
1105
- '<input id="pro" type="hidden" name="leadin_options[pro]" value="%d"/>',
1106
- $pro
1107
- );
1108
-
1109
- printf(
1110
- '<input id="li_updates_subscription" type="hidden" name="leadin_options[li_updates_subscription]" value="%d"/>',
1111
- $li_updates_subscription
1112
- );
1113
- }
1114
-
1115
- function has_leads ( )
1116
- {
1117
- global $wpdb;
1118
-
1119
- $q = "SELECT COUNT(hashkey) FROM $wpdb->li_leads WHERE lead_deleted = 0 AND hashkey != '' AND lead_email != ''";
1120
- $num_contacts = $wpdb->get_var($q);
1121
-
1122
- if ( $num_contacts > 0 )
1123
- return TRUE;
1124
- else
1125
- return FALSE;
1126
  }
1127
 
1128
  function update_option_leadin_options_callback ( $old_value, $new_value )
1129
  {
1130
-
1131
- }
1132
-
1133
- /**
1134
- * Creates settings page
1135
- */
1136
- function leadin_plugin_options ()
1137
- {
1138
- $li_options = get_option('leadin_options');
1139
-
1140
- // Load onboarding if not complete
1141
- if ( $li_options['onboarding_complete'] == 0 )
1142
- {
1143
- $this->leadin_plugin_onboarding();
1144
- wp_register_script('leadin-admin-js', LEADIN_PATH . '/assets/js/build/leadin-admin.min.js', array ( 'jquery' ), FALSE, TRUE);
1145
- wp_enqueue_script('leadin-admin-js');
1146
- wp_localize_script('leadin-admin-js', 'li_admin_ajax', array('ajax_url' => get_admin_url(NULL,'') . '/admin-ajax.php'));
1147
- }
1148
- else
1149
- {
1150
- $this->leadin_plugin_settings();
1151
- }
1152
- }
1153
-
1154
- /**
1155
- * Creates onboarding settings page
1156
- */
1157
- function leadin_plugin_onboarding ()
1158
- {
1159
- global $wp_version;
1160
-
1161
- $li_options = get_option('leadin_options');
1162
-
1163
- echo '<div id="leadin" class="li-onboarding wrap centered'. ( $wp_version < 3.8 && !is_plugin_active('mp6/mp6.php') ? 'pre-mp6' : ''). '">';
1164
-
1165
- ?>
1166
-
1167
- <div class="oboarding-steps">
1168
-
1169
- <img src="<?php echo LEADIN_PATH . '/images/leadin_logo.png' ; ?>" width="147px">
1170
-
1171
- <?php if ( $li_options['onboarding_step'] <= 1 ) : ?>
1172
-
1173
- <?php $this->leadin_header('You\'re 3 steps away from understanding your visitors better.' , 'li_setup_header', 'Onboarding Step 2 - Get Contact Reports'); ?>
1174
-
1175
- <ol class="oboarding-steps-names">
1176
- <li class="oboarding-step-name completed">Activate Leadin</li>
1177
- <li class="oboarding-step-name active">Get Contact Reports</li>
1178
- <li class="oboarding-step-name">Grow Your Contacts List</li>
1179
- <li class="oboarding-step-name">Email your new contacts</li>
1180
- </ol>
1181
- <div class="oboarding-step">
1182
- <h2 class="oboarding-step-title">Where should we send your contact reports?</h2>
1183
- <div class="oboarding-step-content">
1184
- <p class="oboarding-step-description">Leadin will help you get to know your website visitors by sending you a report including traffic source and pageview history each time a visitor fills out a form.</p>
1185
- <form id="li-onboarding-form" method="post" action="options.php">
1186
- <div>
1187
- <?php settings_fields('leadin_settings_options'); ?>
1188
- <?php $this->li_email_callback(); ?>
1189
- </div>
1190
- <?php $this->print_hidden_settings_fields(); ?>
1191
-
1192
- <p id="agree-pp-error" style="display: none; border-left: 4px solid #dd3d36; padding: 8px 12px; margin-bottom: 25px; background: #fff;">
1193
- Before you can unlock the awesomeness of Leadin , we need you to agree to our Privacy Policy, you know... because lawyers.
1194
- </p>
1195
-
1196
- <p>
1197
- <label for="agree-pp">
1198
- <input type="checkbox" id="agree-pp" name="agree-pp"/>
1199
- I agree to Leadin's <a href="http://leadin.com/legal/privacy-policy" target="_blank">Privacy Policy</a>
1200
- </label>
1201
- </p>
1202
-
1203
- <input type="submit" name="submit" id="onboarding-step-1-button" class="button button-primary button-big" style="margin-top: 15px;" value="<?php esc_attr_e('Save Email'); ?>">
1204
- </form>
1205
- </div>
1206
- </div>
1207
- <!-- Facebook Conversion Code for Installed plugin -->
1208
- <script>(function() {
1209
- var _fbq = window._fbq || (window._fbq = []);
1210
- if (!_fbq.loaded) {
1211
- var fbds = document.createElement('script');
1212
- fbds.async = true;
1213
- fbds.src = '//connect.facebook.net/en_US/fbds.js';
1214
- var s = document.getElementsByTagName('script')[0];
1215
- s.parentNode.insertBefore(fbds, s);
1216
- _fbq.loaded = true;
1217
- }
1218
- })();
1219
- window._fbq = window._fbq || [];
1220
- window._fbq.push(['track', '6024677413664', {'value':'0.00','currency':'USD'}]);
1221
- </script>
1222
- <noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?ev=6024677413664&amp;cd[value]=0.00&amp;cd[currency]=USD&amp;noscript=1" /></noscript>
1223
-
1224
- <?php elseif ( $li_options['onboarding_step'] == 2 && !isset($_GET['activate_popup']) && !isset($_GET['activate_esp']) ) : ?>
1225
-
1226
- <?php
1227
- // Upgrade to Pro in the database
1228
- leadin_upgrade_to_pro('onboarding');
1229
- ?>
1230
-
1231
- <?php $this->leadin_header('You\'re 2 steps away from understanding your visitors better.', 'li_setup_header', 'Onboarding Step 3 - Grow Your Contact List'); ?>
1232
-
1233
- <ol class="oboarding-steps-names">
1234
- <li class="oboarding-step-name completed">Activate Leadin</li>
1235
- <li class="oboarding-step-name completed">Get Contact Reports</li>
1236
- <li class="oboarding-step-name active">Grow Your Contacts List</li>
1237
- <li class="oboarding-step-name">Email your new contacts</li>
1238
- </ol>
1239
- <div class="oboarding-step">
1240
- <h2 class="oboarding-step-title">Grow your contacts list with our popup form</h2>
1241
- <div class="oboarding-step-content">
1242
- <p class="oboarding-step-description">Start converting more visitors to contacts on <?php echo get_bloginfo('wpurl') ?>. Don't worry, you'll be able to customize this form more later.</p>
1243
- </div>
1244
- <form id="li-onboarding-form" method="post" action="options.php">
1245
- <?php $this->print_hidden_settings_fields(); ?>
1246
- <div class="popup-options">
1247
- <label class="popup-option">
1248
- <input type="radio" name="popup-position" value="slide_in" checked="checked" >Slide in
1249
- <img src="<?php echo LEADIN_PATH ?>/images/popup-bottom.png">
1250
- </label>
1251
- <label class="popup-option">
1252
- <input type="radio" name="popup-position" value="popup">Popup
1253
- <img src="<?php echo LEADIN_PATH ?>/images/popup-over.png">
1254
- </label>
1255
- <label class="popup-option">
1256
- <input type="radio" name="popup-position" value="top">Top
1257
- <img src="<?php echo LEADIN_PATH ?>/images/popup-top.png">
1258
- </label>
1259
- </div>
1260
- <a id="btn-activate-subscribe" href="<?php echo get_admin_url() .'admin.php?page=leadin_settings&leadin_action=activate&power_up=subscribe_widget&redirect_to=' . get_admin_url() . urlencode('admin.php?page=leadin_settings&activate_popup=true&popup_position=slide_in'); ?>" class="button button-primary button-big"><?php esc_attr_e('Activate the popup form');?></a>
1261
- <p><a href="<?php echo get_admin_url() .'admin.php?page=leadin_settings&activate_popup=false'; ?>">Don't activate the popup form right now</a></p>
1262
- </form>
1263
- </div>
1264
-
1265
- <?php elseif ( isset($_GET['activate_popup']) && !isset($_GET['activate_esp']) ) : ?>
1266
-
1267
- <?php
1268
- // Set the popup position based on get URL
1269
- if ( isset($_GET['activate_popup']) ) {
1270
- if ( isset($_GET['popup_position']) ) {
1271
- $vex_class_option = '';
1272
- switch ( $_GET['popup_position'] ) {
1273
- case 'slide_in' :
1274
- $vex_class_option = 'vex-theme-bottom-right-corner';
1275
- break;
1276
-
1277
- case 'popup' :
1278
- $vex_class_option = 'vex-theme-default';
1279
- break;
1280
-
1281
- case 'top' :
1282
- $vex_class_option = 'vex-theme-top';
1283
- break;
1284
- }
1285
-
1286
- leadin_update_option('leadin_subscribe_options', 'li_subscribe_vex_class', $vex_class_option);
1287
- leadin_track_plugin_activity('Onboarding Popup Activated');
1288
- }
1289
- else {
1290
- leadin_track_plugin_activity('Onboarding Popup Not Activated');
1291
- }
1292
- }
1293
-
1294
- ?>
1295
-
1296
- <?php $this->leadin_header('You\'re 1 step away from understanding your visitors better.', 'li_setup_header', 'Onboarding Step 4 - Email your contacts'); ?>
1297
-
1298
- <ol class="oboarding-steps-names">
1299
- <li class="oboarding-step-name completed">Activate Leadin</li>
1300
- <li class="oboarding-step-name completed">Get Contact Reports</li>
1301
- <li class="oboarding-step-name completed">Grow Your Contacts List</li>
1302
- <li class="oboarding-step-name active">Email your new contacts</li>
1303
- </ol>
1304
- <div class="oboarding-step">
1305
- <h2 class="oboarding-step-title">Which email provider do you use?</h2>
1306
- <div class="oboarding-step-content">
1307
- <p class="oboarding-step-description">Leadin works best when connected to an email provider. Don’t worry, we won’t start syncing contacts until we get your account details later.</p>
1308
- </div>
1309
- <form id="li-onboarding-form" method="post" action="options.php">
1310
- <?php $this->print_hidden_settings_fields(); ?>
1311
- <div class="popup-options">
1312
- <label class="esp-option">
1313
- <input type="radio" name="esp" value="mailchimp_connect" checked="checked" ><span class="esp-name mailchimp">MailChimp</span>
1314
- </label>
1315
- <label class="esp-option">
1316
- <input type="radio" name="esp" value="constant_contact_connect"><span class="esp-name constant-contact">Constant Contact</span>
1317
- </label>
1318
- <label class="esp-option">
1319
- <input type="radio" name="esp" value="aweber_connect"><span class="esp-name aweber">Aweber</span>
1320
- </label>
1321
- <label class="esp-option">
1322
- <input type="radio" name="esp" value="getresponse_connect"><span class="esp-name getresponse">GetResponse</span>
1323
- </label>
1324
- <label class="esp-option">
1325
- <input type="radio" name="esp" value="campaign_monitor_connect"><span class="esp-name campaign-monitor">CampaignMonitor</span>
1326
- </label>
1327
- </div>
1328
- <a id="btn-activate-esp" href="<?php echo get_admin_url() .'admin.php?page=leadin_settings&leadin_action=activate&power_up=mailchimp_connect&redirect_to=' . get_admin_url() . urlencode('admin.php?page=leadin_settings&activate_esp=true&esp=mailchimp'); ?>" class="button button-primary button-big"><?php esc_attr_e('Select your email tool');?></a>
1329
- <p><a href="<?php echo get_admin_url() .'admin.php?page=leadin_settings&activate_esp=false'; ?>">Don't connect an email provider right now</a></p>
1330
- </form>
1331
- </div>
1332
-
1333
- <?php elseif ( isset($_GET['activate_esp']) ) : ?>
1334
-
1335
- <?php leadin_update_option('leadin_options', 'onboarding_complete', 1); ?>
1336
-
1337
- <?php $this->leadin_header('Setup Complete!', 'li_setup_header', 'Onboarding Complete'); ?>
1338
-
1339
- <ol class="oboarding-steps-names">
1340
- <li class="oboarding-step-name completed">Activate Leadin</li>
1341
- <li class="oboarding-step-name completed">Get Contact Reports</li>
1342
- <li class="oboarding-step-name completed">Grow Your Contacts List</li>
1343
- <li class="oboarding-step-name completed">Email your new contacts</li>
1344
- </ol>
1345
- <div class="oboarding-step">
1346
- <h2 class="oboarding-step-title">Leadin is waiting for your first form submission.</h2>
1347
- <div class="oboarding-step-content">
1348
- <p class="oboarding-step-description">Leadin is set up and waiting for a form submission. Once Leadin detects a form submission, a new contact will be added to your contacts list. We recommend filling out a form on your site to test that Leadin is working correctly.</p>
1349
- <form id="li-onboarding-form" method="post" action="options.php">
1350
- <?php $this->print_hidden_settings_fields(); ?>
1351
- <a href="<?php echo get_admin_url() . 'admin.php?page=leadin_settings'; ?>" class="button button-primary button-big"><?php esc_attr_e('Complete Setup'); ?></a>
1352
- </form>
1353
- </div>
1354
- </div>
1355
-
1356
- <?php endif; ?>
1357
-
1358
- </div><!--/oboarding-steps -->
1359
-
1360
- </div><!--/wrap -->
1361
-
1362
- <?php
1363
-
1364
- }
1365
-
1366
- /**
1367
- * Creates default settings page
1368
- */
1369
- function leadin_plugin_settings ()
1370
- {
1371
- global $wp_version;
1372
-
1373
- echo '<div id="leadin" class="li-settings wrap '. ( $wp_version < 3.8 && !is_plugin_active('mp6/mp6.php') ? 'pre-mp6' : ''). '">';
1374
-
1375
- $this->leadin_header('Leadin Settings', 'li_settings', 'Loaded Settings Page');
1376
-
1377
- ?>
1378
- <div class="leadin-settings__content">
1379
- <form method="POST" action="options.php">
1380
- <?php
1381
- settings_fields('leadin_settings_options');
1382
- do_settings_sections(LEADIN_ADMIN_PATH);
1383
- submit_button('Save Settings');
1384
- ?>
1385
- </form>
1386
- </div>
1387
- <?php if ( ! leadin_check_pro_user() ) : ?>
1388
- <div class="leadin-settings__sidebar">
1389
- <a href="<?php echo admin_url(); ?>admin.php?page=leadin_pro_upgrade"><img class="pro-upgrade-cta" src="<?php echo LEADIN_PATH; ?>/images/pro-upgrade-cta.png"></a>
1390
- </div>
1391
- <?php endif; ?>
1392
- <?php
1393
-
1394
- $this->leadin_footer();
1395
-
1396
- //end wrap
1397
- echo '</div>';
1398
  }
1399
 
1400
- /**
1401
- * Sanitize each setting field as needed
1402
- *
1403
- * @param array $input Contains all settings fields as array keys
1404
- */
1405
- public function sanitize ( $input )
1406
- {
1407
- $new_input = array();
1408
-
1409
- if ( isset($input['li_email']) )
1410
- $new_input['li_email'] = sanitize_text_field( $input['li_email'] );
1411
-
1412
- if ( isset($input['li_installed']) )
1413
- $new_input['li_installed'] = $input['li_installed'];
1414
-
1415
- if ( isset($input['li_db_version']) )
1416
- $new_input['li_db_version'] = $input['li_db_version'];
1417
-
1418
- if ( isset($input['onboarding_step']) )
1419
- $new_input['onboarding_step'] = ( $input['onboarding_step'] + 1 );
1420
-
1421
- if ( isset($input['onboarding_complete']) )
1422
- $new_input['onboarding_complete'] = $input['onboarding_complete'];
1423
-
1424
- if ( isset($input['ignore_settings_popup']) )
1425
- $new_input['ignore_settings_popup'] = $input['ignore_settings_popup'];
1426
-
1427
- if ( isset($input['data_recovered']) )
1428
- $new_input['data_recovered'] = $input['data_recovered'];
1429
-
1430
- if ( isset($input['converted_to_tags']) )
1431
- $new_input['converted_to_tags'] = $input['converted_to_tags'];
1432
-
1433
- if ( isset($input['names_added_to_contacts']) )
1434
- $new_input['names_added_to_contacts'] = $input['names_added_to_contacts'];
1435
-
1436
- if ( isset($input['delete_flags_fixed']) )
1437
- $new_input['delete_flags_fixed'] = $input['delete_flags_fixed'];
1438
-
1439
- if ( isset($input['leadin_version']) )
1440
- $new_input['leadin_version'] = $input['leadin_version'];
1441
-
1442
- if ( isset($input['li_updates_subscription']) )
1443
- $new_input['li_updates_subscription'] = $input['li_updates_subscription'];
1444
-
1445
- if ( isset($input['pro']) )
1446
- $new_input['pro'] = $input['pro'];
1447
-
1448
- $user_roles = get_editable_roles();
1449
- if ( count($user_roles) )
1450
- {
1451
- //print_r($user_roles);
1452
- foreach ( $user_roles as $key => $role )
1453
- {
1454
- $role_id_tracking = 'li_do_not_track_' . $key;
1455
- $role_id_access = 'li_grant_access_to_' . $key;
1456
-
1457
- if ( isset( $input[$role_id_tracking] ) )
1458
- $new_input[$role_id_tracking] = $input[$role_id_tracking];
1459
-
1460
- if ( isset( $input[$role_id_access] ) )
1461
- $new_input[$role_id_access] = $input[$role_id_access];
1462
- }
1463
- }
1464
-
1465
- if( isset( $input['li_subscribe_template_home'] ) )
1466
- $new_input['li_subscribe_template_home'] = sanitize_text_field( $input['li_subscribe_template_home'] );
1467
-
1468
- return $new_input;
1469
- }
1470
 
1471
  /**
1472
- * Prints email input for settings page
1473
  */
1474
- function li_email_callback ()
1475
  {
1476
- $options = get_option('leadin_options');
1477
- $li_email = ( isset($options['li_email']) && $options['li_email'] ? $options['li_email'] : '' ); // Get email from plugin settings, if none set, use admin email
1478
-
1479
- printf(
1480
- '<input id="li_email" type="text" id="title" name="leadin_options[li_email]" value="%s" size="50"/><br/><span class="description">Separate multiple emails with commas. Leave blank to disable email notifications.</span>',
1481
- $li_email
1482
- );
1483
- }
1484
-
1485
- /**
1486
- * Prints do not track checkboxes for settings page
1487
- */
1488
- function li_do_not_track_callback ()
1489
- {
1490
- $options = get_option('leadin_options');
1491
-
1492
- $user_roles = get_editable_roles();
1493
- if ( count($user_roles) )
1494
- {
1495
- foreach ( $user_roles as $key => $role )
1496
- {
1497
- $role_id = 'li_do_not_track_' . $key;
1498
- printf(
1499
- '<p><input id="' . $role_id . '" type="checkbox" name="leadin_options[' . $role_id . ']" value="1"' . checked( 1, ( isset($options[$role_id]) ? $options[$role_id] : '0' ), FALSE ) . '/>' .
1500
- '<label for="' . $role_id . '">' . $role['name'] . 's' . '</label></p>'
1501
- );
1502
- }
1503
- }
1504
- }
1505
 
1506
- /**
1507
- * Prints checkboxes for toggling Leadin access to specific user roles
1508
- */
1509
- function li_grant_access_callback ()
1510
- {
1511
- $options = get_option('leadin_options');
1512
-
1513
- $user_roles = get_editable_roles();
1514
 
1515
- // Show a disabled checkbox for administrative roles that always need to be enabled so users don't get locked out of the Leadin settings
1516
- echo '<p><input id="li_grant_access_to_administrator" type="checkbox" value="1" checked disabled/>';
1517
- echo '<label for="li_grant_access_to_administrator">Administrators</label></p>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1518
 
1519
- if ( count($user_roles) )
 
1520
  {
1521
- foreach ( $user_roles as $key => $role )
1522
- {
1523
- $admin_role = FALSE;
1524
- if ( isset($role['capabilities']['activate_plugins']) && $role['capabilities']['activate_plugins'] )
1525
- $admin_role = TRUE;
1526
 
1527
- $role_id = 'li_grant_access_to_' . $key;
1528
-
1529
- if ( ! $admin_role )
1530
- {
1531
- printf(
1532
- '<p><input id="' . $role_id . '" type="checkbox" name="leadin_options[' . $role_id . ']" value="1"' . checked( 1, ( isset($options[$role_id]) ? $options[$role_id] : '0' ), FALSE ) . '/>' .
1533
- '<label for="' . $role_id . '">' . $role['name'] . 's' . '</label></p>'
1534
- );
1535
- }
1536
- }
1537
  }
1538
- }
1539
 
1540
- /**
1541
- * Creates power-up page
1542
- */
1543
- function leadin_power_ups_page ()
1544
- {
1545
- global $wp_version;
1546
-
1547
- echo '<div id="leadin" class="li-settings wrap '. ( $wp_version < 3.8 && !is_plugin_active('mp6/mp6.php') ? 'pre-mp6' : ''). '">';
1548
-
1549
- $this->leadin_header('Leadin Power-ups', 'li_powerups', 'Loaded Power-ups Page');
1550
-
1551
- ?>
1552
-
1553
- <p>Get the most out of your Leadin install with these powerful marketing powerups.</p>
1554
-
1555
- <ul class="powerup-list">
1556
-
1557
- <?php $power_up_count = 0; ?>
1558
- <?php foreach ( $this->admin_power_ups as $power_up ) : ?>
1559
- <?php
1560
- // Skip displaying the power-up on the power-ups page if it's hidden
1561
- if ( $power_up->hidden )
1562
- continue;
1563
- ?>
1564
-
1565
- <?php if ( $power_up_count == 2 ) : ?>
1566
- <!-- static content stats power-up - not a real powerup and this is a hack to put it second in the order -->
1567
- <li class="powerup activated">
1568
- <div class="img-containter">
1569
- <img src="<?php echo LEADIN_PATH; ?>/images/powerup-icon-analytics@2x.png" height="80px" width="80px">
1570
- </div>
1571
- <h2>Content Stats</h2>
1572
- <p>See where all your conversions are coming from.</p>
1573
- <a href="<?php echo get_bloginfo('wpurl') . '/wp-admin/admin.php?page=leadin_stats'; ?>" class="button button-large">View Stats</a>
1574
- </li>
1575
- <?php $power_up_count++; ?>
1576
- <?php endif; ?>
1577
-
1578
- <li class="powerup <?php echo ( $power_up->activated ? 'activated' : ''); ?>">
1579
- <div class="img-containter">
1580
- <?php if ( strstr($power_up->icon, 'dashicon') ) : ?>
1581
- <span class="<?php echo $power_up->icon; ?>"></span>
1582
- <?php else : ?>
1583
- <img src="<?php echo LEADIN_PATH . '/images/' . $power_up->icon . '@2x.png'; ?>" height="80px" width="80px"/>
1584
- <?php endif; ?>
1585
- </div>
1586
- <h2><?php echo $power_up->power_up_name; ?></h2>
1587
- <p><?php echo $power_up->description; ?></p>
1588
-
1589
- <?php if ( $power_up->activated ) : ?>
1590
- <?php if ( ! $power_up->permanent ) : ?>
1591
- <?php // SHOW DEACTIVATE POWER-UP BUTTON ?>
1592
- <a href="<?php echo get_bloginfo('wpurl') . '/wp-admin/admin.php?page=leadin_power_ups&leadin_action=deactivate&power_up=' . $power_up->slug; ?>" class="button button-secondary button-large">Deactivate</a>
1593
- <?php endif; ?>
1594
- <?php else : ?>
1595
- <?php // SHOW DEACTIVATE POWER-UP BUTTON ?>
1596
- <?php if ( $power_up->pro_only ) : ?>
1597
- <?php if ( ! leadin_check_pro_user() ) : ?>
1598
- <a href="<?php echo admin_url(); ?>admin.php?page=leadin_pro_upgrade">Upgrade to Pro</a> for free to unlock
1599
- <?php endif; ?>
1600
- <?php else : ?>
1601
- <?php if ( ( $power_up->curl_required && function_exists('curl_init') && function_exists('curl_setopt') ) || ! $power_up->curl_required ) : ?>
1602
- <?php // SHOW ACTIVATE POWER-UP BUTTON ?>
1603
- <a href="<?php echo get_bloginfo('wpurl') . '/wp-admin/admin.php?page=leadin_power_ups&leadin_action=activate&power_up=' . $power_up->slug; ?>" class="button button-primary button-large">Activate</a>
1604
- <?php else : ?>
1605
- <?php // SHOW CURL REQUIRED MESSAGE ?>
1606
- <p><a href="http://stackoverflow.com/questions/2939820/how-to-enable-curl-installed-ubuntu-lamp-stack" target="_blank">Install cURL</a> to use this power-up.</p>
1607
- <?php endif; ?>
1608
- <?php endif; ?>
1609
- <?php endif; ?>
1610
-
1611
- <?php if ( $power_up->activated || ( $power_up->permanent && $power_up->activated ) ) : ?>
1612
-
1613
- <?php if ( $power_up->slug == 'contacts' || $power_up->slug == 'lookups' ) : ?>
1614
- <?php // SHOW VIEW CONTACTS / CONFIGURE BUTTON ?>
1615
- <a href="<?php echo get_bloginfo('wpurl') . '/wp-admin/admin.php?page=leadin_contacts'; ?>" class="button button-secondary button-large">View Contacts</a>
1616
- <a href="<?php echo get_bloginfo('wpurl') . '/wp-admin/admin.php?page=leadin_settings'; ?>" class="button button-secondary button-large">Configure</a>
1617
- <?php else : ?>
1618
- <?php // SHOW CONFIGURE BUTTON ?>
1619
- <a href="<?php echo get_bloginfo('wpurl') . '/wp-admin/admin.php?page=leadin_' . $power_up->menu_link; ?>" class="button button-secondary button-large">Configure</a>
1620
- <?php endif; ?>
1621
- <?php endif; ?>
1622
- </li>
1623
- <?php $power_up_count++; ?>
1624
- <?php endforeach; ?>
1625
-
1626
- <li class="powerup">
1627
- <div class="img-containter">
1628
- <img src="<?php echo LEADIN_PATH; ?>/images/powerup-icon-ideas@2x.png" height="80px" width="80px">
1629
- </div>
1630
- <h2>Your Idea</h2>
1631
- <p>Have an idea for a power-up? We'd love to hear it!</p>
1632
- <a href="mailto:support@leadin.com" target="_blank" class="button button-primary button-large">Suggest an idea</a>
1633
- </li>
1634
-
1635
- <li class="powerup">
1636
- <div class="img-containter">
1637
- <img src="<?php echo LEADIN_PATH; ?>/images/powerup-icon-vip@2x.png" height="80px" width="80px">
1638
- </div>
1639
- <h2>Leadin VIP Program</h2>
1640
- <p>Exclusive features and offers for consultants and agencies.</p>
1641
-
1642
- <a href="http://leadin.com/vip" target="_blank" class="button button-primary button-large">Become a VIP</a>
1643
- </li>
1644
-
1645
- </ul>
1646
-
1647
- <?php
1648
-
1649
-
1650
- $this->leadin_footer();
1651
-
1652
- //end wrap
1653
- echo '</div>';
1654
-
1655
- }
1656
-
1657
- function check_admin_action ( )
1658
- {
1659
- if ( isset( $_GET['leadin_action'] ) )
1660
  {
1661
- switch ( $_GET['leadin_action'] )
1662
- {
1663
- case 'activate' :
1664
 
1665
- $power_up = stripslashes( $_GET['power_up'] );
1666
-
1667
- WPLeadIn::activate_power_up( $power_up, FALSE );
1668
- //ob_end_clean();
1669
- leadin_track_plugin_activity($power_up . " power-up activated");
1670
-
1671
- if ( isset($_GET['redirect_to']) )
1672
- wp_redirect($_GET['redirect_to']);
1673
- else
1674
- wp_redirect(get_bloginfo('wpurl') . '/wp-admin/admin.php?page=leadin_power_ups');
1675
- exit;
1676
-
1677
- break;
1678
-
1679
- case 'deactivate' :
1680
-
1681
- $power_up = stripslashes( $_GET['power_up'] );
1682
-
1683
- WPLeadIn::deactivate_power_up( $power_up, FALSE );
1684
- leadin_track_plugin_activity($power_up . " power-up deactivated");
1685
- wp_redirect(get_bloginfo('wpurl') . '/wp-admin/admin.php?page=leadin_power_ups');
1686
- exit;
1687
-
1688
- break;
1689
- }
1690
  }
1691
  }
1692
 
1693
- //=============================================
1694
- // Admin Styles & Scripts
1695
- //=============================================
1696
-
1697
- /**
1698
- * Adds admin style sheets
1699
- */
1700
- function add_leadin_admin_styles ()
1701
- {
1702
- wp_register_style('leadin-admin-css', LEADIN_PATH . '/assets/css/build/leadin-admin.css');
1703
- wp_enqueue_style('leadin-admin-css');
1704
-
1705
- wp_register_style('select2', LEADIN_PATH . '/assets/css/select2.css');
1706
- wp_enqueue_style('select2');
1707
- }
1708
-
1709
  //=============================================
1710
  // Internal Class Functions
1711
  //=============================================
1712
 
1713
- /**
1714
- * Creates postbox for admin
1715
- *
1716
- * @param string
1717
- * @param string
1718
- * @param string
1719
- * @param bool
1720
- * @return string HTML for postbox
1721
- */
1722
- function leadin_postbox ( $css_class, $title, $content, $handle = TRUE )
1723
  {
1724
- $postbox_wrap = "";
1725
-
1726
- $postbox_wrap .= '<div class="' . $css_class . ' leadin-postbox">';
1727
- $postbox_wrap .= '<h3 class="leadin-postbox__header">' . $title . '</h3>';
1728
- $postbox_wrap .= '<div class="leadin-postbox__content">' . $content . '</div>';
1729
- $postbox_wrap .= '</div>';
1730
-
1731
- return $postbox_wrap;
1732
- }
1733
-
1734
- /**
1735
- * Prints the admin page title, icon and help notification
1736
- *
1737
- * @param string
1738
- */
1739
- function leadin_header ( $page_title = '', $css_class = '', $event_name = '' )
1740
- {
1741
- $li_options = get_option('leadin_options');
1742
-
1743
  $leadin_user = leadin_get_current_user();
1744
- ?>
1745
-
1746
- <?php if ( leadin_check_pro_user() ) : ?>
1747
- <?php // @TODO - we should really move this logic to the leadin-admin.js file... ?>
1748
- <script type="text/javascript">
1749
- !function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","group","track","ready","alias","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t<analytics.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t){var e=document.createElement("script");e.type="text/javascript";e.async=!0;e.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.com/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(e,n)};analytics.SNIPPET_VERSION="3.0.1";
1750
- analytics.load("<?php echo SEGMENT_WRITE_KEY ?>");
1751
- analytics.identify("<?php echo $leadin_user['user_id']; ?>", {
1752
- "name" : "<?php echo $leadin_user['alias']; ?>",
1753
- "email" : "<?php echo $leadin_user['email']; ?>",
1754
- "wp-url" : "<?php echo $leadin_user['wp_url']; ?>",
1755
- "wp-version" : "<?php echo $leadin_user['wp_version']; ?>",
1756
- "li-version" : "<?php echo $leadin_user['li_version']; ?>",
1757
- "li-source" : "<?php echo LEADIN_SOURCE; ?>",
1758
- "website" : "<?php echo $leadin_user['wp_url']; ?>",
1759
- "company" : "<?php echo $leadin_user['wp_url']; ?>",
1760
- "utm_source" : "<?php echo $leadin_user['utm_source']; ?>",
1761
- "utm_medium" : "<?php echo $leadin_user['utm_medium']; ?>",
1762
- "utm_term" : "<?php echo $leadin_user['utm_term']; ?>",
1763
- "utm_content" : "<?php echo $leadin_user['utm_content']; ?>",
1764
- "utm_campaign" : "<?php echo $leadin_user['utm_campaign']; ?>",
1765
- "referral_source" : "<?php echo $leadin_user['referral_source']; ?>"
1766
- });
1767
-
1768
- jQuery(document).ready( function ( $ ) {
1769
- <?php if ( $event_name == 'Loaded Contact List Page' ) : ?>
1770
- var num_tags = jQuery('.icon-tag').length;
1771
- analytics.track(<?php echo "'$event_name'"; ?>, {
1772
- num_tags: num_tags
1773
- });
1774
- analytics.page('');
1775
- <?php else : ?>
1776
- analytics.track(<?php echo "'$event_name'"; ?>);
1777
- analytics.page('');
1778
- <?php endif; ?>
1779
- });
1780
- }}();
1781
- </script>
1782
- <?php endif; ?>
1783
-
1784
- <?php if ( $page_title ) : ?>
1785
- <?php screen_icon('leadin'); ?>
1786
- <h2 class="<?php echo $css_class ?>"><?php echo $page_title; ?></h2>
1787
- <?php endif; ?>
1788
-
1789
- <?php if ( isset($_GET['tables_restored']) && $_GET['tables_restored'] ) : ?>
1790
- <div id="message" class="updated">
1791
- <p>Your Leadin database tables were successfully restored and the product should start working correctly again.</p>
1792
- </div>
1793
- <?php endif; ?>
1794
-
1795
-
1796
- <?php if ( $li_options['onboarding_complete'] ) : ?>
1797
-
1798
- <?php if ( isset($_GET['settings-updated']) ) : ?>
1799
- <div id="message" class="updated">
1800
- <p><strong><?php _e('Settings saved.') ?></strong></p>
1801
- </div>
1802
-
1803
- <?php
1804
- foreach ( $this->esp_power_ups as $power_up_name => $power_up_slug )
1805
- {
1806
- if ( WPLeadIn::is_power_up_active($power_up_slug) )
1807
- {
1808
- global ${'leadin_' . $power_up_slug . '_wp'}; // e.g leadin_mailchimp_connect_wp
1809
- $esp_name = strtolower(str_replace('_connect', '', $power_up_slug)); // e.g. mailchimp
1810
-
1811
- if ( ${'leadin_' . $power_up_slug . '_wp'}->admin->invalid_key )
1812
- {
1813
- echo '<div id="message" class="error">';
1814
- echo '<p>' . 'Your ' . $power_up_name . ' key seems to not be correct.' . '</p>';
1815
- echo '</div>';
1816
- }
1817
- }
1818
- }
1819
- ?>
1820
- <?php elseif ( $this->has_leads() == FALSE ) : ?>
1821
- <div id="message" class="updated">
1822
- <p>Leadin is set up and waiting for a form submission... Need help? <a href="http://wordpress.org/support/plugin/leadin">Contact Us</a>.</p>
1823
- </div>
1824
- <?php elseif ( !leadin_check_pro_user() ) : ?>
1825
- <div id="message" class="updated">
1826
- <p>Did you know that Leadin Pro is a free upgrade with even more feaures? <a href="<?php echo admin_url(); ?>admin.php?page=leadin_pro_upgrade">Learn more</a>.</p>
1827
- </div>
1828
- <?php endif; ?>
1829
- <?php endif; ?>
1830
- <?php
1831
- }
1832
-
1833
- function leadin_footer ()
1834
- {
1835
- $li_options = get_option('leadin_options');
1836
- global $wp_version;
1837
-
1838
- ?>
1839
- <div id="leadin-footer">
1840
- <p class="support">
1841
- <a href="http://leadin.com">Leadin</a> <?php echo LEADIN_PLUGIN_VERSION; ?>
1842
- <span style="padding: 0px 5px;">|</span><a href="<?php echo 'http://support.leadin.com?leadin_version=' . LEADIN_PLUGIN_VERSION . '&wp_version=' . $wp_version ?>" target="_blank">Support Docs</a>
1843
- <span style="padding: 0px 5px;">|</span><a href="http://leadin.com/dev-updates/">Get product &amp; security updates</a>
1844
- <span style="padding: 0px 5px;">|</span><a href="http://wordpress.org/support/view/plugin-reviews/leadin?rate=5#postform">Leave us a review</a>
1845
- </p>
1846
-
1847
- <p class="sharing"><a href="https://twitter.com/leadinapp" class="twitter-follow-button" data-show-count="false">Follow @leadinapp</a><p>
1848
- </div>
1849
-
1850
- <?php
1851
- }
1852
-
1853
- function build_contacts_chart ( )
1854
- {
1855
- ?>
1856
- <script type="text/javascript">
1857
-
1858
- function create_weekends ( $ )
1859
- {
1860
- var $ = jQuery;
1861
-
1862
- series = chart.get('contacts');
1863
- var in_between = Math.floor(series.data[1].barX - (Math.floor(series.data[0].barX) + Math.floor(series.data[0].pointWidth)))*2;
1864
-
1865
- $series = $('.highcharts-series').first();
1866
- $series.find('rect').each ( function ( e ) {
1867
- var $this = $(this);
1868
- $this.attr('width', (Math.floor(series.data[0].pointWidth) + Math.floor(in_between/2)));
1869
- $this.attr('x', $this.attr('x') - Math.floor(in_between/4));
1870
- $this.css('opacity', 100);
1871
- });
1872
- }
1873
-
1874
- function hide_weekends ( $ )
1875
- {
1876
- var $ = jQuery;
1877
-
1878
- series = chart.get('contacts');
1879
-
1880
- $series = $('.highcharts-series').first();
1881
- $series.find('rect').each ( function ( e ) {
1882
- var $this = $(this);
1883
- $this.css('opacity', 0);
1884
- });
1885
- }
1886
-
1887
- function create_chart ( $ )
1888
- {
1889
- var $ = jQuery;
1890
-
1891
- $('#contacts_chart').highcharts({
1892
- chart: {
1893
- type: 'column',
1894
- style: {
1895
- fontFamily: "Open-Sans"
1896
- }
1897
- },
1898
- credits: {
1899
- enabled: false
1900
- },
1901
- title: {
1902
- text: ''
1903
- },
1904
- xAxis: {
1905
- categories: [ <?php echo $this->stats_dashboard->x_axis_labels; ?> ],
1906
- tickInterval: 2,
1907
- tickmarkPlacement: 'on',
1908
- labels: {
1909
- style: {
1910
- color: '#aaa',
1911
- fontFamily: 'Open Sans'
1912
- }
1913
- }
1914
- },
1915
- yAxis: {
1916
- min: 0,
1917
- title: {
1918
- text: ''
1919
- },
1920
- gridLineColor: '#ddd',
1921
- labels: {
1922
-
1923
- style: {
1924
- color: '#aaa',
1925
- fontFamily: 'Open Sans'
1926
- }
1927
- },
1928
- minRange: 4
1929
- },
1930
- tooltip: {
1931
- enabled: true,
1932
- headerFormat: '<span style="font-size: 11px; font-weight: normal; text-transform: capitalize; font-family: \'Open Sans\'; color: #555;">{point.key}</span><br/>',
1933
- pointFormat: '<span style="font-size: 11px; font-weight: normal; font-family: \'Open Sans\'; color: #888;">Contacts: {point.y}</span>',
1934
- valueDecimals: 0,
1935
- borderColor: '#ccc',
1936
- borderRadius: 0,
1937
- shadow: false
1938
- },
1939
- plotOptions: {
1940
- column: {
1941
- borderWidth: 0,
1942
- borderColor: 'rgba(0,0,0,0)',
1943
- showInLegend: false,
1944
- colorByPoint: true,
1945
- states: {
1946
- brightness: 0
1947
- }
1948
- },
1949
- line: {
1950
- enableMouseTracking: false,
1951
- linkedTo: ':previous',
1952
- dashStyle: 'ShortDash',
1953
- dataLabels: {
1954
- enabled: false
1955
- },
1956
- marker: {
1957
- enabled: false
1958
- },
1959
- color: '#4CA6CF',
1960
- tooltip: {
1961
- enabled: false
1962
- },
1963
- showInLegend: false
1964
- }
1965
- },
1966
- colors: [
1967
- <?php echo $this->stats_dashboard->column_colors; ?>
1968
- ],
1969
- series: [{
1970
- type: 'column',
1971
- name: 'Contacts',
1972
- id: 'contacts',
1973
- data: [ <?php echo $this->stats_dashboard->column_data; ?> ],
1974
- zIndex: 3,
1975
- index: 3
1976
- }, {
1977
- type: 'line',
1978
- name: 'Average',
1979
- animation: false,
1980
- data: [ <?php echo $this->stats_dashboard->average_data; ?> ],
1981
- zIndex: 2,
1982
- index: 2
1983
- },
1984
- {
1985
- type: 'column',
1986
- name: 'Weekends',
1987
- animation: false,
1988
- minPointLength: 500,
1989
- grouping: false,
1990
- tooltip: {
1991
- enabled: true
1992
- },
1993
- data: [ <?php echo $this->stats_dashboard->weekend_column_data; ?> ],
1994
- zIndex: 1,
1995
- index: 1,
1996
- id: 'weekends',
1997
- events: {
1998
- mouseOut: function ( event ) { event.preventDefault(); },
1999
- halo: false
2000
- },
2001
- states: {
2002
- hover: {
2003
- enabled: false
2004
- }
2005
- }
2006
- }]
2007
- });
2008
- }
2009
-
2010
- var $series;
2011
- var chart;
2012
- var $ = jQuery;
2013
-
2014
- $(document).ready( function ( e ) {
2015
-
2016
- create_chart();
2017
-
2018
- chart = $('#contacts_chart').highcharts();
2019
- create_weekends();
2020
- });
2021
-
2022
- var delay = (function(){
2023
- var timer = 0;
2024
- return function(callback, ms){
2025
- clearTimeout (timer);
2026
- timer = setTimeout(callback, ms);
2027
- };
2028
- })();
2029
-
2030
- // Takes care of figuring out the weekend widths based on the new column widths
2031
- $(window).resize(function() {
2032
- hide_weekends();
2033
- height = chart.height
2034
- width = $("#contacts_chart").width();
2035
- chart.setSize(width, height);
2036
- delay(function(){
2037
- create_weekends();
2038
- }, 500);
2039
- });
2040
-
2041
- </script>
2042
- <?php
2043
  }
2044
 
2045
  /**
@@ -2056,6 +244,7 @@ class WPLeadInAdmin {
2056
 
2057
  return FALSE;
2058
  }
 
2059
  }
2060
 
2061
- ?>
17
  // Include Needed Files
18
  //=============================================
19
 
20
+ include_once(ABSPATH . 'wp-admin/includes/plugin.php');
 
 
 
 
21
 
22
  if ( !class_exists('LI_Pointers') )
23
+ require_once LEADIN_PLUGIN_DIR . '/inc/class-leadin-pointers.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  //=============================================
26
  // WPLeadInAdmin Class
27
  //=============================================
28
  class WPLeadInAdmin {
29
 
 
30
  var $li_viewers;
 
31
  var $stats_dashboard;
32
  var $action;
 
33
 
34
  /**
35
  * Class constructor
36
  */
37
+ function __construct ()
38
  {
39
  //=============================================
40
  // Hooks & Filters
43
  $options = get_option('leadin_options');
44
 
45
  $this->action = $this->leadin_current_action();
 
 
 
 
 
 
46
 
47
  add_action('admin_menu', array(&$this, 'leadin_add_menu_items'));
48
+ add_action('admin_print_scripts', array(&$this, 'add_leadin_admin_scripts'));
 
49
  add_filter('plugin_action_links_' . 'leadin/leadin.php', array($this, 'leadin_plugin_settings_link'));
50
 
 
 
 
 
 
 
 
 
 
 
 
51
  }
52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  //=============================================
54
  // Menus
55
  //=============================================
86
  }
87
  }
88
 
89
+ $leadin_icon = LEADIN_PATH . '/images/leadin-icon-16x16-white.png';
90
 
91
+ add_menu_page('Leadin', 'Leadin', $capability, 'leadin', array($this, 'leadin_build_app'), $leadin_icon , '25.100713');
92
 
93
+ add_submenu_page('leadin', 'Contacts', 'Contacts', 'activate_plugins', 'leadin_contacts', array($this, 'leadin_build_app'));
94
+ add_submenu_page('leadin', 'Settings', 'Settings', 'activate_plugins', 'leadin_settings', array($this, 'leadin_build_app'));
95
 
96
+ if (get_option('leadin_puntMigration') == true && get_option('leadin_migrationStatus') != 'completed')
97
  {
98
+ add_submenu_page('leadin', 'Migrate', 'Migrate', 'activate_plugins', 'leadin#migration/unpunt', array($this, 'unpunt_migration_callback'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  }
100
 
101
+ $submenu['leadin'][0][0] = 'Stats';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
 
103
+ if ( ! isset($_GET['page']) || $_GET['page'] != 'leadin_settings' )
104
+ {
105
+ if ( ! get_option('leadin_portalId') )
106
+ $li_pointers = new LI_Pointers(TRUE);
107
+ //else if ( ! get_option('leadin_portalId') && $options )
108
+ //$li_pointers = new LI_Pointers(FALSE);
109
+ }
110
  }
111
 
112
  //=============================================
121
  */
122
  function leadin_plugin_settings_link ( $links )
123
  {
124
+ $url = get_admin_url(get_current_blog_id(), 'admin.php?page=leadin_settings');
125
  $settings_link = '<a href="' . $url . '">Settings</a>';
126
  array_unshift($links, $settings_link);
127
  return $links;
128
  }
129
 
130
  /**
131
+ * Creates leadin app
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
 
134
+ function leadin_build_app () {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  global $wp_version;
136
 
137
+ echo '<div id="leadin" class="wrap '. ( $wp_version < 3.8 && !is_plugin_active('mp6/mp6.php') ? 'pre-mp6' : ''). '"></div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
 
139
+ wp_enqueue_style('leadin-css');
140
+ wp_enqueue_script('leadin-app');
 
 
 
141
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  }
143
 
144
  function update_option_leadin_options_callback ( $old_value, $new_value )
145
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  }
147
 
148
+ //=============================================
149
+ // Admin Styles & Scripts
150
+ //=============================================
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
 
152
  /**
153
+ * Adds admin javascript
154
  */
155
+ function add_leadin_admin_scripts ()
156
  {
157
+ global $pagenow;
158
+ global $wp_roles;
159
+ global $wp_version;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
 
161
+ $ajaxUrl = get_admin_url(get_current_blog_id(), 'admin-ajax.php');
 
 
 
 
 
 
 
162
 
163
+ $leadin_config = array(
164
+ 'portalId' => get_option('leadin_portalId'),
165
+ 'hapikey' => get_option('leadin_hapikey'),
166
+ 'env' => constant('LEADIN_ENV'),
167
+ 'segmentKey' => constant('LEADIN_SEGMENT_WRITE_KEY'),
168
+ 'user' => $this->leadin_get_user_for_tracking(),
169
+ 'allRoles' => $wp_roles->get_names(),
170
+ 'leadinPluginVersion' => constant('LEADIN_PLUGIN_VERSION'),
171
+ 'wpVersion' => $wp_version,
172
+ 'siteUrl' => get_site_url(),
173
+ 'adminEmail' => get_option('admin_email'),
174
+ 'siteName' => get_bloginfo('name'),
175
+ 'adminBaseUrl' => get_admin_url(get_current_blog_id(), 'admin.php'),
176
+ 'apiBaseUrl' => constant('LEADIN_API_BASE_URL'),
177
+ 'assetsBaseUrl' => constant('LEADIN_ADMIN_ASSETS_BASE_URL'),
178
+ 'migrationStatus' => leadin_check_migration_status(),
179
+ 'migrationPunted' => get_option('leadin_puntMigration'),
180
+ 'migrationNonce' => wp_create_nonce( 'leadin-migration-nonce' ),
181
+ 'leadinPluginDirectory' => LEADIN_PLUGIN_SLUG,
182
+ 'ajaxUrl' => is_ssl() ? str_replace('http:', 'https:', $ajaxUrl) : str_replace('https:', 'http:', $ajaxUrl),
183
+ 'locale' => get_locale(),
184
+ 'timezone' => get_option('gmt_offset')
185
+ );
186
 
187
+ // remove after migration is complete
188
+ if ( $leadin_config['migrationStatus'] == 'started')
189
  {
190
+ $leadin_config['timeSinceLastMigration'] = time() - get_option('leadin_most_recent_migration_timestamp');
 
 
 
 
191
 
 
 
 
 
 
 
 
 
 
 
192
  }
193
+ // remove after migration is complete
194
 
195
+ if ( ($pagenow == 'admin.php' && isset($_GET['page']) && strstr($_GET['page'], 'leadin')) )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  {
197
+ wp_register_script('leadin-head-js', leadin_get_resource_url('/bundle/head/head.js'), FALSE, FALSE, FALSE);
198
+ wp_localize_script('leadin-head-js', 'leadin_config', $leadin_config);
199
+ wp_enqueue_script('leadin-head-js');
200
 
201
+ wp_register_script('leadin-app', leadin_get_resource_url('/bundle/app.js'), array( 'backbone' ), FALSE, TRUE);
202
+ wp_register_style('leadin-css', leadin_get_resource_url('/bundle/app.css'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
  }
204
  }
205
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
  //=============================================
207
  // Internal Class Functions
208
  //=============================================
209
 
210
+ function leadin_get_user_for_tracking ()
 
 
 
 
 
 
 
 
 
211
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
  $leadin_user = leadin_get_current_user();
213
+ $tracking_leadin_user = array(
214
+ 'hashed_wp_url' => $leadin_user['user_id'],
215
+ 'name' => $leadin_user['alias'],
216
+ 'email' => $leadin_user['email'],
217
+ 'wp-url' => $leadin_user['wp_url'],
218
+ 'wp-version' => $leadin_user['wp_version'],
219
+ 'li-source' => LEADIN_SOURCE,
220
+ 'createdAt' => date('Y-m-d H:i:s'),
221
+ 'website' => $leadin_user['wp_url'],
222
+ 'company' => $leadin_user['wp_url'],
223
+ 'utm_source' => $leadin_user['utm_source'],
224
+ 'utm_medium' => $leadin_user['utm_medium'],
225
+ 'utm_term' => $leadin_user['utm_term'],
226
+ 'utm_content' => $leadin_user['utm_term'],
227
+ 'utm_campaign' => $leadin_user['utm_campaign'],
228
+ 'referral_source' => $leadin_user['referral_source']
229
+ );
230
+ return $tracking_leadin_user;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
  }
232
 
233
  /**
244
 
245
  return FALSE;
246
  }
247
+
248
  }
249
 
250
+ ?>
assets/css/build/leadin-admin.css DELETED
@@ -1 +0,0 @@
1
- #leadin label{cursor:default}#leadin .col-wrap{padding:0}#leadin .col-left .col-wrap{padding-right:10px}#leadin .metabox-holder{*zoom:1}#leadin .metabox-holder:after{content:"";display:table;clear:both}#wp-admin-bar-leadin-admin-menu img{height:16px;width:16px;opacity:0.6}@media (min-width: 1200px){#leadin{*zoom:1;max-width:1420px;max-width:88.75rem;padding-left:20px;padding-left:1.25rem;padding-right:20px;padding-right:1.25rem;margin-left:auto;margin-right:auto;margin:10px 20px 0 0;padding:0}#leadin:after{content:"";display:table;clear:both}#leadin *{box-sizing:border-box}#leadin.centered{margin:10px auto 0}}#li_analytics-meta .li-analytics-link{float:left}#li_analytics-meta .li-analytics-link .li-analytics__face{height:35px;width:35px;margin-right:5px;margin-bottom:5px}#li_analytics-meta .hidden_face{display:none}#li_analytics-meta .show-all-faces-container{clear:both}.leadin-postbox,#leadin .leadin-meta-section,.powerup-list .powerup{background-color:#fff;border:1px solid #e5e5e5;-moz-box-shadow:0 1px 1px rgba(0,0,0,0.04);-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.04);box-shadow:0 1px 1px rgba(0,0,0,0.04)}.leadin-postbox__header,#leadin .leain-meta-header{margin:0;padding:18px 18px 0;font-size:13px;text-transform:uppercase;letter-spacing:0.05em;color:#444}.leadin-postbox__content{padding:18px;*zoom:1}.leadin-postbox__content:after{content:"";display:table;clear:both}.leadin-postbox__table{margin:0;width:100%}.leadin-postbox__table th{padding:6px 0;text-align:left;text-transform:uppercase;letter-spacing:0.05em;color:#999;font-weight:400;font-size:12px}.leadin-postbox__table td{padding:6px 0}.leadin-postbox__table td.sources-contacts-num{text-align:right;padding-right:20px}.leadin-postbox__table tr,.leadin-postbox__table td,.leadin-postbox__table th{vertical-align:middle !important}.leadin-dynamic-avatar_0{background-color:#F88E4B}.leadin-dynamic-avatar_1{background-color:#64AADA}.leadin-dynamic-avatar_2{background-color:#64C2B6}.leadin-dynamic-avatar_3{background-color:#CF7BAA}.leadin-dynamic-avatar_4{background-color:#E7C24B}.leadin-dynamic-avatar_5{background-color:#9387DA}.leadin-dynamic-avatar_6{background-color:#D6DD99}.leadin-dynamic-avatar_7{background-color:#FF4C4C}.leadin-dynamic-avatar_8{background-color:#99583D}.leadin-dynamic-avatar_9{background-color:#54CC14}@font-face{font-family:"icomoon";src:url("../../fonts/icomoon.eot?-lejfm6");src:url("../../fonts/icomoon.eot?#iefix-lejfm6") format("embedded-opentype"),url("../../fonts/icomoon.woff?-lejfm6") format("woff"),url("../../fonts/icomoon.ttf?-lejfm6") format("truetype"),url("../../fonts/icomoon.svg?-lejfm6#icomoon") format("svg");font-weight:normal;font-style:normal}.icon,.icon-profile,.icon-tag,.icon-tags,.icon-envelope,.icon-envelope-alt,.icon-email,.icon-user,.icon-cog,.icon-bars,.icon-lab,.icon-bulb,.icon-mover,.icon-leadin-logo,.icon-facebook,.icon-twitter,.icon-wordpress,.icon-linkedin,.icon-google-plus{font-family:"icomoon";speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-leadin-logo:before{content:""}.icon-profile:before{content:""}.icon-tag:before{content:""}.icon-email:before{content:""}.icon-user:before{content:""}.icon-cog:before{content:""}.icon-bars:before{content:""}.icon-lab:before{content:""}.icon-bulb:before{content:""}.icon-tags:before{content:""}.icon-mover:before{content:""}.icon-twitter:before{content:""}.icon-linkedin:before{content:""}.icon-facebook:before{content:""}.icon-wordpress:before{content:""}.icon-google-plus:before{content:""}.icon-envelope-alt:before{content:""}.icon-envelope:before{content:""}#leadin-footer{*zoom:1;clear:both;margin-top:48px;color:#999;border-top:1px solid #dedede}#leadin-footer:after{content:"";display:table;clear:both}#leadin-footer .support .sharing{height:18px;text-align:left}@media screen and (min-width: 500px){#leadin-footer .support,#leadin-footer .version,#leadin-footer .sharing{width:50%;float:left}#leadin-footer .sharing{text-align:right}}.button-big{padding:6px 36px !important;font-size:14px !important;height:auto !important}.oboarding-steps{margin:18px 0}@media (min-width: 1200px){.oboarding-steps{width:83.09859%;float:right;margin-right:0;margin-left:8.4507%;margin-right:8.4507%;text-align:center}}.oboarding-steps .li_setup_header{margin:18px 0 36px;padding:0;font-size:18px}.oboarding-steps-names{*zoom:1;margin:0}.oboarding-steps-names:after{content:"";display:table;clear:both}.oboarding-step-name{margin:0;padding-bottom:24px;list-style:none;font-size:14px;color:#bbb;display:inline-block}.oboarding-step-name.active{color:#1F7D71;background-image:url(../../../images/triangle.png);background-position:bottom center;background-repeat:no-repeat}.oboarding-step-name.completed:before{background-image:url(../../../images/checkmark.png);background-position:top center;background-repeat:no-repeat;content:"";height:10px;width:13px;display:inline-block;margin-right:10px}.oboarding-step-name+.oboarding-step-name{margin-left:72px}.oboarding-step-content{margin:0 auto;max-width:500px}.oboarding-step-content .description{margin:12px 0;display:block;display:none}.oboarding-step{display:block;padding:36px;background-color:#D3EEEB;border:2px solid #2a9;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;color:#1F7D71}.oboarding-step .form-table th{display:none}.oboarding-step .form-table td{width:auto;display:block}.oboarding-step .form-table input{width:100%;font-size:16px;line-height:1.5;padding:7px 10px;display:block}.oboarding-step .oboarding-step-title,.oboarding-step .oboarding-step-description{color:#1F7D71;padding:0;margin-bottom:36px}.oboarding-step .button-primary{margin-top:36px}.oboarding-step .oboarding-step-description{font-size:16px;text-align:left}.oboarding-step .popup-option{width:31%;float:left;text-align:left;cursor:pointer !important}.oboarding-step .popup-option img{max-width:100%;margin-top:6px;-moz-box-shadow:0 1px 2px rgba(0,0,0,0.15);-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.15);box-shadow:0 1px 2px rgba(0,0,0,0.15);-moz-border-radius:6px;-webkit-border-radius:6px;border-radius:6px}.oboarding-step .popup-option:hover img{-moz-box-shadow:0 2px 4px rgba(0,0,0,0.25);-webkit-box-shadow:0 2px 4px rgba(0,0,0,0.25);box-shadow:0 2px 4px rgba(0,0,0,0.25)}.oboarding-step .popup-option input{margin-right:8px !important}.oboarding-step .popup-option input:checked ~ img{border:2px solid #2ea2cc}.oboarding-step .popup-option+.popup-option{margin-left:3%}.oboarding-step .esp-option{width:48%;float:left;text-align:left;cursor:pointer !important;-moz-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;border:2px solid #2a9;margin-bottom:25px;padding:1.5em;font-size:16px;font-weight:600}.oboarding-step .esp-option:hover{background-color:#E0F6F4}.oboarding-step .esp-option input{margin-right:1em !important}.oboarding-step .esp-option:nth-child(2n){margin-left:4%}.oboarding-step .esp-option .esp-name:before{height:20px;background-position:center center;background-repeat:no-repeat;content:"";display:inline-block;margin:-3px 1em -3px 0}.oboarding-step .esp-option .esp-name.mailchimp:before{background-size:18px 20px;width:18px;background-image:url(../../../images/power-up-icon-mailchimp-connect_small@2x.png)}.oboarding-step .esp-option .esp-name.aweber:before{background-size:20px 20px;width:20px;background-image:url(../../../images/power-up-icon-aweber-connect_small@2x.png)}.oboarding-step .esp-option .esp-name.constant-contact:before{background-size:29px 20px;width:29px;background-image:url(../../../images/power-up-icon-constant-contact-connect_small@2x.png)}.oboarding-step .esp-option .esp-name.getresponse:before{background-size:27px 20px;width:27px;background-image:url(../../../images/power-up-icon-getresponse-list-sync_small@2x.png)}.oboarding-step .esp-option .esp-name.campaign-monitor:before{background-size:27px 20px;width:27px;background-image:url(../../../images/power-up-icon-campaign-monitor-connect_small@2x.png)}.oboarding-step .popup-options{*zoom:1}.oboarding-step .popup-options:after{content:"";display:table;clear:both}@media (min-width: 1200px){.leadin-settings__content{width:74.64789%;float:left;margin-right:1.40845%}.leadin-settings__sidebar{width:23.94366%;float:right;margin-right:0}}.li-settings h3{border-left:1px solid #e5e5e5;border-right:1px solid #e5e5e5;border-top:1px solid #e5e5e5;border-bottom:1px solid #e5e5e5;margin-bottom:0px;background:#fff;padding:8px 12px;font-size:15px}.li-settings .form-table{margin-top:0px;border-left:1px solid #e5e5e5;border-right:1px solid #e5e5e5;border-bottom:1px solid #e5e5e5;background-color:#fff;-moz-box-shadow:0 1px 1px rgba(0,0,0,0.04);-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.04);box-shadow:0 1px 1px rgba(0,0,0,0.04)}.li-settings .form-table th{padding-left:12px}.li-settings .leadin-section{background-color:#fff;border-left:1px solid #e5e5e5;border-right:1px solid #e5e5e5;font-size:14px;padding:15px 12px 5px 12px}.li-settings .leadin-section p{margin:0;padding:0}.li-settings .power-up-settings-icon{padding-right:10px;float:left;max-height:20px;margin-top:-1px}.li-settings .dashicons{margin-right:10px;float:left;margin-top:-1px}.li-settings tr.synced-list-row td.synced-list-cell{padding:3px 0px 10px 0px}.li-settings tr.synced-list-row td.synced-list-cell .icon-tag{font-size:12px}.li-settings tr.synced-list-row span.synced-list-arrow{padding:0px 10px}.li-settings tr.synced-list-row td.synced-list-edit{padding:3px 0px 10px 20px}.li-settings.pre-mp6 h3{font-family:Georgia}.li-settings.pre-mp6 select,.li-settings.pre-mp6 input{font-family:sans-serif;font-size:12px}.li-settings.pre-mp6 .form-table,.li-settings.pre-mp6 .leadin-section,.li-settings.pre-mp6 h3{background-color:#f9f9f9 !important}.li-settings.pre-mp6 .form-table{-moz-border-radius-bottomleft:3px;-webkit-border-bottom-left-radius:3px;border-bottom-left-radius:3px;-moz-border-radius-bottomright:3px;-webkit-border-bottom-right-radius:3px;border-bottom-right-radius:3px}.li-settings.pre-mp6 h3{background-color:#f9f9f9 !important;-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;border-top-right-radius:3px}.li-settings.pre-mp6 .leadin-section{font-size:12px;padding-left:6px}.li-settings.pre-mp6 h3{padding-left:6px;font-weight:normal;color:#464646;text-shadow:#fff 0px 1px 0px}.li-settings.pre-mp6 label{font-size:12px}.li-settings.pre-mp6 input[type="checkbox"],.li-settings.pre-mp6 input[type="radio"]{margin-right:2px}.li-settings .color-swatch:before{content:"";height:19px;width:19px;vertical-align:top;margin:0 8px;display:inline-block}.li-settings .color-swatch.blue:before{background-color:#3288e6}.li-settings .color-swatch.red:before{background-color:#E43833}.li-settings .color-swatch.green:before{background-color:#7ED321}.li-settings .color-swatch.yellow:before{background-color:#FFBC00}.li-settings .color-swatch.purple:before{background-color:#BD10E0}.li-settings .color-swatch.orange:before{background-color:#FF8311}#icon-leadin{background:url("../../images/leadin-icon-32x32.png") top center no-repeat}.help-notification{background:#d9edf7;border:1px solid #bce8f1;padding:10px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.leadin-contact-avatar{margin-right:10px;float:left}.power-up-settings-icon{padding-right:10px;float:left;max-height:20px;margin-top:-1px}.dashicons{margin-right:10px;float:left;margin-top:-1px}tr.synced-list-row td.synced-list-cell{padding:3px 0px 10px 0px}tr.synced-list-row td.synced-list-cell .icon-tag{font-size:12px}tr.synced-list-row span.synced-list-arrow{padding:0px 10px}tr.synced-list-row td.synced-list-edit{padding:3px 0px 10px 20px}.leadin-settings__sidebar .pro-upgrade-cta{max-width:100%}.leadin-contacts .button{transition:background-color 0.2s}@media (min-width: 1200px){.leadin-contacts__nav{margin-top:30px;width:15.49296%;float:left;margin-right:1.40845%;margin-top:30px}.leadin-contacts__content{width:83.09859%;float:right;margin-right:0;margin-top:30px;margin-bottom:18px;margin-top:30px}.leadin-contacts__export-form{width:83.09859%;float:left;margin-right:1.40845%;padding-left:16.90141%;margin-bottom:18px}}.leadin-contacts__search{float:right;padding:10px 0;padding-bottom:9px}.leadin-contacts__type-picker{margin:0 0 30px;*zoom:1}.leadin-contacts__type-picker:after{content:"";display:table;clear:both}.leadin-contacts__type-picker li{margin:0;padding:0 1em 0 0;float:left}@media (min-width: 1200px){.leadin-contacts__type-picker li{float:none;padding:0}.leadin-contacts__type-picker li+li{padding:18px 0 0}}.leadin-contacts__type-picker li a{display:block;line-height:24px;font-weight:400;font-size:16px;text-decoration:none}.leadin-contacts__type-picker li a.current{font-weight:bold}.leadin-contacts__type-picker li a.current,.leadin-contacts__type-picker li a:hover,.leadin-contacts__type-picker li a:active{color:#F67D42}.leadin-contacts__type-picker li a .icon-tag,.leadin-contacts__type-picker li a .icon-user{padding-right:1em;font-size:0.85em}.leadin-contacts__tags-header{margin:30px 0 18px;font-size:14px;text-transform:uppercase;letter-spacing:0.1em;color:#999}.leadin-contacts__filter-text{margin:0 0 18px}.leadin-contacts__filter-count{color:#F67D42}#clear-filter{font-size:0.8em;margin-left:10px}.leadin-contacts__table table th#source{width:20%}.leadin-contacts__table table th#visits,.leadin-contacts__table table th#submissions{width:8%}.leadin-contacts__table table th#status,.leadin-contacts__table table th#last_visit,.leadin-contacts__table table th#date,.leadin-contacts__table table th#pageviews{width:10%}.leadin-contacts__table table th,.leadin-contacts__table table td{display:none}.leadin-contacts__table table th:nth-child(-n+3),.leadin-contacts__table table td:nth-child(-n+3){display:table-cell}@media (min-width: 1200px){.leadin-contacts__table table th,.leadin-contacts__table table td{display:table-cell}}.leadin-contacts.pre-mp6 .table_search{float:right;padding:12px 0;padding-bottom:11px}.leadin-contacts.pre-mp6 table{background-color:#fff;border-color:#dedede}.leadin-contacts.pre-mp6 table tr.alternate{background-color:#fff}.leadin-contacts.pre-mp6 table th,.leadin-contacts.pre-mp6 table td{border-top:0;padding:12px 6px 11px}.leadin-contacts.pre-mp6 table th a,.leadin-contacts.pre-mp6 table td a{padding:0}.leadin-contacts.pre-mp6 table th[scope="col"]{background:#eee;font-family:sans-serif;font-size:12px;text-shadow:none}.leadin-contacts.pre-mp6 table td{border-color:#dedede;line-height:18px;font-size:14px}.leadin-contacts.pre-mp6 table td .row-actions{float:left}#leadin .contact-top-navigation,#leadin .contact-deatils-column,#leadin .contact-timeline-column{width:100%;float:right;margin-right:0;*margin-left:-20px;display:inline;margin-bottom:12px}@media (min-width: 1200px){#leadin .contact-deatils-column{width:32.39437%;float:left;margin-right:1.40845%}#leadin .contact-timeline-column{width:66.19718%;float:right;margin-right:0}}#leadin .contact-header-wrap{*zoom:1;padding:18px 0 24px}#leadin .contact-header-wrap:after{content:"";display:table;clear:both}#leadin .contact-header-avatar,#leadin .contact-header-info{float:left}#leadin .contact-header-info{padding-left:15px}#leadin .contact-name{line-height:30px;padding:0;margin:0}#leadin .contact-networks{margin-top:12px}#leadin .contact-networks .icon-linkedin,#leadin .contact-networks .icon-facebook,#leadin .contact-networks .icon-twitter,#leadin .contact-networks .icon-googleplus,#leadin .contact-networks .icon-envelope{height:25px;width:25px;font-size:25px;margin-right:10px;color:#999;text-decoration:none}#leadin .contact-networks .icon-linkedin:hover,#leadin .contact-networks .icon-facebook:hover,#leadin .contact-networks .icon-twitter:hover,#leadin .contact-networks .icon-googleplus:hover,#leadin .contact-networks .icon-envelope:hover{color:#666}#leadin .contact-tag{display:inline-block;padding:3px 10px;color:#999;text-decoration:none;font-weight:600;font-size:13px;border:1px solid #ccc;-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px}#leadin .contact-tag:hover{opacity:0.75}#leadin .contact-tag+.contact-tag{margin-left:10px}#leadin .contact-edit-tags{text-decoration:none;text-transform:none;letter-spacing:0;font-weight:400}#leadin .contact-info h3{margin:0}#leadin .contact-info label{font-weight:bold;line-height:1;cursor:default}#leadin .leadin-meta-section{margin-bottom:12px}#leadin .leadin-meta-table{width:100%;text-align:left}#leadin .leadin-meta-table th{color:#666;padding-bottom:6px}#leadin .leadin-premium-tag:after{content:"Pro";margin-left:10px;font-size:10px;color:#fff;background-color:#93C054;padding:2px 6px;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px}#leadin .contact-history{margin-left:20px}@media (min-width: 1200px){#leadin .contact-history{padding-left:20px;border-left:2px solid #dedede}}#leadin .contact-history .sessions{margin:0}#leadin .contact-history .session+.session{margin-top:24px}#leadin .contact-history .session-date{position:relative}@media (min-width: 1200px){#leadin .contact-history .session-date:before{content:"•";font-size:32px;line-height:0;height:31px;width:31px;position:absolute;left:-27px;top:9px;color:#dedede}}#leadin .contact-history .session-time-range{color:#999;font-weight:400}#leadin .contact-history .events{background-color:#fff;border:1px solid #dedede;-moz-box-shadow:0 1px 1px rgba(0,0,0,0.04);-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.04);box-shadow:0 1px 1px rgba(0,0,0,0.04)}#leadin .contact-history .event{margin:0;padding:10px 20px;border-bottom:1px solid #dedede;border-left:4px solid;*zoom:1}#leadin .contact-history .event:after{content:"";display:table;clear:both}#leadin .contact-history .event:first-child{border-top:0}#leadin .contact-history .event.pageview{border-left-color:#28c;color:#28c}#leadin .contact-history .event.form-submission{border-left-color:#F67D42;color:#F67D42}#leadin .contact-history .event.source{border-left-color:#99AA1F;color:#99AA1F}#leadin .contact-history .event-title{margin:0;font-size:13px;font-weight:600}#leadin .contact-history .event-time{float:left;font-weight:400;width:75px}#leadin .contact-history .event-content{margin-left:75px}#leadin .contact-history .event-detail{margin-top:20px;color:#444}#leadin .contact-history .event-detail li+li{padding-top:6px;border-top:1px solid #eee}#leadin .contact-history .event-detail.pageview-url{color:#ccc}#leadin .contact-history .visit-source p{margin:0;color:#1F6696}#leadin .contact-history .field-label{text-transform:uppercase;letter-spacing:0.05em;color:#999;margin-bottom:6px;font-size:0.9em}#leadin .contact-history .field-value{margin:0}#leadin.pre-mp6 .events{background-color:#f9f9f9}.powerup-list{margin:0}.powerup-list .powerup{width:20%;min-width:250px;float:left;margin:20px;padding:15px}.powerup-list .powerup h2,.powerup-list .powerup p{margin:0;padding:0;color:#666;margin-bottom:15px}.powerup-list .powerup .img-containter{text-align:center;padding:30px 15px;margin-bottom:15px;background-color:#f1f1f1;color:red}.powerup-list .powerup .img-containter h2{font-size:20px}.powerup-list .powerup.activated h2,.powerup-list .powerup.activated p{color:#1F7D71}.powerup-list .powerup.activated .img-containter{background-color:#D3EEEB}@media (min-width: 1200px){.leadin-stats__top-container,.leadin-stats__chart-container,.leadin-stats__big-numbers-container{width:100%;float:right;margin-right:0}.leadin-stats__postbox_containter{width:49.29577%;float:left;margin-right:1.40845%}.leadin-stats__postbox_containter:nth-child(2n+2){width:49.29577%;float:right;margin-right:0}}h2.leadin-stats__header{margin-bottom:12px}.leadin-stats__postbox_containter .leadin-postbox,.leadin-stats__postbox_containter #leadin .leadin-meta-section,#leadin .leadin-stats__postbox_containter .leadin-meta-section,.leadin-stats__postbox_containter .powerup-list .powerup,.powerup-list .leadin-stats__postbox_containter .powerup{margin-bottom:12px}.leadin-stats__big-number{text-align:center;width:42%;float:left;padding:4%}@media (min-width: 1200px){.leadin-stats__big-number{width:25%;padding:10px}}.big-number--average .leadin-stats__big-number-top-label,.big-number--average .leadin-stats__big-number-content,.big-number--average .leadin-stats__big-number-bottom-label{color:#4CA6CF}.leadin-stats__top-container,.leadin-stats__big-number-top-label,.leadin-stats__big-number-content,.leadin-stats__big-number-bottom-label{color:#666;margin-bottom:12px}.leadin-stats__big-number-top-label{text-transform:uppercase;letter-spacing:0.05em}.big-button,.big-button--orange{display:block;text-align:center;color:#fff;text-decoration:none;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;padding:10px;font-size:16px;margin-top:15px}.big-button:hover,.big-button--orange:hover,.big-button:active,.big-button--orange:active,.big-button:focus,.big-button--orange:focus,.big-button:visited,.big-button--orange:visited{color:#fff;cursor:pointer}.big-button--orange{background-color:#F67D42;border:1px solid #E75913;-webkit-box-shadow:inset 0 1px 0 rgba(255,195,166,0.5),0 1px 0 rgba(0,0,0,0.08);box-shadow:inset 0 1px 0 rgba(255,195,166,0.5),0 1px 0 rgba(0,0,0,0.08)}.big-button--orange:hover{color:#fff;background-color:#f56c2a}.big-button--orange:active{color:#f1f1f1;background-color:#f45c11;-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none}.btn-submitting{background-color:#979797;cursor:not-allowed;border-color:grey;box-shadow:none}.btn-submitting:hover,.btn-submitting:active,.btn-submitting:focus,.btn-submitting:visited{background-color:#979797;color:#fff;box-shadow:none}.compare{width:100%;float:left;margin-right:1.40845%;display:inline;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;background-color:#fff;position:relative;margin-bottom:20px}.compare:first-of-type{margin-bottom:60px}.compare:first-of-type:after{width:100%;float:left;margin-right:1.40845%;display:inline;content:"";display:inline-block;-webkit-font-smoothing:antialiased;font:normal 48px/1 "dashicons";position:absolute;bottom:-55px;text-align:center}@media (min-width: 1200px){.compare:first-of-type:after{width:7.04225%;float:left;margin-right:1.40845%;content:"";display:inline-block;-webkit-font-smoothing:antialiased;font:normal 48px/1 "dashicons";position:absolute;right:-40px;top:4em}}@media (min-width: 1200px){.compare{width:32.39437%;float:left;margin-right:1.40845%;margin-right:60px}}.compare .title{width:100%;height:72px;background-color:#979797;position:absolute;text-align:center;padding-top:15px;-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;border-top-right-radius:3px}.compare .title h2{color:#fff;font-size:20px}.compare .title.teal{background-color:#6EC8C7}.compare .content{margin-top:50px;padding:30px}.compare .features{text-transform:uppercase;font-weight:bold;font-size:18px;padding-left:15px}.compare .features li{list-style-position:outside;text-indent:-16px}.compare .features p{margin-left:2px;margin-top:-5px}.compare p{text-transform:none;font-weight:normal;line-height:27px}
 
assets/css/build/leadin-lead-notifcation.css DELETED
@@ -1 +0,0 @@
1
- body,.body{background-color:#F1F1F1}h1{font-size:26px;line-height:60px}h2{font-size:23px}h3{font-size:18px}h4{font-size:14px;font-weight:bold}.submission-detail h3{color:#666}.lead-timeline__pageview-url a{color:#999}.lead-timeline__submission-label{text-transform:uppercase;font-size:12px;color:#999;letter-spacing:0.05em}.lead-timeline__previous-activity h2{margin-top:15px}.lead-timeline__event{background-color:#fff;border-top:1px solid #DEDEDE;border-right:1px solid #DEDEDE}.lead-timeline__event.pageview{border-left:4px solid #28c}.lead-timeline__event.pageview .lead-timeline__event-title,.lead-timeline__event.pageview .lead-timeline__event-time{color:#1F6696}.lead-timeline__event.submission{border-left:4px solid #F6601D}.lead-timeline__event.submission .lead-timeline__event-title,.lead-timeline__event.submission .lead-timeline__event-time{color:#B34A12}.lead-timeline__event.traffic-source{border-left:4px solid #99AA1F;border-bottom:1px solid #DEDEDE;margin-bottom:20px}.lead-timeline__event.traffic-source .lead-timeline__event-title,.lead-timeline__event.traffic-source .lead-timeline__event-time{color:#727E14}.data-lookup-header{font-size:20px;margin-bottom:15px}.data-lookup-limit .green,.data-lookup-limit .yellow,.data-lookup-limit .red{font-weight:bold}.data-lookup-limit .green{color:green}.data-lookup-limit .yellow{color:#ff0}.data-lookup-limit .red{color:red}.contact-name,.company-name{font-size:14px;font-weight:bold;color:#444}.contact-name-subhead,.company-name-subhead{font-size:14px;font-weight:400;margin-bottom:15px;color:#444}.contact-description,.company-description{color:#666}.footer{margin-bottom:20px}
 
assets/css/build/leadin-subscribe.css DELETED
@@ -1 +0,0 @@
1
- @keyframes vex-fadein{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes vex-fadein{0%{opacity:0}100%{opacity:1}}@-moz-keyframes vex-fadein{0%{opacity:0}100%{opacity:1}}@-ms-keyframes vex-fadein{0%{opacity:0}100%{opacity:1}}@-o-keyframes vex-fadein{0%{opacity:0}100%{opacity:1}}@keyframes vex-fadeout{0%{opacity:1}100%{opacity:0}}@-webkit-keyframes vex-fadeout{0%{opacity:1}100%{opacity:0}}@-moz-keyframes vex-fadeout{0%{opacity:1}100%{opacity:0}}@-ms-keyframes vex-fadeout{0%{opacity:1}100%{opacity:0}}@-o-keyframes vex-fadeout{0%{opacity:1}100%{opacity:0}}@keyframes vex-rotation{0%{transform:rotate(0deg);-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-ms-transform:rotate(0deg);-o-transform:rotate(0deg)}100%{transform:rotate(359deg);-webkit-transform:rotate(359deg);-moz-transform:rotate(359deg);-ms-transform:rotate(359deg);-o-transform:rotate(359deg)}}@-webkit-keyframes vex-rotation{0%{transform:rotate(0deg);-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-ms-transform:rotate(0deg);-o-transform:rotate(0deg)}100%{transform:rotate(359deg);-webkit-transform:rotate(359deg);-moz-transform:rotate(359deg);-ms-transform:rotate(359deg);-o-transform:rotate(359deg)}}@-moz-keyframes vex-rotation{0%{transform:rotate(0deg);-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-ms-transform:rotate(0deg);-o-transform:rotate(0deg)}100%{transform:rotate(359deg);-webkit-transform:rotate(359deg);-moz-transform:rotate(359deg);-ms-transform:rotate(359deg);-o-transform:rotate(359deg)}}@-ms-keyframes vex-rotation{0%{transform:rotate(0deg);-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-ms-transform:rotate(0deg);-o-transform:rotate(0deg)}100%{transform:rotate(359deg);-webkit-transform:rotate(359deg);-moz-transform:rotate(359deg);-ms-transform:rotate(359deg);-o-transform:rotate(359deg)}}@-o-keyframes vex-rotation{0%{transform:rotate(0deg);-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-ms-transform:rotate(0deg);-o-transform:rotate(0deg)}100%{transform:rotate(359deg);-webkit-transform:rotate(359deg);-moz-transform:rotate(359deg);-ms-transform:rotate(359deg);-o-transform:rotate(359deg)}}@keyframes vex-slideup{0%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);opacity:0}1%{transform:translateY(800px);-webkit-transform:translateY(800px);-moz-transform:translateY(800px);-ms-transform:translateY(800px);-o-transform:translateY(800px);opacity:0}2%{transform:translateY(800px);-webkit-transform:translateY(800px);-moz-transform:translateY(800px);-ms-transform:translateY(800px);-o-transform:translateY(800px);opacity:1}100%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);opacity:1}}@-webkit-keyframes vex-slideup{0%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);opacity:0}1%{transform:translateY(800px);-webkit-transform:translateY(800px);-moz-transform:translateY(800px);-ms-transform:translateY(800px);-o-transform:translateY(800px);opacity:0}2%{transform:translateY(800px);-webkit-transform:translateY(800px);-moz-transform:translateY(800px);-ms-transform:translateY(800px);-o-transform:translateY(800px);opacity:1}100%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);opacity:1}}@-moz-keyframes vex-slideup{0%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);opacity:0}1%{transform:translateY(800px);-webkit-transform:translateY(800px);-moz-transform:translateY(800px);-ms-transform:translateY(800px);-o-transform:translateY(800px);opacity:0}2%{transform:translateY(800px);-webkit-transform:translateY(800px);-moz-transform:translateY(800px);-ms-transform:translateY(800px);-o-transform:translateY(800px);opacity:1}100%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);opacity:1}}@-ms-keyframes vex-slideup{0%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);opacity:0}1%{transform:translateY(800px);-webkit-transform:translateY(800px);-moz-transform:translateY(800px);-ms-transform:translateY(800px);-o-transform:translateY(800px);opacity:0}2%{transform:translateY(800px);-webkit-transform:translateY(800px);-moz-transform:translateY(800px);-ms-transform:translateY(800px);-o-transform:translateY(800px);opacity:1}100%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);opacity:1}}@-o-keyframes vex-slideup{0%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);opacity:0}1%{transform:translateY(800px);-webkit-transform:translateY(800px);-moz-transform:translateY(800px);-ms-transform:translateY(800px);-o-transform:translateY(800px);opacity:0}2%{transform:translateY(800px);-webkit-transform:translateY(800px);-moz-transform:translateY(800px);-ms-transform:translateY(800px);-o-transform:translateY(800px);opacity:1}100%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);opacity:1}}@keyframes vex-slidedown{0%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0)}100%{transform:translateY(800px);-webkit-transform:translateY(800px);-moz-transform:translateY(800px);-ms-transform:translateY(800px);-o-transform:translateY(800px)}}@-webkit-keyframes vex-slidedown{0%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0)}100%{transform:translateY(800px);-webkit-transform:translateY(800px);-moz-transform:translateY(800px);-ms-transform:translateY(800px);-o-transform:translateY(800px)}}@-moz-keyframes vex-slidedown{0%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0)}100%{transform:translateY(800px);-webkit-transform:translateY(800px);-moz-transform:translateY(800px);-ms-transform:translateY(800px);-o-transform:translateY(800px)}}@-ms-keyframes vex-slidedown{0%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0)}100%{transform:translateY(800px);-webkit-transform:translateY(800px);-moz-transform:translateY(800px);-ms-transform:translateY(800px);-o-transform:translateY(800px)}}@-o-keyframes vex-slidedown{0%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0)}100%{transform:translateY(800px);-webkit-transform:translateY(800px);-moz-transform:translateY(800px);-ms-transform:translateY(800px);-o-transform:translateY(800px)}}@keyframes vex-flyin{0%{opacity:0;transform:translateY(-40px);-webkit-transform:translateY(-40px);-moz-transform:translateY(-40px);-ms-transform:translateY(-40px);-o-transform:translateY(-40px)}100%{opacity:1;transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0)}}@-webkit-keyframes vex-flyin{0%{opacity:0;transform:translateY(-40px);-webkit-transform:translateY(-40px);-moz-transform:translateY(-40px);-ms-transform:translateY(-40px);-o-transform:translateY(-40px)}100%{opacity:1;transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0)}}@-moz-keyframes vex-flyin{0%{opacity:0;transform:translateY(-40px);-webkit-transform:translateY(-40px);-moz-transform:translateY(-40px);-ms-transform:translateY(-40px);-o-transform:translateY(-40px)}100%{opacity:1;transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0)}}@-ms-keyframes vex-flyin{0%{opacity:0;transform:translateY(-40px);-webkit-transform:translateY(-40px);-moz-transform:translateY(-40px);-ms-transform:translateY(-40px);-o-transform:translateY(-40px)}100%{opacity:1;transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0)}}@-o-keyframes vex-flyin{0%{opacity:0;transform:translateY(-40px);-webkit-transform:translateY(-40px);-moz-transform:translateY(-40px);-ms-transform:translateY(-40px);-o-transform:translateY(-40px)}100%{opacity:1;transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0)}}@keyframes vex-flyout{0%{opacity:1;transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0)}100%{opacity:0;transform:translateY(-40px);-webkit-transform:translateY(-40px);-moz-transform:translateY(-40px);-ms-transform:translateY(-40px);-o-transform:translateY(-40px)}}@-webkit-keyframes vex-flyout{0%{opacity:1;transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0)}100%{opacity:0;transform:translateY(-40px);-webkit-transform:translateY(-40px);-moz-transform:translateY(-40px);-ms-transform:translateY(-40px);-o-transform:translateY(-40px)}}@-moz-keyframes vex-flyout{0%{opacity:1;transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0)}100%{opacity:0;transform:translateY(-40px);-webkit-transform:translateY(-40px);-moz-transform:translateY(-40px);-ms-transform:translateY(-40px);-o-transform:translateY(-40px)}}@-ms-keyframes vex-flyout{0%{opacity:1;transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0)}100%{opacity:0;transform:translateY(-40px);-webkit-transform:translateY(-40px);-moz-transform:translateY(-40px);-ms-transform:translateY(-40px);-o-transform:translateY(-40px)}}@-o-keyframes vex-flyout{0%{opacity:1;transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0)}100%{opacity:0;transform:translateY(-40px);-webkit-transform:translateY(-40px);-moz-transform:translateY(-40px);-ms-transform:translateY(-40px);-o-transform:translateY(-40px)}}@keyframes vex-dropin{0%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);opacity:0}1%{transform:translateY(-800px);-webkit-transform:translateY(-800px);-moz-transform:translateY(-800px);-ms-transform:translateY(-800px);-o-transform:translateY(-800px);opacity:0}2%{transform:translateY(-800px);-webkit-transform:translateY(-800px);-moz-transform:translateY(-800px);-ms-transform:translateY(-800px);-o-transform:translateY(-800px);opacity:1}100%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);opacity:1}}@-webkit-keyframes vex-dropin{0%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);opacity:0}1%{transform:translateY(-800px);-webkit-transform:translateY(-800px);-moz-transform:translateY(-800px);-ms-transform:translateY(-800px);-o-transform:translateY(-800px);opacity:0}2%{transform:translateY(-800px);-webkit-transform:translateY(-800px);-moz-transform:translateY(-800px);-ms-transform:translateY(-800px);-o-transform:translateY(-800px);opacity:1}100%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);opacity:1}}@-moz-keyframes vex-dropin{0%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);opacity:0}1%{transform:translateY(-800px);-webkit-transform:translateY(-800px);-moz-transform:translateY(-800px);-ms-transform:translateY(-800px);-o-transform:translateY(-800px);opacity:0}2%{transform:translateY(-800px);-webkit-transform:translateY(-800px);-moz-transform:translateY(-800px);-ms-transform:translateY(-800px);-o-transform:translateY(-800px);opacity:1}100%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);opacity:1}}@-ms-keyframes vex-dropin{0%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);opacity:0}1%{transform:translateY(-800px);-webkit-transform:translateY(-800px);-moz-transform:translateY(-800px);-ms-transform:translateY(-800px);-o-transform:translateY(-800px);opacity:0}2%{transform:translateY(-800px);-webkit-transform:translateY(-800px);-moz-transform:translateY(-800px);-ms-transform:translateY(-800px);-o-transform:translateY(-800px);opacity:1}100%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);opacity:1}}@-o-keyframes vex-dropin{0%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);opacity:0}1%{transform:translateY(-800px);-webkit-transform:translateY(-800px);-moz-transform:translateY(-800px);-ms-transform:translateY(-800px);-o-transform:translateY(-800px);opacity:0}2%{transform:translateY(-800px);-webkit-transform:translateY(-800px);-moz-transform:translateY(-800px);-ms-transform:translateY(-800px);-o-transform:translateY(-800px);opacity:1}100%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);opacity:1}}@keyframes vex-dropout{0%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0)}100%{transform:translateY(-800px);-webkit-transform:translateY(-800px);-moz-transform:translateY(-800px);-ms-transform:translateY(-800px);-o-transform:translateY(-800px)}}@-webkit-keyframes vex-dropout{0%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0)}100%{transform:translateY(-800px);-webkit-transform:translateY(-800px);-moz-transform:translateY(-800px);-ms-transform:translateY(-800px);-o-transform:translateY(-800px)}}@-moz-keyframes vex-dropout{0%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0)}100%{transform:translateY(-800px);-webkit-transform:translateY(-800px);-moz-transform:translateY(-800px);-ms-transform:translateY(-800px);-o-transform:translateY(-800px)}}@-ms-keyframes vex-dropout{0%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0)}100%{transform:translateY(-800px);-webkit-transform:translateY(-800px);-moz-transform:translateY(-800px);-ms-transform:translateY(-800px);-o-transform:translateY(-800px)}}@-o-keyframes vex-dropout{0%{transform:translateY(0);-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0)}100%{transform:translateY(-800px);-webkit-transform:translateY(-800px);-moz-transform:translateY(-800px);-ms-transform:translateY(-800px);-o-transform:translateY(-800px)}}@keyframes vex-pulse{0%{-moz-box-shadow:inset 0 0 0 300px transparent;-webkit-box-shadow:inset 0 0 0 300px transparent;box-shadow:inset 0 0 0 300px transparent}70%{-moz-box-shadow:inset 0 0 0 300px rgba(255,255,255,0.25);-webkit-box-shadow:inset 0 0 0 300px rgba(255,255,255,0.25);box-shadow:inset 0 0 0 300px rgba(255,255,255,0.25)}100%{-moz-box-shadow:inset 0 0 0 300px transparent;-webkit-box-shadow:inset 0 0 0 300px transparent;box-shadow:inset 0 0 0 300px transparent}}@-webkit-keyframes vex-pulse{0%{-moz-box-shadow:inset 0 0 0 300px transparent;-webkit-box-shadow:inset 0 0 0 300px transparent;box-shadow:inset 0 0 0 300px transparent}70%{-moz-box-shadow:inset 0 0 0 300px rgba(255,255,255,0.25);-webkit-box-shadow:inset 0 0 0 300px rgba(255,255,255,0.25);box-shadow:inset 0 0 0 300px rgba(255,255,255,0.25)}100%{-moz-box-shadow:inset 0 0 0 300px transparent;-webkit-box-shadow:inset 0 0 0 300px transparent;box-shadow:inset 0 0 0 300px transparent}}@-moz-keyframes vex-pulse{0%{-moz-box-shadow:inset 0 0 0 300px transparent;-webkit-box-shadow:inset 0 0 0 300px transparent;box-shadow:inset 0 0 0 300px transparent}70%{-moz-box-shadow:inset 0 0 0 300px rgba(255,255,255,0.25);-webkit-box-shadow:inset 0 0 0 300px rgba(255,255,255,0.25);box-shadow:inset 0 0 0 300px rgba(255,255,255,0.25)}100%{-moz-box-shadow:inset 0 0 0 300px transparent;-webkit-box-shadow:inset 0 0 0 300px transparent;box-shadow:inset 0 0 0 300px transparent}}@-ms-keyframes vex-pulse{0%{-moz-box-shadow:inset 0 0 0 300px transparent;-webkit-box-shadow:inset 0 0 0 300px transparent;box-shadow:inset 0 0 0 300px transparent}70%{-moz-box-shadow:inset 0 0 0 300px rgba(255,255,255,0.25);-webkit-box-shadow:inset 0 0 0 300px rgba(255,255,255,0.25);box-shadow:inset 0 0 0 300px rgba(255,255,255,0.25)}100%{-moz-box-shadow:inset 0 0 0 300px transparent;-webkit-box-shadow:inset 0 0 0 300px transparent;box-shadow:inset 0 0 0 300px transparent}}@-o-keyframes vex-pulse{0%{-moz-box-shadow:inset 0 0 0 300px transparent;-webkit-box-shadow:inset 0 0 0 300px transparent;box-shadow:inset 0 0 0 300px transparent}70%{-moz-box-shadow:inset 0 0 0 300px rgba(255,255,255,0.25);-webkit-box-shadow:inset 0 0 0 300px rgba(255,255,255,0.25);box-shadow:inset 0 0 0 300px rgba(255,255,255,0.25)}100%{-moz-box-shadow:inset 0 0 0 300px transparent;-webkit-box-shadow:inset 0 0 0 300px transparent;box-shadow:inset 0 0 0 300px transparent}}.vex,.vex *,.vex *:before,.vex *:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;border:0;margin:0;padding:0}.vex,.vex-overlay{position:fixed;top:0;right:0;bottom:0;left:0}.vex{overflow:visible;-webkit-overflow-scrolling:touch;z-index:1111;font-size:16px}.vex .vex-overlay{background:#000;filter:alpha(opacity=40);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)"}.vex .vex-closing.vex-overlay{animation:vex-fadeout 0.5s;-webkit-animation:vex-fadeout 0.5s;-moz-animation:vex-fadeout 0.5s;-ms-animation:vex-fadeout 0.5s;-o-animation:vex-fadeout 0.5s;-webkit-backface-visibility:hidden}.vex .vex-overlay{animation:vex-fadein 0.5s;-webkit-animation:vex-fadein 0.5s;-moz-animation:vex-fadein 0.5s;-ms-animation:vex-fadein 0.5s;-o-animation:vex-fadein 0.5s;-webkit-backface-visibility:hidden;background-color:rgba(0,0,0,0.4)}.vex .vex-content{*zoom:1;-moz-box-shadow:0px 0px 5px rgba(0,0,0,0.25);-webkit-box-shadow:0px 0px 5px rgba(0,0,0,0.25);box-shadow:0px 0px 5px rgba(0,0,0,0.25);position:relative;padding:1em 1.5em;margin:0 auto;background:#fff;max-width:100%;width:30em}.vex .vex-content:after{content:"";display:table;clear:both}.vex .vex-content h1,.vex .vex-content h2,.vex .vex-content h3,.vex .vex-content h4,.vex .vex-content h5,.vex .vex-content h6,.vex .vex-content p,.vex .vex-content ul,.vex .vex-content li,.vex .vex-content input{line-height:1.5;text-transform:none;letter-spacing:0;margin:0}.vex .vex-content h1,.vex .vex-content h2,.vex .vex-content h3,.vex .vex-content h4,.vex .vex-content h5,.vex .vex-content h6{color:#444;font-size:1.3em;font-weight:600;margin-bottom:0.6em}.vex .vex-content p,.vex .vex-content ul,.vex .vex-content li,.vex .vex-content input{color:#666;font-size:1em;font-weight:normal;margin-bottom:1em}.vex .vex-dialog-message,.vex .vex-dialog-input,.vex .vex-dialog-buttons{*zoom:1}.vex .vex-dialog-message:after,.vex .vex-dialog-input:after,.vex .vex-dialog-buttons:after{content:"";display:table;clear:both}.vex .leadin-subscribe-powered-by{color:#999;display:block;text-align:center;font-size:0.8em;text-decoration:none}.vex .leadin-subscribe-powered-by:hover{background:none;color:#999;text-decoration:underline;font-weight:normal}.vex .vex-close{-moz-border-radius:0.33em;-webkit-border-radius:0.33em;border-radius:0.33em;position:absolute;top:1em;right:1.5em;cursor:pointer;z-index:9999}.vex .vex-close:before{-moz-border-radius:0.33em;-webkit-border-radius:0.33em;border-radius:0.33em;content:"×";font-size:25px;font-weight:normal;line-height:25px;height:25px;width:25px;text-align:center;color:#bbb;background:transparent}.vex .vex-close:hover:before,.vex .vex-close:active:before{color:#777}.vex .vex-dialog-form{margin:0}.vex .vex-dialog-input{margin-bottom:1em}.vex textarea,.vex input[type="date"],.vex input[type="datetime"],.vex input[type="datetime-local"],.vex input[type="email"],.vex input[type="month"],.vex input[type="number"],.vex input[type="password"],.vex input[type="search"],.vex input[type="tel"],.vex input[type="text"],.vex input[type="time"],.vex input[type="url"],.vex input[type="week"]{-moz-border-radius:0.25em;-webkit-border-radius:0.25em;border-radius:0.25em;background:#fff;width:100%;padding:0.5em 0.5em;border:1px solid #ddd;margin:0;height:auto}.vex textarea:hover,.vex input[type="date"]:hover,.vex input[type="datetime"]:hover,.vex input[type="datetime-local"]:hover,.vex input[type="email"]:hover,.vex input[type="month"]:hover,.vex input[type="number"]:hover,.vex input[type="password"]:hover,.vex input[type="search"]:hover,.vex input[type="tel"]:hover,.vex input[type="text"]:hover,.vex input[type="time"]:hover,.vex input[type="url"]:hover,.vex input[type="week"]:hover{border:1px solid #ddd}.vex textarea:focus,.vex input[type="date"]:focus,.vex input[type="datetime"]:focus,.vex input[type="datetime-local"]:focus,.vex input[type="email"]:focus,.vex input[type="month"]:focus,.vex input[type="number"]:focus,.vex input[type="password"]:focus,.vex input[type="search"]:focus,.vex input[type="tel"]:focus,.vex input[type="text"]:focus,.vex input[type="time"]:focus,.vex input[type="url"]:focus,.vex input[type="week"]:focus{border:1px solid #ddd;outline:none}.vex textarea .error,.vex input[type="date"] .error,.vex input[type="datetime"] .error,.vex input[type="datetime-local"] .error,.vex input[type="email"] .error,.vex input[type="month"] .error,.vex input[type="number"] .error,.vex input[type="password"] .error,.vex input[type="search"] .error,.vex input[type="tel"] .error,.vex input[type="text"] .error,.vex input[type="time"] .error,.vex input[type="url"] .error,.vex input[type="week"] .error{-moz-box-shadow:inset 0 0 0 2px #f33f33;-webkit-box-shadow:inset 0 0 0 2px #f33f33;box-shadow:inset 0 0 0 2px #f33f33}.vex input+input{margin-top:0.5em !important}.vex .vex-dialog-button{-moz-border-radius:0.25em;-webkit-border-radius:0.25em;border-radius:0.25em;-webkit-appearance:none;cursor:pointer;font-size:1em;font-weight:bold;line-height:1;padding:1em 1.5em;width:100%}.vex .vex-dialog-button.vex-last{margin-left:0}.vex .vex-dialog-button:focus,.vex .vex-dialog-button:hover{outline:none}.vex .vex-dialog-button.vex-dialog-button-primary{-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none;border:0}.vex .vex-loading-spinner{animation:vex-rotation 0.7s linear infinite;-webkit-animation:vex-rotation 0.7s linear infinite;-moz-animation:vex-rotation 0.7s linear infinite;-ms-animation:vex-rotation 0.7s linear infinite;-o-animation:vex-rotation 0.7s linear infinite;-webkit-backface-visibility:hidden;-moz-box-shadow:0 0 0 0.5em #f0f0f0,0 0 1px 0.5em rgba(0,0,0,0.3);-webkit-box-shadow:0 0 0 0.5em #f0f0f0,0 0 1px 0.5em rgba(0,0,0,0.3);box-shadow:0 0 0 0.5em #f0f0f0,0 0 1px 0.5em rgba(0,0,0,0.3);-moz-border-radius:100%;-webkit-border-radius:100%;border-radius:100%;background:#f0f0f0;z-index:1112;margin:auto;height:2em;width:2em;border:0.2em solid transparent;border-top-color:#bbb}.vex.vex-theme-bottom-right-corner .vex-content,.vex.vex-theme-bottom-left-corner .vex-content,.vex.vex-theme-default .vex-content{border-top:5px solid}.vex.vex-theme-bottom-right-corner .vex-overlay,.vex.vex-theme-bottom-left-corner .vex-overlay,.vex.vex-theme-top .vex-overlay{display:none}.vex.vex-theme-bottom-right-corner,.vex.vex-theme-bottom-left-corner{top:auto;bottom:0}.vex.vex-theme-bottom-right-corner .vex-content,.vex.vex-theme-bottom-left-corner .vex-content{animation:vex-slideup 0.5s;-webkit-animation:vex-slideup 0.5s;-moz-animation:vex-slideup 0.5s;-ms-animation:vex-slideup 0.5s;-o-animation:vex-slideup 0.5s;-webkit-backface-visibility:hidden;position:fixed}.vex.vex-theme-bottom-right-corner.vex-closing .vex-content,.vex.vex-theme-bottom-left-corner.vex-closing .vex-content{animation:vex-slidedown 0.5s;-webkit-animation:vex-slidedown 0.5s;-moz-animation:vex-slidedown 0.5s;-ms-animation:vex-slidedown 0.5s;-o-animation:vex-slidedown 0.5s;-webkit-backface-visibility:hidden}.vex.vex-theme-default{padding-top:200px}.vex.vex-theme-default .vex-content{animation:vex-flyin 0.5s;-webkit-animation:vex-flyin 0.5s;-moz-animation:vex-flyin 0.5s;-ms-animation:vex-flyin 0.5s;-o-animation:vex-flyin 0.5s;-webkit-backface-visibility:hidden;-moz-border-radius:0.33em;-webkit-border-radius:0.33em;border-radius:0.33em}.vex.vex-theme-default.vex-closing .vex-content{animation:vex-flyout 0.5s;-webkit-animation:vex-flyout 0.5s;-moz-animation:vex-flyout 0.5s;-ms-animation:vex-flyout 0.5s;-o-animation:vex-flyout 0.5s;-webkit-backface-visibility:hidden}.vex.vex-theme-bottom-right-corner .vex-content{-moz-border-radius:0.33em 0 0 0;-webkit-border-radius:0.33em;border-radius:0.33em 0 0 0;right:0;left:auto;bottom:0}.vex.vex-theme-bottom-left-corner .vex-content{-moz-border-radius:0 0.33em 0 0;-webkit-border-radius:0;border-radius:0 0.33em 0 0;left:0;right:auto;bottom:0}.vex.vex-theme-top{bottom:inherit}.vex.vex-theme-top .vex-content{animation:vex-dropin 0.5s;-webkit-animation:vex-dropin 0.5s;-moz-animation:vex-dropin 0.5s;-ms-animation:vex-dropin 0.5s;-o-animation:vex-dropin 0.5s;-webkit-backface-visibility:hidden;width:100%;border-bottom:5px solid}.vex.vex-theme-top.vex-closing .vex-content{animation:vex-dropout 0.5s;-webkit-animation:vex-dropout 0.5s;-moz-animation:vex-dropout 0.5s;-ms-animation:vex-dropout 0.5s;-o-animation:vex-dropout 0.5s;-webkit-backface-visibility:hidden}@media only screen and (min-width: 600px){.vex.vex-theme-top .vex-dialog-message,.vex.vex-theme-top .vex-dialog-input,.vex.vex-theme-top .vex-dialog-buttons{float:left}.vex.vex-theme-top .vex-dialog-message{width:40%;text-align:right;padding-right:1em}.vex.vex-theme-top .vex-dialog-message h4{padding:0;margin:0;line-height:2.1em}.vex.vex-theme-top .vex-dialog-message p{display:none}.vex.vex-theme-top .vex-dialog-input{width:20%;margin:0}.vex.vex-theme-top .vex-dialog-buttons{width:40%;text-align:left;padding-left:1em}.vex.vex-theme-top .vex-dialog-buttons .vex-dialog-button-primary{width:auto;margin:0;padding:0.5em 1em;border:1px solid}.vex.vex-theme-top .leadin-subscribe-powered-by{position:absolute;bottom:10px;right:10px}}.vex.leadin-popup-color-blue .vex-content{border-color:#3288e6}.vex.leadin-popup-color-blue input:focus{-moz-box-shadow:inset 0 0 0 2px #8dbdf1;-webkit-box-shadow:inset 0 0 0 2px #8dbdf1;box-shadow:inset 0 0 0 2px #8dbdf1}.vex.leadin-popup-color-blue .vex-dialog-button-primary{background:#3288e6;color:#fff}.vex.leadin-popup-color-blue .vex-dialog-button-primary:hover{background:#5fa2ec}.vex.leadin-popup-color-red .vex-content{border-color:#E43833}.vex.leadin-popup-color-red input:focus{-moz-box-shadow:inset 0 0 0 2px #f0908d;-webkit-box-shadow:inset 0 0 0 2px #f0908d;box-shadow:inset 0 0 0 2px #f0908d}.vex.leadin-popup-color-red .vex-dialog-button-primary{background:#E43833;color:#fff}.vex.leadin-popup-color-red .vex-dialog-button-primary:hover{background:#ea6460}.vex.leadin-popup-color-green .vex-content{border-color:#7ED321}.vex.leadin-popup-color-green input:focus{-moz-box-shadow:inset 0 0 0 2px #b0e971;-webkit-box-shadow:inset 0 0 0 2px #b0e971;box-shadow:inset 0 0 0 2px #b0e971}.vex.leadin-popup-color-green .vex-dialog-button-primary{background:#7ED321;color:#fff}.vex.leadin-popup-color-green .vex-dialog-button-primary:hover{background:#97e245}.vex.leadin-popup-color-yellow .vex-content{border-color:#FFBC00}.vex.leadin-popup-color-yellow input:focus{-moz-box-shadow:inset 0 0 0 2px #ffd766;-webkit-box-shadow:inset 0 0 0 2px #ffd766;box-shadow:inset 0 0 0 2px #ffd766}.vex.leadin-popup-color-yellow .vex-dialog-button-primary{background:#FFBC00;color:#fff}.vex.leadin-popup-color-yellow .vex-dialog-button-primary:hover{background:#ffc933}.vex.leadin-popup-color-purple .vex-content{border-color:#BD10E0}.vex.leadin-popup-color-purple input:focus{-moz-box-shadow:inset 0 0 0 2px #db62f4;-webkit-box-shadow:inset 0 0 0 2px #db62f4;box-shadow:inset 0 0 0 2px #db62f4}.vex.leadin-popup-color-purple .vex-dialog-button-primary{background:#BD10E0;color:#fff}.vex.leadin-popup-color-purple .vex-dialog-button-primary:hover{background:#d033f0}.vex.leadin-popup-color-orange .vex-content{border-color:#FF8311}.vex.leadin-popup-color-orange input:focus{-moz-box-shadow:inset 0 0 0 2px #ffb877;-webkit-box-shadow:inset 0 0 0 2px #ffb877;box-shadow:inset 0 0 0 2px #ffb877}.vex.leadin-popup-color-orange .vex-dialog-button-primary{background:#FF8311;color:#fff}.vex.leadin-popup-color-orange .vex-dialog-button-primary:hover{background:#ff9e44}@media only screen and (max-width: 760px){.vex.leadin-subscribe-mobile-hide{display:none}}
 
assets/css/select2.css DELETED
@@ -1,601 +0,0 @@
1
- /*
2
- Version: 3.4.8 Timestamp: Thu May 1 09:50:32 EDT 2014
3
- */
4
- .select2-container {
5
- margin: 0;
6
- position: relative;
7
- display: inline-block;
8
- /* inline-block for ie7 */
9
- zoom: 1;
10
- *display: inline;
11
- vertical-align: middle;
12
- }
13
-
14
- .select2-container,
15
- .select2-drop,
16
- .select2-search,
17
- .select2-search input {
18
- /*
19
- Force border-box so that % widths fit the parent
20
- container without overlap because of margin/padding.
21
- More Info : http://www.quirksmode.org/css/box.html
22
- */
23
- -webkit-box-sizing: border-box; /* webkit */
24
- -moz-box-sizing: border-box; /* firefox */
25
- box-sizing: border-box; /* css3 */
26
- }
27
-
28
- .select2-container .select2-choice {
29
- display: block;
30
- height: 28px;
31
- padding: 0 0 0 8px;
32
- overflow: hidden;
33
- position: relative;
34
-
35
- border: 1px solid #ddd;
36
- white-space: nowrap;
37
- line-height: 28px;
38
- color: #444;
39
- text-decoration: none;
40
-
41
- border-radius: 4px;
42
-
43
- background-clip: padding-box;
44
-
45
- -webkit-touch-callout: none;
46
- -webkit-user-select: none;
47
- -moz-user-select: none;
48
- -ms-user-select: none;
49
- user-select: none;
50
-
51
- background-color: #fff;
52
- }
53
-
54
- .select2-container.select2-drop-above .select2-choice {
55
- border-bottom-color: #ddd;
56
-
57
- border-radius: 0 0 4px 4px;
58
- }
59
-
60
- .select2-container.select2-allowclear .select2-choice .select2-chosen {
61
- margin-right: 42px;
62
- }
63
-
64
- .select2-container .select2-choice > .select2-chosen {
65
- margin-right: 28px;
66
- display: block;
67
- overflow: hidden;
68
- line-height: 28px;
69
- font-size: 0.8em;
70
-
71
- white-space: nowrap;
72
-
73
- text-overflow: ellipsis;
74
- float: none;
75
- width: auto;
76
- }
77
-
78
- .select2-container .select2-choice abbr {
79
- display: none;
80
- width: 12px;
81
- height: 12px;
82
- position: absolute;
83
- right: 24px;
84
- top: 8px;
85
-
86
- font-size: 1px;
87
- text-decoration: none;
88
-
89
- border: 0;
90
- background: url('../../images/select2.png') right top no-repeat;
91
- cursor: pointer;
92
- outline: 0;
93
- }
94
-
95
- .select2-container.select2-allowclear .select2-choice abbr {
96
- display: inline-block;
97
- }
98
-
99
- .select2-container .select2-choice abbr:hover {
100
- background-position: right -11px;
101
- cursor: pointer;
102
- }
103
-
104
- .select2-drop-mask {
105
- border: 0;
106
- margin: 0;
107
- padding: 0;
108
- position: fixed;
109
- left: 0;
110
- top: 0;
111
- min-height: 100%;
112
- min-width: 100%;
113
- height: auto;
114
- width: auto;
115
- opacity: 0;
116
- z-index: 9998;
117
- /* styles required for IE to work */
118
- background-color: #fff;
119
- filter: alpha(opacity=0);
120
- }
121
-
122
- .select2-drop {
123
- width: 100%;
124
- margin-top: -1px;
125
- position: absolute;
126
- z-index: 9999;
127
- top: 100%;
128
-
129
- background: #fff;
130
- color: #000;
131
- border: 1px solid #ddd;
132
- border-top: 0;
133
-
134
- border-radius: 0 0 4px 4px;
135
-
136
- -webkit-box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
137
- box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
138
- }
139
-
140
- .select2-drop.select2-drop-above {
141
- margin-top: 1px;
142
- border-top: 1px solid #ddd;
143
- border-bottom: 0;
144
-
145
- border-radius: 4px 4px 0 0;
146
-
147
- -webkit-box-shadow: 0 -4px 5px rgba(0, 0, 0, .15);
148
- box-shadow: 0 -4px 5px rgba(0, 0, 0, .15);
149
- }
150
-
151
- .select2-drop-active {
152
- border: 1px solid #5897fb;
153
- border-top: none;
154
- }
155
-
156
- .select2-drop.select2-drop-above.select2-drop-active {
157
- border-top: 1px solid #5897fb;
158
- }
159
-
160
- .select2-drop-auto-width {
161
- border-top: 1px solid #ddd;
162
- width: auto;
163
- }
164
-
165
- .select2-drop-auto-width .select2-search {
166
- padding-top: 4px;
167
- }
168
-
169
- .select2-container .select2-choice .select2-arrow {
170
- display: inline-block;
171
- width: 18px;
172
- height: 100%;
173
- position: absolute;
174
- right: 0;
175
- top: 0;
176
-
177
- border-radius: 0 4px 4px 0;
178
-
179
- background-clip: padding-box;
180
-
181
- }
182
-
183
- .select2-container .select2-choice .select2-arrow b {
184
- display: block;
185
- width: 100%;
186
- height: 100%;
187
- background: url('../../images/select2.png') no-repeat 0 1px;
188
- }
189
-
190
- .select2-search {
191
- display: inline-block;
192
- width: 100%;
193
- min-height: 28px;
194
- margin: 0;
195
- padding-left: 4px;
196
- padding-right: 4px;
197
-
198
- position: relative;
199
- z-index: 10000;
200
-
201
- white-space: nowrap;
202
- }
203
-
204
- .select2-search input {
205
- width: 100%;
206
- height: auto !important;
207
- min-height: 28px;
208
- padding: 4px 20px 4px 5px;
209
- margin: 0;
210
-
211
- outline: 0;
212
- font-family: sans-serif;
213
- font-size: 1em;
214
-
215
- border: 1px solid #ddd;
216
- border-radius: 0;
217
-
218
- -webkit-box-shadow: none;
219
- box-shadow: none;
220
-
221
- background: #fff
222
- }
223
-
224
- .select2-drop.select2-drop-above .select2-search input {
225
- margin-top: 4px;
226
- }
227
-
228
- .select2-search input.select2-active {
229
-
230
- }
231
-
232
- .select2-container-active .select2-choice,
233
- .select2-container-active .select2-choices {
234
- border: 1px solid #5897fb;
235
- outline: none;
236
-
237
- -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, .3);
238
- box-shadow: 0 0 5px rgba(0, 0, 0, .3);
239
- }
240
-
241
- .select2-dropdown-open .select2-choice {
242
- border-bottom-color: transparent;
243
- -webkit-box-shadow: 0 1px 0 #fff inset;
244
- box-shadow: 0 1px 0 #fff inset;
245
-
246
- border-bottom-left-radius: 0;
247
- border-bottom-right-radius: 0;
248
-
249
- }
250
-
251
- .select2-dropdown-open.select2-drop-above .select2-choice,
252
- .select2-dropdown-open.select2-drop-above .select2-choices {
253
- border: 1px solid #5897fb;
254
- border-top-color: transparent;
255
- }
256
-
257
- .select2-dropdown-open .select2-choice .select2-arrow {
258
- background: transparent;
259
- border-left: none;
260
- filter: none;
261
- }
262
- .select2-dropdown-open .select2-choice .select2-arrow b {
263
- background-position: -18px 1px;
264
- }
265
-
266
- .select2-hidden-accessible {
267
- border: 0;
268
- clip: rect(0 0 0 0);
269
- height: 1px;
270
- margin: -1px;
271
- overflow: hidden;
272
- padding: 0;
273
- position: absolute;
274
- width: 1px;
275
- }
276
-
277
- /* results */
278
- .select2-results {
279
- max-height: 200px;
280
- padding: 0 0 0 4px;
281
- margin: 4px 4px 4px 0;
282
- position: relative;
283
- overflow-x: hidden;
284
- overflow-y: auto;
285
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
286
- }
287
-
288
- .select2-results ul.select2-result-sub {
289
- margin: 0;
290
- padding-left: 0;
291
- }
292
-
293
- .select2-results li {
294
- list-style: none;
295
- display: list-item;
296
- background-image: none;
297
- }
298
-
299
- .select2-results li.select2-result-with-children > .select2-result-label {
300
- font-weight: bold;
301
- }
302
-
303
- .select2-results .select2-result-label {
304
- padding: 3px 7px 4px;
305
- margin: 0;
306
- cursor: pointer;
307
-
308
- min-height: 1em;
309
-
310
- -webkit-touch-callout: none;
311
- -webkit-user-select: none;
312
- -moz-user-select: none;
313
- -ms-user-select: none;
314
- user-select: none;
315
- }
316
-
317
- .select2-results-dept-1 .select2-result-label { padding-left: 20px }
318
- .select2-results-dept-2 .select2-result-label { padding-left: 40px }
319
- .select2-results-dept-3 .select2-result-label { padding-left: 60px }
320
- .select2-results-dept-4 .select2-result-label { padding-left: 80px }
321
- .select2-results-dept-5 .select2-result-label { padding-left: 100px }
322
- .select2-results-dept-6 .select2-result-label { padding-left: 110px }
323
- .select2-results-dept-7 .select2-result-label { padding-left: 120px }
324
-
325
- .select2-results .select2-highlighted {
326
- background: #3875d7;
327
- color: #fff;
328
- }
329
-
330
- .select2-results li em {
331
- background: #feffde;
332
- font-style: normal;
333
- }
334
-
335
- .select2-results .select2-highlighted em {
336
- background: transparent;
337
- }
338
-
339
- .select2-results .select2-highlighted ul {
340
- background: #fff;
341
- color: #000;
342
- }
343
-
344
-
345
- .select2-results .select2-no-results,
346
- .select2-results .select2-searching,
347
- .select2-results .select2-selection-limit {
348
- background: #f4f4f4;
349
- display: list-item;
350
- padding-left: 5px;
351
- }
352
-
353
- /*
354
- disabled look for disabled choices in the results dropdown
355
- */
356
- .select2-results .select2-disabled.select2-highlighted {
357
- color: #666;
358
- background: #f4f4f4;
359
- display: list-item;
360
- cursor: default;
361
- }
362
- .select2-results .select2-disabled {
363
- background: #f4f4f4;
364
- display: list-item;
365
- cursor: default;
366
- }
367
-
368
- .select2-results .select2-selected {
369
- display: none;
370
- }
371
-
372
- .select2-more-results.select2-active {
373
- background: #f4f4f4 url('../../images/select2-spinner.gif') no-repeat 100%;
374
- }
375
-
376
- .select2-more-results {
377
- background: #f4f4f4;
378
- display: list-item;
379
- }
380
-
381
- /* disabled styles */
382
-
383
- .select2-container.select2-container-disabled .select2-choice {
384
- background-color: #f4f4f4;
385
- background-image: none;
386
- border: 1px solid #ddd;
387
- cursor: default;
388
- }
389
-
390
- .select2-container.select2-container-disabled .select2-choice .select2-arrow {
391
- background-color: #f4f4f4;
392
- background-image: none;
393
- border-left: 0;
394
- }
395
-
396
- .select2-container.select2-container-disabled .select2-choice abbr {
397
- display: none;
398
- }
399
-
400
-
401
- /* multiselect */
402
-
403
- .select2-container-multi .select2-choices {
404
- height: auto !important;
405
- height: 1%;
406
- margin: 0;
407
- padding: 0;
408
- position: relative;
409
-
410
- border: 1px solid #ddd;
411
- cursor: text;
412
- overflow: hidden;
413
-
414
- background-color: #fff;
415
- }
416
-
417
- .select2-locked {
418
- padding: 3px 5px 3px 5px !important;
419
- }
420
-
421
- .select2-container-multi .select2-choices {
422
- min-height: 28px;
423
- }
424
-
425
- .select2-container-multi.select2-container-active .select2-choices {
426
- border: 1px solid #5897fb;
427
- outline: none;
428
-
429
- -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, .3);
430
- box-shadow: 0 0 5px rgba(0, 0, 0, .3);
431
- }
432
- .select2-container-multi .select2-choices li {
433
- float: left;
434
- list-style: none;
435
- }
436
- html[dir="rtl"] .select2-container-multi .select2-choices li
437
- {
438
- float: right;
439
- }
440
- .select2-container-multi .select2-choices .select2-search-field {
441
- margin: 0;
442
- padding: 0;
443
- white-space: nowrap;
444
- }
445
-
446
- .select2-container-multi .select2-choices .select2-search-field input {
447
- padding: 5px;
448
- margin: 1px 0;
449
-
450
- font-family: sans-serif;
451
- font-size: 100%;
452
- color: #666;
453
- outline: 0;
454
- border: 0;
455
- -webkit-box-shadow: none;
456
- box-shadow: none;
457
- background: transparent !important;
458
- }
459
-
460
- .select2-container-multi .select2-choices .select2-search-field input.select2-active {
461
- background: #fff url('../../images/select2-spinner.gif') no-repeat 100% !important;
462
- }
463
-
464
- .select2-default {
465
- color: #999 !important;
466
- }
467
-
468
- .select2-container-multi .select2-choices .select2-search-choice {
469
- padding: 3px 5px 3px 18px;
470
- margin: 3px 0 3px 5px;
471
- position: relative;
472
-
473
- line-height: 13px;
474
- color: #333;
475
- cursor: default;
476
- border: 1px solid #ddd;
477
-
478
- border-radius: 3px;
479
-
480
- -webkit-box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
481
- box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
482
-
483
- background-clip: padding-box;
484
-
485
- -webkit-touch-callout: none;
486
- -webkit-user-select: none;
487
- -moz-user-select: none;
488
- -ms-user-select: none;
489
- user-select: none;
490
-
491
- background-color: #e4e4e4;
492
- }
493
- html[dir="rtl"] .select2-container-multi .select2-choices .select2-search-choice
494
- {
495
- margin-left: 0;
496
- margin-right: 5px;
497
- }
498
- .select2-container-multi .select2-choices .select2-search-choice .select2-chosen {
499
- cursor: default;
500
- }
501
- .select2-container-multi .select2-choices .select2-search-choice-focus {
502
- background: #d4d4d4;
503
- }
504
-
505
- .select2-search-choice-close {
506
- display: block;
507
- width: 12px;
508
- height: 13px;
509
- position: absolute;
510
- right: 3px;
511
- top: 4px;
512
-
513
- font-size: 1px;
514
- outline: none;
515
- background: url('../../images/select2.png') right top no-repeat;
516
- }
517
- html[dir="rtl"] .select2-search-choice-close {
518
- right: auto;
519
- left: 3px;
520
- }
521
-
522
- .select2-container-multi .select2-search-choice-close {
523
- left: 3px;
524
- }
525
-
526
- .select2-container-multi .select2-choices .select2-search-choice .select2-search-choice-close:hover {
527
- background-position: right -11px;
528
- }
529
- .select2-container-multi .select2-choices .select2-search-choice-focus .select2-search-choice-close {
530
- background-position: right -11px;
531
- }
532
-
533
- /* disabled styles */
534
- .select2-container-multi.select2-container-disabled .select2-choices {
535
- background-color: #f4f4f4;
536
- background-image: none;
537
- border: 1px solid #ddd;
538
- cursor: default;
539
- }
540
-
541
- .select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice {
542
- padding: 3px 5px 3px 5px;
543
- border: 1px solid #ddd;
544
- background-image: none;
545
- background-color: #f4f4f4;
546
- }
547
-
548
- .select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice .select2-search-choice-close { display: none;
549
- background: none;
550
- }
551
- /* end multiselect */
552
-
553
-
554
- .select2-result-selectable .select2-match,
555
- .select2-result-unselectable .select2-match {
556
- text-decoration: underline;
557
- }
558
-
559
- .select2-offscreen, .select2-offscreen:focus {
560
- clip: rect(0 0 0 0) !important;
561
- width: 1px !important;
562
- height: 1px !important;
563
- border: 0 !important;
564
- margin: 0 !important;
565
- padding: 0 !important;
566
- overflow: hidden !important;
567
- position: absolute !important;
568
- outline: 0 !important;
569
- left: 0px !important;
570
- top: 0px !important;
571
- }
572
-
573
- .select2-display-none {
574
- display: none;
575
- }
576
-
577
- .select2-measure-scrollbar {
578
- position: absolute;
579
- top: -10000px;
580
- left: -10000px;
581
- width: 100px;
582
- height: 100px;
583
- overflow: scroll;
584
- }
585
-
586
- /* Retina-ize icons */
587
-
588
- @media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 2dppx) {
589
- .select2-search input,
590
- .select2-search-choice-close,
591
- .select2-container .select2-choice abbr,
592
- .select2-container .select2-choice .select2-arrow b {
593
- background-image: url('../../images/select2x2.png') !important;
594
- background-repeat: no-repeat !important;
595
- background-size: 60px 40px !important;
596
- }
597
-
598
- .select2-search input {
599
- background-position: 100% -21px !important;
600
- }
601
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/build/leadin-admin.js DELETED
@@ -1,4385 +0,0 @@
1
- /*!
2
- * jQuery Cookie Plugin v1.4.0
3
- * https://github.com/carhartl/jquery-cookie
4
- *
5
- * Copyright 2013 Klaus Hartl
6
- * Released under the MIT license
7
- */
8
- (function (factory) {
9
- if (typeof define === 'function' && define.amd) {
10
- // AMD. Register as anonymous module.
11
- define(['jquery'], factory);
12
- } else {
13
- // Browser globals.
14
- factory(jQuery);
15
- }
16
- }(function ($) {
17
-
18
- var pluses = /\+/g;
19
-
20
- function encode(s) {
21
- return config.raw ? s : encodeURIComponent(s);
22
- }
23
-
24
- function decode(s) {
25
- return config.raw ? s : decodeURIComponent(s);
26
- }
27
-
28
- function stringifyCookieValue(value) {
29
- return encode(config.json ? JSON.stringify(value) : String(value));
30
- }
31
-
32
- function parseCookieValue(s) {
33
- if (s.indexOf('"') === 0) {
34
- // This is a quoted cookie as according to RFC2068, unescape...
35
- s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
36
- }
37
-
38
- try {
39
- // Replace server-side written pluses with spaces.
40
- // If we can't decode the cookie, ignore it, it's unusable.
41
- // If we can't parse the cookie, ignore it, it's unusable.
42
- s = decodeURIComponent(s.replace(pluses, ' '));
43
- return config.json ? JSON.parse(s) : s;
44
- } catch(e) {}
45
- }
46
-
47
- function read(s, converter) {
48
- var value = config.raw ? s : parseCookieValue(s);
49
- return $.isFunction(converter) ? converter(value) : value;
50
- }
51
-
52
- var config = $.cookie = function (key, value, options) {
53
-
54
- // Write
55
- if (value !== undefined && !$.isFunction(value)) {
56
- options = $.extend({}, config.defaults, options);
57
-
58
- if (typeof options.expires === 'number') {
59
- var days = options.expires, t = options.expires = new Date();
60
- t.setDate(t.getDate() + days);
61
- }
62
-
63
- return (document.cookie = [
64
- encode(key), '=', stringifyCookieValue(value),
65
- options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
66
- options.path ? '; path=' + options.path : '',
67
- options.domain ? '; domain=' + options.domain : '',
68
- options.secure ? '; secure' : ''
69
- ].join(''));
70
- }
71
-
72
- // Read
73
-
74
- var result = key ? undefined : {};
75
-
76
- // To prevent the for loop in the first place assign an empty array
77
- // in case there are no cookies at all. Also prevents odd result when
78
- // calling $.cookie().
79
- var cookies = document.cookie ? document.cookie.split('; ') : [];
80
-
81
- for (var i = 0, l = cookies.length; i < l; i++) {
82
- var parts = cookies[i].split('=');
83
- var name = decode(parts.shift());
84
- var cookie = parts.join('=');
85
-
86
- if (key && key === name) {
87
- // If second argument (value) is a function it's a converter...
88
- result = read(cookie, value);
89
- break;
90
- }
91
-
92
- // Prevent storing a cookie that we couldn't decode.
93
- if (!key && (cookie = read(cookie)) !== undefined) {
94
- result[name] = cookie;
95
- }
96
- }
97
-
98
- return result;
99
- };
100
-
101
- config.defaults = {};
102
-
103
- $.removeCookie = function (key, options) {
104
- if ($.cookie(key) === undefined) {
105
- return false;
106
- }
107
-
108
- // Must not alter options, thus extending a fresh object...
109
- $.cookie(key, '', $.extend({}, options, { expires: -1 }));
110
- return !$.cookie(key);
111
- };
112
-
113
- }));
114
- /*
115
- Highcharts JS v4.0.1 (2014-04-24)
116
-
117
- (c) 2009-2014 Torstein Honsi
118
-
119
- License: www.highcharts.com/license
120
- */
121
-
122
-
123
- if ( ! window.Highcharts )
124
- {
125
- (function(){function q(a,b){var c;a||(a={});for(c in b)a[c]=b[c];return a}function w(){var a,b=arguments,c,d={},e=function(a,b){var c,d;typeof a!=="object"&&(a={});for(d in b)b.hasOwnProperty(d)&&(c=b[d],a[d]=c&&typeof c==="object"&&Object.prototype.toString.call(c)!=="[object Array]"&&d!=="renderTo"&&typeof c.nodeType!=="number"?e(a[d]||{},c):b[d]);return a};b[0]===!0&&(d=b[1],b=Array.prototype.slice.call(b,2));c=b.length;for(a=0;a<c;a++)d=e(d,b[a]);return d}function z(a,b){return parseInt(a,b||
126
- 10)}function Fa(a){return typeof a==="string"}function ca(a){return typeof a==="object"}function La(a){return Object.prototype.toString.call(a)==="[object Array]"}function ha(a){return typeof a==="number"}function za(a){return U.log(a)/U.LN10}function ia(a){return U.pow(10,a)}function ja(a,b){for(var c=a.length;c--;)if(a[c]===b){a.splice(c,1);break}}function r(a){return a!==t&&a!==null}function H(a,b,c){var d,e;if(Fa(b))r(c)?a.setAttribute(b,c):a&&a.getAttribute&&(e=a.getAttribute(b));else if(r(b)&&
127
- ca(b))for(d in b)a.setAttribute(d,b[d]);return e}function qa(a){return La(a)?a:[a]}function m(){var a=arguments,b,c,d=a.length;for(b=0;b<d;b++)if(c=a[b],typeof c!=="undefined"&&c!==null)return c}function G(a,b){if(Aa&&!aa&&b&&b.opacity!==t)b.filter="alpha(opacity="+b.opacity*100+")";q(a.style,b)}function Y(a,b,c,d,e){a=y.createElement(a);b&&q(a,b);e&&G(a,{padding:0,border:Q,margin:0});c&&G(a,c);d&&d.appendChild(a);return a}function ka(a,b){var c=function(){};c.prototype=new a;q(c.prototype,b);return c}
128
- function Ga(a,b,c,d){var e=E.lang,a=+a||0,f=b===-1?(a.toString().split(".")[1]||"").length:isNaN(b=M(b))?2:b,b=c===void 0?e.decimalPoint:c,d=d===void 0?e.thousandsSep:d,e=a<0?"-":"",c=String(z(a=M(a).toFixed(f))),g=c.length>3?c.length%3:0;return e+(g?c.substr(0,g)+d:"")+c.substr(g).replace(/(\d{3})(?=\d)/g,"$1"+d)+(f?b+M(a-c).toFixed(f).slice(2):"")}function Ha(a,b){return Array((b||2)+1-String(a).length).join(0)+a}function Ma(a,b,c){var d=a[b];a[b]=function(){var a=Array.prototype.slice.call(arguments);
129
- a.unshift(d);return c.apply(this,a)}}function Ia(a,b){for(var c="{",d=!1,e,f,g,h,i,j=[];(c=a.indexOf(c))!==-1;){e=a.slice(0,c);if(d){f=e.split(":");g=f.shift().split(".");i=g.length;e=b;for(h=0;h<i;h++)e=e[g[h]];if(f.length)f=f.join(":"),g=/\.([0-9])/,h=E.lang,i=void 0,/f$/.test(f)?(i=(i=f.match(g))?i[1]:-1,e!==null&&(e=Ga(e,i,h.decimalPoint,f.indexOf(",")>-1?h.thousandsSep:""))):e=cb(f,e)}j.push(e);a=a.slice(c+1);c=(d=!d)?"}":"{"}j.push(a);return j.join("")}function mb(a){return U.pow(10,T(U.log(a)/
130
- U.LN10))}function nb(a,b,c,d){var e,c=m(c,1);e=a/c;b||(b=[1,2,2.5,5,10],d&&d.allowDecimals===!1&&(c===1?b=[1,2,5,10]:c<=0.1&&(b=[1/c])));for(d=0;d<b.length;d++)if(a=b[d],e<=(b[d]+(b[d+1]||b[d]))/2)break;a*=c;return a}function Bb(){this.symbol=this.color=0}function ob(a,b){var c=a.length,d,e;for(e=0;e<c;e++)a[e].ss_i=e;a.sort(function(a,c){d=b(a,c);return d===0?a.ss_i-c.ss_i:d});for(e=0;e<c;e++)delete a[e].ss_i}function Na(a){for(var b=a.length,c=a[0];b--;)a[b]<c&&(c=a[b]);return c}function Ba(a){for(var b=
131
- a.length,c=a[0];b--;)a[b]>c&&(c=a[b]);return c}function Oa(a,b){for(var c in a)a[c]&&a[c]!==b&&a[c].destroy&&a[c].destroy(),delete a[c]}function Pa(a){db||(db=Y(Ja));a&&db.appendChild(a);db.innerHTML=""}function ra(a,b){var c="Highcharts error #"+a+": www.highcharts.com/errors/"+a;if(b)throw c;else I.console&&console.log(c)}function da(a){return parseFloat(a.toPrecision(14))}function Qa(a,b){va=m(a,b.animation)}function Cb(){var a=E.global.useUTC,b=a?"getUTC":"get",c=a?"setUTC":"set";Ra=(a&&E.global.timezoneOffset||
132
- 0)*6E4;eb=a?Date.UTC:function(a,b,c,g,h,i){return(new Date(a,b,m(c,1),m(g,0),m(h,0),m(i,0))).getTime()};pb=b+"Minutes";qb=b+"Hours";rb=b+"Day";Xa=b+"Date";fb=b+"Month";gb=b+"FullYear";Db=c+"Minutes";Eb=c+"Hours";sb=c+"Date";Fb=c+"Month";Gb=c+"FullYear"}function P(){}function Sa(a,b,c,d){this.axis=a;this.pos=b;this.type=c||"";this.isNew=!0;!c&&!d&&this.addLabel()}function la(){this.init.apply(this,arguments)}function Ya(){this.init.apply(this,arguments)}function Hb(a,b,c,d,e){var f=a.chart.inverted;
133
- this.axis=a;this.isNegative=c;this.options=b;this.x=d;this.total=null;this.points={};this.stack=e;this.alignOptions={align:b.align||(f?c?"left":"right":"center"),verticalAlign:b.verticalAlign||(f?"middle":c?"bottom":"top"),y:m(b.y,f?4:c?14:-6),x:m(b.x,f?c?-6:6:0)};this.textAlign=b.textAlign||(f?c?"right":"left":"center")}var t,y=document,I=window,U=Math,u=U.round,T=U.floor,Ka=U.ceil,v=U.max,C=U.min,M=U.abs,Z=U.cos,ea=U.sin,ma=U.PI,Ca=ma*2/360,wa=navigator.userAgent,Ib=I.opera,Aa=/msie/i.test(wa)&&
134
- !Ib,hb=y.documentMode===8,ib=/AppleWebKit/.test(wa),Ta=/Firefox/.test(wa),Jb=/(Mobile|Android|Windows Phone)/.test(wa),xa="http://www.w3.org/2000/svg",aa=!!y.createElementNS&&!!y.createElementNS(xa,"svg").createSVGRect,Nb=Ta&&parseInt(wa.split("Firefox/")[1],10)<4,fa=!aa&&!Aa&&!!y.createElement("canvas").getContext,Za,$a,Kb={},tb=0,db,E,cb,va,ub,A,sa=function(){},V=[],ab=0,Ja="div",Q="none",Ob=/^[0-9]+$/,Pb="stroke-width",eb,Ra,pb,qb,rb,Xa,fb,gb,Db,Eb,sb,Fb,Gb,F={},R=I.Highcharts=I.Highcharts?ra(16,
135
- !0):{};cb=function(a,b,c){if(!r(b)||isNaN(b))return"Invalid date";var a=m(a,"%Y-%m-%d %H:%M:%S"),d=new Date(b-Ra),e,f=d[qb](),g=d[rb](),h=d[Xa](),i=d[fb](),j=d[gb](),k=E.lang,l=k.weekdays,d=q({a:l[g].substr(0,3),A:l[g],d:Ha(h),e:h,b:k.shortMonths[i],B:k.months[i],m:Ha(i+1),y:j.toString().substr(2,2),Y:j,H:Ha(f),I:Ha(f%12||12),l:f%12||12,M:Ha(d[pb]()),p:f<12?"AM":"PM",P:f<12?"am":"pm",S:Ha(d.getSeconds()),L:Ha(u(b%1E3),3)},R.dateFormats);for(e in d)for(;a.indexOf("%"+e)!==-1;)a=a.replace("%"+e,typeof d[e]===
136
- "function"?d[e](b):d[e]);return c?a.substr(0,1).toUpperCase()+a.substr(1):a};Bb.prototype={wrapColor:function(a){if(this.color>=a)this.color=0},wrapSymbol:function(a){if(this.symbol>=a)this.symbol=0}};A=function(){for(var a=0,b=arguments,c=b.length,d={};a<c;a++)d[b[a++]]=b[a];return d}("millisecond",1,"second",1E3,"minute",6E4,"hour",36E5,"day",864E5,"week",6048E5,"month",26784E5,"year",31556952E3);ub={init:function(a,b,c){var b=b||"",d=a.shift,e=b.indexOf("C")>-1,f=e?7:3,g,b=b.split(" "),c=[].concat(c),
137
- h,i,j=function(a){for(g=a.length;g--;)a[g]==="M"&&a.splice(g+1,0,a[g+1],a[g+2],a[g+1],a[g+2])};e&&(j(b),j(c));a.isArea&&(h=b.splice(b.length-6,6),i=c.splice(c.length-6,6));if(d<=c.length/f&&b.length===c.length)for(;d--;)c=[].concat(c).splice(0,f).concat(c);a.shift=0;if(b.length)for(a=c.length;b.length<a;)d=[].concat(b).splice(b.length-f,f),e&&(d[f-6]=d[f-2],d[f-5]=d[f-1]),b=b.concat(d);h&&(b=b.concat(h),c=c.concat(i));return[b,c]},step:function(a,b,c,d){var e=[],f=a.length;if(c===1)e=d;else if(f===
138
- b.length&&c<1)for(;f--;)d=parseFloat(a[f]),e[f]=isNaN(d)?a[f]:c*parseFloat(b[f]-d)+d;else e=b;return e}};(function(a){I.HighchartsAdapter=I.HighchartsAdapter||a&&{init:function(b){var c=a.fx,d=c.step,e,f=a.Tween,g=f&&f.propHooks;e=a.cssHooks.opacity;a.extend(a.easing,{easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c}});a.each(["cur","_default","width","height","opacity"],function(a,b){var e=d,k;b==="cur"?e=c.prototype:b==="_default"&&f&&(e=g[b],b="set");(k=e[b])&&(e[b]=function(c){var d,c=
139
- a?c:this;if(c.prop!=="align")return d=c.elem,d.attr?d.attr(c.prop,b==="cur"?t:c.now):k.apply(this,arguments)})});Ma(e,"get",function(a,b,c){return b.attr?b.opacity||0:a.call(this,b,c)});e=function(a){var c=a.elem,d;if(!a.started)d=b.init(c,c.d,c.toD),a.start=d[0],a.end=d[1],a.started=!0;c.attr("d",b.step(a.start,a.end,a.pos,c.toD))};f?g.d={set:e}:d.d=e;this.each=Array.prototype.forEach?function(a,b){return Array.prototype.forEach.call(a,b)}:function(a,b){for(var c=0,d=a.length;c<d;c++)if(b.call(a[c],
140
- a[c],c,a)===!1)return c};a.fn.highcharts=function(){var a="Chart",b=arguments,c,d;if(this[0]){Fa(b[0])&&(a=b[0],b=Array.prototype.slice.call(b,1));c=b[0];if(c!==t)c.chart=c.chart||{},c.chart.renderTo=this[0],new R[a](c,b[1]),d=this;c===t&&(d=V[H(this[0],"data-highcharts-chart")])}return d}},getScript:a.getScript,inArray:a.inArray,adapterRun:function(b,c){return a(b)[c]()},grep:a.grep,map:function(a,c){for(var d=[],e=0,f=a.length;e<f;e++)d[e]=c.call(a[e],a[e],e,a);return d},offset:function(b){return a(b).offset()},
141
- addEvent:function(b,c,d){a(b).bind(c,d)},removeEvent:function(b,c,d){var e=y.removeEventListener?"removeEventListener":"detachEvent";y[e]&&b&&!b[e]&&(b[e]=function(){});a(b).unbind(c,d)},fireEvent:function(b,c,d,e){var f=a.Event(c),g="detached"+c,h;!Aa&&d&&(delete d.layerX,delete d.layerY,delete d.returnValue);q(f,d);b[c]&&(b[g]=b[c],b[c]=null);a.each(["preventDefault","stopPropagation"],function(a,b){var c=f[b];f[b]=function(){try{c.call(f)}catch(a){b==="preventDefault"&&(h=!0)}}});a(b).trigger(f);
142
- b[g]&&(b[c]=b[g],b[g]=null);e&&!f.isDefaultPrevented()&&!h&&e(f)},washMouseEvent:function(a){var c=a.originalEvent||a;if(c.pageX===t)c.pageX=a.pageX,c.pageY=a.pageY;return c},animate:function(b,c,d){var e=a(b);if(!b.style)b.style={};if(c.d)b.toD=c.d,c.d=1;e.stop();c.opacity!==t&&b.attr&&(c.opacity+="px");e.animate(c,d)},stop:function(b){a(b).stop()}}})(I.jQuery);var S=I.HighchartsAdapter,N=S||{};S&&S.init.call(S,ub);var jb=N.adapterRun,Qb=N.getScript,Da=N.inArray,p=N.each,vb=N.grep,Rb=N.offset,Ua=
143
- N.map,K=N.addEvent,W=N.removeEvent,D=N.fireEvent,Sb=N.washMouseEvent,kb=N.animate,bb=N.stop,N={enabled:!0,x:0,y:15,style:{color:"#606060",cursor:"default",fontSize:"11px"}};E={colors:"#7cb5ec,#434348,#90ed7d,#f7a35c,#8085e9,#f15c80,#e4d354,#8085e8,#8d4653,#91e8e1".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(","),
144
- 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/4.0.1/modules/canvas-tools.js",VMLRadialGradientURL:"http://code.highcharts.com/4.0.1/gfx/vml-radial-gradient.png"},chart:{borderColor:"#4572A7",borderRadius:0,defaultSeriesType:"line",ignoreHiddenSeries:!0,spacing:[10,10,15,
145
- 10],backgroundColor:"#FFFFFF",plotBorderColor:"#C0C0C0",resetZoomButton:{theme:{zIndex:20},position:{align:"right",x:-10,y:10}}},title:{text:"Chart title",align:"center",margin:15,style:{color:"#333333",fontSize:"18px"}},subtitle:{text:"",align:"center",style:{color:"#555555"}},plotOptions:{line:{allowPointSelect:!1,showCheckbox:!1,animation:{duration:1E3},events:{},lineWidth:2,marker:{lineWidth:0,radius:4,lineColor:"#FFFFFF",states:{hover:{enabled:!0},select:{fillColor:"#FFFFFF",lineColor:"#000000",
146
- lineWidth:2}}},point:{events:{}},dataLabels:w(N,{align:"center",enabled:!1,formatter:function(){return this.y===null?"":Ga(this.y,-1)},verticalAlign:"bottom",y:0}),cropThreshold:300,pointRange:0,states:{hover:{marker:{},halo:{size:10,opacity:0.25}},select:{marker:{}}},stickyTracking:!0,turboThreshold:1E3}},labels:{style:{position:"absolute",color:"#3E576F"}},legend:{enabled:!0,align:"center",layout:"horizontal",labelFormatter:function(){return this.name},borderColor:"#909090",borderRadius:0,navigation:{activeColor:"#274b6d",
147
- inactiveColor:"#CCC"},shadow:!1,itemStyle:{color:"#333333",fontSize:"12px",fontWeight:"bold"},itemHoverStyle:{color:"#000"},itemHiddenStyle:{color:"#CCC"},itemCheckboxStyle:{position:"absolute",width:"13px",height:"13px"},symbolPadding:5,verticalAlign:"bottom",x:0,y:0,title:{style:{fontWeight:"bold"}}},loading:{labelStyle:{fontWeight:"bold",position:"relative",top:"1em"},style:{position:"absolute",backgroundColor:"white",opacity:0.5,textAlign:"center"}},tooltip:{enabled:!0,animation:aa,backgroundColor:"rgba(249, 249, 249, .85)",
148
- borderWidth:1,borderRadius:3,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}">●</span> {series.name}: <b>{point.y}</b><br/>',shadow:!0,snap:Jb?25:10,style:{color:"#333333",cursor:"default",fontSize:"12px",padding:"8px",
149
- 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:"9px"}}};var ba=E.plotOptions,S=ba.line;Cb();var Tb=/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*\)/,Ub=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/,Vb=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/,ya=function(a){var b=[],c,
150
- d;(function(a){a&&a.stops?d=Ua(a.stops,function(a){return ya(a[1])}):(c=Tb.exec(a))?b=[z(c[1]),z(c[2]),z(c[3]),parseFloat(c[4],10)]:(c=Ub.exec(a))?b=[z(c[1],16),z(c[2],16),z(c[3],16),1]:(c=Vb.exec(a))&&(b=[z(c[1]),z(c[2]),z(c[3]),1])})(a);return{get:function(c){var f;d?(f=w(a),f.stops=[].concat(f.stops),p(d,function(a,b){f.stops[b]=[f.stops[b][0],a.get(c)]})):f=b&&!isNaN(b[0])?c==="rgb"?"rgb("+b[0]+","+b[1]+","+b[2]+")":c==="a"?b[3]:"rgba("+b.join(",")+")":a;return f},brighten:function(a){if(d)p(d,
151
- function(b){b.brighten(a)});else if(ha(a)&&a!==0){var c;for(c=0;c<3;c++)b[c]+=z(a*255),b[c]<0&&(b[c]=0),b[c]>255&&(b[c]=255)}return this},rgba:b,setOpacity:function(a){b[3]=a;return this}}};P.prototype={init:function(a,b){this.element=b==="span"?Y(b):y.createElementNS(xa,b);this.renderer=a},opacity:1,animate:function(a,b,c){b=m(b,va,!0);bb(this);if(b){b=w(b,{});if(c)b.complete=c;kb(this,a,b)}else this.attr(a),c&&c()},colorGradient:function(a,b,c){var d=this.renderer,e,f,g,h,i,j,k,l,o,n,s=[];a.linearGradient?
152
- f="linearGradient":a.radialGradient&&(f="radialGradient");if(f){g=a[f];h=d.gradients;j=a.stops;o=c.radialReference;La(g)&&(a[f]=g={x1:g[0],y1:g[1],x2:g[2],y2:g[3],gradientUnits:"userSpaceOnUse"});f==="radialGradient"&&o&&!r(g.gradientUnits)&&(g=w(g,{cx:o[0]-o[2]/2+g.cx*o[2],cy:o[1]-o[2]/2+g.cy*o[2],r:g.r*o[2],gradientUnits:"userSpaceOnUse"}));for(n in g)n!=="id"&&s.push(n,g[n]);for(n in j)s.push(j[n]);s=s.join(",");h[s]?a=h[s].attr("id"):(g.id=a="highcharts-"+tb++,h[s]=i=d.createElement(f).attr(g).add(d.defs),
153
- i.stops=[],p(j,function(a){a[1].indexOf("rgba")===0?(e=ya(a[1]),k=e.get("rgb"),l=e.get("a")):(k=a[1],l=1);a=d.createElement("stop").attr({offset:a[0],"stop-color":k,"stop-opacity":l}).add(i);i.stops.push(a)}));c.setAttribute(b,"url("+d.url+"#"+a+")")}},attr:function(a,b){var c,d,e=this.element,f,g=this,h;typeof a==="string"&&b!==t&&(c=a,a={},a[c]=b);if(typeof a==="string")g=(this[a+"Getter"]||this._defaultGetter).call(this,a,e);else{for(c in a){d=a[c];h=!1;this.symbolName&&/^(x|y|width|height|r|start|end|innerR|anchorX|anchorY)/.test(c)&&
154
- (f||(this.symbolAttr(a),f=!0),h=!0);if(this.rotation&&(c==="x"||c==="y"))this.doTransform=!0;h||(this[c+"Setter"]||this._defaultSetter).call(this,d,c,e);this.shadows&&/^(width|height|visibility|x|y|d|transform|cx|cy|r)$/.test(c)&&this.updateShadows(c,d)}if(this.doTransform)this.updateTransform(),this.doTransform=!1}return g},updateShadows:function(a,b){for(var c=this.shadows,d=c.length;d--;)c[d].setAttribute(a,a==="height"?v(b-(c[d].cutHeight||0),0):a==="d"?this.d:b)},addClass:function(a){var b=this.element,
155
- c=H(b,"class")||"";c.indexOf(a)===-1&&H(b,"class",c+" "+a);return this},symbolAttr:function(a){var b=this;p("x,y,r,start,end,width,height,innerR,anchorX,anchorY".split(","),function(c){b[c]=m(a[c],b[c])});b.attr({d:b.renderer.symbols[b.symbolName](b.x,b.y,b.width,b.height,b)})},clip:function(a){return this.attr("clip-path",a?"url("+this.renderer.url+"#"+a.id+")":Q)},crisp:function(a){var b,c={},d,e=a.strokeWidth||this.strokeWidth||this.attr&&this.attr("stroke-width")||0;d=u(e)%2/2;a.x=T(a.x||this.x||
156
- 0)+d;a.y=T(a.y||this.y||0)+d;a.width=T((a.width||this.width||0)-2*d);a.height=T((a.height||this.height||0)-2*d);a.strokeWidth=e;for(b in a)this[b]!==a[b]&&(this[b]=c[b]=a[b]);return c},css:function(a){var b=this.styles,c={},d=this.element,e,f,g="";e=!b;if(a&&a.color)a.fill=a.color;if(b)for(f in a)a[f]!==b[f]&&(c[f]=a[f],e=!0);if(e){e=this.textWidth=a&&a.width&&d.nodeName.toLowerCase()==="text"&&z(a.width);b&&(a=q(b,c));this.styles=a;e&&(fa||!aa&&this.renderer.forExport)&&delete a.width;if(Aa&&!aa)G(this.element,
157
- a);else{b=function(a,b){return"-"+b.toLowerCase()};for(f in a)g+=f.replace(/([A-Z])/g,b)+":"+a[f]+";";H(d,"style",g)}e&&this.added&&this.renderer.buildText(this)}return this},on:function(a,b){var c=this,d=c.element;$a&&a==="click"?(d.ontouchstart=function(a){c.touchEventFired=Date.now();a.preventDefault();b.call(d,a)},d.onclick=function(a){(wa.indexOf("Android")===-1||Date.now()-(c.touchEventFired||0)>1100)&&b.call(d,a)}):d["on"+a]=b;return this},setRadialReference:function(a){this.element.radialReference=
158
- a;return this},translate:function(a,b){return this.attr({translateX:a,translateY:b})},invert:function(){this.inverted=!0;this.updateTransform();return this},updateTransform:function(){var a=this.translateX||0,b=this.translateY||0,c=this.scaleX,d=this.scaleY,e=this.inverted,f=this.rotation,g=this.element;e&&(a+=this.attr("width"),b+=this.attr("height"));a=["translate("+a+","+b+")"];e?a.push("rotate(90) scale(-1,1)"):f&&a.push("rotate("+f+" "+(g.getAttribute("x")||0)+" "+(g.getAttribute("y")||0)+")");
159
- (r(c)||r(d))&&a.push("scale("+m(c,1)+" "+m(d,1)+")");a.length&&g.setAttribute("transform",a.join(" "))},toFront:function(){var a=this.element;a.parentNode.appendChild(a);return this},align:function(a,b,c){var d,e,f,g,h={};e=this.renderer;f=e.alignedObjects;if(a){if(this.alignOptions=a,this.alignByTranslate=b,!c||Fa(c))this.alignTo=d=c||"renderer",ja(f,this),f.push(this),c=null}else a=this.alignOptions,b=this.alignByTranslate,d=this.alignTo;c=m(c,e[d],e);d=a.align;e=a.verticalAlign;f=(c.x||0)+(a.x||
160
- 0);g=(c.y||0)+(a.y||0);if(d==="right"||d==="center")f+=(c.width-(a.width||0))/{right:1,center:2}[d];h[b?"translateX":"x"]=u(f);if(e==="bottom"||e==="middle")g+=(c.height-(a.height||0))/({bottom:1,middle:2}[e]||1);h[b?"translateY":"y"]=u(g);this[this.placed?"animate":"attr"](h);this.placed=!0;this.alignAttr=h;return this},getBBox:function(){var a=this.bBox,b=this.renderer,c,d,e=this.rotation;c=this.element;var f=this.styles,g=e*Ca;d=this.textStr;var h;if(d===""||Ob.test(d))h="num."+d.toString().length+
161
- (f?"|"+f.fontSize+"|"+f.fontFamily:"");h&&(a=b.cache[h]);if(!a){if(c.namespaceURI===xa||b.forExport){try{a=c.getBBox?q({},c.getBBox()):{width:c.offsetWidth,height:c.offsetHeight}}catch(i){}if(!a||a.width<0)a={width:0,height:0}}else a=this.htmlGetBBox();if(b.isSVG){c=a.width;d=a.height;if(Aa&&f&&f.fontSize==="11px"&&d.toPrecision(3)==="16.9")a.height=d=14;if(e)a.width=M(d*ea(g))+M(c*Z(g)),a.height=M(d*Z(g))+M(c*ea(g))}this.bBox=a;h&&(b.cache[h]=a)}return a},show:function(a){return a&&this.element.namespaceURI===
162
- xa?(this.element.removeAttribute("visibility"),this):this.attr({visibility:a?"inherit":"visible"})},hide:function(){return this.attr({visibility:"hidden"})},fadeOut:function(a){var b=this;b.animate({opacity:0},{duration:a||150,complete:function(){b.hide()}})},add:function(a){var b=this.renderer,c=a||b,d=c.element||b.box,e=this.element,f=this.zIndex,g,h;if(a)this.parentGroup=a;this.parentInverted=a&&a.inverted;this.textStr!==void 0&&b.buildText(this);if(f)c.handleZ=!0,f=z(f);if(c.handleZ){a=d.childNodes;
163
- for(g=0;g<a.length;g++)if(b=a[g],c=H(b,"zIndex"),b!==e&&(z(c)>f||!r(f)&&r(c))){d.insertBefore(e,b);h=!0;break}}h||d.appendChild(e);this.added=!0;if(this.onAdd)this.onAdd();return this},safeRemoveChild:function(a){var b=a.parentNode;b&&b.removeChild(a)},destroy:function(){var a=this,b=a.element||{},c=a.shadows,d=a.renderer.isSVG&&b.nodeName==="SPAN"&&a.parentGroup,e,f;b.onclick=b.onmouseout=b.onmouseover=b.onmousemove=b.point=null;bb(a);if(a.clipPath)a.clipPath=a.clipPath.destroy();if(a.stops){for(f=
164
- 0;f<a.stops.length;f++)a.stops[f]=a.stops[f].destroy();a.stops=null}a.safeRemoveChild(b);for(c&&p(c,function(b){a.safeRemoveChild(b)});d&&d.div.childNodes.length===0;)b=d.parentGroup,a.safeRemoveChild(d.div),delete d.div,d=b;a.alignTo&&ja(a.renderer.alignedObjects,a);for(e in a)delete a[e];return null},shadow:function(a,b,c){var d=[],e,f,g=this.element,h,i,j,k;if(a){i=m(a.width,3);j=(a.opacity||0.15)/i;k=this.parentInverted?"(-1,-1)":"("+m(a.offsetX,1)+", "+m(a.offsetY,1)+")";for(e=1;e<=i;e++){f=
165
- g.cloneNode(0);h=i*2+1-2*e;H(f,{isShadow:"true",stroke:a.color||"black","stroke-opacity":j*e,"stroke-width":h,transform:"translate"+k,fill:Q});if(c)H(f,"height",v(H(f,"height")-h,0)),f.cutHeight=h;b?b.element.appendChild(f):g.parentNode.insertBefore(f,g);d.push(f)}this.shadows=d}return this},xGetter:function(a){this.element.nodeName==="circle"&&(a={x:"cx",y:"cy"}[a]||a);return this._defaultGetter(a)},_defaultGetter:function(a){a=m(this[a],this.element?this.element.getAttribute(a):null,0);/^[0-9\.]+$/.test(a)&&
166
- (a=parseFloat(a));return a},dSetter:function(a,b,c){a&&a.join&&(a=a.join(" "));/(NaN| {2}|^$)/.test(a)&&(a="M 0 0");c.setAttribute(b,a);this[b]=a},dashstyleSetter:function(a){var b;if(a=a&&a.toLowerCase()){a=a.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(",");for(b=a.length;b--;)a[b]=z(a[b])*this.element.getAttribute("stroke-width");
167
- a=a.join(",");this.element.setAttribute("stroke-dasharray",a)}},alignSetter:function(a){this.element.setAttribute("text-anchor",{left:"start",center:"middle",right:"end"}[a])},opacitySetter:function(a,b,c){this[b]=a;c.setAttribute(b,a)},"stroke-widthSetter":function(a,b,c){a===0&&(a=1.0E-5);this.strokeWidth=a;c.setAttribute(b,a)},titleSetter:function(a){var b=this.element.getElementsByTagName("title")[0];b||(b=y.createElementNS(xa,"title"),this.element.appendChild(b));b.textContent=a},textSetter:function(a){if(a!==
168
- this.textStr)delete this.bBox,this.textStr=a,this.added&&this.renderer.buildText(this)},fillSetter:function(a,b,c){typeof a==="string"?c.setAttribute(b,a):a&&this.colorGradient(a,b,c)},zIndexSetter:function(a,b,c){c.setAttribute(b,a);this[b]=a},_defaultSetter:function(a,b,c){c.setAttribute(b,a)}};P.prototype.yGetter=P.prototype.xGetter;P.prototype.translateXSetter=P.prototype.translateYSetter=P.prototype.rotationSetter=P.prototype.verticalAlignSetter=P.prototype.scaleXSetter=P.prototype.scaleYSetter=
169
- function(a,b){this[b]=a;this.doTransform=!0};P.prototype.strokeSetter=P.prototype.fillSetter;var ta=function(){this.init.apply(this,arguments)};ta.prototype={Element:P,init:function(a,b,c,d,e){var f=location,g,d=this.createElement("svg").attr({version:"1.1"}).css(this.getStyle(d));g=d.element;a.appendChild(g);a.innerHTML.indexOf("xmlns")===-1&&H(g,"xmlns",xa);this.isSVG=!0;this.box=g;this.boxWrapper=d;this.alignedObjects=[];this.url=(Ta||ib)&&y.getElementsByTagName("base").length?f.href.replace(/#.*?$/,
170
- "").replace(/([\('\)])/g,"\\$1").replace(/ /g,"%20"):"";this.createElement("desc").add().element.appendChild(y.createTextNode("Created with Highcharts 4.0.1"));this.defs=this.createElement("defs").add();this.forExport=e;this.gradients={};this.cache={};this.setSize(b,c,!1);var h;if(Ta&&a.getBoundingClientRect)this.subPixelFix=b=function(){G(a,{left:0,top:0});h=a.getBoundingClientRect();G(a,{left:Ka(h.left)-h.left+"px",top:Ka(h.top)-h.top+"px"})},b(),K(I,"resize",b)},getStyle:function(a){return this.style=
171
- q({fontFamily:'"Lucida Grande", "Lucida Sans Unicode", Arial, Helvetica, sans-serif',fontSize:"12px"},a)},isHidden:function(){return!this.boxWrapper.getBBox().width},destroy:function(){var a=this.defs;this.box=null;this.boxWrapper=this.boxWrapper.destroy();Oa(this.gradients||{});this.gradients=null;if(a)this.defs=a.destroy();this.subPixelFix&&W(I,"resize",this.subPixelFix);return this.alignedObjects=null},createElement:function(a){var b=new this.Element;b.init(this,a);return b},draw:function(){},
172
- buildText:function(a){for(var b=a.element,c=this,d=c.forExport,e=m(a.textStr,"").toString(),f=e.indexOf("<")!==-1,g=b.childNodes,h,i,j=H(b,"x"),k=a.styles,l=a.textWidth,o=k&&k.lineHeight,n=g.length,s=function(a){return o?z(o):c.fontMetrics(/(px|em)$/.test(a&&a.style.fontSize)?a.style.fontSize:k&&k.fontSize||c.style.fontSize||12).h};n--;)b.removeChild(g[n]);!f&&e.indexOf(" ")===-1?b.appendChild(y.createTextNode(e)):(h=/<.*style="([^"]+)".*>/,i=/<.*href="(http[^"]+)".*>/,l&&!a.added&&this.box.appendChild(b),
173
- e=f?e.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):[e],e[e.length-1]===""&&e.pop(),p(e,function(e,f){var g,n=0,e=e.replace(/<span/g,"|||<span").replace(/<\/span>/g,"</span>|||");g=e.split("|||");p(g,function(e){if(e!==""||g.length===1){var o={},m=y.createElementNS(xa,"tspan"),p;h.test(e)&&(p=e.match(h)[1].replace(/(;| |^)color([ :])/,"$1fill$2"),
174
- H(m,"style",p));i.test(e)&&!d&&(H(m,"onclick",'location.href="'+e.match(i)[1]+'"'),G(m,{cursor:"pointer"}));e=(e.replace(/<(.|\n)*?>/g,"")||" ").replace(/&lt;/g,"<").replace(/&gt;/g,">");if(e!==" "){m.appendChild(y.createTextNode(e));if(n)o.dx=0;else if(f&&j!==null)o.x=j;H(m,o);!n&&f&&(!aa&&d&&G(m,{display:"block"}),H(m,"dy",s(m),ib&&m.offsetHeight));b.appendChild(m);n++;if(l)for(var e=e.replace(/([^\^])-/g,"$1- ").split(" "),o=e.length>1&&k.whiteSpace!=="nowrap",$,r,B=a._clipHeight,q=[],v=s(),t=
175
- 1;o&&(e.length||q.length);)delete a.bBox,$=a.getBBox(),r=$.width,!aa&&c.forExport&&(r=c.measureSpanWidth(m.firstChild.data,a.styles)),$=r>l,!$||e.length===1?(e=q,q=[],e.length&&(t++,B&&t*v>B?(e=["..."],a.attr("title",a.textStr)):(m=y.createElementNS(xa,"tspan"),H(m,{dy:v,x:j}),p&&H(m,"style",p),b.appendChild(m),r>l&&(l=r)))):(m.removeChild(m.firstChild),q.unshift(e.pop())),e.length&&m.appendChild(y.createTextNode(e.join(" ").replace(/- /g,"-")))}}})}))},button:function(a,b,c,d,e,f,g,h,i){var j=this.label(a,
176
- b,c,i,null,null,null,null,"button"),k=0,l,o,n,s,m,p,a={x1:0,y1:0,x2:0,y2:1},e=w({"stroke-width":1,stroke:"#CCCCCC",fill:{linearGradient:a,stops:[[0,"#FEFEFE"],[1,"#F6F6F6"]]},r:2,padding:5,style:{color:"black"}},e);n=e.style;delete e.style;f=w(e,{stroke:"#68A",fill:{linearGradient:a,stops:[[0,"#FFF"],[1,"#ACF"]]}},f);s=f.style;delete f.style;g=w(e,{stroke:"#68A",fill:{linearGradient:a,stops:[[0,"#9BD"],[1,"#CDF"]]}},g);m=g.style;delete g.style;h=w(e,{style:{color:"#CCC"}},h);p=h.style;delete h.style;
177
- K(j.element,Aa?"mouseover":"mouseenter",function(){k!==3&&j.attr(f).css(s)});K(j.element,Aa?"mouseout":"mouseleave",function(){k!==3&&(l=[e,f,g][k],o=[n,s,m][k],j.attr(l).css(o))});j.setState=function(a){(j.state=k=a)?a===2?j.attr(g).css(m):a===3&&j.attr(h).css(p):j.attr(e).css(n)};return j.on("click",function(){k!==3&&d.call(j)}).attr(e).css(q({cursor:"default"},n))},crispLine:function(a,b){a[1]===a[4]&&(a[1]=a[4]=u(a[1])-b%2/2);a[2]===a[5]&&(a[2]=a[5]=u(a[2])+b%2/2);return a},path:function(a){var b=
178
- {fill:Q};La(a)?b.d=a:ca(a)&&q(b,a);return this.createElement("path").attr(b)},circle:function(a,b,c){a=ca(a)?a:{x:a,y:b,r:c};b=this.createElement("circle");b.xSetter=function(a){this.element.setAttribute("cx",a)};b.ySetter=function(a){this.element.setAttribute("cy",a)};return b.attr(a)},arc:function(a,b,c,d,e,f){if(ca(a))b=a.y,c=a.r,d=a.innerR,e=a.start,f=a.end,a=a.x;a=this.symbol("arc",a||0,b||0,c||0,c||0,{innerR:d||0,start:e||0,end:f||0});a.r=c;return a},rect:function(a,b,c,d,e,f){var e=ca(a)?a.r:
179
- e,g=this.createElement("rect"),a=ca(a)?a:a===t?{}:{x:a,y:b,width:v(c,0),height:v(d,0)};if(f!==t)a.strokeWidth=f,a=g.crisp(a);if(e)a.r=e;g.rSetter=function(a){H(this.element,{rx:a,ry:a})};return g.attr(a)},setSize:function(a,b,c){var d=this.alignedObjects,e=d.length;this.width=a;this.height=b;for(this.boxWrapper[m(c,!0)?"animate":"attr"]({width:a,height:b});e--;)d[e].align()},g:function(a){var b=this.createElement("g");return r(a)?b.attr({"class":"highcharts-"+a}):b},image:function(a,b,c,d,e){var f=
180
- {preserveAspectRatio:Q};arguments.length>1&&q(f,{x:b,y:c,width:d,height:e});f=this.createElement("image").attr(f);f.element.setAttributeNS?f.element.setAttributeNS("http://www.w3.org/1999/xlink","href",a):f.element.setAttribute("hc-svg-href",a);return f},symbol:function(a,b,c,d,e,f){var g,h=this.symbols[a],h=h&&h(u(b),u(c),d,e,f),i=/^url\((.*?)\)$/,j,k;if(h)g=this.path(h),q(g,{symbolName:a,x:b,y:c,width:d,height:e}),f&&q(g,f);else if(i.test(a))k=function(a,b){a.element&&(a.attr({width:b[0],height:b[1]}),
181
- a.alignByTranslate||a.translate(u((d-b[0])/2),u((e-b[1])/2)))},j=a.match(i)[1],a=Kb[j],g=this.image(j).attr({x:b,y:c}),g.isImg=!0,a?k(g,a):(g.attr({width:0,height:0}),Y("img",{onload:function(){k(g,Kb[j]=[this.width,this.height])},src:j}));return g},symbols:{circle:function(a,b,c,d){var e=0.166*c;return["M",a+c/2,b,"C",a+c+e,b,a+c+e,b+d,a+c/2,b+d,"C",a-e,b+d,a-e,b,a+c/2,b,"Z"]},square:function(a,b,c,d){return["M",a,b,"L",a+c,b,a+c,b+d,a,b+d,"Z"]},triangle:function(a,b,c,d){return["M",a+c/2,b,"L",
182
- a+c,b+d,a,b+d,"Z"]},"triangle-down":function(a,b,c,d){return["M",a,b,"L",a+c,b,a+c/2,b+d,"Z"]},diamond:function(a,b,c,d){return["M",a+c/2,b,"L",a+c,b+d/2,a+c/2,b+d,a,b+d/2,"Z"]},arc:function(a,b,c,d,e){var f=e.start,c=e.r||c||d,g=e.end-0.001,d=e.innerR,h=e.open,i=Z(f),j=ea(f),k=Z(g),g=ea(g),e=e.end-f<ma?0:1;return["M",a+c*i,b+c*j,"A",c,c,0,e,1,a+c*k,b+c*g,h?"M":"L",a+d*k,b+d*g,"A",d,d,0,e,0,a+d*i,b+d*j,h?"":"Z"]},callout:function(a,b,c,d,e){var f=C(e&&e.r||0,c,d),g=f+6,h=e&&e.anchorX,i=e&&e.anchorY,
183
- e=u(e.strokeWidth||0)%2/2;a+=e;b+=e;e=["M",a+f,b,"L",a+c-f,b,"C",a+c,b,a+c,b,a+c,b+f,"L",a+c,b+d-f,"C",a+c,b+d,a+c,b+d,a+c-f,b+d,"L",a+f,b+d,"C",a,b+d,a,b+d,a,b+d-f,"L",a,b+f,"C",a,b,a,b,a+f,b];h&&h>c&&i>b+g&&i<b+d-g?e.splice(13,3,"L",a+c,i-6,a+c+6,i,a+c,i+6,a+c,b+d-f):h&&h<0&&i>b+g&&i<b+d-g?e.splice(33,3,"L",a,i+6,a-6,i,a,i-6,a,b+f):i&&i>d&&h>a+g&&h<a+c-g?e.splice(23,3,"L",h+6,b+d,h,b+d+6,h-6,b+d,a+f,b+d):i&&i<0&&h>a+g&&h<a+c-g&&e.splice(3,3,"L",h-6,b,h,b-6,h+6,b,c-f,b);return e}},clipRect:function(a,
184
- b,c,d){var e="highcharts-"+tb++,f=this.createElement("clipPath").attr({id:e}).add(this.defs),a=this.rect(a,b,c,d,0).add(f);a.id=e;a.clipPath=f;return a},text:function(a,b,c,d){var e=fa||!aa&&this.forExport,f={};if(d&&!this.forExport)return this.html(a,b,c);f.x=Math.round(b||0);if(c)f.y=Math.round(c);if(a||a===0)f.text=a;a=this.createElement("text").attr(f);e&&a.css({position:"absolute"});if(!d)a.xSetter=function(a,b,c){var d=c.childNodes,e,f;for(f=1;f<d.length;f++)e=d[f],e.getAttribute("x")===c.getAttribute("x")&&
185
- e.setAttribute("x",a);c.setAttribute(b,a)};return a},fontMetrics:function(a){var a=a||this.style.fontSize,a=/px/.test(a)?z(a):/em/.test(a)?parseFloat(a)*12:12,a=a<24?a+4:u(a*1.2),b=u(a*0.8);return{h:a,b:b}},label:function(a,b,c,d,e,f,g,h,i){function j(){var a,b;a=s.element.style;J=(Va===void 0||wb===void 0||n.styles.textAlign)&&s.textStr&&s.getBBox();n.width=(Va||J.width||0)+2*x+v;n.height=(wb||J.height||0)+2*x;na=x+o.fontMetrics(a&&a.fontSize).b;if(z){if(!m)a=u(-L*x),b=h?-na:0,n.box=m=d?o.symbol(d,
186
- a,b,n.width,n.height,B):o.rect(a,b,n.width,n.height,0,B[Pb]),m.attr("fill",Q).add(n);m.isImg||m.attr(q({width:u(n.width),height:u(n.height)},B));B=null}}function k(){var a=n.styles,a=a&&a.textAlign,b=v+x*(1-L),c;c=h?0:na;if(r(Va)&&J&&(a==="center"||a==="right"))b+={center:0.5,right:1}[a]*(Va-J.width);if(b!==s.x||c!==s.y)s.attr("x",b),c!==t&&s.attr("y",c);s.x=b;s.y=c}function l(a,b){m?m.attr(a,b):B[a]=b}var o=this,n=o.g(i),s=o.text("",0,0,g).attr({zIndex:1}),m,J,L=0,x=3,v=0,Va,wb,xb,yb,y=0,B={},na,
187
- z;n.onAdd=function(){s.add(n);n.attr({text:a||"",x:b,y:c});m&&r(e)&&n.attr({anchorX:e,anchorY:f})};n.widthSetter=function(a){Va=a};n.heightSetter=function(a){wb=a};n.paddingSetter=function(a){r(a)&&a!==x&&(x=a,k())};n.paddingLeftSetter=function(a){r(a)&&a!==v&&(v=a,k())};n.alignSetter=function(a){L={left:0,center:0.5,right:1}[a]};n.textSetter=function(a){a!==t&&s.textSetter(a);j();k()};n["stroke-widthSetter"]=function(a,b){a&&(z=!0);y=a%2/2;l(b,a)};n.strokeSetter=n.fillSetter=n.rSetter=function(a,
188
- b){b==="fill"&&a&&(z=!0);l(b,a)};n.anchorXSetter=function(a,b){e=a;l(b,a+y-xb)};n.anchorYSetter=function(a,b){f=a;l(b,a-yb)};n.xSetter=function(a){n.x=a;L&&(a-=L*((Va||J.width)+x));xb=u(a);n.attr("translateX",xb)};n.ySetter=function(a){yb=n.y=u(a);n.attr("translateY",yb)};var A=n.css;return q(n,{css:function(a){if(a){var b={},a=w(a);p("fontSize,fontWeight,fontFamily,color,lineHeight,width,textDecoration,textShadow".split(","),function(c){a[c]!==t&&(b[c]=a[c],delete a[c])});s.css(b)}return A.call(n,
189
- a)},getBBox:function(){return{width:J.width+2*x,height:J.height+2*x,x:J.x-x,y:J.y-x}},shadow:function(a){m&&m.shadow(a);return n},destroy:function(){W(n.element,"mouseenter");W(n.element,"mouseleave");s&&(s=s.destroy());m&&(m=m.destroy());P.prototype.destroy.call(n);n=o=j=k=l=null}})}};Za=ta;q(P.prototype,{htmlCss:function(a){var b=this.element;if(b=a&&b.tagName==="SPAN"&&a.width)delete a.width,this.textWidth=b,this.updateTransform();this.styles=q(this.styles,a);G(this.element,a);return this},htmlGetBBox:function(){var a=
190
- this.element,b=this.bBox;if(!b){if(a.nodeName==="text")a.style.position="absolute";b=this.bBox={x:a.offsetLeft,y:a.offsetTop,width:a.offsetWidth,height:a.offsetHeight}}return b},htmlUpdateTransform:function(){if(this.added){var a=this.renderer,b=this.element,c=this.translateX||0,d=this.translateY||0,e=this.x||0,f=this.y||0,g=this.textAlign||"left",h={left:0,center:0.5,right:1}[g],i=this.shadows;G(b,{marginLeft:c,marginTop:d});i&&p(i,function(a){G(a,{marginLeft:c+1,marginTop:d+1})});this.inverted&&
191
- p(b.childNodes,function(c){a.invertChild(c,b)});if(b.tagName==="SPAN"){var j=this.rotation,k,l=z(this.textWidth),o=[j,g,b.innerHTML,this.textWidth].join(",");if(o!==this.cTT){k=a.fontMetrics(b.style.fontSize).b;r(j)&&this.setSpanRotation(j,h,k);i=m(this.elemWidth,b.offsetWidth);if(i>l&&/[ \-]/.test(b.textContent||b.innerText))G(b,{width:l+"px",display:"block",whiteSpace:"normal"}),i=l;this.getSpanCorrection(i,k,h,j,g)}G(b,{left:e+(this.xCorr||0)+"px",top:f+(this.yCorr||0)+"px"});if(ib)k=b.offsetHeight;
192
- this.cTT=o}}else this.alignOnAdd=!0},setSpanRotation:function(a,b,c){var d={},e=Aa?"-ms-transform":ib?"-webkit-transform":Ta?"MozTransform":Ib?"-o-transform":"";d[e]=d.transform="rotate("+a+"deg)";d[e+(Ta?"Origin":"-origin")]=d.transformOrigin=b*100+"% "+c+"px";G(this.element,d)},getSpanCorrection:function(a,b,c){this.xCorr=-a*c;this.yCorr=-b}});q(ta.prototype,{html:function(a,b,c){var d=this.createElement("span"),e=d.element,f=d.renderer;d.textSetter=function(a){a!==e.innerHTML&&delete this.bBox;
193
- e.innerHTML=this.textStr=a};d.xSetter=d.ySetter=d.alignSetter=d.rotationSetter=function(a,b){b==="align"&&(b="textAlign");d[b]=a;d.htmlUpdateTransform()};d.attr({text:a,x:u(b),y:u(c)}).css({position:"absolute",whiteSpace:"nowrap",fontFamily:this.style.fontFamily,fontSize:this.style.fontSize});d.css=d.htmlCss;if(f.isSVG)d.add=function(a){var b,c=f.box.parentNode,j=[];if(this.parentGroup=a){if(b=a.div,!b){for(;a;)j.push(a),a=a.parentGroup;p(j.reverse(),function(a){var d;b=a.div=a.div||Y(Ja,{className:H(a.element,
194
- "class")},{position:"absolute",left:(a.translateX||0)+"px",top:(a.translateY||0)+"px"},b||c);d=b.style;q(a,{translateXSetter:function(b,c){d.left=b+"px";a[c]=b;a.doTransform=!0},translateYSetter:function(b,c){d.top=b+"px";a[c]=b;a.doTransform=!0},visibilitySetter:function(a,b){d[b]=a}})})}}else b=c;b.appendChild(e);d.added=!0;d.alignOnAdd&&d.htmlUpdateTransform();return d};return d}});var X;if(!aa&&!fa){R.VMLElement=X={init:function(a,b){var c=["<",b,' filled="f" stroked="f"'],d=["position: ","absolute",
195
- ";"],e=b===Ja;(b==="shape"||e)&&d.push("left:0;top:0;width:1px;height:1px;");d.push("visibility: ",e?"hidden":"visible");c.push(' style="',d.join(""),'"/>');if(b)c=e||b==="span"||b==="img"?c.join(""):a.prepVML(c),this.element=Y(c);this.renderer=a},add:function(a){var b=this.renderer,c=this.element,d=b.box,d=a?a.element||a:d;a&&a.inverted&&b.invertChild(c,d);d.appendChild(c);this.added=!0;this.alignOnAdd&&!this.deferUpdateTransform&&this.updateTransform();if(this.onAdd)this.onAdd();return this},updateTransform:P.prototype.htmlUpdateTransform,
196
- setSpanRotation:function(){var a=this.rotation,b=Z(a*Ca),c=ea(a*Ca);G(this.element,{filter:a?["progid:DXImageTransform.Microsoft.Matrix(M11=",b,", M12=",-c,", M21=",c,", M22=",b,", sizingMethod='auto expand')"].join(""):Q})},getSpanCorrection:function(a,b,c,d,e){var f=d?Z(d*Ca):1,g=d?ea(d*Ca):0,h=m(this.elemHeight,this.element.offsetHeight),i;this.xCorr=f<0&&-a;this.yCorr=g<0&&-h;i=f*g<0;this.xCorr+=g*b*(i?1-c:c);this.yCorr-=f*b*(d?i?c:1-c:1);e&&e!=="left"&&(this.xCorr-=a*c*(f<0?-1:1),d&&(this.yCorr-=
197
- h*c*(g<0?-1:1)),G(this.element,{textAlign:e}))},pathToVML:function(a){for(var b=a.length,c=[];b--;)if(ha(a[b]))c[b]=u(a[b]*10)-5;else if(a[b]==="Z")c[b]="x";else if(c[b]=a[b],a.isArc&&(a[b]==="wa"||a[b]==="at"))c[b+5]===c[b+7]&&(c[b+7]+=a[b+7]>a[b+5]?1:-1),c[b+6]===c[b+8]&&(c[b+8]+=a[b+8]>a[b+6]?1:-1);return c.join(" ")||"x"},clip:function(a){var b=this,c;a?(c=a.members,ja(c,b),c.push(b),b.destroyClip=function(){ja(c,b)},a=a.getCSS(b)):(b.destroyClip&&b.destroyClip(),a={clip:hb?"inherit":"rect(auto)"});
198
- return b.css(a)},css:P.prototype.htmlCss,safeRemoveChild:function(a){a.parentNode&&Pa(a)},destroy:function(){this.destroyClip&&this.destroyClip();return P.prototype.destroy.apply(this)},on:function(a,b){this.element["on"+a]=function(){var a=I.event;a.target=a.srcElement;b(a)};return this},cutOffPath:function(a,b){var c,a=a.split(/[ ,]/);c=a.length;if(c===9||c===11)a[c-4]=a[c-2]=z(a[c-2])-10*b;return a.join(" ")},shadow:function(a,b,c){var d=[],e,f=this.element,g=this.renderer,h,i=f.style,j,k=f.path,
199
- l,o,n,s;k&&typeof k.value!=="string"&&(k="x");o=k;if(a){n=m(a.width,3);s=(a.opacity||0.15)/n;for(e=1;e<=3;e++){l=n*2+1-2*e;c&&(o=this.cutOffPath(k.value,l+0.5));j=['<shape isShadow="true" strokeweight="',l,'" filled="false" path="',o,'" coordsize="10 10" style="',f.style.cssText,'" />'];h=Y(g.prepVML(j),null,{left:z(i.left)+m(a.offsetX,1),top:z(i.top)+m(a.offsetY,1)});if(c)h.cutOff=l+1;j=['<stroke color="',a.color||"black",'" opacity="',s*e,'"/>'];Y(g.prepVML(j),null,null,h);b?b.element.appendChild(h):
200
- f.parentNode.insertBefore(h,f);d.push(h)}this.shadows=d}return this},updateShadows:sa,setAttr:function(a,b){hb?this.element[a]=b:this.element.setAttribute(a,b)},classSetter:function(a){this.element.className=a},dashstyleSetter:function(a,b,c){(c.getElementsByTagName("stroke")[0]||Y(this.renderer.prepVML(["<stroke/>"]),null,null,c))[b]=a||"solid";this[b]=a},dSetter:function(a,b,c){var d=this.shadows,a=a||[];this.d=a.join(" ");c.path=a=this.pathToVML(a);if(d)for(c=d.length;c--;)d[c].path=d[c].cutOff?
201
- this.cutOffPath(a,d[c].cutOff):a;this.setAttr(b,a)},fillSetter:function(a,b,c){var d=c.nodeName;if(d==="SPAN")c.style.color=a;else if(d!=="IMG")c.filled=a!==Q,this.setAttr("fillcolor",this.renderer.color(a,c,b,this))},opacitySetter:sa,rotationSetter:function(a,b,c){c=c.style;this[b]=c[b]=a;c.left=-u(ea(a*Ca)+1)+"px";c.top=u(Z(a*Ca))+"px"},strokeSetter:function(a,b,c){this.setAttr("strokecolor",this.renderer.color(a,c,b))},"stroke-widthSetter":function(a,b,c){c.stroked=!!a;this[b]=a;ha(a)&&(a+="px");
202
- this.setAttr("strokeweight",a)},titleSetter:function(a,b){this.setAttr(b,a)},visibilitySetter:function(a,b,c){a==="inherit"&&(a="visible");this.shadows&&p(this.shadows,function(c){c.style[b]=a});c.nodeName==="DIV"&&(a=a==="hidden"?"-999em":0,hb||(c.style[b]=a?"visible":"hidden"),b="top");c.style[b]=a},xSetter:function(a,b,c){this[b]=a;b==="x"?b="left":b==="y"&&(b="top");this.updateClipping?(this[b]=a,this.updateClipping()):c.style[b]=a},zIndexSetter:function(a,b,c){c.style[b]=a}};X=ka(P,X);X.prototype.ySetter=
203
- X.prototype.widthSetter=X.prototype.heightSetter=X.prototype.xSetter;var ga={Element:X,isIE8:wa.indexOf("MSIE 8.0")>-1,init:function(a,b,c,d){var e;this.alignedObjects=[];d=this.createElement(Ja).css(q(this.getStyle(d),{position:"relative"}));e=d.element;a.appendChild(d.element);this.isVML=!0;this.box=e;this.boxWrapper=d;this.cache={};this.setSize(b,c,!1);if(!y.namespaces.hcv){y.namespaces.add("hcv","urn:schemas-microsoft-com:vml");try{y.createStyleSheet().cssText="hcv\\:fill, hcv\\:path, hcv\\:shape, hcv\\:stroke{ behavior:url(#default#VML); display: inline-block; } "}catch(f){y.styleSheets[0].cssText+=
204
- "hcv\\:fill, hcv\\:path, hcv\\:shape, hcv\\:stroke{ behavior:url(#default#VML); display: inline-block; } "}}},isHidden:function(){return!this.box.offsetWidth},clipRect:function(a,b,c,d){var e=this.createElement(),f=ca(a);return q(e,{members:[],left:(f?a.x:a)+1,top:(f?a.y:b)+1,width:(f?a.width:c)-1,height:(f?a.height:d)-1,getCSS:function(a){var b=a.element,c=b.nodeName,a=a.inverted,d=this.top-(c==="shape"?b.offsetTop:0),e=this.left,b=e+this.width,f=d+this.height,d={clip:"rect("+u(a?e:d)+"px,"+u(a?
205
- f:b)+"px,"+u(a?b:f)+"px,"+u(a?d:e)+"px)"};!a&&hb&&c==="DIV"&&q(d,{width:b+"px",height:f+"px"});return d},updateClipping:function(){p(e.members,function(a){a.element&&a.css(e.getCSS(a))})}})},color:function(a,b,c,d){var e=this,f,g=/^rgba/,h,i,j=Q;a&&a.linearGradient?i="gradient":a&&a.radialGradient&&(i="pattern");if(i){var k,l,o=a.linearGradient||a.radialGradient,n,s,m,J,L,x="",a=a.stops,r,v=[],q=function(){h=['<fill colors="'+v.join(",")+'" opacity="',m,'" o:opacity2="',s,'" type="',i,'" ',x,'focus="100%" method="any" />'];
206
- Y(e.prepVML(h),null,null,b)};n=a[0];r=a[a.length-1];n[0]>0&&a.unshift([0,n[1]]);r[0]<1&&a.push([1,r[1]]);p(a,function(a,b){g.test(a[1])?(f=ya(a[1]),k=f.get("rgb"),l=f.get("a")):(k=a[1],l=1);v.push(a[0]*100+"% "+k);b?(m=l,J=k):(s=l,L=k)});if(c==="fill")if(i==="gradient")c=o.x1||o[0]||0,a=o.y1||o[1]||0,n=o.x2||o[2]||0,o=o.y2||o[3]||0,x='angle="'+(90-U.atan((o-a)/(n-c))*180/ma)+'"',q();else{var j=o.r,t=j*2,u=j*2,y=o.cx,B=o.cy,na=b.radialReference,w,j=function(){na&&(w=d.getBBox(),y+=(na[0]-w.x)/w.width-
207
- 0.5,B+=(na[1]-w.y)/w.height-0.5,t*=na[2]/w.width,u*=na[2]/w.height);x='src="'+E.global.VMLRadialGradientURL+'" size="'+t+","+u+'" origin="0.5,0.5" position="'+y+","+B+'" color2="'+L+'" ';q()};d.added?j():d.onAdd=j;j=J}else j=k}else if(g.test(a)&&b.tagName!=="IMG")f=ya(a),h=["<",c,' opacity="',f.get("a"),'"/>'],Y(this.prepVML(h),null,null,b),j=f.get("rgb");else{j=b.getElementsByTagName(c);if(j.length)j[0].opacity=1,j[0].type="solid";j=a}return j},prepVML:function(a){var b=this.isIE8,a=a.join("");b?
208
- (a=a.replace("/>",' xmlns="urn:schemas-microsoft-com:vml" />'),a=a.indexOf('style="')===-1?a.replace("/>",' style="display:inline-block;behavior:url(#default#VML);" />'):a.replace('style="','style="display:inline-block;behavior:url(#default#VML);')):a=a.replace("<","<hcv:");return a},text:ta.prototype.html,path:function(a){var b={coordsize:"10 10"};La(a)?b.d=a:ca(a)&&q(b,a);return this.createElement("shape").attr(b)},circle:function(a,b,c){var d=this.symbol("circle");if(ca(a))c=a.r,b=a.y,a=a.x;d.isCircle=
209
- !0;d.r=c;return d.attr({x:a,y:b})},g:function(a){var b;a&&(b={className:"highcharts-"+a,"class":"highcharts-"+a});return this.createElement(Ja).attr(b)},image:function(a,b,c,d,e){var f=this.createElement("img").attr({src:a});arguments.length>1&&f.attr({x:b,y:c,width:d,height:e});return f},createElement:function(a){return a==="rect"?this.symbol(a):ta.prototype.createElement.call(this,a)},invertChild:function(a,b){var c=this,d=b.style,e=a.tagName==="IMG"&&a.style;G(a,{flip:"x",left:z(d.width)-(e?z(e.top):
210
- 1),top:z(d.height)-(e?z(e.left):1),rotation:-90});p(a.childNodes,function(b){c.invertChild(b,a)})},symbols:{arc:function(a,b,c,d,e){var f=e.start,g=e.end,h=e.r||c||d,c=e.innerR,d=Z(f),i=ea(f),j=Z(g),k=ea(g);if(g-f===0)return["x"];f=["wa",a-h,b-h,a+h,b+h,a+h*d,b+h*i,a+h*j,b+h*k];e.open&&!c&&f.push("e","M",a,b);f.push("at",a-c,b-c,a+c,b+c,a+c*j,b+c*k,a+c*d,b+c*i,"x","e");f.isArc=!0;return f},circle:function(a,b,c,d,e){e&&(c=d=2*e.r);e&&e.isCircle&&(a-=c/2,b-=d/2);return["wa",a,b,a+c,b+d,a+c,b+d/2,a+
211
- c,b+d/2,"e"]},rect:function(a,b,c,d,e){return ta.prototype.symbols[!r(e)||!e.r?"square":"callout"].call(0,a,b,c,d,e)}}};R.VMLRenderer=X=function(){this.init.apply(this,arguments)};X.prototype=w(ta.prototype,ga);Za=X}ta.prototype.measureSpanWidth=function(a,b){var c=y.createElement("span"),d;d=y.createTextNode(a);c.appendChild(d);G(c,b);this.box.appendChild(c);d=c.offsetWidth;Pa(c);return d};var Lb;if(fa)R.CanVGRenderer=X=function(){xa="http://www.w3.org/1999/xhtml"},X.prototype.symbols={},Lb=function(){function a(){var a=
212
- b.length,d;for(d=0;d<a;d++)b[d]();b=[]}var b=[];return{push:function(c,d){b.length===0&&Qb(d,a);b.push(c)}}}(),Za=X;Sa.prototype={addLabel:function(){var a=this.axis,b=a.options,c=a.chart,d=a.horiz,e=a.categories,f=a.names,g=this.pos,h=b.labels,i=a.tickPositions,d=d&&e&&!h.step&&!h.staggerLines&&!h.rotation&&c.plotWidth/i.length||!d&&(c.margin[3]||c.chartWidth*0.33),j=g===i[0],k=g===i[i.length-1],l,f=e?m(e[g],f[g],g):g,e=this.label,o=i.info;a.isDatetimeAxis&&o&&(l=b.dateTimeLabelFormats[o.higherRanks[g]||
213
- o.unitName]);this.isFirst=j;this.isLast=k;b=a.labelFormatter.call({axis:a,chart:c,isFirst:j,isLast:k,dateTimeLabelFormat:l,value:a.isLog?da(ia(f)):f});g=d&&{width:v(1,u(d-2*(h.padding||10)))+"px"};g=q(g,h.style);if(r(e))e&&e.attr({text:b}).css(g);else{l={align:a.labelAlign};if(ha(h.rotation))l.rotation=h.rotation;if(d&&h.ellipsis)l._clipHeight=a.len/i.length;this.label=r(b)&&h.enabled?c.renderer.text(b,0,0,h.useHTML).attr(l).css(g).add(a.labelGroup):null}},getLabelSize:function(){var a=this.label,
214
- b=this.axis;return a?a.getBBox()[b.horiz?"height":"width"]:0},getLabelSides:function(){var a=this.label.getBBox(),b=this.axis,c=b.horiz,d=b.options.labels,a=c?a.width:a.height,b=c?d.x-a*{left:0,center:0.5,right:1}[b.labelAlign]:0;return[b,c?a+b:a]},handleOverflow:function(a,b){var c=!0,d=this.axis,e=this.isFirst,f=this.isLast,g=d.horiz?b.x:b.y,h=d.reversed,i=d.tickPositions,j=this.getLabelSides(),k=j[0],j=j[1],l,o,n,s=this.label.line||0;l=d.labelEdge;o=d.justifyLabels&&(e||f);l[s]===t||g+k>l[s]?l[s]=
215
- g+j:o||(c=!1);if(o){l=(o=d.justifyToPlot)?d.pos:0;o=o?l+d.len:d.chart.chartWidth;do a+=e?1:-1,n=d.ticks[i[a]];while(i[a]&&(!n||n.label.line!==s));d=n&&n.label.xy&&n.label.xy.x+n.getLabelSides()[e?0:1];e&&!h||f&&h?g+k<l&&(g=l-k,n&&g+j>d&&(c=!1)):g+j>o&&(g=o-j,n&&g+k<d&&(c=!1));b.x=g}return c},getPosition:function(a,b,c,d){var e=this.axis,f=e.chart,g=d&&f.oldChartHeight||f.chartHeight;return{x:a?e.translate(b+c,null,null,d)+e.transB:e.left+e.offset+(e.opposite?(d&&f.oldChartWidth||f.chartWidth)-e.right-
216
- e.left:0),y:a?g-e.bottom+e.offset-(e.opposite?e.height:0):g-e.translate(b+c,null,null,d)-e.transB}},getLabelPosition:function(a,b,c,d,e,f,g,h){var i=this.axis,j=i.transA,k=i.reversed,l=i.staggerLines,o=i.chart.renderer.fontMetrics(e.style.fontSize).b,n=e.rotation,a=a+e.x-(f&&d?f*j*(k?-1:1):0),b=b+e.y-(f&&!d?f*j*(k?1:-1):0);n&&i.side===2&&(b-=o-o*Z(n*Ca));!r(e.y)&&!n&&(b+=o-c.getBBox().height/2);if(l)c.line=g/(h||1)%l,b+=c.line*(i.labelOffset/l);return{x:a,y:b}},getMarkPath:function(a,b,c,d,e,f){return f.crispLine(["M",
217
- a,b,"L",a+(e?0:-c),b+(e?c:0)],d)},render:function(a,b,c){var d=this.axis,e=d.options,f=d.chart.renderer,g=d.horiz,h=this.type,i=this.label,j=this.pos,k=e.labels,l=this.gridLine,o=h?h+"Grid":"grid",n=h?h+"Tick":"tick",s=e[o+"LineWidth"],p=e[o+"LineColor"],J=e[o+"LineDashStyle"],L=e[n+"Length"],o=e[n+"Width"]||0,x=e[n+"Color"],r=e[n+"Position"],n=this.mark,v=k.step,q=!0,u=d.tickmarkOffset,w=this.getPosition(g,j,u,b),y=w.x,w=w.y,B=g&&y===d.pos+d.len||!g&&w===d.pos?-1:1;this.isActive=!0;if(s){j=d.getPlotLinePath(j+
218
- u,s*B,b,!0);if(l===t){l={stroke:p,"stroke-width":s};if(J)l.dashstyle=J;if(!h)l.zIndex=1;if(b)l.opacity=0;this.gridLine=l=s?f.path(j).attr(l).add(d.gridGroup):null}if(!b&&l&&j)l[this.isNew?"attr":"animate"]({d:j,opacity:c})}if(o&&L)r==="inside"&&(L=-L),d.opposite&&(L=-L),h=this.getMarkPath(y,w,L,o*B,g,f),n?n.animate({d:h,opacity:c}):this.mark=f.path(h).attr({stroke:x,"stroke-width":o,opacity:c}).add(d.axisGroup);if(i&&!isNaN(y))i.xy=w=this.getLabelPosition(y,w,i,g,k,u,a,v),this.isFirst&&!this.isLast&&
219
- !m(e.showFirstLabel,1)||this.isLast&&!this.isFirst&&!m(e.showLastLabel,1)?q=!1:!d.isRadial&&!k.step&&!k.rotation&&!b&&c!==0&&(q=this.handleOverflow(a,w)),v&&a%v&&(q=!1),q&&!isNaN(w.y)?(w.opacity=c,i[this.isNew?"attr":"animate"](w),this.isNew=!1):i.attr("y",-9999)},destroy:function(){Oa(this,this.axis)}};R.PlotLineOrBand=function(a,b){this.axis=a;if(b)this.options=b,this.id=b.id};R.PlotLineOrBand.prototype={render:function(){var a=this,b=a.axis,c=b.horiz,d=(b.pointRange||0)/2,e=a.options,f=e.label,
220
- g=a.label,h=e.width,i=e.to,j=e.from,k=r(j)&&r(i),l=e.value,o=e.dashStyle,n=a.svgElem,s=[],p,J=e.color,L=e.zIndex,x=e.events,q={},t=b.chart.renderer;b.isLog&&(j=za(j),i=za(i),l=za(l));if(h){if(s=b.getPlotLinePath(l,h),q={stroke:J,"stroke-width":h},o)q.dashstyle=o}else if(k){j=v(j,b.min-d);i=C(i,b.max+d);s=b.getPlotBandPath(j,i,e);if(J)q.fill=J;if(e.borderWidth)q.stroke=e.borderColor,q["stroke-width"]=e.borderWidth}else return;if(r(L))q.zIndex=L;if(n)if(s)n.animate({d:s},null,n.onGetPath);else{if(n.hide(),
221
- n.onGetPath=function(){n.show()},g)a.label=g=g.destroy()}else if(s&&s.length&&(a.svgElem=n=t.path(s).attr(q).add(),x))for(p in d=function(b){n.on(b,function(c){x[b].apply(a,[c])})},x)d(p);if(f&&r(f.text)&&s&&s.length&&b.width>0&&b.height>0){f=w({align:c&&k&&"center",x:c?!k&&4:10,verticalAlign:!c&&k&&"middle",y:c?k?16:10:k?6:-4,rotation:c&&!k&&90},f);if(!g){q={align:f.textAlign||f.align,rotation:f.rotation};if(r(L))q.zIndex=L;a.label=g=t.text(f.text,0,0,f.useHTML).attr(q).css(f.style).add()}b=[s[1],
222
- s[4],m(s[6],s[1])];s=[s[2],s[5],m(s[7],s[2])];c=Na(b);k=Na(s);g.align(f,!1,{x:c,y:k,width:Ba(b)-c,height:Ba(s)-k});g.show()}else g&&g.hide();return a},destroy:function(){ja(this.axis.plotLinesAndBands,this);delete this.axis;Oa(this)}};la.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:N,lineColor:"#C0D0E0",lineWidth:1,minPadding:0.01,
223
- maxPadding:0.01,minorGridLineColor:"#E0E0E0",minorGridLineWidth:1,minorTickColor:"#A0A0A0",minorTickLength:2,minorTickPosition:"outside",startOfWeek:1,startOnTick:!1,tickColor:"#C0D0E0",tickLength:10,tickmarkPlacement:"between",tickPixelInterval:100,tickPosition:"outside",tickWidth:1,title:{align:"middle",style:{color:"#707070"}},type:"linear"},defaultYAxisOptions:{endOnTick:!0,gridLineWidth:1,tickPixelInterval:72,showLastLabel:!0,labels:{x:-8,y:3},lineWidth:0,maxPadding:0.05,minPadding:0.05,startOnTick:!0,
224
- tickWidth:0,title:{rotation:270,text:"Values"},stackLabels:{enabled:!1,formatter:function(){return Ga(this.total,-1)},style:N.style}},defaultLeftAxisOptions:{labels:{x:-15,y:null},title:{rotation:270}},defaultRightAxisOptions:{labels:{x:15,y:null},title:{rotation:90}},defaultBottomAxisOptions:{labels:{x:0,y:20},title:{rotation:0}},defaultTopAxisOptions:{labels:{x:0,y:-15},title:{rotation:0}},init:function(a,b){var c=b.isX;this.horiz=a.inverted?!c:c;this.coll=(this.isXAxis=c)?"xAxis":"yAxis";this.opposite=
225
- b.opposite;this.side=b.side||(this.horiz?this.opposite?0:2:this.opposite?1:3);this.setOptions(b);var d=this.options,e=d.type;this.labelFormatter=d.labels.formatter||this.defaultLabelFormatter;this.userOptions=b;this.minPixelPadding=0;this.chart=a;this.reversed=d.reversed;this.zoomEnabled=d.zoomEnabled!==!1;this.categories=d.categories||e==="category";this.names=[];this.isLog=e==="logarithmic";this.isDatetimeAxis=e==="datetime";this.isLinked=r(d.linkedTo);this.tickmarkOffset=this.categories&&d.tickmarkPlacement===
226
- "between"?0.5:0;this.ticks={};this.labelEdge=[];this.minorTicks={};this.plotLinesAndBands=[];this.alternateBands={};this.len=0;this.minRange=this.userMinRange=d.minRange||d.maxZoom;this.range=d.range;this.offset=d.offset||0;this.stacks={};this.oldStacks={};this.min=this.max=null;this.crosshair=m(d.crosshair,qa(a.options.tooltip.crosshairs)[c?0:1],!1);var f,d=this.options.events;Da(this,a.axes)===-1&&(c&&!this.isColorAxis?a.axes.splice(a.xAxis.length,0,this):a.axes.push(this),a[this.coll].push(this));
227
- this.series=this.series||[];if(a.inverted&&c&&this.reversed===t)this.reversed=!0;this.removePlotLine=this.removePlotBand=this.removePlotBandOrLine;for(f in d)K(this,f,d[f]);if(this.isLog)this.val2lin=za,this.lin2val=ia},setOptions:function(a){this.options=w(this.defaultOptions,this.isXAxis?{}:this.defaultYAxisOptions,[this.defaultTopAxisOptions,this.defaultRightAxisOptions,this.defaultBottomAxisOptions,this.defaultLeftAxisOptions][this.side],w(E[this.coll],a))},defaultLabelFormatter:function(){var a=
228
- this.axis,b=this.value,c=a.categories,d=this.dateTimeLabelFormat,e=E.lang.numericSymbols,f=e&&e.length,g,h=a.options.labels.format,a=a.isLog?b:a.tickInterval;if(h)g=Ia(h,this);else if(c)g=b;else if(d)g=cb(d,b);else if(f&&a>=1E3)for(;f--&&g===t;)c=Math.pow(1E3,f+1),a>=c&&e[f]!==null&&(g=Ga(b/c,-1)+e[f]);g===t&&(g=M(b)>=1E4?Ga(b,0):Ga(b,-1,t,""));return g},getSeriesExtremes:function(){var a=this,b=a.chart;a.hasVisibleSeries=!1;a.dataMin=a.dataMax=null;a.buildStacks&&a.buildStacks();p(a.series,function(c){if(c.visible||
229
- !b.options.chart.ignoreHiddenSeries){var d;d=c.options.threshold;var e;a.hasVisibleSeries=!0;a.isLog&&d<=0&&(d=null);if(a.isXAxis){if(d=c.xData,d.length)a.dataMin=C(m(a.dataMin,d[0]),Na(d)),a.dataMax=v(m(a.dataMax,d[0]),Ba(d))}else{c.getExtremes();e=c.dataMax;c=c.dataMin;if(r(c)&&r(e))a.dataMin=C(m(a.dataMin,c),c),a.dataMax=v(m(a.dataMax,e),e);if(r(d))if(a.dataMin>=d)a.dataMin=d,a.ignoreMinPadding=!0;else if(a.dataMax<d)a.dataMax=d,a.ignoreMaxPadding=!0}}})},translate:function(a,b,c,d,e,f){var g=
230
- 1,h=0,i=d?this.oldTransA:this.transA,d=d?this.oldMin:this.min,j=this.minPixelPadding,e=(this.options.ordinal||this.isLog&&e)&&this.lin2val;if(!i)i=this.transA;if(c)g*=-1,h=this.len;this.reversed&&(g*=-1,h-=g*(this.sector||this.len));b?(a=a*g+h,a-=j,a=a/i+d,e&&(a=this.lin2val(a))):(e&&(a=this.val2lin(a)),f==="between"&&(f=0.5),a=g*(a-d)*i+h+g*j+(ha(f)?i*f*this.pointRange:0));return a},toPixels:function(a,b){return this.translate(a,!1,!this.horiz,null,!0)+(b?0:this.pos)},toValue:function(a,b){return this.translate(a-
231
- (b?0:this.pos),!0,!this.horiz,null,!0)},getPlotLinePath:function(a,b,c,d,e){var f=this.chart,g=this.left,h=this.top,i,j,k=c&&f.oldChartHeight||f.chartHeight,l=c&&f.oldChartWidth||f.chartWidth,o;i=this.transB;e=m(e,this.translate(a,null,null,c));a=c=u(e+i);i=j=u(k-e-i);if(isNaN(e))o=!0;else if(this.horiz){if(i=h,j=k-this.bottom,a<g||a>g+this.width)o=!0}else if(a=g,c=l-this.right,i<h||i>h+this.height)o=!0;return o&&!d?null:f.renderer.crispLine(["M",a,i,"L",c,j],b||1)},getLinearTickPositions:function(a,
232
- b,c){var d,e=da(T(b/a)*a),f=da(Ka(c/a)*a),g=[];if(b===c&&ha(b))return[b];for(b=e;b<=f;){g.push(b);b=da(b+a);if(b===d)break;d=b}return g},getMinorTickPositions:function(){var a=this.options,b=this.tickPositions,c=this.minorTickInterval,d=[],e;if(this.isLog){e=b.length;for(a=1;a<e;a++)d=d.concat(this.getLogTickPositions(c,b[a-1],b[a],!0))}else if(this.isDatetimeAxis&&a.minorTickInterval==="auto")d=d.concat(this.getTimeTicks(this.normalizeTimeTickInterval(c),this.min,this.max,a.startOfWeek)),d[0]<this.min&&
233
- d.shift();else for(b=this.min+(b[0]-this.min)%c;b<=this.max;b+=c)d.push(b);return d},adjustForMinRange:function(){var a=this.options,b=this.min,c=this.max,d,e=this.dataMax-this.dataMin>=this.minRange,f,g,h,i,j;if(this.isXAxis&&this.minRange===t&&!this.isLog)r(a.min)||r(a.max)?this.minRange=null:(p(this.series,function(a){i=a.xData;for(g=j=a.xIncrement?1:i.length-1;g>0;g--)if(h=i[g]-i[g-1],f===t||h<f)f=h}),this.minRange=C(f*5,this.dataMax-this.dataMin));if(c-b<this.minRange){var k=this.minRange;d=
234
- (k-c+b)/2;d=[b-d,m(a.min,b-d)];if(e)d[2]=this.dataMin;b=Ba(d);c=[b+k,m(a.max,b+k)];if(e)c[2]=this.dataMax;c=Na(c);c-b<k&&(d[0]=c-k,d[1]=m(a.min,c-k),b=Ba(d))}this.min=b;this.max=c},setAxisTranslation:function(a){var b=this,c=b.max-b.min,d=b.axisPointRange||0,e,f=0,g=0,h=b.linkedParent,i=!!b.categories,j=b.transA;if(b.isXAxis||i||d)h?(f=h.minPointOffset,g=h.pointRangePadding):p(b.series,function(a){var h=i?1:b.isXAxis?a.pointRange:b.axisPointRange||0,j=a.options.pointPlacement,n=a.closestPointRange;
235
- h>c&&(h=0);d=v(d,h);f=v(f,Fa(j)?0:h/2);g=v(g,j==="on"?0:h);!a.noSharedTooltip&&r(n)&&(e=r(e)?C(e,n):n)}),h=b.ordinalSlope&&e?b.ordinalSlope/e:1,b.minPointOffset=f*=h,b.pointRangePadding=g*=h,b.pointRange=C(d,c),b.closestPointRange=e;if(a)b.oldTransA=j;b.translationSlope=b.transA=j=b.len/(c+g||1);b.transB=b.horiz?b.left:b.bottom;b.minPixelPadding=j*f},setTickPositions:function(a){var b=this,c=b.chart,d=b.options,e=b.isLog,f=b.isDatetimeAxis,g=b.isXAxis,h=b.isLinked,i=b.options.tickPositioner,j=d.maxPadding,
236
- k=d.minPadding,l=d.tickInterval,o=d.minTickInterval,n=d.tickPixelInterval,s,$=b.categories;h?(b.linkedParent=c[b.coll][d.linkedTo],c=b.linkedParent.getExtremes(),b.min=m(c.min,c.dataMin),b.max=m(c.max,c.dataMax),d.type!==b.linkedParent.options.type&&ra(11,1)):(b.min=m(b.userMin,d.min,b.dataMin),b.max=m(b.userMax,d.max,b.dataMax));if(e)!a&&C(b.min,m(b.dataMin,b.min))<=0&&ra(10,1),b.min=da(za(b.min)),b.max=da(za(b.max));if(b.range&&r(b.max))b.userMin=b.min=v(b.min,b.max-b.range),b.userMax=b.max,b.range=
237
- null;b.beforePadding&&b.beforePadding();b.adjustForMinRange();if(!$&&!b.axisPointRange&&!b.usePercentage&&!h&&r(b.min)&&r(b.max)&&(c=b.max-b.min)){if(!r(d.min)&&!r(b.userMin)&&k&&(b.dataMin<0||!b.ignoreMinPadding))b.min-=c*k;if(!r(d.max)&&!r(b.userMax)&&j&&(b.dataMax>0||!b.ignoreMaxPadding))b.max+=c*j}if(ha(d.floor))b.min=v(b.min,d.floor);if(ha(d.ceiling))b.max=C(b.max,d.ceiling);b.min===b.max||b.min===void 0||b.max===void 0?b.tickInterval=1:h&&!l&&n===b.linkedParent.options.tickPixelInterval?b.tickInterval=
238
- b.linkedParent.tickInterval:(b.tickInterval=m(l,$?1:(b.max-b.min)*n/v(b.len,n)),!r(l)&&b.len<n&&!this.isRadial&&!this.isLog&&!$&&d.startOnTick&&d.endOnTick&&(s=!0,b.tickInterval/=4));g&&!a&&p(b.series,function(a){a.processData(b.min!==b.oldMin||b.max!==b.oldMax)});b.setAxisTranslation(!0);b.beforeSetTickPositions&&b.beforeSetTickPositions();if(b.postProcessTickInterval)b.tickInterval=b.postProcessTickInterval(b.tickInterval);if(b.pointRange)b.tickInterval=v(b.pointRange,b.tickInterval);if(!l&&b.tickInterval<
239
- o)b.tickInterval=o;if(!f&&!e&&!l)b.tickInterval=nb(b.tickInterval,null,mb(b.tickInterval),d);b.minorTickInterval=d.minorTickInterval==="auto"&&b.tickInterval?b.tickInterval/5:d.minorTickInterval;b.tickPositions=a=d.tickPositions?[].concat(d.tickPositions):i&&i.apply(b,[b.min,b.max]);if(!a)!b.ordinalPositions&&(b.max-b.min)/b.tickInterval>v(2*b.len,200)&&ra(19,!0),a=f?b.getTimeTicks(b.normalizeTimeTickInterval(b.tickInterval,d.units),b.min,b.max,d.startOfWeek,b.ordinalPositions,b.closestPointRange,
240
- !0):e?b.getLogTickPositions(b.tickInterval,b.min,b.max):b.getLinearTickPositions(b.tickInterval,b.min,b.max),s&&a.splice(1,a.length-2),b.tickPositions=a;if(!h)e=a[0],f=a[a.length-1],h=b.minPointOffset||0,d.startOnTick?b.min=e:b.min-h>e&&a.shift(),d.endOnTick?b.max=f:b.max+h<f&&a.pop(),a.length===1&&(d=M(b.max)>1E13?1:0.001,b.min-=d,b.max+=d)},setMaxTicks:function(){var a=this.chart,b=a.maxTicks||{},c=this.tickPositions,d=this._maxTicksKey=[this.coll,this.pos,this.len].join("-");if(!this.isLinked&&
241
- !this.isDatetimeAxis&&c&&c.length>(b[d]||0)&&this.options.alignTicks!==!1)b[d]=c.length;a.maxTicks=b},adjustTickAmount:function(){var a=this._maxTicksKey,b=this.tickPositions,c=this.chart.maxTicks;if(c&&c[a]&&!this.isDatetimeAxis&&!this.categories&&!this.isLinked&&this.options.alignTicks!==!1&&this.min!==t){var d=this.tickAmount,e=b.length;this.tickAmount=a=c[a];if(e<a){for(;b.length<a;)b.push(da(b[b.length-1]+this.tickInterval));this.transA*=(e-1)/(a-1);this.max=b[b.length-1]}if(r(d)&&a!==d)this.isDirty=
242
- !0}},setScale:function(){var a=this.stacks,b,c,d,e;this.oldMin=this.min;this.oldMax=this.max;this.oldAxisLength=this.len;this.setAxisSize();e=this.len!==this.oldAxisLength;p(this.series,function(a){if(a.isDirtyData||a.isDirty||a.xAxis.isDirty)d=!0});if(e||d||this.isLinked||this.forceRedraw||this.userMin!==this.oldUserMin||this.userMax!==this.oldUserMax){if(!this.isXAxis)for(b in a)for(c in a[b])a[b][c].total=null,a[b][c].cum=0;this.forceRedraw=!1;this.getSeriesExtremes();this.setTickPositions();this.oldUserMin=
243
- this.userMin;this.oldUserMax=this.userMax;if(!this.isDirty)this.isDirty=e||this.min!==this.oldMin||this.max!==this.oldMax}else if(!this.isXAxis){if(this.oldStacks)a=this.stacks=this.oldStacks;for(b in a)for(c in a[b])a[b][c].cum=a[b][c].total}this.setMaxTicks()},setExtremes:function(a,b,c,d,e){var f=this,g=f.chart,c=m(c,!0),e=q(e,{min:a,max:b});D(f,"setExtremes",e,function(){f.userMin=a;f.userMax=b;f.eventArgs=e;f.isDirtyExtremes=!0;c&&g.redraw(d)})},zoom:function(a,b){var c=this.dataMin,d=this.dataMax,
244
- e=this.options;this.allowZoomOutside||(r(c)&&a<=C(c,m(e.min,c))&&(a=t),r(d)&&b>=v(d,m(e.max,d))&&(b=t));this.displayBtn=a!==t||b!==t;this.setExtremes(a,b,!1,t,{trigger:"zoom"});return!0},setAxisSize:function(){var a=this.chart,b=this.options,c=b.offsetLeft||0,d=this.horiz,e=m(b.width,a.plotWidth-c+(b.offsetRight||0)),f=m(b.height,a.plotHeight),g=m(b.top,a.plotTop),b=m(b.left,a.plotLeft+c),c=/%$/;c.test(f)&&(f=parseInt(f,10)/100*a.plotHeight);c.test(g)&&(g=parseInt(g,10)/100*a.plotHeight+a.plotTop);
245
- this.left=b;this.top=g;this.width=e;this.height=f;this.bottom=a.chartHeight-f-g;this.right=a.chartWidth-e-b;this.len=v(d?e:f,0);this.pos=d?b:g},getExtremes:function(){var a=this.isLog;return{min:a?da(ia(this.min)):this.min,max:a?da(ia(this.max)):this.max,dataMin:this.dataMin,dataMax:this.dataMax,userMin:this.userMin,userMax:this.userMax}},getThreshold:function(a){var b=this.isLog,c=b?ia(this.min):this.min,b=b?ia(this.max):this.max;c>a||a===null?a=c:b<a&&(a=b);return this.translate(a,0,1,0,1)},autoLabelAlign:function(a){a=
246
- (m(a,0)-this.side*90+720)%360;return a>15&&a<165?"right":a>195&&a<345?"left":"center"},getOffset:function(){var a=this,b=a.chart,c=b.renderer,d=a.options,e=a.tickPositions,f=a.ticks,g=a.horiz,h=a.side,i=b.inverted?[1,0,3,2][h]:h,j,k=0,l,o=0,n=d.title,s=d.labels,$=0,J=b.axisOffset,L=b.clipOffset,x=[-1,1,1,-1][h],q,u=1,w=m(s.maxStaggerLines,5),y,z,A,B,na=h===2?c.fontMetrics(s.style.fontSize).b:0;a.hasData=j=a.hasVisibleSeries||r(a.min)&&r(a.max)&&!!e;a.showAxis=b=j||m(d.showEmpty,!0);a.staggerLines=
247
- a.horiz&&s.staggerLines;if(!a.axisGroup)a.gridGroup=c.g("grid").attr({zIndex:d.gridZIndex||1}).add(),a.axisGroup=c.g("axis").attr({zIndex:d.zIndex||2}).add(),a.labelGroup=c.g("axis-labels").attr({zIndex:s.zIndex||7}).addClass("highcharts-"+a.coll.toLowerCase()+"-labels").add();if(j||a.isLinked){a.labelAlign=m(s.align||a.autoLabelAlign(s.rotation));p(e,function(b){f[b]?f[b].addLabel():f[b]=new Sa(a,b)});if(a.horiz&&!a.staggerLines&&w&&!s.rotation){for(q=a.reversed?[].concat(e).reverse():e;u<w;){j=
248
- [];y=!1;for(s=0;s<q.length;s++)z=q[s],A=(A=f[z].label&&f[z].label.getBBox())?A.width:0,B=s%u,A&&(z=a.translate(z),j[B]!==t&&z<j[B]&&(y=!0),j[B]=z+A);if(y)u++;else break}if(u>1)a.staggerLines=u}p(e,function(b){if(h===0||h===2||{1:"left",3:"right"}[h]===a.labelAlign)$=v(f[b].getLabelSize(),$)});if(a.staggerLines)$*=a.staggerLines,a.labelOffset=$}else for(q in f)f[q].destroy(),delete f[q];if(n&&n.text&&n.enabled!==!1){if(!a.axisTitle)a.axisTitle=c.text(n.text,0,0,n.useHTML).attr({zIndex:7,rotation:n.rotation||
249
- 0,align:n.textAlign||{low:"left",middle:"center",high:"right"}[n.align]}).addClass("highcharts-"+this.coll.toLowerCase()+"-title").css(n.style).add(a.axisGroup),a.axisTitle.isNew=!0;if(b)k=a.axisTitle.getBBox()[g?"height":"width"],o=m(n.margin,g?5:10),l=n.offset;a.axisTitle[b?"show":"hide"]()}a.offset=x*m(d.offset,J[h]);a.axisTitleMargin=m(l,$+o+($&&x*d.labels[g?"y":"x"]-na));J[h]=v(J[h],a.axisTitleMargin+k+x*a.offset);L[i]=v(L[i],T(d.lineWidth/2)*2)},getLinePath:function(a){var b=this.chart,c=this.opposite,
250
- d=this.offset,e=this.horiz,f=this.left+(c?this.width:0)+d,d=b.chartHeight-this.bottom-(c?this.height:0)+d;c&&(a*=-1);return b.renderer.crispLine(["M",e?this.left:f,e?d:this.top,"L",e?b.chartWidth-this.right:f,e?d:b.chartHeight-this.bottom],a)},getTitlePosition:function(){var a=this.horiz,b=this.left,c=this.top,d=this.len,e=this.options.title,f=a?b:c,g=this.opposite,h=this.offset,i=z(e.style.fontSize||12),d={low:f+(a?0:d),middle:f+d/2,high:f+(a?d:0)}[e.align],b=(a?c+this.height:b)+(a?1:-1)*(g?-1:1)*
251
- this.axisTitleMargin+(this.side===2?i:0);return{x:a?d:b+(g?this.width:0)+h+(e.x||0),y:a?b-(g?this.height:0)+h:d+(e.y||0)}},render:function(){var a=this,b=a.horiz,c=a.reversed,d=a.chart,e=d.renderer,f=a.options,g=a.isLog,h=a.isLinked,i=a.tickPositions,j,k=a.axisTitle,l=a.ticks,o=a.minorTicks,n=a.alternateBands,s=f.stackLabels,m=f.alternateGridColor,J=a.tickmarkOffset,L=f.lineWidth,x=d.hasRendered&&r(a.oldMin)&&!isNaN(a.oldMin),q=a.hasData,v=a.showAxis,u,w=f.labels.overflow,y=a.justifyLabels=b&&w!==
252
- !1,z;a.labelEdge.length=0;a.justifyToPlot=w==="justify";p([l,o,n],function(a){for(var b in a)a[b].isActive=!1});if(q||h)if(a.minorTickInterval&&!a.categories&&p(a.getMinorTickPositions(),function(b){o[b]||(o[b]=new Sa(a,b,"minor"));x&&o[b].isNew&&o[b].render(null,!0);o[b].render(null,!1,1)}),i.length&&(j=i.slice(),(b&&c||!b&&!c)&&j.reverse(),y&&(j=j.slice(1).concat([j[0]])),p(j,function(b,c){y&&(c=c===j.length-1?0:c+1);if(!h||b>=a.min&&b<=a.max)l[b]||(l[b]=new Sa(a,b)),x&&l[b].isNew&&l[b].render(c,
253
- !0,0.1),l[b].render(c,!1,1)}),J&&a.min===0&&(l[-1]||(l[-1]=new Sa(a,-1,null,!0)),l[-1].render(-1))),m&&p(i,function(b,c){if(c%2===0&&b<a.max)n[b]||(n[b]=new R.PlotLineOrBand(a)),u=b+J,z=i[c+1]!==t?i[c+1]+J:a.max,n[b].options={from:g?ia(u):u,to:g?ia(z):z,color:m},n[b].render(),n[b].isActive=!0}),!a._addedPlotLB)p((f.plotLines||[]).concat(f.plotBands||[]),function(b){a.addPlotBandOrLine(b)}),a._addedPlotLB=!0;p([l,o,n],function(a){var b,c,e=[],f=va?va.duration||500:0,g=function(){for(c=e.length;c--;)a[e[c]]&&
254
- !a[e[c]].isActive&&(a[e[c]].destroy(),delete a[e[c]])};for(b in a)if(!a[b].isActive)a[b].render(b,!1,0),a[b].isActive=!1,e.push(b);a===n||!d.hasRendered||!f?g():f&&setTimeout(g,f)});if(L)b=a.getLinePath(L),a.axisLine?a.axisLine.animate({d:b}):a.axisLine=e.path(b).attr({stroke:f.lineColor,"stroke-width":L,zIndex:7}).add(a.axisGroup),a.axisLine[v?"show":"hide"]();if(k&&v)k[k.isNew?"attr":"animate"](a.getTitlePosition()),k.isNew=!1;s&&s.enabled&&a.renderStackTotals();a.isDirty=!1},redraw:function(){var a=
255
- this.chart.pointer;a&&a.reset(!0);this.render();p(this.plotLinesAndBands,function(a){a.render()});p(this.series,function(a){a.isDirty=!0})},destroy:function(a){var b=this,c=b.stacks,d,e=b.plotLinesAndBands;a||W(b);for(d in c)Oa(c[d]),c[d]=null;p([b.ticks,b.minorTicks,b.alternateBands],function(a){Oa(a)});for(a=e.length;a--;)e[a].destroy();p("stackTotalGroup,axisLine,axisTitle,axisGroup,cross,gridGroup,labelGroup".split(","),function(a){b[a]&&(b[a]=b[a].destroy())});this.cross&&this.cross.destroy()},
256
- drawCrosshair:function(a,b){if(this.crosshair)if((r(b)||!m(this.crosshair.snap,!0))===!1)this.hideCrosshair();else{var c,d=this.crosshair,e=d.animation;m(d.snap,!0)?r(b)&&(c=this.chart.inverted!=this.horiz?b.plotX:this.len-b.plotY):c=this.horiz?a.chartX-this.pos:this.len-a.chartY+this.pos;c=this.isRadial?this.getPlotLinePath(this.isXAxis?b.x:m(b.stackY,b.y)):this.getPlotLinePath(null,null,null,null,c);if(c===null)this.hideCrosshair();else if(this.cross)this.cross.attr({visibility:"visible"})[e?"animate":
257
- "attr"]({d:c},e);else{e={"stroke-width":d.width||1,stroke:d.color||"#C0C0C0",zIndex:d.zIndex||2};if(d.dashStyle)e.dashstyle=d.dashStyle;this.cross=this.chart.renderer.path(c).attr(e).add()}}},hideCrosshair:function(){this.cross&&this.cross.hide()}};q(la.prototype,{getPlotBandPath:function(a,b){var c=this.getPlotLinePath(b),d=this.getPlotLinePath(a);d&&c?d.push(c[4],c[5],c[1],c[2]):d=null;return d},addPlotBand:function(a){this.addPlotBandOrLine(a,"plotBands")},addPlotLine:function(a){this.addPlotBandOrLine(a,
258
- "plotLines")},addPlotBandOrLine:function(a,b){var c=(new R.PlotLineOrBand(this,a)).render(),d=this.userOptions;c&&(b&&(d[b]=d[b]||[],d[b].push(a)),this.plotLinesAndBands.push(c));return c},removePlotBandOrLine:function(a){for(var b=this.plotLinesAndBands,c=this.options,d=this.userOptions,e=b.length;e--;)b[e].id===a&&b[e].destroy();p([c.plotLines||[],d.plotLines||[],c.plotBands||[],d.plotBands||[]],function(b){for(e=b.length;e--;)b[e].id===a&&ja(b,b[e])})}});la.prototype.getTimeTicks=function(a,b,
259
- c,d){var e=[],f={},g=E.global.useUTC,h,i=new Date(b-Ra),j=a.unitRange,k=a.count;if(r(b)){j>=A.second&&(i.setMilliseconds(0),i.setSeconds(j>=A.minute?0:k*T(i.getSeconds()/k)));if(j>=A.minute)i[Db](j>=A.hour?0:k*T(i[pb]()/k));if(j>=A.hour)i[Eb](j>=A.day?0:k*T(i[qb]()/k));if(j>=A.day)i[sb](j>=A.month?1:k*T(i[Xa]()/k));j>=A.month&&(i[Fb](j>=A.year?0:k*T(i[fb]()/k)),h=i[gb]());j>=A.year&&(h-=h%k,i[Gb](h));if(j===A.week)i[sb](i[Xa]()-i[rb]()+m(d,1));b=1;Ra&&(i=new Date(i.getTime()+Ra));h=i[gb]();for(var d=
260
- i.getTime(),l=i[fb](),o=i[Xa](),n=g?Ra:(864E5+i.getTimezoneOffset()*6E4)%864E5;d<c;)e.push(d),j===A.year?d=eb(h+b*k,0):j===A.month?d=eb(h,l+b*k):!g&&(j===A.day||j===A.week)?d=eb(h,l,o+b*k*(j===A.day?1:7)):d+=j*k,b++;e.push(d);p(vb(e,function(a){return j<=A.hour&&a%A.day===n}),function(a){f[a]="day"})}e.info=q(a,{higherRanks:f,totalRange:j*k});return e};la.prototype.normalizeTimeTickInterval=function(a,b){var c=b||[["millisecond",[1,2,5,10,20,25,50,100,200,500]],["second",[1,2,5,10,15,30]],["minute",
261
- [1,2,5,10,15,30]],["hour",[1,2,3,4,6,8,12]],["day",[1,2]],["week",[1,2]],["month",[1,2,3,4,6]],["year",null]],d=c[c.length-1],e=A[d[0]],f=d[1],g;for(g=0;g<c.length;g++)if(d=c[g],e=A[d[0]],f=d[1],c[g+1]&&a<=(e*f[f.length-1]+A[c[g+1][0]])/2)break;e===A.year&&a<5*e&&(f=[1,2,5]);c=nb(a/e,f,d[0]==="year"?v(mb(a/e),1):1);return{unitRange:e,count:c,unitName:d[0]}};la.prototype.getLogTickPositions=function(a,b,c,d){var e=this.options,f=this.len,g=[];if(!d)this._minorAutoInterval=null;if(a>=0.5)a=u(a),g=this.getLinearTickPositions(a,
262
- b,c);else if(a>=0.08)for(var f=T(b),h,i,j,k,l,e=a>0.3?[1,2,4]:a>0.15?[1,2,4,6,8]:[1,2,3,4,5,6,7,8,9];f<c+1&&!l;f++){i=e.length;for(h=0;h<i&&!l;h++)j=za(ia(f)*e[h]),j>b&&(!d||k<=c)&&g.push(k),k>c&&(l=!0),k=j}else if(b=ia(b),c=ia(c),a=e[d?"minorTickInterval":"tickInterval"],a=m(a==="auto"?null:a,this._minorAutoInterval,(c-b)*(e.tickPixelInterval/(d?5:1))/((d?f/this.tickPositions.length:f)||1)),a=nb(a,null,mb(a)),g=Ua(this.getLinearTickPositions(a,b,c),za),!d)this._minorAutoInterval=a/5;if(!d)this.tickInterval=
263
- a;return g};var Mb=R.Tooltip=function(){this.init.apply(this,arguments)};Mb.prototype={init:function(a,b){var c=b.borderWidth,d=b.style,e=z(d.padding);this.chart=a;this.options=b;this.crosshairs=[];this.now={x:0,y:0};this.isHidden=!0;this.label=a.renderer.label("",0,0,b.shape||"callout",null,null,b.useHTML,null,"tooltip").attr({padding:e,fill:b.backgroundColor,"stroke-width":c,r:b.borderRadius,zIndex:8}).css(d).css({padding:0}).add().attr({y:-9999});fa||this.label.shadow(b.shadow);this.shared=b.shared},
264
- destroy:function(){if(this.label)this.label=this.label.destroy();clearTimeout(this.hideTimer);clearTimeout(this.tooltipTimeout)},move:function(a,b,c,d){var e=this,f=e.now,g=e.options.animation!==!1&&!e.isHidden,h=e.followPointer||e.len>1;q(f,{x:g?(2*f.x+a)/3:a,y:g?(f.y+b)/2:b,anchorX:h?t:g?(2*f.anchorX+c)/3:c,anchorY:h?t:g?(f.anchorY+d)/2:d});e.label.attr(f);if(g&&(M(a-f.x)>1||M(b-f.y)>1))clearTimeout(this.tooltipTimeout),this.tooltipTimeout=setTimeout(function(){e&&e.move(a,b,c,d)},32)},hide:function(){var a=
265
- this,b;clearTimeout(this.hideTimer);if(!this.isHidden)b=this.chart.hoverPoints,this.hideTimer=setTimeout(function(){a.label.fadeOut();a.isHidden=!0},m(this.options.hideDelay,500)),b&&p(b,function(a){a.setState()}),this.chart.hoverPoints=null},getAnchor:function(a,b){var c,d=this.chart,e=d.inverted,f=d.plotTop,g=0,h=0,i,a=qa(a);c=a[0].tooltipPos;this.followPointer&&b&&(b.chartX===t&&(b=d.pointer.normalize(b)),c=[b.chartX-d.plotLeft,b.chartY-f]);c||(p(a,function(a){i=a.series.yAxis;g+=a.plotX;h+=(a.plotLow?
266
- (a.plotLow+a.plotHigh)/2:a.plotY)+(!e&&i?i.top-f:0)}),g/=a.length,h/=a.length,c=[e?d.plotWidth-h:g,this.shared&&!e&&a.length>1&&b?b.chartY-f:e?d.plotHeight-g:h]);return Ua(c,u)},getPosition:function(a,b,c){var d=this.chart,e=this.distance,f={},g,h=["y",d.chartHeight,b,c.plotY+d.plotTop],i=["x",d.chartWidth,a,c.plotX+d.plotLeft],j=c.ttBelow||d.inverted&&!c.negative||!d.inverted&&c.negative,k=function(a,b,c,d){var g=c<d-e,b=d+e+c<b,c=d-e-c;d+=e;if(j&&b)f[a]=d;else if(!j&&g)f[a]=c;else if(g)f[a]=c;else if(b)f[a]=
267
- d;else return!1},l=function(a,b,c,d){if(d<e||d>b-e)return!1;else f[a]=d<c/2?1:d>b-c/2?b-c-2:d-c/2},o=function(a){var b=h;h=i;i=b;g=a},n=function(){k.apply(0,h)!==!1?l.apply(0,i)===!1&&!g&&(o(!0),n()):g?f.x=f.y=0:(o(!0),n())};(d.inverted||this.len>1)&&o();n();return f},defaultFormatter:function(a){var b=this.points||qa(this),c=b[0].series,d;d=[a.tooltipHeaderFormatter(b[0])];p(b,function(a){c=a.series;d.push(c.tooltipFormatter&&c.tooltipFormatter(a)||a.point.tooltipFormatter(c.tooltipOptions.pointFormat))});
268
- d.push(a.options.footerFormat||"");return d.join("")},refresh:function(a,b){var c=this.chart,d=this.label,e=this.options,f,g,h={},i,j=[];i=e.formatter||this.defaultFormatter;var h=c.hoverPoints,k,l=this.shared;clearTimeout(this.hideTimer);this.followPointer=qa(a)[0].series.tooltipOptions.followPointer;g=this.getAnchor(a,b);f=g[0];g=g[1];l&&(!a.series||!a.series.noSharedTooltip)?(c.hoverPoints=a,h&&p(h,function(a){a.setState()}),p(a,function(a){a.setState("hover");j.push(a.getLabelConfig())}),h={x:a[0].category,
269
- y:a[0].y},h.points=j,this.len=j.length,a=a[0]):h=a.getLabelConfig();i=i.call(h,this);h=a.series;this.distance=m(h.tooltipOptions.distance,16);i===!1?this.hide():(this.isHidden&&(bb(d),d.attr("opacity",1).show()),d.attr({text:i}),k=e.borderColor||a.color||h.color||"#606060",d.attr({stroke:k}),this.updatePosition({plotX:f,plotY:g,negative:a.negative,ttBelow:a.ttBelow}),this.isHidden=!1);D(c,"tooltipRefresh",{text:i,x:f+c.plotLeft,y:g+c.plotTop,borderColor:k})},updatePosition:function(a){var b=this.chart,
270
- c=this.label,c=(this.options.positioner||this.getPosition).call(this,c.width,c.height,a);this.move(u(c.x),u(c.y),a.plotX+b.plotLeft,a.plotY+b.plotTop)},tooltipHeaderFormatter:function(a){var b=a.series,c=b.tooltipOptions,d=c.dateTimeLabelFormats,e=c.xDateFormat,f=b.xAxis,g=f&&f.options.type==="datetime"&&ha(a.key),c=c.headerFormat,f=f&&f.closestPointRange,h;if(g&&!e){if(f)for(h in A){if(A[h]>=f||A[h]<=A.day&&a.key%A[h]>0){e=d[h];break}}else e=d.day;e=e||d.year}g&&e&&(c=c.replace("{point.key}","{point.key:"+
271
- e+"}"));return Ia(c,{point:a,series:b})}};var oa;$a=y.documentElement.ontouchstart!==t;var Wa=R.Pointer=function(a,b){this.init(a,b)};Wa.prototype={init:function(a,b){var c=b.chart,d=c.events,e=fa?"":c.zoomType,c=a.inverted,f;this.options=b;this.chart=a;this.zoomX=f=/x/.test(e);this.zoomY=e=/y/.test(e);this.zoomHor=f&&!c||e&&c;this.zoomVert=e&&!c||f&&c;this.hasZoom=f||e;this.runChartClick=d&&!!d.click;this.pinchDown=[];this.lastValidTouch={};if(R.Tooltip&&b.tooltip.enabled)a.tooltip=new Mb(a,b.tooltip),
272
- this.followTouchMove=b.tooltip.followTouchMove;this.setDOMEvents()},normalize:function(a,b){var c,d,a=a||window.event,a=Sb(a);if(!a.target)a.target=a.srcElement;d=a.touches?a.touches.length?a.touches.item(0):a.changedTouches[0]:a;if(!b)this.chartPosition=b=Rb(this.chart.container);d.pageX===t?(c=v(a.x,a.clientX-b.left),d=a.y):(c=d.pageX-b.left,d=d.pageY-b.top);return q(a,{chartX:u(c),chartY:u(d)})},getCoordinates:function(a){var b={xAxis:[],yAxis:[]};p(this.chart.axes,function(c){b[c.isXAxis?"xAxis":
273
- "yAxis"].push({axis:c,value:c.toValue(a[c.horiz?"chartX":"chartY"])})});return b},getIndex:function(a){var b=this.chart;return b.inverted?b.plotHeight+b.plotTop-a.chartY:a.chartX-b.plotLeft},runPointActions:function(a){var b=this.chart,c=b.series,d=b.tooltip,e,f,g=b.hoverPoint,h=b.hoverSeries,i,j,k=b.chartWidth,l=this.getIndex(a);if(d&&this.options.tooltip.shared&&(!h||!h.noSharedTooltip)){f=[];i=c.length;for(j=0;j<i;j++)if(c[j].visible&&c[j].options.enableMouseTracking!==!1&&!c[j].noSharedTooltip&&
274
- c[j].singularTooltips!==!0&&c[j].tooltipPoints.length&&(e=c[j].tooltipPoints[l])&&e.series)e._dist=M(l-e.clientX),k=C(k,e._dist),f.push(e);for(i=f.length;i--;)f[i]._dist>k&&f.splice(i,1);if(f.length&&f[0].clientX!==this.hoverX)d.refresh(f,a),this.hoverX=f[0].clientX}c=h&&h.tooltipOptions.followPointer;if(h&&h.tracker&&!c){if((e=h.tooltipPoints[l])&&e!==g)e.onMouseOver(a)}else d&&c&&!d.isHidden&&(h=d.getAnchor([{}],a),d.updatePosition({plotX:h[0],plotY:h[1]}));if(d&&!this._onDocumentMouseMove)this._onDocumentMouseMove=
275
- function(a){if(V[oa])V[oa].pointer.onDocumentMouseMove(a)},K(y,"mousemove",this._onDocumentMouseMove);p(b.axes,function(b){b.drawCrosshair(a,m(e,g))})},reset:function(a){var b=this.chart,c=b.hoverSeries,d=b.hoverPoint,e=b.tooltip,f=e&&e.shared?b.hoverPoints:d;(a=a&&e&&f)&&qa(f)[0].plotX===t&&(a=!1);if(a)e.refresh(f),d&&d.setState(d.state,!0);else{if(d)d.onMouseOut();if(c)c.onMouseOut();e&&e.hide();if(this._onDocumentMouseMove)W(y,"mousemove",this._onDocumentMouseMove),this._onDocumentMouseMove=null;
276
- p(b.axes,function(a){a.hideCrosshair()});this.hoverX=null}},scaleGroups:function(a,b){var c=this.chart,d;p(c.series,function(e){d=a||e.getPlotBox();e.xAxis&&e.xAxis.zoomEnabled&&(e.group.attr(d),e.markerGroup&&(e.markerGroup.attr(d),e.markerGroup.clip(b?c.clipRect:null)),e.dataLabelsGroup&&e.dataLabelsGroup.attr(d))});c.clipRect.attr(b||c.clipBox)},dragStart:function(a){var b=this.chart;b.mouseIsDown=a.type;b.cancelClick=!1;b.mouseDownX=this.mouseDownX=a.chartX;b.mouseDownY=this.mouseDownY=a.chartY},
277
- drag:function(a){var b=this.chart,c=b.options.chart,d=a.chartX,e=a.chartY,f=this.zoomHor,g=this.zoomVert,h=b.plotLeft,i=b.plotTop,j=b.plotWidth,k=b.plotHeight,l,o=this.mouseDownX,n=this.mouseDownY;d<h?d=h:d>h+j&&(d=h+j);e<i?e=i:e>i+k&&(e=i+k);this.hasDragged=Math.sqrt(Math.pow(o-d,2)+Math.pow(n-e,2));if(this.hasDragged>10){l=b.isInsidePlot(o-h,n-i);if(b.hasCartesianSeries&&(this.zoomX||this.zoomY)&&l&&!this.selectionMarker)this.selectionMarker=b.renderer.rect(h,i,f?1:j,g?1:k,0).attr({fill:c.selectionMarkerFill||
278
- "rgba(69,114,167,0.25)",zIndex:7}).add();this.selectionMarker&&f&&(d-=o,this.selectionMarker.attr({width:M(d),x:(d>0?0:d)+o}));this.selectionMarker&&g&&(d=e-n,this.selectionMarker.attr({height:M(d),y:(d>0?0:d)+n}));l&&!this.selectionMarker&&c.panning&&b.pan(a,c.panning)}},drop:function(a){var b=this.chart,c=this.hasPinched;if(this.selectionMarker){var d={xAxis:[],yAxis:[],originalEvent:a.originalEvent||a},a=this.selectionMarker,e=a.attr?a.attr("x"):a.x,f=a.attr?a.attr("y"):a.y,g=a.attr?a.attr("width"):
279
- a.width,h=a.attr?a.attr("height"):a.height,i;if(this.hasDragged||c)p(b.axes,function(a){if(a.zoomEnabled){var b=a.horiz,c=a.toValue(b?e:f),b=a.toValue(b?e+g:f+h);!isNaN(c)&&!isNaN(b)&&(d[a.coll].push({axis:a,min:C(c,b),max:v(c,b)}),i=!0)}}),i&&D(b,"selection",d,function(a){b.zoom(q(a,c?{animation:!1}:null))});this.selectionMarker=this.selectionMarker.destroy();c&&this.scaleGroups()}if(b)G(b.container,{cursor:b._cursor}),b.cancelClick=this.hasDragged>10,b.mouseIsDown=this.hasDragged=this.hasPinched=
280
- !1,this.pinchDown=[]},onContainerMouseDown:function(a){a=this.normalize(a);a.preventDefault&&a.preventDefault();this.dragStart(a)},onDocumentMouseUp:function(a){V[oa]&&V[oa].pointer.drop(a)},onDocumentMouseMove:function(a){var b=this.chart,c=this.chartPosition,d=b.hoverSeries,a=this.normalize(a,c);c&&d&&!this.inClass(a.target,"highcharts-tracker")&&!b.isInsidePlot(a.chartX-b.plotLeft,a.chartY-b.plotTop)&&this.reset()},onContainerMouseLeave:function(){var a=V[oa];if(a)a.pointer.reset(),a.pointer.chartPosition=
281
- null},onContainerMouseMove:function(a){var b=this.chart;oa=b.index;a=this.normalize(a);b.mouseIsDown==="mousedown"&&this.drag(a);(this.inClass(a.target,"highcharts-tracker")||b.isInsidePlot(a.chartX-b.plotLeft,a.chartY-b.plotTop))&&!b.openMenu&&this.runPointActions(a)},inClass:function(a,b){for(var c;a;){if(c=H(a,"class"))if(c.indexOf(b)!==-1)return!0;else if(c.indexOf("highcharts-container")!==-1)return!1;a=a.parentNode}},onTrackerMouseOut:function(a){var b=this.chart.hoverSeries,c=(a=a.relatedTarget||
282
- a.toElement)&&a.point&&a.point.series;if(b&&!b.options.stickyTracking&&!this.inClass(a,"highcharts-tooltip")&&c!==b)b.onMouseOut()},onContainerClick:function(a){var b=this.chart,c=b.hoverPoint,d=b.plotLeft,e=b.plotTop,a=this.normalize(a);a.cancelBubble=!0;b.cancelClick||(c&&this.inClass(a.target,"highcharts-tracker")?(D(c.series,"click",q(a,{point:c})),b.hoverPoint&&c.firePointEvent("click",a)):(q(a,this.getCoordinates(a)),b.isInsidePlot(a.chartX-d,a.chartY-e)&&D(b,"click",a)))},setDOMEvents:function(){var a=
283
- this,b=a.chart.container;b.onmousedown=function(b){a.onContainerMouseDown(b)};b.onmousemove=function(b){a.onContainerMouseMove(b)};b.onclick=function(b){a.onContainerClick(b)};K(b,"mouseleave",a.onContainerMouseLeave);ab===1&&K(y,"mouseup",a.onDocumentMouseUp);if($a)b.ontouchstart=function(b){a.onContainerTouchStart(b)},b.ontouchmove=function(b){a.onContainerTouchMove(b)},ab===1&&K(y,"touchend",a.onDocumentTouchEnd)},destroy:function(){var a;W(this.chart.container,"mouseleave",this.onContainerMouseLeave);
284
- ab||(W(y,"mouseup",this.onDocumentMouseUp),W(y,"touchend",this.onDocumentTouchEnd));clearInterval(this.tooltipTimeout);for(a in this)this[a]=null}};q(R.Pointer.prototype,{pinchTranslate:function(a,b,c,d,e,f){(this.zoomHor||this.pinchHor)&&this.pinchTranslateDirection(!0,a,b,c,d,e,f);(this.zoomVert||this.pinchVert)&&this.pinchTranslateDirection(!1,a,b,c,d,e,f)},pinchTranslateDirection:function(a,b,c,d,e,f,g,h){var i=this.chart,j=a?"x":"y",k=a?"X":"Y",l="chart"+k,o=a?"width":"height",n=i["plot"+(a?
285
- "Left":"Top")],s,m,p=h||1,q=i.inverted,x=i.bounds[a?"h":"v"],r=b.length===1,v=b[0][l],u=c[0][l],t=!r&&b[1][l],w=!r&&c[1][l],y,c=function(){!r&&M(v-t)>20&&(p=h||M(u-w)/M(v-t));m=(n-u)/p+v;s=i["plot"+(a?"Width":"Height")]/p};c();b=m;b<x.min?(b=x.min,y=!0):b+s>x.max&&(b=x.max-s,y=!0);y?(u-=0.8*(u-g[j][0]),r||(w-=0.8*(w-g[j][1])),c()):g[j]=[u,w];q||(f[j]=m-n,f[o]=s);f=q?1/p:p;e[o]=s;e[j]=b;d[q?a?"scaleY":"scaleX":"scale"+k]=p;d["translate"+k]=f*n+(u-f*v)},pinch:function(a){var b=this,c=b.chart,d=b.pinchDown,
286
- e=b.followTouchMove,f=a.touches,g=f.length,h=b.lastValidTouch,i=b.hasZoom,j=b.selectionMarker,k={},l=g===1&&(b.inClass(a.target,"highcharts-tracker")&&c.runTrackerClick||c.runChartClick),o={};(i||e)&&!l&&a.preventDefault();Ua(f,function(a){return b.normalize(a)});if(a.type==="touchstart")p(f,function(a,b){d[b]={chartX:a.chartX,chartY:a.chartY}}),h.x=[d[0].chartX,d[1]&&d[1].chartX],h.y=[d[0].chartY,d[1]&&d[1].chartY],p(c.axes,function(a){if(a.zoomEnabled){var b=c.bounds[a.horiz?"h":"v"],d=a.minPixelPadding,
287
- e=a.toPixels(a.dataMin),f=a.toPixels(a.dataMax),g=C(e,f),e=v(e,f);b.min=C(a.pos,g-d);b.max=v(a.pos+a.len,e+d)}});else if(d.length){if(!j)b.selectionMarker=j=q({destroy:sa},c.plotBox);b.pinchTranslate(d,f,k,j,o,h);b.hasPinched=i;b.scaleGroups(k,o);!i&&e&&g===1&&this.runPointActions(b.normalize(a))}},onContainerTouchStart:function(a){var b=this.chart;oa=b.index;a.touches.length===1?(a=this.normalize(a),b.isInsidePlot(a.chartX-b.plotLeft,a.chartY-b.plotTop)?(this.runPointActions(a),this.pinch(a)):this.reset()):
288
- a.touches.length===2&&this.pinch(a)},onContainerTouchMove:function(a){(a.touches.length===1||a.touches.length===2)&&this.pinch(a)},onDocumentTouchEnd:function(a){V[oa]&&V[oa].pointer.drop(a)}});if(I.PointerEvent||I.MSPointerEvent){var ua={},zb=!!I.PointerEvent,Wb=function(){var a,b=[];b.item=function(a){return this[a]};for(a in ua)ua.hasOwnProperty(a)&&b.push({pageX:ua[a].pageX,pageY:ua[a].pageY,target:ua[a].target});return b},Ab=function(a,b,c,d){a=a.originalEvent||a;if((a.pointerType==="touch"||
289
- a.pointerType===a.MSPOINTER_TYPE_TOUCH)&&V[oa])d(a),d=V[oa].pointer,d[b]({type:c,target:a.currentTarget,preventDefault:sa,touches:Wb()})};q(Wa.prototype,{onContainerPointerDown:function(a){Ab(a,"onContainerTouchStart","touchstart",function(a){ua[a.pointerId]={pageX:a.pageX,pageY:a.pageY,target:a.currentTarget}})},onContainerPointerMove:function(a){Ab(a,"onContainerTouchMove","touchmove",function(a){ua[a.pointerId]={pageX:a.pageX,pageY:a.pageY};if(!ua[a.pointerId].target)ua[a.pointerId].target=a.currentTarget})},
290
- onDocumentPointerUp:function(a){Ab(a,"onContainerTouchEnd","touchend",function(a){delete ua[a.pointerId]})},batchMSEvents:function(a){a(this.chart.container,zb?"pointerdown":"MSPointerDown",this.onContainerPointerDown);a(this.chart.container,zb?"pointermove":"MSPointerMove",this.onContainerPointerMove);a(y,zb?"pointerup":"MSPointerUp",this.onDocumentPointerUp)}});Ma(Wa.prototype,"init",function(a,b,c){a.call(this,b,c);(this.hasZoom||this.followTouchMove)&&G(b.container,{"-ms-touch-action":Q,"touch-action":Q})});
291
- Ma(Wa.prototype,"setDOMEvents",function(a){a.apply(this);(this.hasZoom||this.followTouchMove)&&this.batchMSEvents(K)});Ma(Wa.prototype,"destroy",function(a){this.batchMSEvents(W);a.call(this)})}var lb=R.Legend=function(a,b){this.init(a,b)};lb.prototype={init:function(a,b){var c=this,d=b.itemStyle,e=m(b.padding,8),f=b.itemMarginTop||0;this.options=b;if(b.enabled)c.baseline=z(d.fontSize)+3+f,c.itemStyle=d,c.itemHiddenStyle=w(d,b.itemHiddenStyle),c.itemMarginTop=f,c.padding=e,c.initialItemX=e,c.initialItemY=
292
- e-5,c.maxItemWidth=0,c.chart=a,c.itemHeight=0,c.lastLineHeight=0,c.symbolWidth=m(b.symbolWidth,16),c.pages=[],c.render(),K(c.chart,"endResize",function(){c.positionCheckboxes()})},colorizeItem:function(a,b){var c=this.options,d=a.legendItem,e=a.legendLine,f=a.legendSymbol,g=this.itemHiddenStyle.color,c=b?c.itemStyle.color:g,h=b?a.legendColor||a.color||"#CCC":g,g=a.options&&a.options.marker,i={fill:h},j;d&&d.css({fill:c,color:c});e&&e.attr({stroke:h});if(f){if(g&&f.isMarker)for(j in i.stroke=h,g=a.convertAttribs(g),
293
- g)d=g[j],d!==t&&(i[j]=d);f.attr(i)}},positionItem:function(a){var b=this.options,c=b.symbolPadding,b=!b.rtl,d=a._legendItemPos,e=d[0],d=d[1],f=a.checkbox;a.legendGroup&&a.legendGroup.translate(b?e:this.legendWidth-e-2*c-4,d);if(f)f.x=e,f.y=d},destroyItem:function(a){var b=a.checkbox;p(["legendItem","legendLine","legendSymbol","legendGroup"],function(b){a[b]&&(a[b]=a[b].destroy())});b&&Pa(a.checkbox)},destroy:function(){var a=this.group,b=this.box;if(b)this.box=b.destroy();if(a)this.group=a.destroy()},
294
- positionCheckboxes:function(a){var b=this.group.alignAttr,c,d=this.clipHeight||this.legendHeight;if(b)c=b.translateY,p(this.allItems,function(e){var f=e.checkbox,g;f&&(g=c+f.y+(a||0)+3,G(f,{left:b.translateX+e.checkboxOffset+f.x-20+"px",top:g+"px",display:g>c-6&&g<c+d-6?"":Q}))})},renderTitle:function(){var a=this.padding,b=this.options.title,c=0;if(b.text){if(!this.title)this.title=this.chart.renderer.label(b.text,a-3,a-4,null,null,null,null,null,"legend-title").attr({zIndex:1}).css(b.style).add(this.group);
295
- a=this.title.getBBox();c=a.height;this.offsetWidth=a.width;this.contentGroup.attr({translateY:c})}this.titleHeight=c},renderItem:function(a){var b=this.chart,c=b.renderer,d=this.options,e=d.layout==="horizontal",f=this.symbolWidth,g=d.symbolPadding,h=this.itemStyle,i=this.itemHiddenStyle,j=this.padding,k=e?m(d.itemDistance,20):0,l=!d.rtl,o=d.width,n=d.itemMarginBottom||0,s=this.itemMarginTop,p=this.initialItemX,q=a.legendItem,r=a.series&&a.series.drawLegendSymbol?a.series:a,x=r.options,x=this.createCheckboxForItem&&
296
- x&&x.showCheckbox,t=d.useHTML;if(!q)a.legendGroup=c.g("legend-item").attr({zIndex:1}).add(this.scrollGroup),r.drawLegendSymbol(this,a),a.legendItem=q=c.text(d.labelFormat?Ia(d.labelFormat,a):d.labelFormatter.call(a),l?f+g:-g,this.baseline,t).css(w(a.visible?h:i)).attr({align:l?"left":"right",zIndex:2}).add(a.legendGroup),this.setItemEvents&&this.setItemEvents(a,q,t,h,i),this.colorizeItem(a,a.visible),x&&this.createCheckboxForItem(a);c=q.getBBox();f=a.checkboxOffset=d.itemWidth||a.legendItemWidth||
297
- f+g+c.width+k+(x?20:0);this.itemHeight=g=u(a.legendItemHeight||c.height);if(e&&this.itemX-p+f>(o||b.chartWidth-2*j-p-d.x))this.itemX=p,this.itemY+=s+this.lastLineHeight+n,this.lastLineHeight=0;this.maxItemWidth=v(this.maxItemWidth,f);this.lastItemY=s+this.itemY+n;this.lastLineHeight=v(g,this.lastLineHeight);a._legendItemPos=[this.itemX,this.itemY];e?this.itemX+=f:(this.itemY+=s+g+n,this.lastLineHeight=g);this.offsetWidth=o||v((e?this.itemX-p-k:f)+j,this.offsetWidth)},getAllItems:function(){var a=
298
- [];p(this.chart.series,function(b){var c=b.options;if(m(c.showInLegend,!r(c.linkedTo)?t:!1,!0))a=a.concat(b.legendItems||(c.legendType==="point"?b.data:b))});return a},render:function(){var a=this,b=a.chart,c=b.renderer,d=a.group,e,f,g,h,i=a.box,j=a.options,k=a.padding,l=j.borderWidth,o=j.backgroundColor;a.itemX=a.initialItemX;a.itemY=a.initialItemY;a.offsetWidth=0;a.lastItemY=0;if(!d)a.group=d=c.g("legend").attr({zIndex:7}).add(),a.contentGroup=c.g().attr({zIndex:1}).add(d),a.scrollGroup=c.g().add(a.contentGroup);
299
- a.renderTitle();e=a.getAllItems();ob(e,function(a,b){return(a.options&&a.options.legendIndex||0)-(b.options&&b.options.legendIndex||0)});j.reversed&&e.reverse();a.allItems=e;a.display=f=!!e.length;p(e,function(b){a.renderItem(b)});g=j.width||a.offsetWidth;h=a.lastItemY+a.lastLineHeight+a.titleHeight;h=a.handleOverflow(h);if(l||o){g+=k;h+=k;if(i){if(g>0&&h>0)i[i.isNew?"attr":"animate"](i.crisp({width:g,height:h})),i.isNew=!1}else a.box=i=c.rect(0,0,g,h,j.borderRadius,l||0).attr({stroke:j.borderColor,
300
- "stroke-width":l||0,fill:o||Q}).add(d).shadow(j.shadow),i.isNew=!0;i[f?"show":"hide"]()}a.legendWidth=g;a.legendHeight=h;p(e,function(b){a.positionItem(b)});f&&d.align(q({width:g,height:h},j),!0,"spacingBox");b.isResizing||this.positionCheckboxes()},handleOverflow:function(a){var b=this,c=this.chart,d=c.renderer,e=this.options,f=e.y,f=c.spacingBox.height+(e.verticalAlign==="top"?-f:f)-this.padding,g=e.maxHeight,h,i=this.clipRect,j=e.navigation,k=m(j.animation,!0),l=j.arrowSize||12,o=this.nav,n=this.pages,
301
- s,q=this.allItems;e.layout==="horizontal"&&(f/=2);g&&(f=C(f,g));n.length=0;if(a>f&&!e.useHTML){this.clipHeight=h=f-20-this.titleHeight-this.padding;this.currentPage=m(this.currentPage,1);this.fullHeight=a;p(q,function(a,b){var c=a._legendItemPos[1],d=u(a.legendItem.getBBox().height),e=n.length;if(!e||c-n[e-1]>h&&(s||c)!==n[e-1])n.push(s||c),e++;b===q.length-1&&c+d-n[e-1]>h&&n.push(c);c!==s&&(s=c)});if(!i)i=b.clipRect=d.clipRect(0,this.padding,9999,0),b.contentGroup.clip(i);i.attr({height:h});if(!o)this.nav=
302
- o=d.g().attr({zIndex:1}).add(this.group),this.up=d.symbol("triangle",0,0,l,l).on("click",function(){b.scroll(-1,k)}).add(o),this.pager=d.text("",15,10).css(j.style).add(o),this.down=d.symbol("triangle-down",0,0,l,l).on("click",function(){b.scroll(1,k)}).add(o);b.scroll(0);a=f}else if(o)i.attr({height:c.chartHeight}),o.hide(),this.scrollGroup.attr({translateY:1}),this.clipHeight=0;return a},scroll:function(a,b){var c=this.pages,d=c.length,e=this.currentPage+a,f=this.clipHeight,g=this.options.navigation,
303
- h=g.activeColor,g=g.inactiveColor,i=this.pager,j=this.padding;e>d&&(e=d);if(e>0)b!==t&&Qa(b,this.chart),this.nav.attr({translateX:j,translateY:f+this.padding+7+this.titleHeight,visibility:"visible"}),this.up.attr({fill:e===1?g:h}).css({cursor:e===1?"default":"pointer"}),i.attr({text:e+"/"+d}),this.down.attr({x:18+this.pager.getBBox().width,fill:e===d?g:h}).css({cursor:e===d?"default":"pointer"}),c=-c[e-1]+this.initialItemY,this.scrollGroup.animate({translateY:c}),this.currentPage=e,this.positionCheckboxes(c)}};
304
- N=R.LegendSymbolMixin={drawRectangle:function(a,b){var c=a.options.symbolHeight||12;b.legendSymbol=this.chart.renderer.rect(0,a.baseline-5-c/2,a.symbolWidth,c,a.options.symbolRadius||0).attr({zIndex:3}).add(b.legendGroup)},drawLineMarker:function(a){var b=this.options,c=b.marker,d;d=a.symbolWidth;var e=this.chart.renderer,f=this.legendGroup,a=a.baseline-u(e.fontMetrics(a.options.itemStyle.fontSize).b*0.3),g;if(b.lineWidth){g={"stroke-width":b.lineWidth};if(b.dashStyle)g.dashstyle=b.dashStyle;this.legendLine=
305
- e.path(["M",0,a,"L",d,a]).attr(g).add(f)}if(c&&c.enabled!==!1)b=c.radius,this.legendSymbol=d=e.symbol(this.symbol,d/2-b,a-b,2*b,2*b).add(f),d.isMarker=!0}};(/Trident\/7\.0/.test(wa)||Ta)&&Ma(lb.prototype,"positionItem",function(a,b){var c=this,d=function(){b._legendItemPos&&a.call(c,b)};d();setTimeout(d)});Ya.prototype={init:function(a,b){var c,d=a.series;a.series=null;c=w(E,a);c.series=a.series=d;this.userOptions=a;d=c.chart;this.margin=this.splashArray("margin",d);this.spacing=this.splashArray("spacing",
306
- d);var e=d.events;this.bounds={h:{},v:{}};this.callback=b;this.isResizing=0;this.options=c;this.axes=[];this.series=[];this.hasCartesianSeries=d.showAxes;var f=this,g;f.index=V.length;V.push(f);ab++;d.reflow!==!1&&K(f,"load",function(){f.initReflow()});if(e)for(g in e)K(f,g,e[g]);f.xAxis=[];f.yAxis=[];f.animation=fa?!1:m(d.animation,!0);f.pointCount=0;f.counters=new Bb;f.firstRender()},initSeries:function(a){var b=this.options.chart;(b=F[a.type||b.type||b.defaultSeriesType])||ra(17,!0);b=new b;b.init(this,
307
- a);return b},isInsidePlot:function(a,b,c){var d=c?b:a,a=c?a:b;return d>=0&&d<=this.plotWidth&&a>=0&&a<=this.plotHeight},adjustTickAmounts:function(){this.options.chart.alignTicks!==!1&&p(this.axes,function(a){a.adjustTickAmount()});this.maxTicks=null},redraw:function(a){var b=this.axes,c=this.series,d=this.pointer,e=this.legend,f=this.isDirtyLegend,g,h,i=this.isDirtyBox,j=c.length,k=j,l=this.renderer,o=l.isHidden(),n=[];Qa(a,this);o&&this.cloneRenderTo();for(this.layOutTitles();k--;)if(a=c[k],a.options.stacking&&
308
- (g=!0,a.isDirty)){h=!0;break}if(h)for(k=j;k--;)if(a=c[k],a.options.stacking)a.isDirty=!0;p(c,function(a){a.isDirty&&a.options.legendType==="point"&&(f=!0)});if(f&&e.options.enabled)e.render(),this.isDirtyLegend=!1;g&&this.getStacks();if(this.hasCartesianSeries){if(!this.isResizing)this.maxTicks=null,p(b,function(a){a.setScale()});this.adjustTickAmounts();this.getMargins();p(b,function(a){a.isDirty&&(i=!0)});p(b,function(a){if(a.isDirtyExtremes)a.isDirtyExtremes=!1,n.push(function(){D(a,"afterSetExtremes",
309
- q(a.eventArgs,a.getExtremes()));delete a.eventArgs});(i||g)&&a.redraw()})}i&&this.drawChartBox();p(c,function(a){a.isDirty&&a.visible&&(!a.isCartesian||a.xAxis)&&a.redraw()});d&&d.reset(!0);l.draw();D(this,"redraw");o&&this.cloneRenderTo(!0);p(n,function(a){a.call()})},get:function(a){var b=this.axes,c=this.series,d,e;for(d=0;d<b.length;d++)if(b[d].options.id===a)return b[d];for(d=0;d<c.length;d++)if(c[d].options.id===a)return c[d];for(d=0;d<c.length;d++){e=c[d].points||[];for(b=0;b<e.length;b++)if(e[b].id===
310
- a)return e[b]}return null},getAxes:function(){var a=this,b=this.options,c=b.xAxis=qa(b.xAxis||{}),b=b.yAxis=qa(b.yAxis||{});p(c,function(a,b){a.index=b;a.isX=!0});p(b,function(a,b){a.index=b});c=c.concat(b);p(c,function(b){new la(a,b)});a.adjustTickAmounts()},getSelectedPoints:function(){var a=[];p(this.series,function(b){a=a.concat(vb(b.points||[],function(a){return a.selected}))});return a},getSelectedSeries:function(){return vb(this.series,function(a){return a.selected})},getStacks:function(){var a=
311
- this;p(a.yAxis,function(a){if(a.stacks&&a.hasVisibleSeries)a.oldStacks=a.stacks});p(a.series,function(b){if(b.options.stacking&&(b.visible===!0||a.options.chart.ignoreHiddenSeries===!1))b.stackKey=b.type+m(b.options.stack,"")})},setTitle:function(a,b,c){var g;var d=this,e=d.options,f;f=e.title=w(e.title,a);g=e.subtitle=w(e.subtitle,b),e=g;p([["title",a,f],["subtitle",b,e]],function(a){var b=a[0],c=d[b],e=a[1],a=a[2];c&&e&&(d[b]=c=c.destroy());a&&a.text&&!c&&(d[b]=d.renderer.text(a.text,0,0,a.useHTML).attr({align:a.align,
312
- "class":"highcharts-"+b,zIndex:a.zIndex||4}).css(a.style).add())});d.layOutTitles(c)},layOutTitles:function(a){var b=0,c=this.title,d=this.subtitle,e=this.options,f=e.title,e=e.subtitle,g=this.spacingBox.width-44;if(c&&(c.css({width:(f.width||g)+"px"}).align(q({y:15},f),!1,"spacingBox"),!f.floating&&!f.verticalAlign))b=c.getBBox().height;d&&(d.css({width:(e.width||g)+"px"}).align(q({y:b+f.margin},e),!1,"spacingBox"),!e.floating&&!e.verticalAlign&&(b=Ka(b+d.getBBox().height)));c=this.titleOffset!==
313
- b;this.titleOffset=b;if(!this.isDirtyBox&&c)this.isDirtyBox=c,this.hasRendered&&m(a,!0)&&this.isDirtyBox&&this.redraw()},getChartSize:function(){var a=this.options.chart,b=a.width,a=a.height,c=this.renderToClone||this.renderTo;if(!r(b))this.containerWidth=jb(c,"width");if(!r(a))this.containerHeight=jb(c,"height");this.chartWidth=v(0,b||this.containerWidth||600);this.chartHeight=v(0,m(a,this.containerHeight>19?this.containerHeight:400))},cloneRenderTo:function(a){var b=this.renderToClone,c=this.container;
314
- a?b&&(this.renderTo.appendChild(c),Pa(b),delete this.renderToClone):(c&&c.parentNode===this.renderTo&&this.renderTo.removeChild(c),this.renderToClone=b=this.renderTo.cloneNode(0),G(b,{position:"absolute",top:"-9999px",display:"block"}),b.style.setProperty&&b.style.setProperty("display","block","important"),y.body.appendChild(b),c&&b.appendChild(c))},getContainer:function(){var a,b=this.options.chart,c,d,e;this.renderTo=a=b.renderTo;e="highcharts-"+tb++;if(Fa(a))this.renderTo=a=y.getElementById(a);
315
- a||ra(13,!0);c=z(H(a,"data-highcharts-chart"));!isNaN(c)&&V[c]&&V[c].hasRendered&&V[c].destroy();H(a,"data-highcharts-chart",this.index);a.innerHTML="";!b.skipClone&&!a.offsetWidth&&this.cloneRenderTo();this.getChartSize();c=this.chartWidth;d=this.chartHeight;this.container=a=Y(Ja,{className:"highcharts-container"+(b.className?" "+b.className:""),id:e},q({position:"relative",overflow:"hidden",width:c+"px",height:d+"px",textAlign:"left",lineHeight:"normal",zIndex:0,"-webkit-tap-highlight-color":"rgba(0,0,0,0)"},
316
- b.style),this.renderToClone||a);this._cursor=a.style.cursor;this.renderer=b.forExport?new ta(a,c,d,b.style,!0):new Za(a,c,d,b.style);fa&&this.renderer.create(this,a,c,d)},getMargins:function(){var a=this.spacing,b,c=this.legend,d=this.margin,e=this.options.legend,f=m(e.margin,20),g=e.x,h=e.y,i=e.align,j=e.verticalAlign,k=this.titleOffset;this.resetMargins();b=this.axisOffset;if(k&&!r(d[0]))this.plotTop=v(this.plotTop,k+this.options.title.margin+a[0]);if(c.display&&!e.floating)if(i==="right"){if(!r(d[1]))this.marginRight=
317
- v(this.marginRight,c.legendWidth-g+f+a[1])}else if(i==="left"){if(!r(d[3]))this.plotLeft=v(this.plotLeft,c.legendWidth+g+f+a[3])}else if(j==="top"){if(!r(d[0]))this.plotTop=v(this.plotTop,c.legendHeight+h+f+a[0])}else if(j==="bottom"&&!r(d[2]))this.marginBottom=v(this.marginBottom,c.legendHeight-h+f+a[2]);this.extraBottomMargin&&(this.marginBottom+=this.extraBottomMargin);this.extraTopMargin&&(this.plotTop+=this.extraTopMargin);this.hasCartesianSeries&&p(this.axes,function(a){a.getOffset()});r(d[3])||
318
- (this.plotLeft+=b[3]);r(d[0])||(this.plotTop+=b[0]);r(d[2])||(this.marginBottom+=b[2]);r(d[1])||(this.marginRight+=b[1]);this.setChartSize()},reflow:function(a){var b=this,c=b.options.chart,d=b.renderTo,e=c.width||jb(d,"width"),f=c.height||jb(d,"height"),c=a?a.target:I,d=function(){if(b.container)b.setSize(e,f,!1),b.hasUserSize=null};if(!b.hasUserSize&&e&&f&&(c===I||c===y)){if(e!==b.containerWidth||f!==b.containerHeight)clearTimeout(b.reflowTimeout),a?b.reflowTimeout=setTimeout(d,100):d();b.containerWidth=
319
- e;b.containerHeight=f}},initReflow:function(){var a=this,b=function(b){a.reflow(b)};K(I,"resize",b);K(a,"destroy",function(){W(I,"resize",b)})},setSize:function(a,b,c){var d=this,e,f,g;d.isResizing+=1;g=function(){d&&D(d,"endResize",null,function(){d.isResizing-=1})};Qa(c,d);d.oldChartHeight=d.chartHeight;d.oldChartWidth=d.chartWidth;if(r(a))d.chartWidth=e=v(0,u(a)),d.hasUserSize=!!e;if(r(b))d.chartHeight=f=v(0,u(b));(va?kb:G)(d.container,{width:e+"px",height:f+"px"},va);d.setChartSize(!0);d.renderer.setSize(e,
320
- f,c);d.maxTicks=null;p(d.axes,function(a){a.isDirty=!0;a.setScale()});p(d.series,function(a){a.isDirty=!0});d.isDirtyLegend=!0;d.isDirtyBox=!0;d.layOutTitles();d.getMargins();d.redraw(c);d.oldChartHeight=null;D(d,"resize");va===!1?g():setTimeout(g,va&&va.duration||500)},setChartSize:function(a){var b=this.inverted,c=this.renderer,d=this.chartWidth,e=this.chartHeight,f=this.options.chart,g=this.spacing,h=this.clipOffset,i,j,k,l;this.plotLeft=i=u(this.plotLeft);this.plotTop=j=u(this.plotTop);this.plotWidth=
321
- k=v(0,u(d-i-this.marginRight));this.plotHeight=l=v(0,u(e-j-this.marginBottom));this.plotSizeX=b?l:k;this.plotSizeY=b?k:l;this.plotBorderWidth=f.plotBorderWidth||0;this.spacingBox=c.spacingBox={x:g[3],y:g[0],width:d-g[3]-g[1],height:e-g[0]-g[2]};this.plotBox=c.plotBox={x:i,y:j,width:k,height:l};d=2*T(this.plotBorderWidth/2);b=Ka(v(d,h[3])/2);c=Ka(v(d,h[0])/2);this.clipBox={x:b,y:c,width:T(this.plotSizeX-v(d,h[1])/2-b),height:T(this.plotSizeY-v(d,h[2])/2-c)};a||p(this.axes,function(a){a.setAxisSize();
322
- a.setAxisTranslation()})},resetMargins:function(){var a=this.spacing,b=this.margin;this.plotTop=m(b[0],a[0]);this.marginRight=m(b[1],a[1]);this.marginBottom=m(b[2],a[2]);this.plotLeft=m(b[3],a[3]);this.axisOffset=[0,0,0,0];this.clipOffset=[0,0,0,0]},drawChartBox:function(){var a=this.options.chart,b=this.renderer,c=this.chartWidth,d=this.chartHeight,e=this.chartBackground,f=this.plotBackground,g=this.plotBorder,h=this.plotBGImage,i=a.borderWidth||0,j=a.backgroundColor,k=a.plotBackgroundColor,l=a.plotBackgroundImage,
323
- o=a.plotBorderWidth||0,n,s=this.plotLeft,m=this.plotTop,p=this.plotWidth,q=this.plotHeight,r=this.plotBox,v=this.clipRect,u=this.clipBox;n=i+(a.shadow?8:0);if(i||j)if(e)e.animate(e.crisp({width:c-n,height:d-n}));else{e={fill:j||Q};if(i)e.stroke=a.borderColor,e["stroke-width"]=i;this.chartBackground=b.rect(n/2,n/2,c-n,d-n,a.borderRadius,i).attr(e).addClass("highcharts-background").add().shadow(a.shadow)}if(k)f?f.animate(r):this.plotBackground=b.rect(s,m,p,q,0).attr({fill:k}).add().shadow(a.plotShadow);
324
- if(l)h?h.animate(r):this.plotBGImage=b.image(l,s,m,p,q).add();v?v.animate({width:u.width,height:u.height}):this.clipRect=b.clipRect(u);if(o)g?g.animate(g.crisp({x:s,y:m,width:p,height:q})):this.plotBorder=b.rect(s,m,p,q,0,-o).attr({stroke:a.plotBorderColor,"stroke-width":o,fill:Q,zIndex:1}).add();this.isDirtyBox=!1},propFromSeries:function(){var a=this,b=a.options.chart,c,d=a.options.series,e,f;p(["inverted","angular","polar"],function(g){c=F[b.type||b.defaultSeriesType];f=a[g]||b[g]||c&&c.prototype[g];
325
- for(e=d&&d.length;!f&&e--;)(c=F[d[e].type])&&c.prototype[g]&&(f=!0);a[g]=f})},linkSeries:function(){var a=this,b=a.series;p(b,function(a){a.linkedSeries.length=0});p(b,function(b){var d=b.options.linkedTo;if(Fa(d)&&(d=d===":previous"?a.series[b.index-1]:a.get(d)))d.linkedSeries.push(b),b.linkedParent=d})},renderSeries:function(){p(this.series,function(a){a.translate();a.setTooltipPoints&&a.setTooltipPoints();a.render()})},render:function(){var a=this,b=a.axes,c=a.renderer,d=a.options,e=d.labels,f=
326
- d.credits,g;a.setTitle();a.legend=new lb(a,d.legend);a.getStacks();p(b,function(a){a.setScale()});a.getMargins();a.maxTicks=null;p(b,function(a){a.setTickPositions(!0);a.setMaxTicks()});a.adjustTickAmounts();a.getMargins();a.drawChartBox();a.hasCartesianSeries&&p(b,function(a){a.render()});if(!a.seriesGroup)a.seriesGroup=c.g("series-group").attr({zIndex:3}).add();a.renderSeries();e.items&&p(e.items,function(b){var d=q(e.style,b.style),f=z(d.left)+a.plotLeft,g=z(d.top)+a.plotTop+12;delete d.left;delete d.top;
327
- c.text(b.html,f,g).attr({zIndex:2}).css(d).add()});if(f.enabled&&!a.credits)g=f.href,a.credits=c.text(f.text,0,0).on("click",function(){if(g)location.href=g}).attr({align:f.position.align,zIndex:8}).css(f.style).add().align(f.position);a.hasRendered=!0},destroy:function(){var a=this,b=a.axes,c=a.series,d=a.container,e,f=d&&d.parentNode;D(a,"destroy");V[a.index]=t;ab--;a.renderTo.removeAttribute("data-highcharts-chart");W(a);for(e=b.length;e--;)b[e]=b[e].destroy();for(e=c.length;e--;)c[e]=c[e].destroy();
328
- p("title,subtitle,chartBackground,plotBackground,plotBGImage,plotBorder,seriesGroup,clipRect,credits,pointer,scroller,rangeSelector,legend,resetZoomButton,tooltip,renderer".split(","),function(b){var c=a[b];c&&c.destroy&&(a[b]=c.destroy())});if(d)d.innerHTML="",W(d),f&&Pa(d);for(e in a)delete a[e]},isReadyToRender:function(){var a=this;return!aa&&I==I.top&&y.readyState!=="complete"||fa&&!I.canvg?(fa?Lb.push(function(){a.firstRender()},a.options.global.canvasToolsURL):y.attachEvent("onreadystatechange",
329
- function(){y.detachEvent("onreadystatechange",a.firstRender);y.readyState==="complete"&&a.firstRender()}),!1):!0},firstRender:function(){var a=this,b=a.options,c=a.callback;if(a.isReadyToRender()){a.getContainer();D(a,"init");a.resetMargins();a.setChartSize();a.propFromSeries();a.getAxes();p(b.series||[],function(b){a.initSeries(b)});a.linkSeries();D(a,"beforeRender");if(R.Pointer)a.pointer=new Wa(a,b);a.render();a.renderer.draw();c&&c.apply(a,[a]);p(a.callbacks,function(b){b.apply(a,[a])});a.cloneRenderTo(!0);
330
- D(a,"load")}},splashArray:function(a,b){var c=b[a],c=ca(c)?c:[c,c,c,c];return[m(b[a+"Top"],c[0]),m(b[a+"Right"],c[1]),m(b[a+"Bottom"],c[2]),m(b[a+"Left"],c[3])]}};Ya.prototype.callbacks=[];X=R.CenteredSeriesMixin={getCenter:function(){var a=this.options,b=this.chart,c=2*(a.slicedOffset||0),d,e=b.plotWidth-2*c,f=b.plotHeight-2*c,b=a.center,a=[m(b[0],"50%"),m(b[1],"50%"),a.size||"100%",a.innerSize||0],g=C(e,f),h;return Ua(a,function(a,b){h=/%$/.test(a);d=b<2||b===2&&h;return(h?[e,f,g,g][b]*z(a)/100:
331
- a)+(d?c:0)})}};var Ea=function(){};Ea.prototype={init:function(a,b,c){this.series=a;this.applyOptions(b,c);this.pointAttr={};if(a.options.colorByPoint&&(b=a.options.colors||a.chart.options.colors,this.color=this.color||b[a.colorCounter++],a.colorCounter===b.length))a.colorCounter=0;a.chart.pointCount++;return this},applyOptions:function(a,b){var c=this.series,d=c.pointValKey,a=Ea.prototype.optionsToObject.call(this,a);q(this,a);this.options=this.options?q(this.options,a):a;if(d)this.y=this[d];if(this.x===
332
- t&&c)this.x=b===t?c.autoIncrement():b;return this},optionsToObject:function(a){var b={},c=this.series,d=c.pointArrayMap||["y"],e=d.length,f=0,g=0;if(typeof a==="number"||a===null)b[d[0]]=a;else if(La(a)){if(a.length>e){c=typeof a[0];if(c==="string")b.name=a[0];else if(c==="number")b.x=a[0];f++}for(;g<e;)b[d[g++]]=a[f++]}else if(typeof a==="object"){b=a;if(a.dataLabels)c._hasPointLabels=!0;if(a.marker)c._hasPointMarkers=!0}return b},destroy:function(){var a=this.series.chart,b=a.hoverPoints,c;a.pointCount--;
333
- if(b&&(this.setState(),ja(b,this),!b.length))a.hoverPoints=null;if(this===a.hoverPoint)this.onMouseOut();if(this.graphic||this.dataLabel)W(this),this.destroyElements();this.legendItem&&a.legend.destroyItem(this);for(c in this)this[c]=null},destroyElements:function(){for(var a="graphic,dataLabel,dataLabelUpper,group,connector,shadowGroup".split(","),b,c=6;c--;)b=a[c],this[b]&&(this[b]=this[b].destroy())},getLabelConfig:function(){return{x:this.category,y:this.y,key:this.name||this.category,series:this.series,
334
- point:this,percentage:this.percentage,total:this.total||this.stackTotal}},tooltipFormatter:function(a){var b=this.series,c=b.tooltipOptions,d=m(c.valueDecimals,""),e=c.valuePrefix||"",f=c.valueSuffix||"";p(b.pointArrayMap||["y"],function(b){b="{point."+b;if(e||f)a=a.replace(b+"}",e+b+"}"+f);a=a.replace(b+"}",b+":,."+d+"f}")});return Ia(a,{point:this,series:this.series})},firePointEvent:function(a,b,c){var d=this,e=this.series.options;(e.point.events[a]||d.options&&d.options.events&&d.options.events[a])&&
335
- this.importEvents();a==="click"&&e.allowPointSelect&&(c=function(a){d.select(null,a.ctrlKey||a.metaKey||a.shiftKey)});D(this,a,b,c)}};var O=function(){};O.prototype={isCartesian:!0,type:"line",pointClass:Ea,sorted:!0,requireSorting:!0,pointAttrToOptions:{stroke:"lineColor","stroke-width":"lineWidth",fill:"fillColor",r:"radius"},axisTypes:["xAxis","yAxis"],colorCounter:0,parallelArrays:["x","y"],init:function(a,b){var c=this,d,e,f=a.series,g=function(a,b){return m(a.options.index,a._i)-m(b.options.index,
336
- b._i)};c.chart=a;c.options=b=c.setOptions(b);c.linkedSeries=[];c.bindAxes();q(c,{name:b.name,state:"",pointAttr:{},visible:b.visible!==!1,selected:b.selected===!0});if(fa)b.animation=!1;e=b.events;for(d in e)K(c,d,e[d]);if(e&&e.click||b.point&&b.point.events&&b.point.events.click||b.allowPointSelect)a.runTrackerClick=!0;c.getColor();c.getSymbol();p(c.parallelArrays,function(a){c[a+"Data"]=[]});c.setData(b.data,!1);if(c.isCartesian)a.hasCartesianSeries=!0;f.push(c);c._i=f.length-1;ob(f,g);this.yAxis&&
337
- ob(this.yAxis.series,g);p(f,function(a,b){a.index=b;a.name=a.name||"Series "+(b+1)})},bindAxes:function(){var a=this,b=a.options,c=a.chart,d;p(a.axisTypes||[],function(e){p(c[e],function(c){d=c.options;if(b[e]===d.index||b[e]!==t&&b[e]===d.id||b[e]===t&&d.index===0)c.series.push(a),a[e]=c,c.isDirty=!0});!a[e]&&a.optionalAxis!==e&&ra(18,!0)})},updateParallelArrays:function(a,b){var c=a.series,d=arguments;p(c.parallelArrays,typeof b==="number"?function(d){var f=d==="y"&&c.toYData?c.toYData(a):a[d];
338
- c[d+"Data"][b]=f}:function(a){Array.prototype[b].apply(c[a+"Data"],Array.prototype.slice.call(d,2))})},autoIncrement:function(){var a=this.options,b=this.xIncrement,b=m(b,a.pointStart,0);this.pointInterval=m(this.pointInterval,a.pointInterval,1);this.xIncrement=b+this.pointInterval;return b},getSegments:function(){var a=-1,b=[],c,d=this.points,e=d.length;if(e)if(this.options.connectNulls){for(c=e;c--;)d[c].y===null&&d.splice(c,1);d.length&&(b=[d])}else p(d,function(c,g){c.y===null?(g>a+1&&b.push(d.slice(a+
339
- 1,g)),a=g):g===e-1&&b.push(d.slice(a+1,g+1))});this.segments=b},setOptions:function(a){var b=this.chart,c=b.options.plotOptions,b=b.userOptions||{},d=b.plotOptions||{},e=c[this.type];this.userOptions=a;c=w(e,c.series,a);this.tooltipOptions=w(E.tooltip,E.plotOptions[this.type].tooltip,b.tooltip,d.series&&d.series.tooltip,d[this.type]&&d[this.type].tooltip,a.tooltip);e.marker===null&&delete c.marker;return c},getColor:function(){var a=this.options,b=this.userOptions,c=this.chart.options.colors,d=this.chart.counters,
340
- e;e=a.color||ba[this.type].color;if(!e&&!a.colorByPoint)r(b._colorIndex)?a=b._colorIndex:(b._colorIndex=d.color,a=d.color++),e=c[a];this.color=e;d.wrapColor(c.length)},getSymbol:function(){var a=this.userOptions,b=this.options.marker,c=this.chart,d=c.options.symbols,c=c.counters;this.symbol=b.symbol;if(!this.symbol)r(a._symbolIndex)?a=a._symbolIndex:(a._symbolIndex=c.symbol,a=c.symbol++),this.symbol=d[a];if(/^url/.test(this.symbol))b.radius=0;c.wrapSymbol(d.length)},drawLegendSymbol:N.drawLineMarker,
341
- setData:function(a,b,c,d){var e=this,f=e.points,g=f&&f.length||0,h,i=e.options,j=e.chart,k=null,l=e.xAxis,o=l&&!!l.categories,n=e.tooltipPoints,s=i.turboThreshold,q=this.xData,r=this.yData,v=(h=e.pointArrayMap)&&h.length,a=a||[];h=a.length;b=m(b,!0);if(d!==!1&&h&&g===h&&!e.cropped&&!e.hasGroupedData)p(a,function(a,b){f[b].update(a,!1)});else{e.xIncrement=null;e.pointRange=o?1:i.pointRange;e.colorCounter=0;p(this.parallelArrays,function(a){e[a+"Data"].length=0});if(s&&h>s){for(c=0;k===null&&c<h;)k=
342
- a[c],c++;if(ha(k)){o=m(i.pointStart,0);i=m(i.pointInterval,1);for(c=0;c<h;c++)q[c]=o,r[c]=a[c],o+=i;e.xIncrement=o}else if(La(k))if(v)for(c=0;c<h;c++)i=a[c],q[c]=i[0],r[c]=i.slice(1,v+1);else for(c=0;c<h;c++)i=a[c],q[c]=i[0],r[c]=i[1];else ra(12)}else for(c=0;c<h;c++)if(a[c]!==t&&(i={series:e},e.pointClass.prototype.applyOptions.apply(i,[a[c]]),e.updateParallelArrays(i,c),o&&i.name))l.names[i.x]=i.name;Fa(r[0])&&ra(14,!0);e.data=[];e.options.data=a;for(c=g;c--;)f[c]&&f[c].destroy&&f[c].destroy();
343
- if(n)n.length=0;if(l)l.minRange=l.userMinRange;e.isDirty=e.isDirtyData=j.isDirtyBox=!0;c=!1}b&&j.redraw(c)},processData:function(a){var b=this.xData,c=this.yData,d=b.length,e;e=0;var f,g,h=this.xAxis,i=this.options,j=i.cropThreshold,k=0,l=this.isCartesian,o,n;if(l&&!this.isDirty&&!h.isDirty&&!this.yAxis.isDirty&&!a)return!1;if(l&&this.sorted&&(!j||d>j||this.forceCrop))if(o=h.min,n=h.max,b[d-1]<o||b[0]>n)b=[],c=[];else if(b[0]<o||b[d-1]>n)e=this.cropData(this.xData,this.yData,o,n),b=e.xData,c=e.yData,
344
- e=e.start,f=!0,k=b.length;for(d=b.length-1;d>=0;d--)a=b[d]-b[d-1],!f&&b[d]>o&&b[d]<n&&k++,a>0&&(g===t||a<g)?g=a:a<0&&this.requireSorting&&ra(15);this.cropped=f;this.cropStart=e;this.processedXData=b;this.processedYData=c;this.activePointCount=k;if(i.pointRange===null)this.pointRange=g||1;this.closestPointRange=g},cropData:function(a,b,c,d){var e=a.length,f=0,g=e,h=m(this.cropShoulder,1),i;for(i=0;i<e;i++)if(a[i]>=c){f=v(0,i-h);break}for(;i<e;i++)if(a[i]>d){g=i+h;break}return{xData:a.slice(f,g),yData:b.slice(f,
345
- g),start:f,end:g}},generatePoints:function(){var a=this.options.data,b=this.data,c,d=this.processedXData,e=this.processedYData,f=this.pointClass,g=d.length,h=this.cropStart||0,i,j=this.hasGroupedData,k,l=[],o;if(!b&&!j)b=[],b.length=a.length,b=this.data=b;for(o=0;o<g;o++)i=h+o,j?l[o]=(new f).init(this,[d[o]].concat(qa(e[o]))):(b[i]?k=b[i]:a[i]!==t&&(b[i]=k=(new f).init(this,a[i],d[o])),l[o]=k);if(b&&(g!==(c=b.length)||j))for(o=0;o<c;o++)if(o===h&&!j&&(o+=g),b[o])b[o].destroyElements(),b[o].plotX=
346
- t;this.data=b;this.points=l},getExtremes:function(a){var b=this.yAxis,c=this.processedXData,d,e=[],f=0;d=this.xAxis.getExtremes();var g=d.min,h=d.max,i,j,k,l,a=a||this.stackedYData||this.processedYData;d=a.length;for(l=0;l<d;l++)if(j=c[l],k=a[l],i=k!==null&&k!==t&&(!b.isLog||k.length||k>0),j=this.getExtremesFromAll||this.cropped||(c[l+1]||j)>=g&&(c[l-1]||j)<=h,i&&j)if(i=k.length)for(;i--;)k[i]!==null&&(e[f++]=k[i]);else e[f++]=k;this.dataMin=m(void 0,Na(e));this.dataMax=m(void 0,Ba(e))},translate:function(){this.processedXData||
347
- this.processData();this.generatePoints();for(var a=this.options,b=a.stacking,c=this.xAxis,d=c.categories,e=this.yAxis,f=this.points,g=f.length,h=!!this.modifyValue,i=a.pointPlacement,j=i==="between"||ha(i),k=a.threshold,a=0;a<g;a++){var l=f[a],o=l.x,n=l.y,s=l.low,p=b&&e.stacks[(this.negStacks&&n<k?"-":"")+this.stackKey];if(e.isLog&&n<=0)l.y=n=null;l.plotX=c.translate(o,0,0,0,1,i,this.type==="flags");if(b&&this.visible&&p&&p[o])p=p[o],n=p.points[this.index+","+a],s=n[0],n=n[1],s===0&&(s=m(k,e.min)),
348
- e.isLog&&s<=0&&(s=null),l.total=l.stackTotal=p.total,l.percentage=p.total&&l.y/p.total*100,l.stackY=n,p.setOffset(this.pointXOffset||0,this.barW||0);l.yBottom=r(s)?e.translate(s,0,1,0,1):null;h&&(n=this.modifyValue(n,l));l.plotY=typeof n==="number"&&n!==Infinity?e.translate(n,0,1,0,1):t;l.clientX=j?c.translate(o,0,0,0,1):l.plotX;l.negative=l.y<(k||0);l.category=d&&d[l.x]!==t?d[l.x]:l.x}this.getSegments()},animate:function(a){var b=this.chart,c=b.renderer,d;d=this.options.animation;var e=this.clipBox||
349
- b.clipBox,f=b.inverted,g;if(d&&!ca(d))d=ba[this.type].animation;g=["_sharedClip",d.duration,d.easing,e.height].join(",");a?(a=b[g],d=b[g+"m"],a||(b[g]=a=c.clipRect(q(e,{width:0})),b[g+"m"]=d=c.clipRect(-99,f?-b.plotLeft:-b.plotTop,99,f?b.chartWidth:b.chartHeight)),this.group.clip(a),this.markerGroup.clip(d),this.sharedClipKey=g):((a=b[g])&&a.animate({width:b.plotSizeX},d),b[g+"m"]&&b[g+"m"].animate({width:b.plotSizeX+99},d),this.animate=null)},afterAnimate:function(){var a=this.chart,b=this.sharedClipKey,
350
- c=this.group,d=this.clipBox;if(c&&this.options.clip!==!1){if(!b||!d)c.clip(d?a.renderer.clipRect(d):a.clipRect);this.markerGroup.clip()}D(this,"afterAnimate");setTimeout(function(){b&&a[b]&&(d||(a[b]=a[b].destroy()),a[b+"m"]&&(a[b+"m"]=a[b+"m"].destroy()))},100)},drawPoints:function(){var a,b=this.points,c=this.chart,d,e,f,g,h,i,j,k;d=this.options.marker;var l=this.pointAttr[""],o,n=this.markerGroup,s=m(d.enabled,this.activePointCount<0.5*this.xAxis.len/d.radius);if(d.enabled!==!1||this._hasPointMarkers)for(f=
351
- b.length;f--;)if(g=b[f],d=T(g.plotX),e=g.plotY,k=g.graphic,i=g.marker||{},a=s&&i.enabled===t||i.enabled,o=c.isInsidePlot(u(d),e,c.inverted),a&&e!==t&&!isNaN(e)&&g.y!==null)if(a=g.pointAttr[g.selected?"select":""]||l,h=a.r,i=m(i.symbol,this.symbol),j=i.indexOf("url")===0,k)k[o?"show":"hide"](!0).animate(q({x:d-h,y:e-h},k.symbolName?{width:2*h,height:2*h}:{}));else{if(o&&(h>0||j))g.graphic=c.renderer.symbol(i,d-h,e-h,2*h,2*h).attr(a).add(n)}else if(k)g.graphic=k.destroy()},convertAttribs:function(a,
352
- b,c,d){var e=this.pointAttrToOptions,f,g,h={},a=a||{},b=b||{},c=c||{},d=d||{};for(f in e)g=e[f],h[f]=m(a[g],b[f],c[f],d[f]);return h},getAttribs:function(){var a=this,b=a.options,c=ba[a.type].marker?b.marker:b,d=c.states,e=d.hover,f,g=a.color;f={stroke:g,fill:g};var h=a.points||[],i,j=[],k,l=a.pointAttrToOptions;k=a.hasPointSpecificOptions;var o=b.negativeColor,n=c.lineColor,s=c.fillColor;i=b.turboThreshold;var m;b.marker?(e.radius=e.radius||c.radius+2,e.lineWidth=e.lineWidth||c.lineWidth+1):e.color=
353
- e.color||ya(e.color||g).brighten(e.brightness).get();j[""]=a.convertAttribs(c,f);p(["hover","select"],function(b){j[b]=a.convertAttribs(d[b],j[""])});a.pointAttr=j;g=h.length;if(!i||g<i||k)for(;g--;){i=h[g];if((c=i.options&&i.options.marker||i.options)&&c.enabled===!1)c.radius=0;if(i.negative&&o)i.color=i.fillColor=o;k=b.colorByPoint||i.color;if(i.options)for(m in l)r(c[l[m]])&&(k=!0);if(k){c=c||{};k=[];d=c.states||{};f=d.hover=d.hover||{};if(!b.marker)f.color=f.color||!i.options.color&&e.color||
354
- ya(i.color).brighten(f.brightness||e.brightness).get();f={color:i.color};if(!s)f.fillColor=i.color;if(!n)f.lineColor=i.color;k[""]=a.convertAttribs(q(f,c),j[""]);k.hover=a.convertAttribs(d.hover,j.hover,k[""]);k.select=a.convertAttribs(d.select,j.select,k[""])}else k=j;i.pointAttr=k}},destroy:function(){var a=this,b=a.chart,c=/AppleWebKit\/533/.test(wa),d,e,f=a.data||[],g,h,i;D(a,"destroy");W(a);p(a.axisTypes||[],function(b){if(i=a[b])ja(i.series,a),i.isDirty=i.forceRedraw=!0});a.legendItem&&a.chart.legend.destroyItem(a);
355
- for(e=f.length;e--;)(g=f[e])&&g.destroy&&g.destroy();a.points=null;clearTimeout(a.animationTimeout);p("area,graph,dataLabelsGroup,group,markerGroup,tracker,graphNeg,areaNeg,posClip,negClip".split(","),function(b){a[b]&&(d=c&&b==="group"?"hide":"destroy",a[b][d]())});if(b.hoverSeries===a)b.hoverSeries=null;ja(b.series,a);for(h in a)delete a[h]},getSegmentPath:function(a){var b=this,c=[],d=b.options.step;p(a,function(e,f){var g=e.plotX,h=e.plotY,i;b.getPointSpline?c.push.apply(c,b.getPointSpline(a,
356
- e,f)):(c.push(f?"L":"M"),d&&f&&(i=a[f-1],d==="right"?c.push(i.plotX,h):d==="center"?c.push((i.plotX+g)/2,i.plotY,(i.plotX+g)/2,h):c.push(g,i.plotY)),c.push(e.plotX,e.plotY))});return c},getGraphPath:function(){var a=this,b=[],c,d=[];p(a.segments,function(e){c=a.getSegmentPath(e);e.length>1?b=b.concat(c):d.push(e[0])});a.singlePoints=d;return a.graphPath=b},drawGraph:function(){var a=this,b=this.options,c=[["graph",b.lineColor||this.color]],d=b.lineWidth,e=b.dashStyle,f=b.linecap!=="square",g=this.getGraphPath(),
357
- h=b.negativeColor;h&&c.push(["graphNeg",h]);p(c,function(c,h){var k=c[0],l=a[k];if(l)bb(l),l.animate({d:g});else if(d&&g.length)l={stroke:c[1],"stroke-width":d,fill:Q,zIndex:1},e?l.dashstyle=e:f&&(l["stroke-linecap"]=l["stroke-linejoin"]="round"),a[k]=a.chart.renderer.path(g).attr(l).add(a.group).shadow(!h&&b.shadow)})},clipNeg:function(){var a=this.options,b=this.chart,c=b.renderer,d=a.negativeColor||a.negativeFillColor,e,f=this.graph,g=this.area,h=this.posClip,i=this.negClip;e=b.chartWidth;var j=
358
- b.chartHeight,k=v(e,j),l=this.yAxis;if(d&&(f||g)){d=u(l.toPixels(a.threshold||0,!0));d<0&&(k-=d);a={x:0,y:0,width:k,height:d};k={x:0,y:d,width:k,height:k};if(b.inverted)a.height=k.y=b.plotWidth-d,c.isVML&&(a={x:b.plotWidth-d-b.plotLeft,y:0,width:e,height:j},k={x:d+b.plotLeft-e,y:0,width:b.plotLeft+d,height:e});l.reversed?(b=k,e=a):(b=a,e=k);h?(h.animate(b),i.animate(e)):(this.posClip=h=c.clipRect(b),this.negClip=i=c.clipRect(e),f&&this.graphNeg&&(f.clip(h),this.graphNeg.clip(i)),g&&(g.clip(h),this.areaNeg.clip(i)))}},
359
- invertGroups:function(){function a(){var a={width:b.yAxis.len,height:b.xAxis.len};p(["group","markerGroup"],function(c){b[c]&&b[c].attr(a).invert()})}var b=this,c=b.chart;if(b.xAxis)K(c,"resize",a),K(b,"destroy",function(){W(c,"resize",a)}),a(),b.invertGroups=a},plotGroup:function(a,b,c,d,e){var f=this[a],g=!f;g&&(this[a]=f=this.chart.renderer.g(b).attr({visibility:c,zIndex:d||0.1}).add(e));f[g?"attr":"animate"](this.getPlotBox());return f},getPlotBox:function(){var a=this.chart,b=this.xAxis,c=this.yAxis;
360
- if(a.inverted)b=c,c=this.xAxis;return{translateX:b?b.left:a.plotLeft,translateY:c?c.top:a.plotTop,scaleX:1,scaleY:1}},render:function(){var a=this,b=a.chart,c,d=a.options,e=(c=d.animation)&&!!a.animate&&b.renderer.isSVG&&m(c.duration,500)||0,f=a.visible?"visible":"hidden",g=d.zIndex,h=a.hasRendered,i=b.seriesGroup;c=a.plotGroup("group","series",f,g,i);a.markerGroup=a.plotGroup("markerGroup","markers",f,g,i);e&&a.animate(!0);a.getAttribs();c.inverted=a.isCartesian?b.inverted:!1;a.drawGraph&&(a.drawGraph(),
361
- a.clipNeg());a.drawDataLabels&&a.drawDataLabels();a.visible&&a.drawPoints();a.drawTracker&&a.options.enableMouseTracking!==!1&&a.drawTracker();b.inverted&&a.invertGroups();d.clip!==!1&&!a.sharedClipKey&&!h&&c.clip(b.clipRect);e&&a.animate();if(!h)e?a.animationTimeout=setTimeout(function(){a.afterAnimate()},e):a.afterAnimate();a.isDirty=a.isDirtyData=!1;a.hasRendered=!0},redraw:function(){var a=this.chart,b=this.isDirtyData,c=this.group,d=this.xAxis,e=this.yAxis;c&&(a.inverted&&c.attr({width:a.plotWidth,
362
- height:a.plotHeight}),c.animate({translateX:m(d&&d.left,a.plotLeft),translateY:m(e&&e.top,a.plotTop)}));this.translate();this.setTooltipPoints&&this.setTooltipPoints(!0);this.render();b&&D(this,"updatedData")}};Hb.prototype={destroy:function(){Oa(this,this.axis)},render:function(a){var b=this.options,c=b.format,c=c?Ia(c,this):b.formatter.call(this);this.label?this.label.attr({text:c,visibility:"hidden"}):this.label=this.axis.chart.renderer.text(c,null,null,b.useHTML).css(b.style).attr({align:this.textAlign,
363
- rotation:b.rotation,visibility:"hidden"}).add(a)},setOffset:function(a,b){var c=this.axis,d=c.chart,e=d.inverted,f=this.isNegative,g=c.translate(c.usePercentage?100:this.total,0,0,0,1),c=c.translate(0),c=M(g-c),h=d.xAxis[0].translate(this.x)+a,i=d.plotHeight,f={x:e?f?g:g-c:h,y:e?i-h-b:f?i-g-c:i-g,width:e?c:b,height:e?b:c};if(e=this.label)e.align(this.alignOptions,null,f),f=e.alignAttr,e[this.options.crop===!1||d.isInsidePlot(f.x,f.y)?"show":"hide"](!0)}};la.prototype.buildStacks=function(){var a=
364
- this.series,b=m(this.options.reversedStacks,!0),c=a.length;if(!this.isXAxis){for(this.usePercentage=!1;c--;)a[b?c:a.length-c-1].setStackedPoints();if(this.usePercentage)for(c=0;c<a.length;c++)a[c].setPercentStacks()}};la.prototype.renderStackTotals=function(){var a=this.chart,b=a.renderer,c=this.stacks,d,e,f=this.stackTotalGroup;if(!f)this.stackTotalGroup=f=b.g("stack-labels").attr({visibility:"visible",zIndex:6}).add();f.translate(a.plotLeft,a.plotTop);for(d in c)for(e in a=c[d],a)a[e].render(f)};
365
- O.prototype.setStackedPoints=function(){if(this.options.stacking&&!(this.visible!==!0&&this.chart.options.chart.ignoreHiddenSeries!==!1)){var a=this.processedXData,b=this.processedYData,c=[],d=b.length,e=this.options,f=e.threshold,g=e.stack,e=e.stacking,h=this.stackKey,i="-"+h,j=this.negStacks,k=this.yAxis,l=k.stacks,o=k.oldStacks,n,m,p,q,r,u;for(q=0;q<d;q++){r=a[q];u=b[q];p=this.index+","+q;m=(n=j&&u<f)?i:h;l[m]||(l[m]={});if(!l[m][r])o[m]&&o[m][r]?(l[m][r]=o[m][r],l[m][r].total=null):l[m][r]=new Hb(k,
366
- k.options.stackLabels,n,r,g);m=l[m][r];m.points[p]=[m.cum||0];e==="percent"?(n=n?h:i,j&&l[n]&&l[n][r]?(n=l[n][r],m.total=n.total=v(n.total,m.total)+M(u)||0):m.total=da(m.total+(M(u)||0))):m.total=da(m.total+(u||0));m.cum=(m.cum||0)+(u||0);m.points[p].push(m.cum);c[q]=m.cum}if(e==="percent")k.usePercentage=!0;this.stackedYData=c;k.oldStacks={}}};O.prototype.setPercentStacks=function(){var a=this,b=a.stackKey,c=a.yAxis.stacks,d=a.processedXData;p([b,"-"+b],function(b){var e;for(var f=d.length,g,h;f--;)if(g=
367
- d[f],e=(h=c[b]&&c[b][g])&&h.points[a.index+","+f],g=e)h=h.total?100/h.total:0,g[0]=da(g[0]*h),g[1]=da(g[1]*h),a.stackedYData[f]=g[1]})};q(Ya.prototype,{addSeries:function(a,b,c){var d,e=this;a&&(b=m(b,!0),D(e,"addSeries",{options:a},function(){d=e.initSeries(a);e.isDirtyLegend=!0;e.linkSeries();b&&e.redraw(c)}));return d},addAxis:function(a,b,c,d){var e=b?"xAxis":"yAxis",f=this.options;new la(this,w(a,{index:this[e].length,isX:b}));f[e]=qa(f[e]||{});f[e].push(a);m(c,!0)&&this.redraw(d)},showLoading:function(a){var b=
368
- this.options,c=this.loadingDiv,d=b.loading;if(!c)this.loadingDiv=c=Y(Ja,{className:"highcharts-loading"},q(d.style,{zIndex:10,display:Q}),this.container),this.loadingSpan=Y("span",null,d.labelStyle,c);this.loadingSpan.innerHTML=a||b.lang.loading;if(!this.loadingShown)G(c,{opacity:0,display:"",left:this.plotLeft+"px",top:this.plotTop+"px",width:this.plotWidth+"px",height:this.plotHeight+"px"}),kb(c,{opacity:d.style.opacity},{duration:d.showDuration||0}),this.loadingShown=!0},hideLoading:function(){var a=
369
- this.options,b=this.loadingDiv;b&&kb(b,{opacity:0},{duration:a.loading.hideDuration||100,complete:function(){G(b,{display:Q})}});this.loadingShown=!1}});q(Ea.prototype,{update:function(a,b,c){var d=this,e=d.series,f=d.graphic,g,h=e.data,i=e.chart,j=e.options,b=m(b,!0);d.firePointEvent("update",{options:a},function(){d.applyOptions(a);if(ca(a)){e.getAttribs();if(f)a&&a.marker&&a.marker.symbol?d.graphic=f.destroy():f.attr(d.pointAttr[d.state||""]);if(a&&a.dataLabels&&d.dataLabel)d.dataLabel=d.dataLabel.destroy()}g=
370
- Da(d,h);e.updateParallelArrays(d,g);j.data[g]=d.options;e.isDirty=e.isDirtyData=!0;if(!e.fixedBox&&e.hasCartesianSeries)i.isDirtyBox=!0;j.legendType==="point"&&i.legend.destroyItem(d);b&&i.redraw(c)})},remove:function(a,b){var c=this,d=c.series,e=d.points,f=d.chart,g,h=d.data;Qa(b,f);a=m(a,!0);c.firePointEvent("remove",null,function(){g=Da(c,h);h.length===e.length&&e.splice(g,1);h.splice(g,1);d.options.data.splice(g,1);d.updateParallelArrays(c,"splice",g,1);c.destroy();d.isDirty=!0;d.isDirtyData=
371
- !0;a&&f.redraw()})}});q(O.prototype,{addPoint:function(a,b,c,d){var e=this.options,f=this.data,g=this.graph,h=this.area,i=this.chart,j=this.xAxis&&this.xAxis.names,k=g&&g.shift||0,l=e.data,o,n=this.xData;Qa(d,i);c&&p([g,h,this.graphNeg,this.areaNeg],function(a){if(a)a.shift=k+1});if(h)h.isArea=!0;b=m(b,!0);d={series:this};this.pointClass.prototype.applyOptions.apply(d,[a]);g=d.x;h=n.length;if(this.requireSorting&&g<n[h-1])for(o=!0;h&&n[h-1]>g;)h--;this.updateParallelArrays(d,"splice",h,0,0);this.updateParallelArrays(d,
372
- h);if(j)j[g]=d.name;l.splice(h,0,a);o&&(this.data.splice(h,0,null),this.processData());e.legendType==="point"&&this.generatePoints();c&&(f[0]&&f[0].remove?f[0].remove(!1):(f.shift(),this.updateParallelArrays(d,"shift"),l.shift()));this.isDirtyData=this.isDirty=!0;b&&(this.getAttribs(),i.redraw())},remove:function(a,b){var c=this,d=c.chart,a=m(a,!0);if(!c.isRemoving)c.isRemoving=!0,D(c,"remove",null,function(){c.destroy();d.isDirtyLegend=d.isDirtyBox=!0;d.linkSeries();a&&d.redraw(b)});c.isRemoving=
373
- !1},update:function(a,b){var c=this.chart,d=this.type,e=F[d].prototype,f,a=w(this.userOptions,{animation:!1,index:this.index,pointStart:this.xData[0]},{data:this.options.data},a);this.remove(!1);for(f in e)e.hasOwnProperty(f)&&(this[f]=t);q(this,F[a.type||d].prototype);this.init(c,a);m(b,!0)&&c.redraw(!1)}});q(la.prototype,{update:function(a,b){var c=this.chart,a=c.options[this.coll][this.options.index]=w(this.userOptions,a);this.destroy(!0);this._addedPlotLB=t;this.init(c,q(a,{events:t}));c.isDirtyBox=
374
- !0;m(b,!0)&&c.redraw()},remove:function(a){for(var b=this.chart,c=this.coll,d=this.series,e=d.length;e--;)d[e]&&d[e].remove(!1);ja(b.axes,this);ja(b[c],this);b.options[c].splice(this.options.index,1);p(b[c],function(a,b){a.options.index=b});this.destroy();b.isDirtyBox=!0;m(a,!0)&&b.redraw()},setTitle:function(a,b){this.update({title:a},b)},setCategories:function(a,b){this.update({categories:a},b)}});ga=ka(O);F.line=ga;ba.area=w(S,{threshold:0});var pa=ka(O,{type:"area",getSegments:function(){var a=
375
- [],b=[],c=[],d=this.xAxis,e=this.yAxis,f=e.stacks[this.stackKey],g={},h,i,j=this.points,k=this.options.connectNulls,l,o,n;if(this.options.stacking&&!this.cropped){for(o=0;o<j.length;o++)g[j[o].x]=j[o];for(n in f)f[n].total!==null&&c.push(+n);c.sort(function(a,b){return a-b});p(c,function(a){if(!k||g[a]&&g[a].y!==null)g[a]?b.push(g[a]):(h=d.translate(a),l=f[a].percent?f[a].total?f[a].cum*100/f[a].total:0:f[a].cum,i=e.toPixels(l,!0),b.push({y:null,plotX:h,clientX:h,plotY:i,yBottom:i,onMouseOver:sa}))});
376
- b.length&&a.push(b)}else O.prototype.getSegments.call(this),a=this.segments;this.segments=a},getSegmentPath:function(a){var b=O.prototype.getSegmentPath.call(this,a),c=[].concat(b),d,e=this.options;d=b.length;var f=this.yAxis.getThreshold(e.threshold),g;d===3&&c.push("L",b[1],b[2]);if(e.stacking&&!this.closedStacks)for(d=a.length-1;d>=0;d--)g=m(a[d].yBottom,f),d<a.length-1&&e.step&&c.push(a[d+1].plotX,g),c.push(a[d].plotX,g);else this.closeSegment(c,a,f);this.areaPath=this.areaPath.concat(c);return b},
377
- closeSegment:function(a,b,c){a.push("L",b[b.length-1].plotX,c,"L",b[0].plotX,c)},drawGraph:function(){this.areaPath=[];O.prototype.drawGraph.apply(this);var a=this,b=this.areaPath,c=this.options,d=c.negativeColor,e=c.negativeFillColor,f=[["area",this.color,c.fillColor]];(d||e)&&f.push(["areaNeg",d,e]);p(f,function(d){var e=d[0],f=a[e];f?f.animate({d:b}):a[e]=a.chart.renderer.path(b).attr({fill:m(d[2],ya(d[1]).setOpacity(m(c.fillOpacity,0.75)).get()),zIndex:0}).add(a.group)})},drawLegendSymbol:N.drawRectangle});
378
- F.area=pa;ba.spline=w(S);ga=ka(O,{type:"spline",getPointSpline:function(a,b,c){var d=b.plotX,e=b.plotY,f=a[c-1],g=a[c+1],h,i,j,k;if(f&&g){a=f.plotY;j=g.plotX;var g=g.plotY,l;h=(1.5*d+f.plotX)/2.5;i=(1.5*e+a)/2.5;j=(1.5*d+j)/2.5;k=(1.5*e+g)/2.5;l=(k-i)*(j-d)/(j-h)+e-k;i+=l;k+=l;i>a&&i>e?(i=v(a,e),k=2*e-i):i<a&&i<e&&(i=C(a,e),k=2*e-i);k>g&&k>e?(k=v(g,e),i=2*e-k):k<g&&k<e&&(k=C(g,e),i=2*e-k);b.rightContX=j;b.rightContY=k}c?(b=["C",f.rightContX||f.plotX,f.rightContY||f.plotY,h||d,i||e,d,e],f.rightContX=
379
- f.rightContY=null):b=["M",d,e];return b}});F.spline=ga;ba.areaspline=w(ba.area);pa=pa.prototype;ga=ka(ga,{type:"areaspline",closedStacks:!0,getSegmentPath:pa.getSegmentPath,closeSegment:pa.closeSegment,drawGraph:pa.drawGraph,drawLegendSymbol:N.drawRectangle});F.areaspline=ga;ba.column=w(S,{borderColor:"#FFFFFF",borderRadius:0,groupPadding:0.2,marker:null,pointPadding:0.1,minPointLength:0,cropThreshold:50,pointRange:null,states:{hover:{brightness:0.1,shadow:!1,halo:!1},select:{color:"#C0C0C0",borderColor:"#000000",
380
- shadow:!1}},dataLabels:{align:null,verticalAlign:null,y:null},stickyTracking:!1,tooltip:{distance:6},threshold:0});ga=ka(O,{type:"column",pointAttrToOptions:{stroke:"borderColor",fill:"color",r:"borderRadius"},cropShoulder:0,trackerGroups:["group","dataLabelsGroup"],negStacks:!0,init:function(){O.prototype.init.apply(this,arguments);var a=this,b=a.chart;b.hasRendered&&p(b.series,function(b){if(b.type===a.type)b.isDirty=!0})},getColumnMetrics:function(){var a=this,b=a.options,c=a.xAxis,d=a.yAxis,e=
381
- c.reversed,f,g={},h,i=0;b.grouping===!1?i=1:p(a.chart.series,function(b){var c=b.options,e=b.yAxis;if(b.type===a.type&&b.visible&&d.len===e.len&&d.pos===e.pos)c.stacking?(f=b.stackKey,g[f]===t&&(g[f]=i++),h=g[f]):c.grouping!==!1&&(h=i++),b.columnIndex=h});var c=C(M(c.transA)*(c.ordinalSlope||b.pointRange||c.closestPointRange||c.tickInterval||1),c.len),j=c*b.groupPadding,k=(c-2*j)/i,l=b.pointWidth,b=r(l)?(k-l)/2:k*b.pointPadding,l=m(l,k-2*b);return a.columnMetrics={width:l,offset:b+(j+((e?i-(a.columnIndex||
382
- 0):a.columnIndex)||0)*k-c/2)*(e?-1:1)}},translate:function(){var a=this,b=a.chart,c=a.options,d=a.borderWidth=m(c.borderWidth,a.activePointCount>0.5*a.xAxis.len?0:1),e=a.yAxis,f=a.translatedThreshold=e.getThreshold(c.threshold),g=m(c.minPointLength,5),c=a.getColumnMetrics(),h=c.width,i=a.barW=Ka(v(h,1+2*d)),j=a.pointXOffset=c.offset,k=-(d%2?0.5:0),l=d%2?0.5:1;b.renderer.isVML&&b.inverted&&(l+=1);O.prototype.translate.apply(a);p(a.points,function(c){var d=m(c.yBottom,f),p=C(v(-999-d,c.plotY),e.len+
383
- 999+d),q=c.plotX+j,r=i,t=C(p,d),x;x=v(p,d)-t;M(x)<g&&g&&(x=g,t=u(M(t-f)>g?d-g:f-(e.translate(c.y,0,1,0,1)<=f?g:0)));c.barX=q;c.pointWidth=h;c.tooltipPos=b.inverted?[e.len-p,a.xAxis.len-q-r/2]:[q+r/2,p];d=M(q)<0.5;r=u(q+r)+k;q=u(q)+k;r-=q;p=M(t)<0.5;x=u(t+x)+l;t=u(t)+l;x-=t;d&&(q+=1,r-=1);p&&(t-=1,x+=1);c.shapeType="rect";c.shapeArgs={x:q,y:t,width:r,height:x}})},getSymbol:sa,drawLegendSymbol:N.drawRectangle,drawGraph:sa,drawPoints:function(){var a=this,b=this.chart,c=a.options,d=b.renderer,e=c.animationLimit||
384
- 250,f,g,h;p(a.points,function(i){var j=i.plotY,k=i.graphic;if(j!==t&&!isNaN(j)&&i.y!==null)f=i.shapeArgs,h=r(a.borderWidth)?{"stroke-width":a.borderWidth}:{},g=i.pointAttr[i.selected?"select":""]||a.pointAttr[""],k?(bb(k),k.attr(h)[b.pointCount<e?"animate":"attr"](w(f))):i.graphic=d[i.shapeType](f).attr(g).attr(h).add(a.group).shadow(c.shadow,null,c.stacking&&!c.borderRadius);else if(k)i.graphic=k.destroy()})},animate:function(a){var b=this.yAxis,c=this.options,d=this.chart.inverted,e={};if(aa)a?
385
- (e.scaleY=0.001,a=C(b.pos+b.len,v(b.pos,b.toPixels(c.threshold))),d?e.translateX=a-b.len:e.translateY=a,this.group.attr(e)):(e.scaleY=1,e[d?"translateX":"translateY"]=b.pos,this.group.animate(e,this.options.animation),this.animate=null)},remove:function(){var a=this,b=a.chart;b.hasRendered&&p(b.series,function(b){if(b.type===a.type)b.isDirty=!0});O.prototype.remove.apply(a,arguments)}});F.column=ga;ba.bar=w(ba.column);pa=ka(ga,{type:"bar",inverted:!0});F.bar=pa;ba.scatter=w(S,{lineWidth:0,tooltip:{headerFormat:'<span style="color:{series.color}">●</span> <span style="font-size: 10px;"> {series.name}</span><br/>',
386
- pointFormat:"x: <b>{point.x}</b><br/>y: <b>{point.y}</b><br/>"},stickyTracking:!1});pa=ka(O,{type:"scatter",sorted:!1,requireSorting:!1,noSharedTooltip:!0,trackerGroups:["markerGroup"],takeOrdinalPosition:!1,singularTooltips:!0,drawGraph:function(){this.options.lineWidth&&O.prototype.drawGraph.call(this)}});F.scatter=pa;ba.pie=w(S,{borderColor:"#FFFFFF",borderWidth:1,center:[null,null],clip:!1,colorByPoint:!0,dataLabels:{distance:30,enabled:!0,formatter:function(){return this.point.name}},ignoreHiddenPoint:!0,
387
- legendType:"point",marker:null,size:null,showInLegend:!1,slicedOffset:10,states:{hover:{brightness:0.1,shadow:!1}},stickyTracking:!1,tooltip:{followPointer:!0}});S={type:"pie",isCartesian:!1,pointClass:ka(Ea,{init:function(){Ea.prototype.init.apply(this,arguments);var a=this,b;if(a.y<0)a.y=null;q(a,{visible:a.visible!==!1,name:m(a.name,"Slice")});b=function(b){a.slice(b.type==="select")};K(a,"select",b);K(a,"unselect",b);return a},setVisible:function(a){var b=this,c=b.series,d=c.chart;b.visible=b.options.visible=
388
- a=a===t?!b.visible:a;c.options.data[Da(b,c.data)]=b.options;p(["graphic","dataLabel","connector","shadowGroup"],function(c){if(b[c])b[c][a?"show":"hide"](!0)});b.legendItem&&d.legend.colorizeItem(b,a);if(!c.isDirty&&c.options.ignoreHiddenPoint)c.isDirty=!0,d.redraw()},slice:function(a,b,c){var d=this.series;Qa(c,d.chart);m(b,!0);this.sliced=this.options.sliced=a=r(a)?a:!this.sliced;d.options.data[Da(this,d.data)]=this.options;a=a?this.slicedTranslation:{translateX:0,translateY:0};this.graphic.animate(a);
389
- this.shadowGroup&&this.shadowGroup.animate(a)},haloPath:function(a){var b=this.shapeArgs,c=this.series.chart;return this.series.chart.renderer.symbols.arc(c.plotLeft+b.x,c.plotTop+b.y,b.r+a,b.r+a,{innerR:this.shapeArgs.r,start:b.start,end:b.end})}}),requireSorting:!1,noSharedTooltip:!0,trackerGroups:["group","dataLabelsGroup"],axisTypes:[],pointAttrToOptions:{stroke:"borderColor","stroke-width":"borderWidth",fill:"color"},singularTooltips:!0,getColor:sa,animate:function(a){var b=this,c=b.points,d=
390
- b.startAngleRad;if(!a)p(c,function(a){var c=a.graphic,a=a.shapeArgs;c&&(c.attr({r:b.center[3]/2,start:d,end:d}),c.animate({r:a.r,start:a.start,end:a.end},b.options.animation))}),b.animate=null},setData:function(a,b,c,d){O.prototype.setData.call(this,a,!1,c,d);this.processData();this.generatePoints();m(b,!0)&&this.chart.redraw(c)},generatePoints:function(){var a,b=0,c,d,e,f=this.options.ignoreHiddenPoint;O.prototype.generatePoints.call(this);c=this.points;d=c.length;for(a=0;a<d;a++)e=c[a],b+=f&&!e.visible?
391
- 0:e.y;this.total=b;for(a=0;a<d;a++)e=c[a],e.percentage=b>0?e.y/b*100:0,e.total=b},translate:function(a){this.generatePoints();var b=0,c=this.options,d=c.slicedOffset,e=d+c.borderWidth,f,g,h,i=c.startAngle||0,j=this.startAngleRad=ma/180*(i-90),i=(this.endAngleRad=ma/180*(m(c.endAngle,i+360)-90))-j,k=this.points,l=c.dataLabels.distance,c=c.ignoreHiddenPoint,o,n=k.length,p;if(!a)this.center=a=this.getCenter();this.getX=function(b,c){h=U.asin(C((b-a[1])/(a[2]/2+l),1));return a[0]+(c?-1:1)*Z(h)*(a[2]/
392
- 2+l)};for(o=0;o<n;o++){p=k[o];f=j+b*i;if(!c||p.visible)b+=p.percentage/100;g=j+b*i;p.shapeType="arc";p.shapeArgs={x:a[0],y:a[1],r:a[2]/2,innerR:a[3]/2,start:u(f*1E3)/1E3,end:u(g*1E3)/1E3};h=(g+f)/2;h>1.5*ma?h-=2*ma:h<-ma/2&&(h+=2*ma);p.slicedTranslation={translateX:u(Z(h)*d),translateY:u(ea(h)*d)};f=Z(h)*a[2]/2;g=ea(h)*a[2]/2;p.tooltipPos=[a[0]+f*0.7,a[1]+g*0.7];p.half=h<-ma/2||h>ma/2?1:0;p.angle=h;e=C(e,l/2);p.labelPos=[a[0]+f+Z(h)*l,a[1]+g+ea(h)*l,a[0]+f+Z(h)*e,a[1]+g+ea(h)*e,a[0]+f,a[1]+g,l<0?
393
- "center":p.half?"right":"left",h]}},drawGraph:null,drawPoints:function(){var a=this,b=a.chart.renderer,c,d,e=a.options.shadow,f,g;if(e&&!a.shadowGroup)a.shadowGroup=b.g("shadow").add(a.group);p(a.points,function(h){d=h.graphic;g=h.shapeArgs;f=h.shadowGroup;if(e&&!f)f=h.shadowGroup=b.g("shadow").add(a.shadowGroup);c=h.sliced?h.slicedTranslation:{translateX:0,translateY:0};f&&f.attr(c);d?d.animate(q(g,c)):h.graphic=d=b[h.shapeType](g).setRadialReference(a.center).attr(h.pointAttr[h.selected?"select":
394
- ""]).attr({"stroke-linejoin":"round"}).attr(c).add(a.group).shadow(e,f);h.visible!==void 0&&h.setVisible(h.visible)})},sortByAngle:function(a,b){a.sort(function(a,d){return a.angle!==void 0&&(d.angle-a.angle)*b})},drawLegendSymbol:N.drawRectangle,getCenter:X.getCenter,getSymbol:sa};S=ka(O,S);F.pie=S;O.prototype.drawDataLabels=function(){var a=this,b=a.options,c=b.cursor,d=b.dataLabels,e=a.points,f,g,h,i;if(d.enabled||a._hasPointLabels)a.dlProcessOptions&&a.dlProcessOptions(d),i=a.plotGroup("dataLabelsGroup",
395
- "data-labels","hidden",d.zIndex||6),!a.hasRendered&&m(d.defer,!0)&&(i.attr({opacity:0}),K(a,"afterAnimate",function(){a.dataLabelsGroup.show()[b.animation?"animate":"attr"]({opacity:1},{duration:200})})),g=d,p(e,function(b){var e,l=b.dataLabel,o,n,p=b.connector,u=!0;f=b.options&&b.options.dataLabels;e=m(f&&f.enabled,g.enabled);if(l&&!e)b.dataLabel=l.destroy();else if(e){d=w(g,f);e=d.rotation;o=b.getLabelConfig();h=d.format?Ia(d.format,o):d.formatter.call(o,d);d.style.color=m(d.color,d.style.color,
396
- a.color,"black");if(l)if(r(h))l.attr({text:h}),u=!1;else{if(b.dataLabel=l=l.destroy(),p)b.connector=p.destroy()}else if(r(h)){l={fill:d.backgroundColor,stroke:d.borderColor,"stroke-width":d.borderWidth,r:d.borderRadius||0,rotation:e,padding:d.padding,zIndex:1};for(n in l)l[n]===t&&delete l[n];l=b.dataLabel=a.chart.renderer[e?"text":"label"](h,0,-999,null,null,null,d.useHTML).attr(l).css(q(d.style,c&&{cursor:c})).add(i).shadow(d.shadow)}l&&a.alignDataLabel(b,l,d,null,u)}})};O.prototype.alignDataLabel=
397
- function(a,b,c,d,e){var f=this.chart,g=f.inverted,h=m(a.plotX,-999),i=m(a.plotY,-999),j=b.getBBox();if(a=this.visible&&(a.series.forceDL||f.isInsidePlot(h,u(i),g)||d&&f.isInsidePlot(h,g?d.x+1:d.y+d.height-1,g)))d=q({x:g?f.plotWidth-i:h,y:u(g?f.plotHeight-h:i),width:0,height:0},d),q(c,{width:j.width,height:j.height}),c.rotation?(g={align:c.align,x:d.x+c.x+d.width/2,y:d.y+c.y+d.height/2},b[e?"attr":"animate"](g)):(b.align(c,null,d),g=b.alignAttr,m(c.overflow,"justify")==="justify"?this.justifyDataLabel(b,
398
- c,g,j,d,e):m(c.crop,!0)&&(a=f.isInsidePlot(g.x,g.y)&&f.isInsidePlot(g.x+j.width,g.y+j.height)));if(!a)b.attr({y:-999}),b.placed=!1};O.prototype.justifyDataLabel=function(a,b,c,d,e,f){var g=this.chart,h=b.align,i=b.verticalAlign,j,k;j=c.x;if(j<0)h==="right"?b.align="left":b.x=-j,k=!0;j=c.x+d.width;if(j>g.plotWidth)h==="left"?b.align="right":b.x=g.plotWidth-j,k=!0;j=c.y;if(j<0)i==="bottom"?b.verticalAlign="top":b.y=-j,k=!0;j=c.y+d.height;if(j>g.plotHeight)i==="top"?b.verticalAlign="bottom":b.y=g.plotHeight-
399
- j,k=!0;if(k)a.placed=!f,a.align(b,null,e)};if(F.pie)F.pie.prototype.drawDataLabels=function(){var a=this,b=a.data,c,d=a.chart,e=a.options.dataLabels,f=m(e.connectorPadding,10),g=m(e.connectorWidth,1),h=d.plotWidth,d=d.plotHeight,i,j,k=m(e.softConnector,!0),l=e.distance,o=a.center,n=o[2]/2,q=o[1],r=l>0,t,w,x,y,z=[[],[]],A,C,G,D,B,F=[0,0,0,0],N=function(a,b){return b.y-a.y};if(a.visible&&(e.enabled||a._hasPointLabels)){O.prototype.drawDataLabels.apply(a);p(b,function(a){a.dataLabel&&a.visible&&z[a.half].push(a)});
400
- for(D=0;!y&&b[D];)y=b[D]&&b[D].dataLabel&&(b[D].dataLabel.getBBox().height||21),D++;for(D=2;D--;){var b=[],K=[],H=z[D],I=H.length,E;a.sortByAngle(H,D-0.5);if(l>0){for(B=q-n-l;B<=q+n+l;B+=y)b.push(B);w=b.length;if(I>w){c=[].concat(H);c.sort(N);for(B=I;B--;)c[B].rank=B;for(B=I;B--;)H[B].rank>=w&&H.splice(B,1);I=H.length}for(B=0;B<I;B++){c=H[B];x=c.labelPos;c=9999;var Q,P;for(P=0;P<w;P++)Q=M(b[P]-x[1]),Q<c&&(c=Q,E=P);if(E<B&&b[B]!==null)E=B;else for(w<I-B+E&&b[B]!==null&&(E=w-I+B);b[E]===null;)E++;K.push({i:E,
401
- y:b[E]});b[E]=null}K.sort(N)}for(B=0;B<I;B++){c=H[B];x=c.labelPos;t=c.dataLabel;G=c.visible===!1?"hidden":"visible";c=x[1];if(l>0){if(w=K.pop(),E=w.i,C=w.y,c>C&&b[E+1]!==null||c<C&&b[E-1]!==null)C=c}else C=c;A=e.justify?o[0]+(D?-1:1)*(n+l):a.getX(E===0||E===b.length-1?c:C,D);t._attr={visibility:G,align:x[6]};t._pos={x:A+e.x+({left:f,right:-f}[x[6]]||0),y:C+e.y-10};t.connX=A;t.connY=C;if(this.options.size===null)w=t.width,A-w<f?F[3]=v(u(w-A+f),F[3]):A+w>h-f&&(F[1]=v(u(A+w-h+f),F[1])),C-y/2<0?F[0]=
402
- v(u(-C+y/2),F[0]):C+y/2>d&&(F[2]=v(u(C+y/2-d),F[2]))}}if(Ba(F)===0||this.verifyDataLabelOverflow(F))this.placeDataLabels(),r&&g&&p(this.points,function(b){i=b.connector;x=b.labelPos;if((t=b.dataLabel)&&t._pos)G=t._attr.visibility,A=t.connX,C=t.connY,j=k?["M",A+(x[6]==="left"?5:-5),C,"C",A,C,2*x[2]-x[4],2*x[3]-x[5],x[2],x[3],"L",x[4],x[5]]:["M",A+(x[6]==="left"?5:-5),C,"L",x[2],x[3],"L",x[4],x[5]],i?(i.animate({d:j}),i.attr("visibility",G)):b.connector=i=a.chart.renderer.path(j).attr({"stroke-width":g,
403
- stroke:e.connectorColor||b.color||"#606060",visibility:G}).add(a.dataLabelsGroup);else if(i)b.connector=i.destroy()})}},F.pie.prototype.placeDataLabels=function(){p(this.points,function(a){var a=a.dataLabel,b;if(a)(b=a._pos)?(a.attr(a._attr),a[a.moved?"animate":"attr"](b),a.moved=!0):a&&a.attr({y:-999})})},F.pie.prototype.alignDataLabel=sa,F.pie.prototype.verifyDataLabelOverflow=function(a){var b=this.center,c=this.options,d=c.center,e=c=c.minSize||80,f;d[0]!==null?e=v(b[2]-v(a[1],a[3]),c):(e=v(b[2]-
404
- a[1]-a[3],c),b[0]+=(a[3]-a[1])/2);d[1]!==null?e=v(C(e,b[2]-v(a[0],a[2])),c):(e=v(C(e,b[2]-a[0]-a[2]),c),b[1]+=(a[0]-a[2])/2);e<b[2]?(b[2]=e,this.translate(b),p(this.points,function(a){if(a.dataLabel)a.dataLabel._pos=null}),this.drawDataLabels&&this.drawDataLabels()):f=!0;return f};if(F.column)F.column.prototype.alignDataLabel=function(a,b,c,d,e){var f=this.chart,g=f.inverted,h=a.dlBox||a.shapeArgs,i=a.below||a.plotY>m(this.translatedThreshold,f.plotSizeY),j=m(c.inside,!!this.options.stacking);if(h&&
405
- (d=w(h),g&&(d={x:f.plotWidth-d.y-d.height,y:f.plotHeight-d.x-d.width,width:d.height,height:d.width}),!j))g?(d.x+=i?0:d.width,d.width=0):(d.y+=i?d.height:0,d.height=0);c.align=m(c.align,!g||j?"center":i?"right":"left");c.verticalAlign=m(c.verticalAlign,g||j?"middle":i?"top":"bottom");O.prototype.alignDataLabel.call(this,a,b,c,d,e)};S=R.TrackerMixin={drawTrackerPoint:function(){var a=this,b=a.chart,c=b.pointer,d=a.options.cursor,e=d&&{cursor:d},f=function(c){var d=c.target,e;if(b.hoverSeries!==a)a.onMouseOver();
406
- for(;d&&!e;)e=d.point,d=d.parentNode;if(e!==t&&e!==b.hoverPoint)e.onMouseOver(c)};p(a.points,function(a){if(a.graphic)a.graphic.element.point=a;if(a.dataLabel)a.dataLabel.element.point=a});if(!a._hasTracking)p(a.trackerGroups,function(b){if(a[b]&&(a[b].addClass("highcharts-tracker").on("mouseover",f).on("mouseout",function(a){c.onTrackerMouseOut(a)}).css(e),$a))a[b].on("touchstart",f)}),a._hasTracking=!0},drawTrackerGraph:function(){var a=this,b=a.options,c=b.trackByArea,d=[].concat(c?a.areaPath:
407
- a.graphPath),e=d.length,f=a.chart,g=f.pointer,h=f.renderer,i=f.options.tooltip.snap,j=a.tracker,k=b.cursor,l=k&&{cursor:k},k=a.singlePoints,m,n=function(){if(f.hoverSeries!==a)a.onMouseOver()},q="rgba(192,192,192,"+(aa?1.0E-4:0.002)+")";if(e&&!c)for(m=e+1;m--;)d[m]==="M"&&d.splice(m+1,0,d[m+1]-i,d[m+2],"L"),(m&&d[m]==="M"||m===e)&&d.splice(m,0,"L",d[m-2]+i,d[m-1]);for(m=0;m<k.length;m++)e=k[m],d.push("M",e.plotX-i,e.plotY,"L",e.plotX+i,e.plotY);j?j.attr({d:d}):(a.tracker=h.path(d).attr({"stroke-linejoin":"round",
408
- visibility:a.visible?"visible":"hidden",stroke:q,fill:c?q:Q,"stroke-width":b.lineWidth+(c?0:2*i),zIndex:2}).add(a.group),p([a.tracker,a.markerGroup],function(a){a.addClass("highcharts-tracker").on("mouseover",n).on("mouseout",function(a){g.onTrackerMouseOut(a)}).css(l);if($a)a.on("touchstart",n)}))}};if(F.column)ga.prototype.drawTracker=S.drawTrackerPoint;if(F.pie)F.pie.prototype.drawTracker=S.drawTrackerPoint;if(F.scatter)pa.prototype.drawTracker=S.drawTrackerPoint;q(lb.prototype,{setItemEvents:function(a,
409
- b,c,d,e){var f=this;(c?b:a.legendGroup).on("mouseover",function(){a.setState("hover");b.css(f.options.itemHoverStyle)}).on("mouseout",function(){b.css(a.visible?d:e);a.setState()}).on("click",function(b){var c=function(){a.setVisible()},b={browserEvent:b};a.firePointEvent?a.firePointEvent("legendItemClick",b,c):D(a,"legendItemClick",b,c)})},createCheckboxForItem:function(a){a.checkbox=Y("input",{type:"checkbox",checked:a.selected,defaultChecked:a.selected},this.options.itemCheckboxStyle,this.chart.container);
410
- K(a.checkbox,"click",function(b){D(a,"checkboxClick",{checked:b.target.checked},function(){a.select()})})}});E.legend.itemStyle.cursor="pointer";q(Ya.prototype,{showResetZoom:function(){var a=this,b=E.lang,c=a.options.chart.resetZoomButton,d=c.theme,e=d.states,f=c.relativeTo==="chart"?null:"plotBox";this.resetZoomButton=a.renderer.button(b.resetZoom,null,null,function(){a.zoomOut()},d,e&&e.hover).attr({align:c.position.align,title:b.resetZoomTitle}).add().align(c.position,!1,f)},zoomOut:function(){var a=
411
- this;D(a,"selection",{resetSelection:!0},function(){a.zoom()})},zoom:function(a){var b,c=this.pointer,d=!1,e;!a||a.resetSelection?p(this.axes,function(a){b=a.zoom()}):p(a.xAxis.concat(a.yAxis),function(a){var e=a.axis,h=e.isXAxis;if(c[h?"zoomX":"zoomY"]||c[h?"pinchX":"pinchY"])b=e.zoom(a.min,a.max),e.displayBtn&&(d=!0)});e=this.resetZoomButton;if(d&&!e)this.showResetZoom();else if(!d&&ca(e))this.resetZoomButton=e.destroy();b&&this.redraw(m(this.options.chart.animation,a&&a.animation,this.pointCount<
412
- 100))},pan:function(a,b){var c=this,d=c.hoverPoints,e;d&&p(d,function(a){a.setState()});p(b==="xy"?[1,0]:[1],function(b){var d=a[b?"chartX":"chartY"],h=c[b?"xAxis":"yAxis"][0],i=c[b?"mouseDownX":"mouseDownY"],j=(h.pointRange||0)/2,k=h.getExtremes(),l=h.toValue(i-d,!0)+j,i=h.toValue(i+c[b?"plotWidth":"plotHeight"]-d,!0)-j;h.series.length&&l>C(k.dataMin,k.min)&&i<v(k.dataMax,k.max)&&(h.setExtremes(l,i,!1,!1,{trigger:"pan"}),e=!0);c[b?"mouseDownX":"mouseDownY"]=d});e&&c.redraw(!1);G(c.container,{cursor:"move"})}});
413
- q(Ea.prototype,{select:function(a,b){var c=this,d=c.series,e=d.chart,a=m(a,!c.selected);c.firePointEvent(a?"select":"unselect",{accumulate:b},function(){c.selected=c.options.selected=a;d.options.data[Da(c,d.data)]=c.options;c.setState(a&&"select");b||p(e.getSelectedPoints(),function(a){if(a.selected&&a!==c)a.selected=a.options.selected=!1,d.options.data[Da(a,d.data)]=a.options,a.setState(""),a.firePointEvent("unselect")})})},onMouseOver:function(a){var b=this.series,c=b.chart,d=c.tooltip,e=c.hoverPoint;
414
- if(e&&e!==this)e.onMouseOut();this.firePointEvent("mouseOver");d&&(!d.shared||b.noSharedTooltip)&&d.refresh(this,a);this.setState("hover");c.hoverPoint=this},onMouseOut:function(){var a=this.series.chart,b=a.hoverPoints;if(!b||Da(this,b)===-1)this.firePointEvent("mouseOut"),this.setState(),a.hoverPoint=null},importEvents:function(){if(!this.hasImportedEvents){var a=w(this.series.options.point,this.options).events,b;this.events=a;for(b in a)K(this,b,a[b]);this.hasImportedEvents=!0}},setState:function(a,
415
- b){var c=this.plotX,d=this.plotY,e=this.series,f=e.options.states,g=ba[e.type].marker&&e.options.marker,h=g&&!g.enabled,i=g&&g.states[a],j=i&&i.enabled===!1,k=e.stateMarkerGraphic,l=this.marker||{},m=e.chart,n=e.halo,p,a=a||"";p=this.pointAttr[a]||e.pointAttr[a];if(!(a===this.state&&!b||this.selected&&a!=="select"||f[a]&&f[a].enabled===!1||a&&(j||h&&i.enabled===!1)||a&&l.states&&l.states[a]&&l.states[a].enabled===!1)){if(this.graphic)g=g&&this.graphic.symbolName&&p.r,this.graphic.attr(w(p,g?{x:c-
416
- g,y:d-g,width:2*g,height:2*g}:{})),k&&k.hide();else{if(a&&i)if(g=i.radius,l=l.symbol||e.symbol,k&&k.currentSymbol!==l&&(k=k.destroy()),k)k[b?"animate":"attr"]({x:c-g,y:d-g});else if(l)e.stateMarkerGraphic=k=m.renderer.symbol(l,c-g,d-g,2*g,2*g).attr(p).add(e.markerGroup),k.currentSymbol=l;if(k)k[a&&m.isInsidePlot(c,d,m.inverted)?"show":"hide"]()}if((c=f[a]&&f[a].halo)&&c.size){if(!n)e.halo=n=m.renderer.path().add(e.seriesGroup);n.attr(q({fill:ya(this.color||e.color).setOpacity(c.opacity).get()},c.attributes))[b?
417
- "animate":"attr"]({d:this.haloPath(c.size)})}else n&&n.attr({d:[]});this.state=a}},haloPath:function(a){var b=this.series,c=b.chart,d=b.getPlotBox(),e=c.inverted;return c.renderer.symbols.circle(d.translateX+(e?b.yAxis.len-this.plotY:this.plotX)-a,d.translateY+(e?b.xAxis.len-this.plotX:this.plotY)-a,a*2,a*2)}});q(O.prototype,{onMouseOver:function(){var a=this.chart,b=a.hoverSeries;if(b&&b!==this)b.onMouseOut();this.options.events.mouseOver&&D(this,"mouseOver");this.setState("hover");a.hoverSeries=
418
- this},onMouseOut:function(){var a=this.options,b=this.chart,c=b.tooltip,d=b.hoverPoint;if(d)d.onMouseOut();this&&a.events.mouseOut&&D(this,"mouseOut");c&&!a.stickyTracking&&(!c.shared||this.noSharedTooltip)&&c.hide();this.setState();b.hoverSeries=null},setState:function(a){var b=this.options,c=this.graph,d=this.graphNeg,e=b.states,b=b.lineWidth,a=a||"";if(this.state!==a)this.state=a,e[a]&&e[a].enabled===!1||(a&&(b=e[a].lineWidth||b+1),c&&!c.dashstyle&&(a={"stroke-width":b},c.attr(a),d&&d.attr(a)))},
419
- setVisible:function(a,b){var c=this,d=c.chart,e=c.legendItem,f,g=d.options.chart.ignoreHiddenSeries,h=c.visible;f=(c.visible=a=c.userOptions.visible=a===t?!h:a)?"show":"hide";p(["group","dataLabelsGroup","markerGroup","tracker"],function(a){if(c[a])c[a][f]()});if(d.hoverSeries===c)c.onMouseOut();e&&d.legend.colorizeItem(c,a);c.isDirty=!0;c.options.stacking&&p(d.series,function(a){if(a.options.stacking&&a.visible)a.isDirty=!0});p(c.linkedSeries,function(b){b.setVisible(a,!1)});if(g)d.isDirtyBox=!0;
420
- b!==!1&&d.redraw();D(c,f)},setTooltipPoints:function(a){var b=[],c,d,e=this.xAxis,f=e&&e.getExtremes(),g=e?e.tooltipLen||e.len:this.chart.plotSizeX,h,i,j=[];if(!(this.options.enableMouseTracking===!1||this.singularTooltips)){if(a)this.tooltipPoints=null;p(this.segments||this.points,function(a){b=b.concat(a)});e&&e.reversed&&(b=b.reverse());this.orderTooltipPoints&&this.orderTooltipPoints(b);a=b.length;for(i=0;i<a;i++)if(e=b[i],c=e.x,c>=f.min&&c<=f.max){h=b[i+1];c=d===t?0:d+1;for(d=b[i+1]?C(v(0,T((e.clientX+
421
- (h?h.wrappedClientX||h.clientX:g))/2)),g):g;c>=0&&c<=d;)j[c++]=e}this.tooltipPoints=j}},show:function(){this.setVisible(!0)},hide:function(){this.setVisible(!1)},select:function(a){this.selected=a=a===t?!this.selected:a;if(this.checkbox)this.checkbox.checked=a;D(this,a?"select":"unselect")},drawTracker:S.drawTrackerGraph});q(R,{Axis:la,Chart:Ya,Color:ya,Point:Ea,Tick:Sa,Renderer:Za,Series:O,SVGElement:P,SVGRenderer:ta,arrayMin:Na,arrayMax:Ba,charts:V,dateFormat:cb,format:Ia,pathAnim:ub,getOptions:function(){return E},
422
- hasBidiBug:Nb,isTouchDevice:Jb,numberFormat:Ga,seriesTypes:F,setOptions:function(a){E=w(!0,E,a);Cb();return E},addEvent:K,removeEvent:W,createElement:Y,discardElement:Pa,css:G,each:p,extend:q,map:Ua,merge:w,pick:m,splat:qa,extendClass:ka,pInt:z,wrap:Ma,svg:aa,canvas:fa,vml:!aa&&!fa,product:"Highcharts",version:"4.0.1"})})();
423
- }
424
- /*! http://mths.be/placeholder v2.1.1 by @mathias */
425
- (function(factory) {
426
- if (typeof define === 'function' && define.amd) {
427
- // AMD
428
- define(['jquery'], factory);
429
- } else {
430
- // Browser globals
431
- factory(jQuery);
432
- }
433
- }(function($) {
434
-
435
- // Opera Mini v7 doesn't support placeholder although its DOM seems to indicate so
436
- var isOperaMini = Object.prototype.toString.call(window.operamini) == '[object OperaMini]';
437
- var isInputSupported = 'placeholder' in document.createElement('input') && !isOperaMini;
438
- var isTextareaSupported = 'placeholder' in document.createElement('textarea') && !isOperaMini;
439
- var valHooks = $.valHooks;
440
- var propHooks = $.propHooks;
441
- var hooks;
442
- var placeholder;
443
-
444
- if (isInputSupported && isTextareaSupported) {
445
-
446
- placeholder = $.fn.placeholder = function() {
447
- return this;
448
- };
449
-
450
- placeholder.input = placeholder.textarea = true;
451
-
452
- } else {
453
-
454
- var settings = {};
455
-
456
- placeholder = $.fn.placeholder = function(options) {
457
-
458
- var defaults = {customClass: 'placeholder'};
459
- settings = $.extend({}, defaults, options);
460
-
461
- var $this = this;
462
- $this
463
- .filter((isInputSupported ? 'textarea' : ':input') + '[placeholder]')
464
- .not('.'+settings.customClass)
465
- .bind({
466
- 'focus.placeholder': clearPlaceholder,
467
- 'blur.placeholder': setPlaceholder
468
- })
469
- .data('placeholder-enabled', true)
470
- .trigger('blur.placeholder');
471
- return $this;
472
- };
473
-
474
- placeholder.input = isInputSupported;
475
- placeholder.textarea = isTextareaSupported;
476
-
477
- hooks = {
478
- 'get': function(element) {
479
- var $element = $(element);
480
-
481
- var $passwordInput = $element.data('placeholder-password');
482
- if ($passwordInput) {
483
- return $passwordInput[0].value;
484
- }
485
-
486
- return $element.data('placeholder-enabled') && $element.hasClass(settings.customClass) ? '' : element.value;
487
- },
488
- 'set': function(element, value) {
489
- var $element = $(element);
490
-
491
- var $passwordInput = $element.data('placeholder-password');
492
- if ($passwordInput) {
493
- return $passwordInput[0].value = value;
494
- }
495
-
496
- if (!$element.data('placeholder-enabled')) {
497
- return element.value = value;
498
- }
499
- if (value === '') {
500
- element.value = value;
501
- // Issue #56: Setting the placeholder causes problems if the element continues to have focus.
502
- if (element != safeActiveElement()) {
503
- // We can't use `triggerHandler` here because of dummy text/password inputs :(
504
- setPlaceholder.call(element);
505
- }
506
- } else if ($element.hasClass(settings.customClass)) {
507
- clearPlaceholder.call(element, true, value) || (element.value = value);
508
- } else {
509
- element.value = value;
510
- }
511
- // `set` can not return `undefined`; see http://jsapi.info/jquery/1.7.1/val#L2363
512
- return $element;
513
- }
514
- };
515
-
516
- if (!isInputSupported) {
517
- valHooks.input = hooks;
518
- propHooks.value = hooks;
519
- }
520
- if (!isTextareaSupported) {
521
- valHooks.textarea = hooks;
522
- propHooks.value = hooks;
523
- }
524
-
525
- $(function() {
526
- // Look for forms
527
- $(document).delegate('form', 'submit.placeholder', function() {
528
- // Clear the placeholder values so they don't get submitted
529
- var $inputs = $('.'+settings.customClass, this).each(clearPlaceholder);
530
- setTimeout(function() {
531
- $inputs.each(setPlaceholder);
532
- }, 10);
533
- });
534
- });
535
-
536
- // Clear placeholder values upon page reload
537
- $(window).bind('beforeunload.placeholder', function() {
538
- $('.'+settings.customClass).each(function() {
539
- this.value = '';
540
- });
541
- });
542
-
543
- }
544
-
545
- function args(elem) {
546
- // Return an object of element attributes
547
- var newAttrs = {};
548
- var rinlinejQuery = /^jQuery\d+$/;
549
- $.each(elem.attributes, function(i, attr) {
550
- if (attr.specified && !rinlinejQuery.test(attr.name)) {
551
- newAttrs[attr.name] = attr.value;
552
- }
553
- });
554
- return newAttrs;
555
- }
556
-
557
- function clearPlaceholder(event, value) {
558
- var input = this;
559
- var $input = $(input);
560
- if (input.value == $input.attr('placeholder') && $input.hasClass(settings.customClass)) {
561
- if ($input.data('placeholder-password')) {
562
- $input = $input.hide().nextAll('input[type="password"]:first').show().attr('id', $input.removeAttr('id').data('placeholder-id'));
563
- // If `clearPlaceholder` was called from `$.valHooks.input.set`
564
- if (event === true) {
565
- return $input[0].value = value;
566
- }
567
- $input.focus();
568
- } else {
569
- input.value = '';
570
- $input.removeClass(settings.customClass);
571
- input == safeActiveElement() && input.select();
572
- }
573
- }
574
- }
575
-
576
- function setPlaceholder() {
577
- var $replacement;
578
- var input = this;
579
- var $input = $(input);
580
- var id = this.id;
581
- if (input.value === '') {
582
- if (input.type === 'password') {
583
- if (!$input.data('placeholder-textinput')) {
584
- try {
585
- $replacement = $input.clone().attr({ 'type': 'text' });
586
- } catch(e) {
587
- $replacement = $('<input>').attr($.extend(args(this), { 'type': 'text' }));
588
- }
589
- $replacement
590
- .removeAttr('name')
591
- .data({
592
- 'placeholder-password': $input,
593
- 'placeholder-id': id
594
- })
595
- .bind('focus.placeholder', clearPlaceholder);
596
- $input
597
- .data({
598
- 'placeholder-textinput': $replacement,
599
- 'placeholder-id': id
600
- })
601
- .before($replacement);
602
- }
603
- $input = $input.removeAttr('id').hide().prevAll('input[type="text"]:first').attr('id', id).show();
604
- // Note: `$input[0] != input` now!
605
- }
606
- $input.addClass(settings.customClass);
607
- $input[0].value = $input.attr('placeholder');
608
- } else {
609
- $input.removeClass(settings.customClass);
610
- }
611
- }
612
-
613
- function safeActiveElement() {
614
- // Avoid IE9 `document.activeElement` of death
615
- // https://github.com/mathiasbynens/jquery-placeholder/pull/99
616
- try {
617
- return document.activeElement;
618
- } catch (exception) {}
619
- }
620
-
621
- }));
622
- jQuery(document).ready( function ( $ ) {
623
-
624
- $('#close-share').click( function( e ) {
625
- $.cookie('ignore_social_share', 1, { expires: 30 });
626
- });
627
-
628
- $('.big-button--share').click( function( e ) {
629
- $.cookie('ignore_social_share', 1);
630
- });
631
-
632
- if ( ! $.cookie('ignore_social_share') )
633
- leadin_check_social_share_popup();
634
-
635
- $("#filter_action").select2(
636
-
637
- );
638
-
639
- $('#filter_action').change( function ( e ) {
640
- var $this = $(this);
641
-
642
- if ( $this.val() == 'submitted' )
643
- {
644
- $('#form-filter-input').show();
645
- }
646
- else
647
- {
648
- $('#form-filter-input').hide();
649
- $('#filter_form').select2("val", "any form");
650
- }
651
- });
652
-
653
- $('#view-all-do-not-track-selectors').click( function ( e ) {
654
- $('.form-do-not-track, #view-less-do-not-track-selectors').not('.do-not-track-always-show').show();
655
- $('#view-all-do-not-track-selectors').hide();
656
- });
657
-
658
- $('#view-less-do-not-track-selectors').click( function ( e ) {
659
- $('.form-do-not-track, #view-less-do-not-track-selectors').not('.do-not-track-always-show').hide();
660
- $('#view-all-do-not-track-selectors').show();
661
- });
662
-
663
- $("#filter_content").select2({
664
- query: function( query ) {
665
- var key = query.term;
666
-
667
- $.ajax({
668
- type: 'POST',
669
- url: li_admin_ajax.ajax_url,
670
- data: {
671
- "action": "leadin_get_posts_and_pages",
672
- "search_term": key
673
- },
674
- success: function(data){
675
- // Force override the current tracking with the merged value
676
- var json_data = jQuery.parseJSON(data);
677
- var data_test = {results: []}, i, j, s;
678
- for ( i = 0; i < json_data.length; i++ )
679
- {
680
- data_test.results.push({id: json_data[i].post_title, text: json_data[i].post_title});
681
- }
682
-
683
- query.callback(data_test);
684
- }
685
- })
686
-
687
- },
688
- initSelection: function(element, callback) {
689
-
690
- if ( $('#filter_content').val() )
691
- {
692
- $('#filter_content').select2("data", {id: $('#filter_content').val(), text: $('#filter_content').val()});
693
- }
694
- else
695
- {
696
- $('#filter_content').select2("data", {id: 'any page', text: 'any page'});
697
- }
698
- }
699
- });
700
-
701
- $("#filter_form").select2({
702
- query: function( query ) {
703
- var key = query.term;
704
-
705
- $.ajax({
706
- type: 'POST',
707
- url: li_admin_ajax.ajax_url,
708
- data: {
709
- "action": "leadin_get_form_selectors",
710
- "search_term": key
711
- },
712
- success: function(data){
713
- // Force override the current tracking with the merged value
714
- var json_data = jQuery.parseJSON(data);
715
- var data_test = {results: []}, i, j, s;
716
- for ( i = 0; i < json_data.length; i++ )
717
- {
718
- data_test.results.push({id: json_data[i], text: json_data[i]});
719
- }
720
-
721
- query.callback(data_test);
722
- }
723
- })
724
-
725
- },
726
- initSelection: function(element, callback) {
727
-
728
- if ( $('#filter_form').val() )
729
- {
730
- $('#filter_form').select2("data", {id: $('#filter_form').val(), text: $('#filter_form').val()});
731
- }
732
- else
733
- {
734
- $('#filter_form').select2("data", {id: 'any form', text: 'any form'});
735
- }
736
- }
737
- });
738
-
739
- $('#leadin-contact-status').change( function ( e ) {
740
- $('#leadin-contact-status-button').addClass('button-primary');
741
- });
742
-
743
- $('input[name=popup-position]:radio').change( function ( e ) {
744
- $('#btn-activate-subscribe').attr('href', window.location.href + '&leadin_action=activate&power_up=subscribe_widget&redirect_to=' + encodeURIComponent(window.location.href + '&activate_popup=true&popup_position=' + $("input:radio[name='popup-position']:checked").val()));
745
- });
746
-
747
- $('input[name=esp]:radio').change( function ( e ) {
748
- $('#btn-activate-esp').attr('href', window.location.href + '&leadin_action=activate&power_up=' + $("input:radio[name='esp']:checked").val() + '&redirect_to=' + encodeURIComponent(window.location.href + '&activate_esp=true'));
749
- });
750
-
751
- $('#pro-upgrade-button').click( function ( e ) {
752
- e.preventDefault();
753
-
754
- if ( ! $('#agree-pp').is(":checked") )
755
- {
756
- $('#agree-pp-error').show();
757
- return false;
758
- }
759
- else
760
- {
761
- $('#agree-pp-error').hide();
762
- $(this).addClass('btn-submitting').text('Upgrading...');
763
- }
764
-
765
- $.ajax({
766
- type: 'POST',
767
- url: li_admin_ajax.ajax_url,
768
- data: {
769
- "action": "leadin_upgrade_to_pro_ajax_call"
770
- },
771
- success: function( redirect_to ) {
772
-
773
- if ( redirect_to )
774
- window.location.href = redirect_to + "&pro_upgrade=1";
775
- }
776
- });
777
- });
778
-
779
- $('#onboarding-step-1-button').click( function ( e ) {
780
-
781
- if ( ! $('#agree-pp').is(":checked") )
782
- {
783
- e.preventDefault();
784
- $('#agree-pp-error').show();
785
- return false;
786
- }
787
-
788
- });
789
-
790
- $('input, textarea').placeholder();
791
- });
792
-
793
- function leadin_check_social_share_popup ()
794
- {
795
- jQuery.ajax({
796
- type: 'POST',
797
- url: li_admin_ajax.ajax_url,
798
- data: {
799
- "action": "leadin_check_installation_date"
800
- },
801
- success: function( data ) {
802
- if ( ! data )
803
- $.cookie('ignore_social_share', 1);
804
- }
805
- });
806
- }
807
- jQuery(document).ready( function ( $ ) {
808
-
809
- var $bulk_opt_selected = $('.bulkactions select option[value="add_tag_to_selected"], .bulkactions select option[value="remove_tag_from_selected"], .bulkactions select option[value="delete_selected"]');
810
-
811
- $('#leadin-contacts input:checkbox').not('thead input:checkbox, tfoot input:checkbox').bind('change', function ( e ){
812
- var cb_count = 0;
813
- var selected_vals = '';
814
- var $btn_selected = $('#leadin-export-selected-leads');
815
-
816
- var $input_selected_vals = $('.leadin-selected-contacts');
817
- var $cb_selected = $('#leadin-contacts input:checkbox:checked').not('thead input:checkbox, tfoot input:checkbox');
818
-
819
- if ( $cb_selected.length > 0 )
820
- {
821
- $btn_selected.attr('disabled', false);
822
- $bulk_opt_selected.attr('disabled', false);
823
-
824
- }
825
- else
826
- {
827
- $btn_selected.attr('disabled', true);
828
- $bulk_opt_selected.attr('disabled', true);
829
- }
830
-
831
- $cb_selected.each( function ( e ) {
832
- selected_vals += $(this).val();
833
-
834
- if ( cb_count != ($cb_selected.length-1) )
835
- selected_vals += ',';
836
-
837
- cb_count++;
838
- });
839
-
840
- $input_selected_vals.val(selected_vals);
841
- $('.selected-contacts-count').text(cb_count);
842
- });
843
-
844
- $('#cb-select-all-1, #cb-select-all-2').bind('change', function ( e ) {
845
- var cb_count = 0;
846
- var selected_vals = '';
847
- var $this = $(this);
848
- var $btn_selected = $('#leadin-export-selected-leads');
849
- var $cb_selected = $('#leadin-contacts input:checkbox').not('thead input:checkbox, tfoot input:checkbox');
850
- var $input_selected_vals = $('.leadin-selected-contacts');
851
-
852
- $cb_selected.each( function ( e ) {
853
- selected_vals += $(this).val();
854
-
855
- if ( cb_count != ($cb_selected.length-1) )
856
- selected_vals += ',';
857
-
858
- cb_count++;
859
- });
860
-
861
- $input_selected_vals.val(selected_vals);
862
-
863
- if ( !$this.is(':checked') )
864
- {
865
- $btn_selected.attr('disabled', true);
866
- $bulk_opt_selected.attr('disabled', true);
867
- $('.selected-contacts-count').text($('#contact-count').text());
868
- }
869
- else
870
- {
871
- $btn_selected.attr('disabled', false);
872
- $bulk_opt_selected.attr('disabled', false);
873
- }
874
-
875
- $('.selected-contacts-count').text(cb_count);
876
-
877
-
878
- });
879
-
880
- $('.postbox .handlediv').bind('click', function ( e ) {
881
- var $postbox = $(this).parent();
882
-
883
- if ( $postbox.hasClass('closed') )
884
- {
885
- $postbox.removeClass('closed');
886
- }
887
- else
888
- {
889
- $postbox.addClass('closed');
890
- }
891
- });
892
-
893
- $('.selected-contacts-count').text($('#contact-count').text());
894
- $bulk_opt_selected.attr('disabled', true);
895
-
896
- $('.bulkactions select').change(function ( e ) {
897
- var $this = $(this);
898
- var $contact_count = $('#contact-count').text();
899
-
900
- if ( $this.val() == 'add_tag_to_all' || $this.val() == 'add_tag_to_selected' )
901
- {
902
- $('#bulk-edit-tags h2').html($('#bulk-edit-tags h2').html().replace('remove from', 'add to'));
903
- $('#bulk-edit-button').val('Add Tag');
904
- $('#bulk-edit-tag-action').val('add_tag');
905
- tb_show("", "#TB_inline?width=400&height=175&inlineId=bulk-edit-tags");
906
-
907
- // Reset the bulk actions so if the user closes the box it resets the values and nulls the apply button
908
- $('.bulkactions select').val('-1');
909
- }
910
- else if ( $this.val() == 'remove_tag_from_all' || $this.val() == 'remove_tag_from_selected' )
911
- {
912
- $('#bulk-edit-tags h2').html($('#bulk-edit-tags h2').html().replace('add to', 'remove from'));
913
- $('#bulk-edit-button').val('Remove Tag');
914
- $('#bulk-edit-tag-action').val('remove_tag');
915
- tb_show("", "#TB_inline?width=400&height=175&inlineId=bulk-edit-tags");
916
-
917
- // Reset the bulk actions so if the user closes the box it resets the values and nulls the apply button
918
- $('.bulkactions select').val('-1');
919
- }
920
- });
921
-
922
- $('#contact-detail-read-more').click( function ( e ) {
923
- $('#company-detail-overview-short').hide();
924
- $('#company-detail-overview-full').show();
925
- });
926
-
927
- $('#contact-detail-read-less').click( function ( e ) {
928
- $('#company-detail-overview-full').hide();
929
- $('#company-detail-overview-short').show();
930
- });
931
- });
932
- /*
933
- Copyright 2012 Igor Vaynberg
934
-
935
- Version: 3.4.8 Timestamp: Thu May 1 09:50:32 EDT 2014
936
-
937
- This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU
938
- General Public License version 2 (the "GPL License"). You may choose either license to govern your
939
- use of this software only upon the condition that you accept all of the terms of either the Apache
940
- License or the GPL License.
941
-
942
- You may obtain a copy of the Apache License and the GPL License at:
943
-
944
- http://www.apache.org/licenses/LICENSE-2.0
945
- http://www.gnu.org/licenses/gpl-2.0.html
946
-
947
- Unless required by applicable law or agreed to in writing, software distributed under the
948
- Apache License or the GPL License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
949
- CONDITIONS OF ANY KIND, either express or implied. See the Apache License and the GPL License for
950
- the specific language governing permissions and limitations under the Apache License and the GPL License.
951
- */
952
- (function ($) {
953
- if(typeof $.fn.each2 == "undefined") {
954
- $.extend($.fn, {
955
- /*
956
- * 4-10 times faster .each replacement
957
- * use it carefully, as it overrides jQuery context of element on each iteration
958
- */
959
- each2 : function (c) {
960
- var j = $([0]), i = -1, l = this.length;
961
- while (
962
- ++i < l
963
- && (j.context = j[0] = this[i])
964
- && c.call(j[0], i, j) !== false //"this"=DOM, i=index, j=jQuery object
965
- );
966
- return this;
967
- }
968
- });
969
- }
970
- })(jQuery);
971
-
972
- (function ($, undefined) {
973
- "use strict";
974
- /*global document, window, jQuery, console */
975
-
976
- if (window.Select2 !== undefined) {
977
- return;
978
- }
979
-
980
- var KEY, AbstractSelect2, SingleSelect2, MultiSelect2, nextUid, sizer,
981
- lastMousePosition={x:0,y:0}, $document, scrollBarDimensions,
982
-
983
- KEY = {
984
- TAB: 9,
985
- ENTER: 13,
986
- ESC: 27,
987
- SPACE: 32,
988
- LEFT: 37,
989
- UP: 38,
990
- RIGHT: 39,
991
- DOWN: 40,
992
- SHIFT: 16,
993
- CTRL: 17,
994
- ALT: 18,
995
- PAGE_UP: 33,
996
- PAGE_DOWN: 34,
997
- HOME: 36,
998
- END: 35,
999
- BACKSPACE: 8,
1000
- DELETE: 46,
1001
- isArrow: function (k) {
1002
- k = k.which ? k.which : k;
1003
- switch (k) {
1004
- case KEY.LEFT:
1005
- case KEY.RIGHT:
1006
- case KEY.UP:
1007
- case KEY.DOWN:
1008
- return true;
1009
- }
1010
- return false;
1011
- },
1012
- isControl: function (e) {
1013
- var k = e.which;
1014
- switch (k) {
1015
- case KEY.SHIFT:
1016
- case KEY.CTRL:
1017
- case KEY.ALT:
1018
- return true;
1019
- }
1020
-
1021
- if (e.metaKey) return true;
1022
-
1023
- return false;
1024
- },
1025
- isFunctionKey: function (k) {
1026
- k = k.which ? k.which : k;
1027
- return k >= 112 && k <= 123;
1028
- }
1029
- },
1030
- MEASURE_SCROLLBAR_TEMPLATE = "<div class='select2-measure-scrollbar'></div>",
1031
-
1032
- DIACRITICS = {"\u24B6":"A","\uFF21":"A","\u00C0":"A","\u00C1":"A","\u00C2":"A","\u1EA6":"A","\u1EA4":"A","\u1EAA":"A","\u1EA8":"A","\u00C3":"A","\u0100":"A","\u0102":"A","\u1EB0":"A","\u1EAE":"A","\u1EB4":"A","\u1EB2":"A","\u0226":"A","\u01E0":"A","\u00C4":"A","\u01DE":"A","\u1EA2":"A","\u00C5":"A","\u01FA":"A","\u01CD":"A","\u0200":"A","\u0202":"A","\u1EA0":"A","\u1EAC":"A","\u1EB6":"A","\u1E00":"A","\u0104":"A","\u023A":"A","\u2C6F":"A","\uA732":"AA","\u00C6":"AE","\u01FC":"AE","\u01E2":"AE","\uA734":"AO","\uA736":"AU","\uA738":"AV","\uA73A":"AV","\uA73C":"AY","\u24B7":"B","\uFF22":"B","\u1E02":"B","\u1E04":"B","\u1E06":"B","\u0243":"B","\u0182":"B","\u0181":"B","\u24B8":"C","\uFF23":"C","\u0106":"C","\u0108":"C","\u010A":"C","\u010C":"C","\u00C7":"C","\u1E08":"C","\u0187":"C","\u023B":"C","\uA73E":"C","\u24B9":"D","\uFF24":"D","\u1E0A":"D","\u010E":"D","\u1E0C":"D","\u1E10":"D","\u1E12":"D","\u1E0E":"D","\u0110":"D","\u018B":"D","\u018A":"D","\u0189":"D","\uA779":"D","\u01F1":"DZ","\u01C4":"DZ","\u01F2":"Dz","\u01C5":"Dz","\u24BA":"E","\uFF25":"E","\u00C8":"E","\u00C9":"E","\u00CA":"E","\u1EC0":"E","\u1EBE":"E","\u1EC4":"E","\u1EC2":"E","\u1EBC":"E","\u0112":"E","\u1E14":"E","\u1E16":"E","\u0114":"E","\u0116":"E","\u00CB":"E","\u1EBA":"E","\u011A":"E","\u0204":"E","\u0206":"E","\u1EB8":"E","\u1EC6":"E","\u0228":"E","\u1E1C":"E","\u0118":"E","\u1E18":"E","\u1E1A":"E","\u0190":"E","\u018E":"E","\u24BB":"F","\uFF26":"F","\u1E1E":"F","\u0191":"F","\uA77B":"F","\u24BC":"G","\uFF27":"G","\u01F4":"G","\u011C":"G","\u1E20":"G","\u011E":"G","\u0120":"G","\u01E6":"G","\u0122":"G","\u01E4":"G","\u0193":"G","\uA7A0":"G","\uA77D":"G","\uA77E":"G","\u24BD":"H","\uFF28":"H","\u0124":"H","\u1E22":"H","\u1E26":"H","\u021E":"H","\u1E24":"H","\u1E28":"H","\u1E2A":"H","\u0126":"H","\u2C67":"H","\u2C75":"H","\uA78D":"H","\u24BE":"I","\uFF29":"I","\u00CC":"I","\u00CD":"I","\u00CE":"I","\u0128":"I","\u012A":"I","\u012C":"I","\u0130":"I","\u00CF":"I","\u1E2E":"I","\u1EC8":"I","\u01CF":"I","\u0208":"I","\u020A":"I","\u1ECA":"I","\u012E":"I","\u1E2C":"I","\u0197":"I","\u24BF":"J","\uFF2A":"J","\u0134":"J","\u0248":"J","\u24C0":"K","\uFF2B":"K","\u1E30":"K","\u01E8":"K","\u1E32":"K","\u0136":"K","\u1E34":"K","\u0198":"K","\u2C69":"K","\uA740":"K","\uA742":"K","\uA744":"K","\uA7A2":"K","\u24C1":"L","\uFF2C":"L","\u013F":"L","\u0139":"L","\u013D":"L","\u1E36":"L","\u1E38":"L","\u013B":"L","\u1E3C":"L","\u1E3A":"L","\u0141":"L","\u023D":"L","\u2C62":"L","\u2C60":"L","\uA748":"L","\uA746":"L","\uA780":"L","\u01C7":"LJ","\u01C8":"Lj","\u24C2":"M","\uFF2D":"M","\u1E3E":"M","\u1E40":"M","\u1E42":"M","\u2C6E":"M","\u019C":"M","\u24C3":"N","\uFF2E":"N","\u01F8":"N","\u0143":"N","\u00D1":"N","\u1E44":"N","\u0147":"N","\u1E46":"N","\u0145":"N","\u1E4A":"N","\u1E48":"N","\u0220":"N","\u019D":"N","\uA790":"N","\uA7A4":"N","\u01CA":"NJ","\u01CB":"Nj","\u24C4":"O","\uFF2F":"O","\u00D2":"O","\u00D3":"O","\u00D4":"O","\u1ED2":"O","\u1ED0":"O","\u1ED6":"O","\u1ED4":"O","\u00D5":"O","\u1E4C":"O","\u022C":"O","\u1E4E":"O","\u014C":"O","\u1E50":"O","\u1E52":"O","\u014E":"O","\u022E":"O","\u0230":"O","\u00D6":"O","\u022A":"O","\u1ECE":"O","\u0150":"O","\u01D1":"O","\u020C":"O","\u020E":"O","\u01A0":"O","\u1EDC":"O","\u1EDA":"O","\u1EE0":"O","\u1EDE":"O","\u1EE2":"O","\u1ECC":"O","\u1ED8":"O","\u01EA":"O","\u01EC":"O","\u00D8":"O","\u01FE":"O","\u0186":"O","\u019F":"O","\uA74A":"O","\uA74C":"O","\u01A2":"OI","\uA74E":"OO","\u0222":"OU","\u24C5":"P","\uFF30":"P","\u1E54":"P","\u1E56":"P","\u01A4":"P","\u2C63":"P","\uA750":"P","\uA752":"P","\uA754":"P","\u24C6":"Q","\uFF31":"Q","\uA756":"Q","\uA758":"Q","\u024A":"Q","\u24C7":"R","\uFF32":"R","\u0154":"R","\u1E58":"R","\u0158":"R","\u0210":"R","\u0212":"R","\u1E5A":"R","\u1E5C":"R","\u0156":"R","\u1E5E":"R","\u024C":"R","\u2C64":"R","\uA75A":"R","\uA7A6":"R","\uA782":"R","\u24C8":"S","\uFF33":"S","\u1E9E":"S","\u015A":"S","\u1E64":"S","\u015C":"S","\u1E60":"S","\u0160":"S","\u1E66":"S","\u1E62":"S","\u1E68":"S","\u0218":"S","\u015E":"S","\u2C7E":"S","\uA7A8":"S","\uA784":"S","\u24C9":"T","\uFF34":"T","\u1E6A":"T","\u0164":"T","\u1E6C":"T","\u021A":"T","\u0162":"T","\u1E70":"T","\u1E6E":"T","\u0166":"T","\u01AC":"T","\u01AE":"T","\u023E":"T","\uA786":"T","\uA728":"TZ","\u24CA":"U","\uFF35":"U","\u00D9":"U","\u00DA":"U","\u00DB":"U","\u0168":"U","\u1E78":"U","\u016A":"U","\u1E7A":"U","\u016C":"U","\u00DC":"U","\u01DB":"U","\u01D7":"U","\u01D5":"U","\u01D9":"U","\u1EE6":"U","\u016E":"U","\u0170":"U","\u01D3":"U","\u0214":"U","\u0216":"U","\u01AF":"U","\u1EEA":"U","\u1EE8":"U","\u1EEE":"U","\u1EEC":"U","\u1EF0":"U","\u1EE4":"U","\u1E72":"U","\u0172":"U","\u1E76":"U","\u1E74":"U","\u0244":"U","\u24CB":"V","\uFF36":"V","\u1E7C":"V","\u1E7E":"V","\u01B2":"V","\uA75E":"V","\u0245":"V","\uA760":"VY","\u24CC":"W","\uFF37":"W","\u1E80":"W","\u1E82":"W","\u0174":"W","\u1E86":"W","\u1E84":"W","\u1E88":"W","\u2C72":"W","\u24CD":"X","\uFF38":"X","\u1E8A":"X","\u1E8C":"X","\u24CE":"Y","\uFF39":"Y","\u1EF2":"Y","\u00DD":"Y","\u0176":"Y","\u1EF8":"Y","\u0232":"Y","\u1E8E":"Y","\u0178":"Y","\u1EF6":"Y","\u1EF4":"Y","\u01B3":"Y","\u024E":"Y","\u1EFE":"Y","\u24CF":"Z","\uFF3A":"Z","\u0179":"Z","\u1E90":"Z","\u017B":"Z","\u017D":"Z","\u1E92":"Z","\u1E94":"Z","\u01B5":"Z","\u0224":"Z","\u2C7F":"Z","\u2C6B":"Z","\uA762":"Z","\u24D0":"a","\uFF41":"a","\u1E9A":"a","\u00E0":"a","\u00E1":"a","\u00E2":"a","\u1EA7":"a","\u1EA5":"a","\u1EAB":"a","\u1EA9":"a","\u00E3":"a","\u0101":"a","\u0103":"a","\u1EB1":"a","\u1EAF":"a","\u1EB5":"a","\u1EB3":"a","\u0227":"a","\u01E1":"a","\u00E4":"a","\u01DF":"a","\u1EA3":"a","\u00E5":"a","\u01FB":"a","\u01CE":"a","\u0201":"a","\u0203":"a","\u1EA1":"a","\u1EAD":"a","\u1EB7":"a","\u1E01":"a","\u0105":"a","\u2C65":"a","\u0250":"a","\uA733":"aa","\u00E6":"ae","\u01FD":"ae","\u01E3":"ae","\uA735":"ao","\uA737":"au","\uA739":"av","\uA73B":"av","\uA73D":"ay","\u24D1":"b","\uFF42":"b","\u1E03":"b","\u1E05":"b","\u1E07":"b","\u0180":"b","\u0183":"b","\u0253":"b","\u24D2":"c","\uFF43":"c","\u0107":"c","\u0109":"c","\u010B":"c","\u010D":"c","\u00E7":"c","\u1E09":"c","\u0188":"c","\u023C":"c","\uA73F":"c","\u2184":"c","\u24D3":"d","\uFF44":"d","\u1E0B":"d","\u010F":"d","\u1E0D":"d","\u1E11":"d","\u1E13":"d","\u1E0F":"d","\u0111":"d","\u018C":"d","\u0256":"d","\u0257":"d","\uA77A":"d","\u01F3":"dz","\u01C6":"dz","\u24D4":"e","\uFF45":"e","\u00E8":"e","\u00E9":"e","\u00EA":"e","\u1EC1":"e","\u1EBF":"e","\u1EC5":"e","\u1EC3":"e","\u1EBD":"e","\u0113":"e","\u1E15":"e","\u1E17":"e","\u0115":"e","\u0117":"e","\u00EB":"e","\u1EBB":"e","\u011B":"e","\u0205":"e","\u0207":"e","\u1EB9":"e","\u1EC7":"e","\u0229":"e","\u1E1D":"e","\u0119":"e","\u1E19":"e","\u1E1B":"e","\u0247":"e","\u025B":"e","\u01DD":"e","\u24D5":"f","\uFF46":"f","\u1E1F":"f","\u0192":"f","\uA77C":"f","\u24D6":"g","\uFF47":"g","\u01F5":"g","\u011D":"g","\u1E21":"g","\u011F":"g","\u0121":"g","\u01E7":"g","\u0123":"g","\u01E5":"g","\u0260":"g","\uA7A1":"g","\u1D79":"g","\uA77F":"g","\u24D7":"h","\uFF48":"h","\u0125":"h","\u1E23":"h","\u1E27":"h","\u021F":"h","\u1E25":"h","\u1E29":"h","\u1E2B":"h","\u1E96":"h","\u0127":"h","\u2C68":"h","\u2C76":"h","\u0265":"h","\u0195":"hv","\u24D8":"i","\uFF49":"i","\u00EC":"i","\u00ED":"i","\u00EE":"i","\u0129":"i","\u012B":"i","\u012D":"i","\u00EF":"i","\u1E2F":"i","\u1EC9":"i","\u01D0":"i","\u0209":"i","\u020B":"i","\u1ECB":"i","\u012F":"i","\u1E2D":"i","\u0268":"i","\u0131":"i","\u24D9":"j","\uFF4A":"j","\u0135":"j","\u01F0":"j","\u0249":"j","\u24DA":"k","\uFF4B":"k","\u1E31":"k","\u01E9":"k","\u1E33":"k","\u0137":"k","\u1E35":"k","\u0199":"k","\u2C6A":"k","\uA741":"k","\uA743":"k","\uA745":"k","\uA7A3":"k","\u24DB":"l","\uFF4C":"l","\u0140":"l","\u013A":"l","\u013E":"l","\u1E37":"l","\u1E39":"l","\u013C":"l","\u1E3D":"l","\u1E3B":"l","\u017F":"l","\u0142":"l","\u019A":"l","\u026B":"l","\u2C61":"l","\uA749":"l","\uA781":"l","\uA747":"l","\u01C9":"lj","\u24DC":"m","\uFF4D":"m","\u1E3F":"m","\u1E41":"m","\u1E43":"m","\u0271":"m","\u026F":"m","\u24DD":"n","\uFF4E":"n","\u01F9":"n","\u0144":"n","\u00F1":"n","\u1E45":"n","\u0148":"n","\u1E47":"n","\u0146":"n","\u1E4B":"n","\u1E49":"n","\u019E":"n","\u0272":"n","\u0149":"n","\uA791":"n","\uA7A5":"n","\u01CC":"nj","\u24DE":"o","\uFF4F":"o","\u00F2":"o","\u00F3":"o","\u00F4":"o","\u1ED3":"o","\u1ED1":"o","\u1ED7":"o","\u1ED5":"o","\u00F5":"o","\u1E4D":"o","\u022D":"o","\u1E4F":"o","\u014D":"o","\u1E51":"o","\u1E53":"o","\u014F":"o","\u022F":"o","\u0231":"o","\u00F6":"o","\u022B":"o","\u1ECF":"o","\u0151":"o","\u01D2":"o","\u020D":"o","\u020F":"o","\u01A1":"o","\u1EDD":"o","\u1EDB":"o","\u1EE1":"o","\u1EDF":"o","\u1EE3":"o","\u1ECD":"o","\u1ED9":"o","\u01EB":"o","\u01ED":"o","\u00F8":"o","\u01FF":"o","\u0254":"o","\uA74B":"o","\uA74D":"o","\u0275":"o","\u01A3":"oi","\u0223":"ou","\uA74F":"oo","\u24DF":"p","\uFF50":"p","\u1E55":"p","\u1E57":"p","\u01A5":"p","\u1D7D":"p","\uA751":"p","\uA753":"p","\uA755":"p","\u24E0":"q","\uFF51":"q","\u024B":"q","\uA757":"q","\uA759":"q","\u24E1":"r","\uFF52":"r","\u0155":"r","\u1E59":"r","\u0159":"r","\u0211":"r","\u0213":"r","\u1E5B":"r","\u1E5D":"r","\u0157":"r","\u1E5F":"r","\u024D":"r","\u027D":"r","\uA75B":"r","\uA7A7":"r","\uA783":"r","\u24E2":"s","\uFF53":"s","\u00DF":"s","\u015B":"s","\u1E65":"s","\u015D":"s","\u1E61":"s","\u0161":"s","\u1E67":"s","\u1E63":"s","\u1E69":"s","\u0219":"s","\u015F":"s","\u023F":"s","\uA7A9":"s","\uA785":"s","\u1E9B":"s","\u24E3":"t","\uFF54":"t","\u1E6B":"t","\u1E97":"t","\u0165":"t","\u1E6D":"t","\u021B":"t","\u0163":"t","\u1E71":"t","\u1E6F":"t","\u0167":"t","\u01AD":"t","\u0288":"t","\u2C66":"t","\uA787":"t","\uA729":"tz","\u24E4":"u","\uFF55":"u","\u00F9":"u","\u00FA":"u","\u00FB":"u","\u0169":"u","\u1E79":"u","\u016B":"u","\u1E7B":"u","\u016D":"u","\u00FC":"u","\u01DC":"u","\u01D8":"u","\u01D6":"u","\u01DA":"u","\u1EE7":"u","\u016F":"u","\u0171":"u","\u01D4":"u","\u0215":"u","\u0217":"u","\u01B0":"u","\u1EEB":"u","\u1EE9":"u","\u1EEF":"u","\u1EED":"u","\u1EF1":"u","\u1EE5":"u","\u1E73":"u","\u0173":"u","\u1E77":"u","\u1E75":"u","\u0289":"u","\u24E5":"v","\uFF56":"v","\u1E7D":"v","\u1E7F":"v","\u028B":"v","\uA75F":"v","\u028C":"v","\uA761":"vy","\u24E6":"w","\uFF57":"w","\u1E81":"w","\u1E83":"w","\u0175":"w","\u1E87":"w","\u1E85":"w","\u1E98":"w","\u1E89":"w","\u2C73":"w","\u24E7":"x","\uFF58":"x","\u1E8B":"x","\u1E8D":"x","\u24E8":"y","\uFF59":"y","\u1EF3":"y","\u00FD":"y","\u0177":"y","\u1EF9":"y","\u0233":"y","\u1E8F":"y","\u00FF":"y","\u1EF7":"y","\u1E99":"y","\u1EF5":"y","\u01B4":"y","\u024F":"y","\u1EFF":"y","\u24E9":"z","\uFF5A":"z","\u017A":"z","\u1E91":"z","\u017C":"z","\u017E":"z","\u1E93":"z","\u1E95":"z","\u01B6":"z","\u0225":"z","\u0240":"z","\u2C6C":"z","\uA763":"z"};
1033
-
1034
- $document = $(document);
1035
-
1036
- nextUid=(function() { var counter=1; return function() { return counter++; }; }());
1037
-
1038
-
1039
- function reinsertElement(element) {
1040
- var placeholder = $(document.createTextNode(''));
1041
-
1042
- element.before(placeholder);
1043
- placeholder.before(element);
1044
- placeholder.remove();
1045
- }
1046
-
1047
- function stripDiacritics(str) {
1048
- // Used 'uni range + named function' from http://jsperf.com/diacritics/18
1049
- function match(a) {
1050
- return DIACRITICS[a] || a;
1051
- }
1052
-
1053
- return str.replace(/[^\u0000-\u007E]/g, match);
1054
- }
1055
-
1056
- function indexOf(value, array) {
1057
- var i = 0, l = array.length;
1058
- for (; i < l; i = i + 1) {
1059
- if (equal(value, array[i])) return i;
1060
- }
1061
- return -1;
1062
- }
1063
-
1064
- function measureScrollbar () {
1065
- var $template = $( MEASURE_SCROLLBAR_TEMPLATE );
1066
- $template.appendTo('body');
1067
-
1068
- var dim = {
1069
- width: $template.width() - $template[0].clientWidth,
1070
- height: $template.height() - $template[0].clientHeight
1071
- };
1072
- $template.remove();
1073
-
1074
- return dim;
1075
- }
1076
-
1077
- /**
1078
- * Compares equality of a and b
1079
- * @param a
1080
- * @param b
1081
- */
1082
- function equal(a, b) {
1083
- if (a === b) return true;
1084
- if (a === undefined || b === undefined) return false;
1085
- if (a === null || b === null) return false;
1086
- // Check whether 'a' or 'b' is a string (primitive or object).
1087
- // The concatenation of an empty string (+'') converts its argument to a string's primitive.
1088
- if (a.constructor === String) return a+'' === b+''; // a+'' - in case 'a' is a String object
1089
- if (b.constructor === String) return b+'' === a+''; // b+'' - in case 'b' is a String object
1090
- return false;
1091
- }
1092
-
1093
- /**
1094
- * Splits the string into an array of values, trimming each value. An empty array is returned for nulls or empty
1095
- * strings
1096
- * @param string
1097
- * @param separator
1098
- */
1099
- function splitVal(string, separator) {
1100
- var val, i, l;
1101
- if (string === null || string.length < 1) return [];
1102
- val = string.split(separator);
1103
- for (i = 0, l = val.length; i < l; i = i + 1) val[i] = $.trim(val[i]);
1104
- return val;
1105
- }
1106
-
1107
- function getSideBorderPadding(element) {
1108
- return element.outerWidth(false) - element.width();
1109
- }
1110
-
1111
- function installKeyUpChangeEvent(element) {
1112
- var key="keyup-change-value";
1113
- element.on("keydown", function () {
1114
- if ($.data(element, key) === undefined) {
1115
- $.data(element, key, element.val());
1116
- }
1117
- });
1118
- element.on("keyup", function () {
1119
- var val= $.data(element, key);
1120
- if (val !== undefined && element.val() !== val) {
1121
- $.removeData(element, key);
1122
- element.trigger("keyup-change");
1123
- }
1124
- });
1125
- }
1126
-
1127
- $document.on("mousemove", function (e) {
1128
- lastMousePosition.x = e.pageX;
1129
- lastMousePosition.y = e.pageY;
1130
- });
1131
-
1132
- /**
1133
- * filters mouse events so an event is fired only if the mouse moved.
1134
- *
1135
- * filters out mouse events that occur when mouse is stationary but
1136
- * the elements under the pointer are scrolled.
1137
- */
1138
- function installFilteredMouseMove(element) {
1139
- element.on("mousemove", function (e) {
1140
- var lastpos = lastMousePosition;
1141
- if (lastpos === undefined || lastpos.x !== e.pageX || lastpos.y !== e.pageY) {
1142
- $(e.target).trigger("mousemove-filtered", e);
1143
- }
1144
- });
1145
- }
1146
-
1147
- /**
1148
- * Debounces a function. Returns a function that calls the original fn function only if no invocations have been made
1149
- * within the last quietMillis milliseconds.
1150
- *
1151
- * @param quietMillis number of milliseconds to wait before invoking fn
1152
- * @param fn function to be debounced
1153
- * @param ctx object to be used as this reference within fn
1154
- * @return debounced version of fn
1155
- */
1156
- function debounce(quietMillis, fn, ctx) {
1157
- ctx = ctx || undefined;
1158
- var timeout;
1159
- return function () {
1160
- var args = arguments;
1161
- window.clearTimeout(timeout);
1162
- timeout = window.setTimeout(function() {
1163
- fn.apply(ctx, args);
1164
- }, quietMillis);
1165
- };
1166
- }
1167
-
1168
- function installDebouncedScroll(threshold, element) {
1169
- var notify = debounce(threshold, function (e) { element.trigger("scroll-debounced", e);});
1170
- element.on("scroll", function (e) {
1171
- if (indexOf(e.target, element.get()) >= 0) notify(e);
1172
- });
1173
- }
1174
-
1175
- function focus($el) {
1176
- if ($el[0] === document.activeElement) return;
1177
-
1178
- /* set the focus in a 0 timeout - that way the focus is set after the processing
1179
- of the current event has finished - which seems like the only reliable way
1180
- to set focus */
1181
- window.setTimeout(function() {
1182
- var el=$el[0], pos=$el.val().length, range;
1183
-
1184
- $el.focus();
1185
-
1186
- /* make sure el received focus so we do not error out when trying to manipulate the caret.
1187
- sometimes modals or others listeners may steal it after its set */
1188
- var isVisible = (el.offsetWidth > 0 || el.offsetHeight > 0);
1189
- if (isVisible && el === document.activeElement) {
1190
-
1191
- /* after the focus is set move the caret to the end, necessary when we val()
1192
- just before setting focus */
1193
- if(el.setSelectionRange)
1194
- {
1195
- el.setSelectionRange(pos, pos);
1196
- }
1197
- else if (el.createTextRange) {
1198
- range = el.createTextRange();
1199
- range.collapse(false);
1200
- range.select();
1201
- }
1202
- }
1203
- }, 0);
1204
- }
1205
-
1206
- function getCursorInfo(el) {
1207
- el = $(el)[0];
1208
- var offset = 0;
1209
- var length = 0;
1210
- if ('selectionStart' in el) {
1211
- offset = el.selectionStart;
1212
- length = el.selectionEnd - offset;
1213
- } else if ('selection' in document) {
1214
- el.focus();
1215
- var sel = document.selection.createRange();
1216
- length = document.selection.createRange().text.length;
1217
- sel.moveStart('character', -el.value.length);
1218
- offset = sel.text.length - length;
1219
- }
1220
- return { offset: offset, length: length };
1221
- }
1222
-
1223
- function killEvent(event) {
1224
- event.preventDefault();
1225
- event.stopPropagation();
1226
- }
1227
- function killEventImmediately(event) {
1228
- event.preventDefault();
1229
- event.stopImmediatePropagation();
1230
- }
1231
-
1232
- function measureTextWidth(e) {
1233
- if (!sizer){
1234
- var style = e[0].currentStyle || window.getComputedStyle(e[0], null);
1235
- sizer = $(document.createElement("div")).css({
1236
- position: "absolute",
1237
- left: "-10000px",
1238
- top: "-10000px",
1239
- display: "none",
1240
- fontSize: style.fontSize,
1241
- fontFamily: style.fontFamily,
1242
- fontStyle: style.fontStyle,
1243
- fontWeight: style.fontWeight,
1244
- letterSpacing: style.letterSpacing,
1245
- textTransform: style.textTransform,
1246
- whiteSpace: "nowrap"
1247
- });
1248
- sizer.attr("class","select2-sizer");
1249
- $("body").append(sizer);
1250
- }
1251
- sizer.text(e.val());
1252
- return sizer.width();
1253
- }
1254
-
1255
- function syncCssClasses(dest, src, adapter) {
1256
- var classes, replacements = [], adapted;
1257
-
1258
- classes = dest.attr("class");
1259
- if (classes) {
1260
- classes = '' + classes; // for IE which returns object
1261
- $(classes.split(" ")).each2(function() {
1262
- if (this.indexOf("select2-") === 0) {
1263
- replacements.push(this);
1264
- }
1265
- });
1266
- }
1267
- classes = src.attr("class");
1268
- if (classes) {
1269
- classes = '' + classes; // for IE which returns object
1270
- $(classes.split(" ")).each2(function() {
1271
- if (this.indexOf("select2-") !== 0) {
1272
- adapted = adapter(this);
1273
- if (adapted) {
1274
- replacements.push(adapted);
1275
- }
1276
- }
1277
- });
1278
- }
1279
- dest.attr("class", replacements.join(" "));
1280
- }
1281
-
1282
-
1283
- function markMatch(text, term, markup, escapeMarkup) {
1284
- var match=stripDiacritics(text.toUpperCase()).indexOf(stripDiacritics(term.toUpperCase())),
1285
- tl=term.length;
1286
-
1287
- if (match<0) {
1288
- markup.push(escapeMarkup(text));
1289
- return;
1290
- }
1291
-
1292
- markup.push(escapeMarkup(text.substring(0, match)));
1293
- markup.push("<span class='select2-match'>");
1294
- markup.push(escapeMarkup(text.substring(match, match + tl)));
1295
- markup.push("</span>");
1296
- markup.push(escapeMarkup(text.substring(match + tl, text.length)));
1297
- }
1298
-
1299
- function defaultEscapeMarkup(markup) {
1300
- var replace_map = {
1301
- '\\': '&#92;',
1302
- '&': '&amp;',
1303
- '<': '&lt;',
1304
- '>': '&gt;',
1305
- '"': '&quot;',
1306
- "'": '&#39;',
1307
- "/": '&#47;'
1308
- };
1309
-
1310
- return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
1311
- return replace_map[match];
1312
- });
1313
- }
1314
-
1315
- /**
1316
- * Produces an ajax-based query function
1317
- *
1318
- * @param options object containing configuration parameters
1319
- * @param options.params parameter map for the transport ajax call, can contain such options as cache, jsonpCallback, etc. see $.ajax
1320
- * @param options.transport function that will be used to execute the ajax request. must be compatible with parameters supported by $.ajax
1321
- * @param options.url url for the data
1322
- * @param options.data a function(searchTerm, pageNumber, context) that should return an object containing query string parameters for the above url.
1323
- * @param options.dataType request data type: ajax, jsonp, other datatypes supported by jQuery's $.ajax function or the transport function if specified
1324
- * @param options.quietMillis (optional) milliseconds to wait before making the ajaxRequest, helps debounce the ajax function if invoked too often
1325
- * @param options.results a function(remoteData, pageNumber) that converts data returned form the remote request to the format expected by Select2.
1326
- * The expected format is an object containing the following keys:
1327
- * results array of objects that will be used as choices
1328
- * more (optional) boolean indicating whether there are more results available
1329
- * Example: {results:[{id:1, text:'Red'},{id:2, text:'Blue'}], more:true}
1330
- */
1331
- function ajax(options) {
1332
- var timeout, // current scheduled but not yet executed request
1333
- handler = null,
1334
- quietMillis = options.quietMillis || 100,
1335
- ajaxUrl = options.url,
1336
- self = this;
1337
-
1338
- return function (query) {
1339
- window.clearTimeout(timeout);
1340
- timeout = window.setTimeout(function () {
1341
- var data = options.data, // ajax data function
1342
- url = ajaxUrl, // ajax url string or function
1343
- transport = options.transport || $.fn.select2.ajaxDefaults.transport,
1344
- // deprecated - to be removed in 4.0 - use params instead
1345
- deprecated = {
1346
- type: options.type || 'GET', // set type of request (GET or POST)
1347
- cache: options.cache || false,
1348
- jsonpCallback: options.jsonpCallback||undefined,
1349
- dataType: options.dataType||"json"
1350
- },
1351
- params = $.extend({}, $.fn.select2.ajaxDefaults.params, deprecated);
1352
-
1353
- data = data ? data.call(self, query.term, query.page, query.context) : null;
1354
- url = (typeof url === 'function') ? url.call(self, query.term, query.page, query.context) : url;
1355
-
1356
- if (handler && typeof handler.abort === "function") { handler.abort(); }
1357
-
1358
- if (options.params) {
1359
- if ($.isFunction(options.params)) {
1360
- $.extend(params, options.params.call(self));
1361
- } else {
1362
- $.extend(params, options.params);
1363
- }
1364
- }
1365
-
1366
- $.extend(params, {
1367
- url: url,
1368
- dataType: options.dataType,
1369
- data: data,
1370
- success: function (data) {
1371
- // TODO - replace query.page with query so users have access to term, page, etc.
1372
- var results = options.results(data, query.page);
1373
- query.callback(results);
1374
- }
1375
- });
1376
- handler = transport.call(self, params);
1377
- }, quietMillis);
1378
- };
1379
- }
1380
-
1381
- /**
1382
- * Produces a query function that works with a local array
1383
- *
1384
- * @param options object containing configuration parameters. The options parameter can either be an array or an
1385
- * object.
1386
- *
1387
- * If the array form is used it is assumed that it contains objects with 'id' and 'text' keys.
1388
- *
1389
- * If the object form is used it is assumed that it contains 'data' and 'text' keys. The 'data' key should contain
1390
- * an array of objects that will be used as choices. These objects must contain at least an 'id' key. The 'text'
1391
- * key can either be a String in which case it is expected that each element in the 'data' array has a key with the
1392
- * value of 'text' which will be used to match choices. Alternatively, text can be a function(item) that can extract
1393
- * the text.
1394
- */
1395
- function local(options) {
1396
- var data = options, // data elements
1397
- dataText,
1398
- tmp,
1399
- text = function (item) { return ""+item.text; }; // function used to retrieve the text portion of a data item that is matched against the search
1400
-
1401
- if ($.isArray(data)) {
1402
- tmp = data;
1403
- data = { results: tmp };
1404
- }
1405
-
1406
- if ($.isFunction(data) === false) {
1407
- tmp = data;
1408
- data = function() { return tmp; };
1409
- }
1410
-
1411
- var dataItem = data();
1412
- if (dataItem.text) {
1413
- text = dataItem.text;
1414
- // if text is not a function we assume it to be a key name
1415
- if (!$.isFunction(text)) {
1416
- dataText = dataItem.text; // we need to store this in a separate variable because in the next step data gets reset and data.text is no longer available
1417
- text = function (item) { return item[dataText]; };
1418
- }
1419
- }
1420
-
1421
- return function (query) {
1422
- var t = query.term, filtered = { results: [] }, process;
1423
- if (t === "") {
1424
- query.callback(data());
1425
- return;
1426
- }
1427
-
1428
- process = function(datum, collection) {
1429
- var group, attr;
1430
- datum = datum[0];
1431
- if (datum.children) {
1432
- group = {};
1433
- for (attr in datum) {
1434
- if (datum.hasOwnProperty(attr)) group[attr]=datum[attr];
1435
- }
1436
- group.children=[];
1437
- $(datum.children).each2(function(i, childDatum) { process(childDatum, group.children); });
1438
- if (group.children.length || query.matcher(t, text(group), datum)) {
1439
- collection.push(group);
1440
- }
1441
- } else {
1442
- if (query.matcher(t, text(datum), datum)) {
1443
- collection.push(datum);
1444
- }
1445
- }
1446
- };
1447
-
1448
- $(data().results).each2(function(i, datum) { process(datum, filtered.results); });
1449
- query.callback(filtered);
1450
- };
1451
- }
1452
-
1453
- // TODO javadoc
1454
- function tags(data) {
1455
- var isFunc = $.isFunction(data);
1456
- return function (query) {
1457
- var t = query.term, filtered = {results: []};
1458
- var result = isFunc ? data(query) : data;
1459
- if ($.isArray(result)) {
1460
- $(result).each(function () {
1461
- var isObject = this.text !== undefined,
1462
- text = isObject ? this.text : this;
1463
- if (t === "" || query.matcher(t, text)) {
1464
- filtered.results.push(isObject ? this : {id: this, text: this});
1465
- }
1466
- });
1467
- query.callback(filtered);
1468
- }
1469
- };
1470
- }
1471
-
1472
- /**
1473
- * Checks if the formatter function should be used.
1474
- *
1475
- * Throws an error if it is not a function. Returns true if it should be used,
1476
- * false if no formatting should be performed.
1477
- *
1478
- * @param formatter
1479
- */
1480
- function checkFormatter(formatter, formatterName) {
1481
- if ($.isFunction(formatter)) return true;
1482
- if (!formatter) return false;
1483
- if (typeof(formatter) === 'string') return true;
1484
- throw new Error(formatterName +" must be a string, function, or falsy value");
1485
- }
1486
-
1487
- function evaluate(val) {
1488
- if ($.isFunction(val)) {
1489
- var args = Array.prototype.slice.call(arguments, 1);
1490
- return val.apply(null, args);
1491
- }
1492
- return val;
1493
- }
1494
-
1495
- function countResults(results) {
1496
- var count = 0;
1497
- $.each(results, function(i, item) {
1498
- if (item.children) {
1499
- count += countResults(item.children);
1500
- } else {
1501
- count++;
1502
- }
1503
- });
1504
- return count;
1505
- }
1506
-
1507
- /**
1508
- * Default tokenizer. This function uses breaks the input on substring match of any string from the
1509
- * opts.tokenSeparators array and uses opts.createSearchChoice to create the choice object. Both of those
1510
- * two options have to be defined in order for the tokenizer to work.
1511
- *
1512
- * @param input text user has typed so far or pasted into the search field
1513
- * @param selection currently selected choices
1514
- * @param selectCallback function(choice) callback tho add the choice to selection
1515
- * @param opts select2's opts
1516
- * @return undefined/null to leave the current input unchanged, or a string to change the input to the returned value
1517
- */
1518
- function defaultTokenizer(input, selection, selectCallback, opts) {
1519
- var original = input, // store the original so we can compare and know if we need to tell the search to update its text
1520
- dupe = false, // check for whether a token we extracted represents a duplicate selected choice
1521
- token, // token
1522
- index, // position at which the separator was found
1523
- i, l, // looping variables
1524
- separator; // the matched separator
1525
-
1526
- if (!opts.createSearchChoice || !opts.tokenSeparators || opts.tokenSeparators.length < 1) return undefined;
1527
-
1528
- while (true) {
1529
- index = -1;
1530
-
1531
- for (i = 0, l = opts.tokenSeparators.length; i < l; i++) {
1532
- separator = opts.tokenSeparators[i];
1533
- index = input.indexOf(separator);
1534
- if (index >= 0) break;
1535
- }
1536
-
1537
- if (index < 0) break; // did not find any token separator in the input string, bail
1538
-
1539
- token = input.substring(0, index);
1540
- input = input.substring(index + separator.length);
1541
-
1542
- if (token.length > 0) {
1543
- token = opts.createSearchChoice.call(this, token, selection);
1544
- if (token !== undefined && token !== null && opts.id(token) !== undefined && opts.id(token) !== null) {
1545
- dupe = false;
1546
- for (i = 0, l = selection.length; i < l; i++) {
1547
- if (equal(opts.id(token), opts.id(selection[i]))) {
1548
- dupe = true; break;
1549
- }
1550
- }
1551
-
1552
- if (!dupe) selectCallback(token);
1553
- }
1554
- }
1555
- }
1556
-
1557
- if (original!==input) return input;
1558
- }
1559
-
1560
- function cleanupJQueryElements() {
1561
- var self = this;
1562
-
1563
- Array.prototype.forEach.call(arguments, function (element) {
1564
- self[element].remove();
1565
- self[element] = null;
1566
- });
1567
- }
1568
-
1569
- /**
1570
- * Creates a new class
1571
- *
1572
- * @param superClass
1573
- * @param methods
1574
- */
1575
- function clazz(SuperClass, methods) {
1576
- var constructor = function () {};
1577
- constructor.prototype = new SuperClass;
1578
- constructor.prototype.constructor = constructor;
1579
- constructor.prototype.parent = SuperClass.prototype;
1580
- constructor.prototype = $.extend(constructor.prototype, methods);
1581
- return constructor;
1582
- }
1583
-
1584
- AbstractSelect2 = clazz(Object, {
1585
-
1586
- // abstract
1587
- bind: function (func) {
1588
- var self = this;
1589
- return function () {
1590
- func.apply(self, arguments);
1591
- };
1592
- },
1593
-
1594
- // abstract
1595
- init: function (opts) {
1596
- var results, search, resultsSelector = ".select2-results";
1597
-
1598
- // prepare options
1599
- this.opts = opts = this.prepareOpts(opts);
1600
-
1601
- this.id=opts.id;
1602
-
1603
- // destroy if called on an existing component
1604
- if (opts.element.data("select2") !== undefined &&
1605
- opts.element.data("select2") !== null) {
1606
- opts.element.data("select2").destroy();
1607
- }
1608
-
1609
- this.container = this.createContainer();
1610
-
1611
- this.liveRegion = $("<span>", {
1612
- role: "status",
1613
- "aria-live": "polite"
1614
- })
1615
- .addClass("select2-hidden-accessible")
1616
- .appendTo(document.body);
1617
-
1618
- this.containerId="s2id_"+(opts.element.attr("id") || "autogen"+nextUid());
1619
- this.containerEventName= this.containerId
1620
- .replace(/([.])/g, '_')
1621
- .replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g, '\\$1');
1622
- this.container.attr("id", this.containerId);
1623
-
1624
- this.container.attr("title", opts.element.attr("title"));
1625
-
1626
- this.body = $("body");
1627
-
1628
- syncCssClasses(this.container, this.opts.element, this.opts.adaptContainerCssClass);
1629
-
1630
- this.container.attr("style", opts.element.attr("style"));
1631
- this.container.css(evaluate(opts.containerCss));
1632
- this.container.addClass(evaluate(opts.containerCssClass));
1633
-
1634
- this.elementTabIndex = this.opts.element.attr("tabindex");
1635
-
1636
- // swap container for the element
1637
- this.opts.element
1638
- .data("select2", this)
1639
- .attr("tabindex", "-1")
1640
- .before(this.container)
1641
- .on("click.select2", killEvent); // do not leak click events
1642
-
1643
- this.container.data("select2", this);
1644
-
1645
- this.dropdown = this.container.find(".select2-drop");
1646
-
1647
- syncCssClasses(this.dropdown, this.opts.element, this.opts.adaptDropdownCssClass);
1648
-
1649
- this.dropdown.addClass(evaluate(opts.dropdownCssClass));
1650
- this.dropdown.data("select2", this);
1651
- this.dropdown.on("click", killEvent);
1652
-
1653
- this.results = results = this.container.find(resultsSelector);
1654
- this.search = search = this.container.find("input.select2-input");
1655
-
1656
- this.queryCount = 0;
1657
- this.resultsPage = 0;
1658
- this.context = null;
1659
-
1660
- // initialize the container
1661
- this.initContainer();
1662
-
1663
- this.container.on("click", killEvent);
1664
-
1665
- installFilteredMouseMove(this.results);
1666
-
1667
- this.dropdown.on("mousemove-filtered", resultsSelector, this.bind(this.highlightUnderEvent));
1668
- this.dropdown.on("touchstart touchmove touchend", resultsSelector, this.bind(function (event) {
1669
- this._touchEvent = true;
1670
- this.highlightUnderEvent(event);
1671
- }));
1672
- this.dropdown.on("touchmove", resultsSelector, this.bind(this.touchMoved));
1673
- this.dropdown.on("touchstart touchend", resultsSelector, this.bind(this.clearTouchMoved));
1674
-
1675
- // Waiting for a click event on touch devices to select option and hide dropdown
1676
- // otherwise click will be triggered on an underlying element
1677
- this.dropdown.on('click', this.bind(function (event) {
1678
- if (this._touchEvent) {
1679
- this._touchEvent = false;
1680
- this.selectHighlighted();
1681
- }
1682
- }));
1683
-
1684
- installDebouncedScroll(80, this.results);
1685
- this.dropdown.on("scroll-debounced", resultsSelector, this.bind(this.loadMoreIfNeeded));
1686
-
1687
- // do not propagate change event from the search field out of the component
1688
- $(this.container).on("change", ".select2-input", function(e) {e.stopPropagation();});
1689
- $(this.dropdown).on("change", ".select2-input", function(e) {e.stopPropagation();});
1690
-
1691
- // if jquery.mousewheel plugin is installed we can prevent out-of-bounds scrolling of results via mousewheel
1692
- if ($.fn.mousewheel) {
1693
- results.mousewheel(function (e, delta, deltaX, deltaY) {
1694
- var top = results.scrollTop();
1695
- if (deltaY > 0 && top - deltaY <= 0) {
1696
- results.scrollTop(0);
1697
- killEvent(e);
1698
- } else if (deltaY < 0 && results.get(0).scrollHeight - results.scrollTop() + deltaY <= results.height()) {
1699
- results.scrollTop(results.get(0).scrollHeight - results.height());
1700
- killEvent(e);
1701
- }
1702
- });
1703
- }
1704
-
1705
- installKeyUpChangeEvent(search);
1706
- search.on("keyup-change input paste", this.bind(this.updateResults));
1707
- search.on("focus", function () { search.addClass("select2-focused"); });
1708
- search.on("blur", function () { search.removeClass("select2-focused");});
1709
-
1710
- this.dropdown.on("mouseup", resultsSelector, this.bind(function (e) {
1711
- if ($(e.target).closest(".select2-result-selectable").length > 0) {
1712
- this.highlightUnderEvent(e);
1713
- this.selectHighlighted(e);
1714
- }
1715
- }));
1716
-
1717
- // trap all mouse events from leaving the dropdown. sometimes there may be a modal that is listening
1718
- // for mouse events outside of itself so it can close itself. since the dropdown is now outside the select2's
1719
- // dom it will trigger the popup close, which is not what we want
1720
- // focusin can cause focus wars between modals and select2 since the dropdown is outside the modal.
1721
- this.dropdown.on("click mouseup mousedown touchstart touchend focusin", function (e) { e.stopPropagation(); });
1722
-
1723
- this.nextSearchTerm = undefined;
1724
-
1725
- if ($.isFunction(this.opts.initSelection)) {
1726
- // initialize selection based on the current value of the source element
1727
- this.initSelection();
1728
-
1729
- // if the user has provided a function that can set selection based on the value of the source element
1730
- // we monitor the change event on the element and trigger it, allowing for two way synchronization
1731
- this.monitorSource();
1732
- }
1733
-
1734
- if (opts.maximumInputLength !== null) {
1735
- this.search.attr("maxlength", opts.maximumInputLength);
1736
- }
1737
-
1738
- var disabled = opts.element.prop("disabled");
1739
- if (disabled === undefined) disabled = false;
1740
- this.enable(!disabled);
1741
-
1742
- var readonly = opts.element.prop("readonly");
1743
- if (readonly === undefined) readonly = false;
1744
- this.readonly(readonly);
1745
-
1746
- // Calculate size of scrollbar
1747
- scrollBarDimensions = scrollBarDimensions || measureScrollbar();
1748
-
1749
- this.autofocus = opts.element.prop("autofocus");
1750
- opts.element.prop("autofocus", false);
1751
- if (this.autofocus) this.focus();
1752
-
1753
- this.search.attr("placeholder", opts.searchInputPlaceholder);
1754
- },
1755
-
1756
- // abstract
1757
- destroy: function () {
1758
- var element=this.opts.element, select2 = element.data("select2");
1759
-
1760
- this.close();
1761
-
1762
- if (this.propertyObserver) {
1763
- this.propertyObserver.disconnect();
1764
- this.propertyObserver = null;
1765
- }
1766
-
1767
- if (select2 !== undefined) {
1768
- select2.container.remove();
1769
- select2.liveRegion.remove();
1770
- select2.dropdown.remove();
1771
- element
1772
- .removeClass("select2-offscreen")
1773
- .removeData("select2")
1774
- .off(".select2")
1775
- .prop("autofocus", this.autofocus || false);
1776
- if (this.elementTabIndex) {
1777
- element.attr({tabindex: this.elementTabIndex});
1778
- } else {
1779
- element.removeAttr("tabindex");
1780
- }
1781
- element.show();
1782
- }
1783
-
1784
- cleanupJQueryElements.call(this,
1785
- "container",
1786
- "liveRegion",
1787
- "dropdown",
1788
- "results",
1789
- "search"
1790
- );
1791
- },
1792
-
1793
- // abstract
1794
- optionToData: function(element) {
1795
- if (element.is("option")) {
1796
- return {
1797
- id:element.prop("value"),
1798
- text:element.text(),
1799
- element: element.get(),
1800
- css: element.attr("class"),
1801
- disabled: element.prop("disabled"),
1802
- locked: equal(element.attr("locked"), "locked") || equal(element.data("locked"), true)
1803
- };
1804
- } else if (element.is("optgroup")) {
1805
- return {
1806
- text:element.attr("label"),
1807
- children:[],
1808
- element: element.get(),
1809
- css: element.attr("class")
1810
- };
1811
- }
1812
- },
1813
-
1814
- // abstract
1815
- prepareOpts: function (opts) {
1816
- var element, select, idKey, ajaxUrl, self = this;
1817
-
1818
- element = opts.element;
1819
-
1820
- if (element.get(0).tagName.toLowerCase() === "select") {
1821
- this.select = select = opts.element;
1822
- }
1823
-
1824
- if (select) {
1825
- // these options are not allowed when attached to a select because they are picked up off the element itself
1826
- $.each(["id", "multiple", "ajax", "query", "createSearchChoice", "initSelection", "data", "tags"], function () {
1827
- if (this in opts) {
1828
- throw new Error("Option '" + this + "' is not allowed for Select2 when attached to a <select> element.");
1829
- }
1830
- });
1831
- }
1832
-
1833
- opts = $.extend({}, {
1834
- populateResults: function(container, results, query) {
1835
- var populate, id=this.opts.id, liveRegion=this.liveRegion;
1836
-
1837
- populate=function(results, container, depth) {
1838
-
1839
- var i, l, result, selectable, disabled, compound, node, label, innerContainer, formatted;
1840
-
1841
- results = opts.sortResults(results, container, query);
1842
-
1843
- for (i = 0, l = results.length; i < l; i = i + 1) {
1844
-
1845
- result=results[i];
1846
-
1847
- disabled = (result.disabled === true);
1848
- selectable = (!disabled) && (id(result) !== undefined);
1849
-
1850
- compound=result.children && result.children.length > 0;
1851
-
1852
- node=$("<li></li>");
1853
- node.addClass("select2-results-dept-"+depth);
1854
- node.addClass("select2-result");
1855
- node.addClass(selectable ? "select2-result-selectable" : "select2-result-unselectable");
1856
- if (disabled) { node.addClass("select2-disabled"); }
1857
- if (compound) { node.addClass("select2-result-with-children"); }
1858
- node.addClass(self.opts.formatResultCssClass(result));
1859
- node.attr("role", "presentation");
1860
-
1861
- label=$(document.createElement("div"));
1862
- label.addClass("select2-result-label");
1863
- label.attr("id", "select2-result-label-" + nextUid());
1864
- label.attr("role", "option");
1865
-
1866
- formatted=opts.formatResult(result, label, query, self.opts.escapeMarkup);
1867
- if (formatted!==undefined) {
1868
- label.html(formatted);
1869
- node.append(label);
1870
- }
1871
-
1872
-
1873
- if (compound) {
1874
-
1875
- innerContainer=$("<ul></ul>");
1876
- innerContainer.addClass("select2-result-sub");
1877
- populate(result.children, innerContainer, depth+1);
1878
- node.append(innerContainer);
1879
- }
1880
-
1881
- node.data("select2-data", result);
1882
- container.append(node);
1883
- }
1884
-
1885
- liveRegion.text(opts.formatMatches(results.length));
1886
- };
1887
-
1888
- populate(results, container, 0);
1889
- }
1890
- }, $.fn.select2.defaults, opts);
1891
-
1892
- if (typeof(opts.id) !== "function") {
1893
- idKey = opts.id;
1894
- opts.id = function (e) { return e[idKey]; };
1895
- }
1896
-
1897
- if ($.isArray(opts.element.data("select2Tags"))) {
1898
- if ("tags" in opts) {
1899
- throw "tags specified as both an attribute 'data-select2-tags' and in options of Select2 " + opts.element.attr("id");
1900
- }
1901
- opts.tags=opts.element.data("select2Tags");
1902
- }
1903
-
1904
- if (select) {
1905
- opts.query = this.bind(function (query) {
1906
- var data = { results: [], more: false },
1907
- term = query.term,
1908
- children, placeholderOption, process;
1909
-
1910
- process=function(element, collection) {
1911
- var group;
1912
- if (element.is("option")) {
1913
- if (query.matcher(term, element.text(), element)) {
1914
- collection.push(self.optionToData(element));
1915
- }
1916
- } else if (element.is("optgroup")) {
1917
- group=self.optionToData(element);
1918
- element.children().each2(function(i, elm) { process(elm, group.children); });
1919
- if (group.children.length>0) {
1920
- collection.push(group);
1921
- }
1922
- }
1923
- };
1924
-
1925
- children=element.children();
1926
-
1927
- // ignore the placeholder option if there is one
1928
- if (this.getPlaceholder() !== undefined && children.length > 0) {
1929
- placeholderOption = this.getPlaceholderOption();
1930
- if (placeholderOption) {
1931
- children=children.not(placeholderOption);
1932
- }
1933
- }
1934
-
1935
- children.each2(function(i, elm) { process(elm, data.results); });
1936
-
1937
- query.callback(data);
1938
- });
1939
- // this is needed because inside val() we construct choices from options and there id is hardcoded
1940
- opts.id=function(e) { return e.id; };
1941
- } else {
1942
- if (!("query" in opts)) {
1943
-
1944
- if ("ajax" in opts) {
1945
- ajaxUrl = opts.element.data("ajax-url");
1946
- if (ajaxUrl && ajaxUrl.length > 0) {
1947
- opts.ajax.url = ajaxUrl;
1948
- }
1949
- opts.query = ajax.call(opts.element, opts.ajax);
1950
- } else if ("data" in opts) {
1951
- opts.query = local(opts.data);
1952
- } else if ("tags" in opts) {
1953
- opts.query = tags(opts.tags);
1954
- if (opts.createSearchChoice === undefined) {
1955
- opts.createSearchChoice = function (term) { return {id: $.trim(term), text: $.trim(term)}; };
1956
- }
1957
- if (opts.initSelection === undefined) {
1958
- opts.initSelection = function (element, callback) {
1959
- var data = [];
1960
- $(splitVal(element.val(), opts.separator)).each(function () {
1961
- var obj = { id: this, text: this },
1962
- tags = opts.tags;
1963
- if ($.isFunction(tags)) tags=tags();
1964
- $(tags).each(function() { if (equal(this.id, obj.id)) { obj = this; return false; } });
1965
- data.push(obj);
1966
- });
1967
-
1968
- callback(data);
1969
- };
1970
- }
1971
- }
1972
- }
1973
- }
1974
- if (typeof(opts.query) !== "function") {
1975
- throw "query function not defined for Select2 " + opts.element.attr("id");
1976
- }
1977
-
1978
- if (opts.createSearchChoicePosition === 'top') {
1979
- opts.createSearchChoicePosition = function(list, item) { list.unshift(item); };
1980
- }
1981
- else if (opts.createSearchChoicePosition === 'bottom') {
1982
- opts.createSearchChoicePosition = function(list, item) { list.push(item); };
1983
- }
1984
- else if (typeof(opts.createSearchChoicePosition) !== "function") {
1985
- throw "invalid createSearchChoicePosition option must be 'top', 'bottom' or a custom function";
1986
- }
1987
-
1988
- return opts;
1989
- },
1990
-
1991
- /**
1992
- * Monitor the original element for changes and update select2 accordingly
1993
- */
1994
- // abstract
1995
- monitorSource: function () {
1996
- var el = this.opts.element, sync, observer;
1997
-
1998
- el.on("change.select2", this.bind(function (e) {
1999
- if (this.opts.element.data("select2-change-triggered") !== true) {
2000
- this.initSelection();
2001
- }
2002
- }));
2003
-
2004
- sync = this.bind(function () {
2005
-
2006
- // sync enabled state
2007
- var disabled = el.prop("disabled");
2008
- if (disabled === undefined) disabled = false;
2009
- this.enable(!disabled);
2010
-
2011
- var readonly = el.prop("readonly");
2012
- if (readonly === undefined) readonly = false;
2013
- this.readonly(readonly);
2014
-
2015
- syncCssClasses(this.container, this.opts.element, this.opts.adaptContainerCssClass);
2016
- this.container.addClass(evaluate(this.opts.containerCssClass));
2017
-
2018
- syncCssClasses(this.dropdown, this.opts.element, this.opts.adaptDropdownCssClass);
2019
- this.dropdown.addClass(evaluate(this.opts.dropdownCssClass));
2020
-
2021
- });
2022
-
2023
- // IE8-10 (IE9/10 won't fire propertyChange via attachEventListener)
2024
- if (el.length && el[0].attachEvent) {
2025
- el.each(function() {
2026
- this.attachEvent("onpropertychange", sync);
2027
- });
2028
- }
2029
-
2030
- // safari, chrome, firefox, IE11
2031
- observer = window.MutationObserver || window.WebKitMutationObserver|| window.MozMutationObserver;
2032
- if (observer !== undefined) {
2033
- if (this.propertyObserver) { delete this.propertyObserver; this.propertyObserver = null; }
2034
- this.propertyObserver = new observer(function (mutations) {
2035
- mutations.forEach(sync);
2036
- });
2037
- this.propertyObserver.observe(el.get(0), { attributes:true, subtree:false });
2038
- }
2039
- },
2040
-
2041
- // abstract
2042
- triggerSelect: function(data) {
2043
- var evt = $.Event("select2-selecting", { val: this.id(data), object: data });
2044
- this.opts.element.trigger(evt);
2045
- return !evt.isDefaultPrevented();
2046
- },
2047
-
2048
- /**
2049
- * Triggers the change event on the source element
2050
- */
2051
- // abstract
2052
- triggerChange: function (details) {
2053
-
2054
- details = details || {};
2055
- details= $.extend({}, details, { type: "change", val: this.val() });
2056
- // prevents recursive triggering
2057
- this.opts.element.data("select2-change-triggered", true);
2058
- this.opts.element.trigger(details);
2059
- this.opts.element.data("select2-change-triggered", false);
2060
-
2061
- // some validation frameworks ignore the change event and listen instead to keyup, click for selects
2062
- // so here we trigger the click event manually
2063
- this.opts.element.click();
2064
-
2065
- // ValidationEngine ignores the change event and listens instead to blur
2066
- // so here we trigger the blur event manually if so desired
2067
- if (this.opts.blurOnChange)
2068
- this.opts.element.blur();
2069
- },
2070
-
2071
- //abstract
2072
- isInterfaceEnabled: function()
2073
- {
2074
- return this.enabledInterface === true;
2075
- },
2076
-
2077
- // abstract
2078
- enableInterface: function() {
2079
- var enabled = this._enabled && !this._readonly,
2080
- disabled = !enabled;
2081
-
2082
- if (enabled === this.enabledInterface) return false;
2083
-
2084
- this.container.toggleClass("select2-container-disabled", disabled);
2085
- this.close();
2086
- this.enabledInterface = enabled;
2087
-
2088
- return true;
2089
- },
2090
-
2091
- // abstract
2092
- enable: function(enabled) {
2093
- if (enabled === undefined) enabled = true;
2094
- if (this._enabled === enabled) return;
2095
- this._enabled = enabled;
2096
-
2097
- this.opts.element.prop("disabled", !enabled);
2098
- this.enableInterface();
2099
- },
2100
-
2101
- // abstract
2102
- disable: function() {
2103
- this.enable(false);
2104
- },
2105
-
2106
- // abstract
2107
- readonly: function(enabled) {
2108
- if (enabled === undefined) enabled = false;
2109
- if (this._readonly === enabled) return;
2110
- this._readonly = enabled;
2111
-
2112
- this.opts.element.prop("readonly", enabled);
2113
- this.enableInterface();
2114
- },
2115
-
2116
- // abstract
2117
- opened: function () {
2118
- return this.container.hasClass("select2-dropdown-open");
2119
- },
2120
-
2121
- // abstract
2122
- positionDropdown: function() {
2123
- var $dropdown = this.dropdown,
2124
- offset = this.container.offset(),
2125
- height = this.container.outerHeight(false),
2126
- width = this.container.outerWidth(false),
2127
- dropHeight = $dropdown.outerHeight(false),
2128
- $window = $(window),
2129
- windowWidth = $window.width(),
2130
- windowHeight = $window.height(),
2131
- viewPortRight = $window.scrollLeft() + windowWidth,
2132
- viewportBottom = $window.scrollTop() + windowHeight,
2133
- dropTop = offset.top + height,
2134
- dropLeft = offset.left,
2135
- enoughRoomBelow = dropTop + dropHeight <= viewportBottom,
2136
- enoughRoomAbove = (offset.top - dropHeight) >= $window.scrollTop(),
2137
- dropWidth = $dropdown.outerWidth(false),
2138
- enoughRoomOnRight = dropLeft + dropWidth <= viewPortRight,
2139
- aboveNow = $dropdown.hasClass("select2-drop-above"),
2140
- bodyOffset,
2141
- above,
2142
- changeDirection,
2143
- css,
2144
- resultsListNode;
2145
-
2146
- // always prefer the current above/below alignment, unless there is not enough room
2147
- if (aboveNow) {
2148
- above = true;
2149
- if (!enoughRoomAbove && enoughRoomBelow) {
2150
- changeDirection = true;
2151
- above = false;
2152
- }
2153
- } else {
2154
- above = false;
2155
- if (!enoughRoomBelow && enoughRoomAbove) {
2156
- changeDirection = true;
2157
- above = true;
2158
- }
2159
- }
2160
-
2161
- //if we are changing direction we need to get positions when dropdown is hidden;
2162
- if (changeDirection) {
2163
- $dropdown.hide();
2164
- offset = this.container.offset();
2165
- height = this.container.outerHeight(false);
2166
- width = this.container.outerWidth(false);
2167
- dropHeight = $dropdown.outerHeight(false);
2168
- viewPortRight = $window.scrollLeft() + windowWidth;
2169
- viewportBottom = $window.scrollTop() + windowHeight;
2170
- dropTop = offset.top + height;
2171
- dropLeft = offset.left;
2172
- dropWidth = $dropdown.outerWidth(false);
2173
- enoughRoomOnRight = dropLeft + dropWidth <= viewPortRight;
2174
- $dropdown.show();
2175
-
2176
- // fix so the cursor does not move to the left within the search-textbox in IE
2177
- this.focusSearch();
2178
- }
2179
-
2180
- if (this.opts.dropdownAutoWidth) {
2181
- resultsListNode = $('.select2-results', $dropdown)[0];
2182
- $dropdown.addClass('select2-drop-auto-width');
2183
- $dropdown.css('width', '');
2184
- // Add scrollbar width to dropdown if vertical scrollbar is present
2185
- dropWidth = $dropdown.outerWidth(false) + (resultsListNode.scrollHeight === resultsListNode.clientHeight ? 0 : scrollBarDimensions.width);
2186
- dropWidth > width ? width = dropWidth : dropWidth = width;
2187
- dropHeight = $dropdown.outerHeight(false);
2188
- enoughRoomOnRight = dropLeft + dropWidth <= viewPortRight;
2189
- }
2190
- else {
2191
- this.container.removeClass('select2-drop-auto-width');
2192
- }
2193
-
2194
- //console.log("below/ droptop:", dropTop, "dropHeight", dropHeight, "sum", (dropTop+dropHeight)+" viewport bottom", viewportBottom, "enough?", enoughRoomBelow);
2195
- //console.log("above/ offset.top", offset.top, "dropHeight", dropHeight, "top", (offset.top-dropHeight), "scrollTop", this.body.scrollTop(), "enough?", enoughRoomAbove);
2196
-
2197
- // fix positioning when body has an offset and is not position: static
2198
- if (this.body.css('position') !== 'static') {
2199
- bodyOffset = this.body.offset();
2200
- dropTop -= bodyOffset.top;
2201
- dropLeft -= bodyOffset.left;
2202
- }
2203
-
2204
- if (!enoughRoomOnRight) {
2205
- dropLeft = offset.left + this.container.outerWidth(false) - dropWidth;
2206
- }
2207
-
2208
- css = {
2209
- left: dropLeft,
2210
- width: width
2211
- };
2212
-
2213
- if (above) {
2214
- css.top = offset.top - dropHeight;
2215
- css.bottom = 'auto';
2216
- this.container.addClass("select2-drop-above");
2217
- $dropdown.addClass("select2-drop-above");
2218
- }
2219
- else {
2220
- css.top = dropTop;
2221
- css.bottom = 'auto';
2222
- this.container.removeClass("select2-drop-above");
2223
- $dropdown.removeClass("select2-drop-above");
2224
- }
2225
- css = $.extend(css, evaluate(this.opts.dropdownCss));
2226
-
2227
- $dropdown.css(css);
2228
- },
2229
-
2230
- // abstract
2231
- shouldOpen: function() {
2232
- var event;
2233
-
2234
- if (this.opened()) return false;
2235
-
2236
- if (this._enabled === false || this._readonly === true) return false;
2237
-
2238
- event = $.Event("select2-opening");
2239
- this.opts.element.trigger(event);
2240
- return !event.isDefaultPrevented();
2241
- },
2242
-
2243
- // abstract
2244
- clearDropdownAlignmentPreference: function() {
2245
- // clear the classes used to figure out the preference of where the dropdown should be opened
2246
- this.container.removeClass("select2-drop-above");
2247
- this.dropdown.removeClass("select2-drop-above");
2248
- },
2249
-
2250
- /**
2251
- * Opens the dropdown
2252
- *
2253
- * @return {Boolean} whether or not dropdown was opened. This method will return false if, for example,
2254
- * the dropdown is already open, or if the 'open' event listener on the element called preventDefault().
2255
- */
2256
- // abstract
2257
- open: function () {
2258
-
2259
- if (!this.shouldOpen()) return false;
2260
-
2261
- this.opening();
2262
-
2263
- return true;
2264
- },
2265
-
2266
- /**
2267
- * Performs the opening of the dropdown
2268
- */
2269
- // abstract
2270
- opening: function() {
2271
- var cid = this.containerEventName,
2272
- scroll = "scroll." + cid,
2273
- resize = "resize."+cid,
2274
- orient = "orientationchange."+cid,
2275
- mask;
2276
-
2277
- this.container.addClass("select2-dropdown-open").addClass("select2-container-active");
2278
-
2279
- this.clearDropdownAlignmentPreference();
2280
-
2281
- if(this.dropdown[0] !== this.body.children().last()[0]) {
2282
- this.dropdown.detach().appendTo(this.body);
2283
- }
2284
-
2285
- // create the dropdown mask if doesn't already exist
2286
- mask = $("#select2-drop-mask");
2287
- if (mask.length == 0) {
2288
- mask = $(document.createElement("div"));
2289
- mask.attr("id","select2-drop-mask").attr("class","select2-drop-mask");
2290
- mask.hide();
2291
- mask.appendTo(this.body);
2292
- mask.on("mousedown touchstart click", function (e) {
2293
- // Prevent IE from generating a click event on the body
2294
- reinsertElement(mask);
2295
-
2296
- var dropdown = $("#select2-drop"), self;
2297
- if (dropdown.length > 0) {
2298
- self=dropdown.data("select2");
2299
- if (self.opts.selectOnBlur) {
2300
- self.selectHighlighted({noFocus: true});
2301
- }
2302
- self.close();
2303
- e.preventDefault();
2304
- e.stopPropagation();
2305
- }
2306
- });
2307
- }
2308
-
2309
- // ensure the mask is always right before the dropdown
2310
- if (this.dropdown.prev()[0] !== mask[0]) {
2311
- this.dropdown.before(mask);
2312
- }
2313
-
2314
- // move the global id to the correct dropdown
2315
- $("#select2-drop").removeAttr("id");
2316
- this.dropdown.attr("id", "select2-drop");
2317
-
2318
- // show the elements
2319
- mask.show();
2320
-
2321
- this.positionDropdown();
2322
- this.dropdown.show();
2323
- this.positionDropdown();
2324
-
2325
- this.dropdown.addClass("select2-drop-active");
2326
-
2327
- // attach listeners to events that can change the position of the container and thus require
2328
- // the position of the dropdown to be updated as well so it does not come unglued from the container
2329
- var that = this;
2330
- this.container.parents().add(window).each(function () {
2331
- $(this).on(resize+" "+scroll+" "+orient, function (e) {
2332
- if (that.opened()) that.positionDropdown();
2333
- });
2334
- });
2335
-
2336
-
2337
- },
2338
-
2339
- // abstract
2340
- close: function () {
2341
- if (!this.opened()) return;
2342
-
2343
- var cid = this.containerEventName,
2344
- scroll = "scroll." + cid,
2345
- resize = "resize."+cid,
2346
- orient = "orientationchange."+cid;
2347
-
2348
- // unbind event listeners
2349
- this.container.parents().add(window).each(function () { $(this).off(scroll).off(resize).off(orient); });
2350
-
2351
- this.clearDropdownAlignmentPreference();
2352
-
2353
- $("#select2-drop-mask").hide();
2354
- this.dropdown.removeAttr("id"); // only the active dropdown has the select2-drop id
2355
- this.dropdown.hide();
2356
- this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active");
2357
- this.results.empty();
2358
-
2359
-
2360
- this.clearSearch();
2361
- this.search.removeClass("select2-active");
2362
- this.opts.element.trigger($.Event("select2-close"));
2363
- },
2364
-
2365
- /**
2366
- * Opens control, sets input value, and updates results.
2367
- */
2368
- // abstract
2369
- externalSearch: function (term) {
2370
- this.open();
2371
- this.search.val(term);
2372
- this.updateResults(false);
2373
- },
2374
-
2375
- // abstract
2376
- clearSearch: function () {
2377
-
2378
- },
2379
-
2380
- //abstract
2381
- getMaximumSelectionSize: function() {
2382
- return evaluate(this.opts.maximumSelectionSize);
2383
- },
2384
-
2385
- // abstract
2386
- ensureHighlightVisible: function () {
2387
- var results = this.results, children, index, child, hb, rb, y, more;
2388
-
2389
- index = this.highlight();
2390
-
2391
- if (index < 0) return;
2392
-
2393
- if (index == 0) {
2394
-
2395
- // if the first element is highlighted scroll all the way to the top,
2396
- // that way any unselectable headers above it will also be scrolled
2397
- // into view
2398
-
2399
- results.scrollTop(0);
2400
- return;
2401
- }
2402
-
2403
- children = this.findHighlightableChoices().find('.select2-result-label');
2404
-
2405
- child = $(children[index]);
2406
-
2407
- hb = child.offset().top + child.outerHeight(true);
2408
-
2409
- // if this is the last child lets also make sure select2-more-results is visible
2410
- if (index === children.length - 1) {
2411
- more = results.find("li.select2-more-results");
2412
- if (more.length > 0) {
2413
- hb = more.offset().top + more.outerHeight(true);
2414
- }
2415
- }
2416
-
2417
- rb = results.offset().top + results.outerHeight(true);
2418
- if (hb > rb) {
2419
- results.scrollTop(results.scrollTop() + (hb - rb));
2420
- }
2421
- y = child.offset().top - results.offset().top;
2422
-
2423
- // make sure the top of the element is visible
2424
- if (y < 0 && child.css('display') != 'none' ) {
2425
- results.scrollTop(results.scrollTop() + y); // y is negative
2426
- }
2427
- },
2428
-
2429
- // abstract
2430
- findHighlightableChoices: function() {
2431
- return this.results.find(".select2-result-selectable:not(.select2-disabled):not(.select2-selected)");
2432
- },
2433
-
2434
- // abstract
2435
- moveHighlight: function (delta) {
2436
- var choices = this.findHighlightableChoices(),
2437
- index = this.highlight();
2438
-
2439
- while (index > -1 && index < choices.length) {
2440
- index += delta;
2441
- var choice = $(choices[index]);
2442
- if (choice.hasClass("select2-result-selectable") && !choice.hasClass("select2-disabled") && !choice.hasClass("select2-selected")) {
2443
- this.highlight(index);
2444
- break;
2445
- }
2446
- }
2447
- },
2448
-
2449
- // abstract
2450
- highlight: function (index) {
2451
- var choices = this.findHighlightableChoices(),
2452
- choice,
2453
- data;
2454
-
2455
- if (arguments.length === 0) {
2456
- return indexOf(choices.filter(".select2-highlighted")[0], choices.get());
2457
- }
2458
-
2459
- if (index >= choices.length) index = choices.length - 1;
2460
- if (index < 0) index = 0;
2461
-
2462
- this.removeHighlight();
2463
-
2464
- choice = $(choices[index]);
2465
- choice.addClass("select2-highlighted");
2466
-
2467
- // ensure assistive technology can determine the active choice
2468
- this.search.attr("aria-activedescendant", choice.find(".select2-result-label").attr("id"));
2469
-
2470
- this.ensureHighlightVisible();
2471
-
2472
- this.liveRegion.text(choice.text());
2473
-
2474
- data = choice.data("select2-data");
2475
- if (data) {
2476
- this.opts.element.trigger({ type: "select2-highlight", val: this.id(data), choice: data });
2477
- }
2478
- },
2479
-
2480
- removeHighlight: function() {
2481
- this.results.find(".select2-highlighted").removeClass("select2-highlighted");
2482
- },
2483
-
2484
- touchMoved: function() {
2485
- this._touchMoved = true;
2486
- },
2487
-
2488
- clearTouchMoved: function() {
2489
- this._touchMoved = false;
2490
- },
2491
-
2492
- // abstract
2493
- countSelectableResults: function() {
2494
- return this.findHighlightableChoices().length;
2495
- },
2496
-
2497
- // abstract
2498
- highlightUnderEvent: function (event) {
2499
- var el = $(event.target).closest(".select2-result-selectable");
2500
- if (el.length > 0 && !el.is(".select2-highlighted")) {
2501
- var choices = this.findHighlightableChoices();
2502
- this.highlight(choices.index(el));
2503
- } else if (el.length == 0) {
2504
- // if we are over an unselectable item remove all highlights
2505
- this.removeHighlight();
2506
- }
2507
- },
2508
-
2509
- // abstract
2510
- loadMoreIfNeeded: function () {
2511
- var results = this.results,
2512
- more = results.find("li.select2-more-results"),
2513
- below, // pixels the element is below the scroll fold, below==0 is when the element is starting to be visible
2514
- page = this.resultsPage + 1,
2515
- self=this,
2516
- term=this.search.val(),
2517
- context=this.context;
2518
-
2519
- if (more.length === 0) return;
2520
- below = more.offset().top - results.offset().top - results.height();
2521
-
2522
- if (below <= this.opts.loadMorePadding) {
2523
- more.addClass("select2-active");
2524
- this.opts.query({
2525
- element: this.opts.element,
2526
- term: term,
2527
- page: page,
2528
- context: context,
2529
- matcher: this.opts.matcher,
2530
- callback: this.bind(function (data) {
2531
-
2532
- // ignore a response if the select2 has been closed before it was received
2533
- if (!self.opened()) return;
2534
-
2535
-
2536
- self.opts.populateResults.call(this, results, data.results, {term: term, page: page, context:context});
2537
- self.postprocessResults(data, false, false);
2538
-
2539
- if (data.more===true) {
2540
- more.detach().appendTo(results).text(evaluate(self.opts.formatLoadMore, page+1));
2541
- window.setTimeout(function() { self.loadMoreIfNeeded(); }, 10);
2542
- } else {
2543
- more.remove();
2544
- }
2545
- self.positionDropdown();
2546
- self.resultsPage = page;
2547
- self.context = data.context;
2548
- this.opts.element.trigger({ type: "select2-loaded", items: data });
2549
- })});
2550
- }
2551
- },
2552
-
2553
- /**
2554
- * Default tokenizer function which does nothing
2555
- */
2556
- tokenize: function() {
2557
-
2558
- },
2559
-
2560
- /**
2561
- * @param initial whether or not this is the call to this method right after the dropdown has been opened
2562
- */
2563
- // abstract
2564
- updateResults: function (initial) {
2565
- var search = this.search,
2566
- results = this.results,
2567
- opts = this.opts,
2568
- data,
2569
- self = this,
2570
- input,
2571
- term = search.val(),
2572
- lastTerm = $.data(this.container, "select2-last-term"),
2573
- // sequence number used to drop out-of-order responses
2574
- queryNumber;
2575
-
2576
- // prevent duplicate queries against the same term
2577
- if (initial !== true && lastTerm && equal(term, lastTerm)) return;
2578
-
2579
- $.data(this.container, "select2-last-term", term);
2580
-
2581
- // if the search is currently hidden we do not alter the results
2582
- if (initial !== true && (this.showSearchInput === false || !this.opened())) {
2583
- return;
2584
- }
2585
-
2586
- function postRender() {
2587
- search.removeClass("select2-active");
2588
- self.positionDropdown();
2589
- if (results.find('.select2-no-results,.select2-selection-limit,.select2-searching').length) {
2590
- self.liveRegion.text(results.text());
2591
- }
2592
- else {
2593
- self.liveRegion.text(self.opts.formatMatches(results.find('.select2-result-selectable').length));
2594
- }
2595
- }
2596
-
2597
- function render(html) {
2598
- results.html(html);
2599
- postRender();
2600
- }
2601
-
2602
- queryNumber = ++this.queryCount;
2603
-
2604
- var maxSelSize = this.getMaximumSelectionSize();
2605
- if (maxSelSize >=1) {
2606
- data = this.data();
2607
- if ($.isArray(data) && data.length >= maxSelSize && checkFormatter(opts.formatSelectionTooBig, "formatSelectionTooBig")) {
2608
- render("<li class='select2-selection-limit'>" + evaluate(opts.formatSelectionTooBig, maxSelSize) + "</li>");
2609
- return;
2610
- }
2611
- }
2612
-
2613
- if (search.val().length < opts.minimumInputLength) {
2614
- if (checkFormatter(opts.formatInputTooShort, "formatInputTooShort")) {
2615
- render("<li class='select2-no-results'>" + evaluate(opts.formatInputTooShort, search.val(), opts.minimumInputLength) + "</li>");
2616
- } else {
2617
- render("");
2618
- }
2619
- if (initial && this.showSearch) this.showSearch(true);
2620
- return;
2621
- }
2622
-
2623
- if (opts.maximumInputLength && search.val().length > opts.maximumInputLength) {
2624
- if (checkFormatter(opts.formatInputTooLong, "formatInputTooLong")) {
2625
- render("<li class='select2-no-results'>" + evaluate(opts.formatInputTooLong, search.val(), opts.maximumInputLength) + "</li>");
2626
- } else {
2627
- render("");
2628
- }
2629
- return;
2630
- }
2631
-
2632
- if (opts.formatSearching && this.findHighlightableChoices().length === 0) {
2633
- render("<li class='select2-searching'>" + evaluate(opts.formatSearching) + "</li>");
2634
- }
2635
-
2636
- search.addClass("select2-active");
2637
-
2638
- this.removeHighlight();
2639
-
2640
- // give the tokenizer a chance to pre-process the input
2641
- input = this.tokenize();
2642
- if (input != undefined && input != null) {
2643
- search.val(input);
2644
- }
2645
-
2646
- this.resultsPage = 1;
2647
-
2648
- opts.query({
2649
- element: opts.element,
2650
- term: search.val(),
2651
- page: this.resultsPage,
2652
- context: null,
2653
- matcher: opts.matcher,
2654
- callback: this.bind(function (data) {
2655
- var def; // default choice
2656
-
2657
- // ignore old responses
2658
- if (queryNumber != this.queryCount) {
2659
- return;
2660
- }
2661
-
2662
- // ignore a response if the select2 has been closed before it was received
2663
- if (!this.opened()) {
2664
- this.search.removeClass("select2-active");
2665
- return;
2666
- }
2667
-
2668
- // save context, if any
2669
- this.context = (data.context===undefined) ? null : data.context;
2670
- // create a default choice and prepend it to the list
2671
- if (this.opts.createSearchChoice && search.val() !== "") {
2672
- def = this.opts.createSearchChoice.call(self, search.val(), data.results);
2673
- if (def !== undefined && def !== null && self.id(def) !== undefined && self.id(def) !== null) {
2674
- if ($(data.results).filter(
2675
- function () {
2676
- return equal(self.id(this), self.id(def));
2677
- }).length === 0) {
2678
- this.opts.createSearchChoicePosition(data.results, def);
2679
- }
2680
- }
2681
- }
2682
-
2683
- if (data.results.length === 0 && checkFormatter(opts.formatNoMatches, "formatNoMatches")) {
2684
- render("<li class='select2-no-results'>" + evaluate(opts.formatNoMatches, search.val()) + "</li>");
2685
- return;
2686
- }
2687
-
2688
- results.empty();
2689
- self.opts.populateResults.call(this, results, data.results, {term: search.val(), page: this.resultsPage, context:null});
2690
-
2691
- if (data.more === true && checkFormatter(opts.formatLoadMore, "formatLoadMore")) {
2692
- results.append("<li class='select2-more-results'>" + self.opts.escapeMarkup(evaluate(opts.formatLoadMore, this.resultsPage)) + "</li>");
2693
- window.setTimeout(function() { self.loadMoreIfNeeded(); }, 10);
2694
- }
2695
-
2696
- this.postprocessResults(data, initial);
2697
-
2698
- postRender();
2699
-
2700
- this.opts.element.trigger({ type: "select2-loaded", items: data });
2701
- })});
2702
- },
2703
-
2704
- // abstract
2705
- cancel: function () {
2706
- this.close();
2707
- },
2708
-
2709
- // abstract
2710
- blur: function () {
2711
- // if selectOnBlur == true, select the currently highlighted option
2712
- if (this.opts.selectOnBlur)
2713
- this.selectHighlighted({noFocus: true});
2714
-
2715
- this.close();
2716
- this.container.removeClass("select2-container-active");
2717
- // synonymous to .is(':focus'), which is available in jquery >= 1.6
2718
- if (this.search[0] === document.activeElement) { this.search.blur(); }
2719
- this.clearSearch();
2720
- this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");
2721
- },
2722
-
2723
- // abstract
2724
- focusSearch: function () {
2725
- focus(this.search);
2726
- },
2727
-
2728
- // abstract
2729
- selectHighlighted: function (options) {
2730
- if (this._touchMoved) {
2731
- this.clearTouchMoved();
2732
- return;
2733
- }
2734
- var index=this.highlight(),
2735
- highlighted=this.results.find(".select2-highlighted"),
2736
- data = highlighted.closest('.select2-result').data("select2-data");
2737
-
2738
- if (data) {
2739
- this.highlight(index);
2740
- this.onSelect(data, options);
2741
- } else if (options && options.noFocus) {
2742
- this.close();
2743
- }
2744
- },
2745
-
2746
- // abstract
2747
- getPlaceholder: function () {
2748
- var placeholderOption;
2749
- return this.opts.element.attr("placeholder") ||
2750
- this.opts.element.attr("data-placeholder") || // jquery 1.4 compat
2751
- this.opts.element.data("placeholder") ||
2752
- this.opts.placeholder ||
2753
- ((placeholderOption = this.getPlaceholderOption()) !== undefined ? placeholderOption.text() : undefined);
2754
- },
2755
-
2756
- // abstract
2757
- getPlaceholderOption: function() {
2758
- if (this.select) {
2759
- var firstOption = this.select.children('option').first();
2760
- if (this.opts.placeholderOption !== undefined ) {
2761
- //Determine the placeholder option based on the specified placeholderOption setting
2762
- return (this.opts.placeholderOption === "first" && firstOption) ||
2763
- (typeof this.opts.placeholderOption === "function" && this.opts.placeholderOption(this.select));
2764
- } else if ($.trim(firstOption.text()) === "" && firstOption.val() === "") {
2765
- //No explicit placeholder option specified, use the first if it's blank
2766
- return firstOption;
2767
- }
2768
- }
2769
- },
2770
-
2771
- /**
2772
- * Get the desired width for the container element. This is
2773
- * derived first from option `width` passed to select2, then
2774
- * the inline 'style' on the original element, and finally
2775
- * falls back to the jQuery calculated element width.
2776
- */
2777
- // abstract
2778
- initContainerWidth: function () {
2779
- function resolveContainerWidth() {
2780
- var style, attrs, matches, i, l, attr;
2781
-
2782
- if (this.opts.width === "off") {
2783
- return null;
2784
- } else if (this.opts.width === "element"){
2785
- return this.opts.element.outerWidth(false) === 0 ? 'auto' : this.opts.element.outerWidth(false) + 'px';
2786
- } else if (this.opts.width === "copy" || this.opts.width === "resolve") {
2787
- // check if there is inline style on the element that contains width
2788
- style = this.opts.element.attr('style');
2789
- if (style !== undefined) {
2790
- attrs = style.split(';');
2791
- for (i = 0, l = attrs.length; i < l; i = i + 1) {
2792
- attr = attrs[i].replace(/\s/g, '');
2793
- matches = attr.match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i);
2794
- if (matches !== null && matches.length >= 1)
2795
- return matches[1];
2796
- }
2797
- }
2798
-
2799
- if (this.opts.width === "resolve") {
2800
- // next check if css('width') can resolve a width that is percent based, this is sometimes possible
2801
- // when attached to input type=hidden or elements hidden via css
2802
- style = this.opts.element.css('width');
2803
- if (style.indexOf("%") > 0) return style;
2804
-
2805
- // finally, fallback on the calculated width of the element
2806
- return (this.opts.element.outerWidth(false) === 0 ? 'auto' : this.opts.element.outerWidth(false) + 'px');
2807
- }
2808
-
2809
- return null;
2810
- } else if ($.isFunction(this.opts.width)) {
2811
- return this.opts.width();
2812
- } else {
2813
- return this.opts.width;
2814
- }
2815
- };
2816
-
2817
- var width = resolveContainerWidth.call(this);
2818
- if (width !== null) {
2819
- this.container.css("width", width);
2820
- }
2821
- }
2822
- });
2823
-
2824
- SingleSelect2 = clazz(AbstractSelect2, {
2825
-
2826
- // single
2827
-
2828
- createContainer: function () {
2829
- var container = $(document.createElement("div")).attr({
2830
- "class": "select2-container"
2831
- }).html([
2832
- "<a href='javascript:void(0)' class='select2-choice' tabindex='-1'>",
2833
- " <span class='select2-chosen'>&#160;</span><abbr class='select2-search-choice-close'></abbr>",
2834
- " <span class='select2-arrow' role='presentation'><b role='presentation'></b></span>",
2835
- "</a>",
2836
- "<label for='' class='select2-offscreen'></label>",
2837
- "<input class='select2-focusser select2-offscreen' type='text' aria-haspopup='true' role='button' />",
2838
- "<div class='select2-drop select2-display-none'>",
2839
- " <div class='select2-search'>",
2840
- " <label for='' class='select2-offscreen'></label>",
2841
- " <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input' role='combobox' aria-expanded='true'",
2842
- " aria-autocomplete='list' />",
2843
- " </div>",
2844
- " <ul class='select2-results' role='listbox'>",
2845
- " </ul>",
2846
- "</div>"].join(""));
2847
- return container;
2848
- },
2849
-
2850
- // single
2851
- enableInterface: function() {
2852
- if (this.parent.enableInterface.apply(this, arguments)) {
2853
- this.focusser.prop("disabled", !this.isInterfaceEnabled());
2854
- }
2855
- },
2856
-
2857
- // single
2858
- opening: function () {
2859
- var el, range, len;
2860
-
2861
- if (this.opts.minimumResultsForSearch >= 0) {
2862
- this.showSearch(true);
2863
- }
2864
-
2865
- this.parent.opening.apply(this, arguments);
2866
-
2867
- if (this.showSearchInput !== false) {
2868
- // IE appends focusser.val() at the end of field :/ so we manually insert it at the beginning using a range
2869
- // all other browsers handle this just fine
2870
-
2871
- this.search.val(this.focusser.val());
2872
- }
2873
- if (this.opts.shouldFocusInput(this)) {
2874
- this.search.focus();
2875
- // move the cursor to the end after focussing, otherwise it will be at the beginning and
2876
- // new text will appear *before* focusser.val()
2877
- el = this.search.get(0);
2878
- if (el.createTextRange) {
2879
- range = el.createTextRange();
2880
- range.collapse(false);
2881
- range.select();
2882
- } else if (el.setSelectionRange) {
2883
- len = this.search.val().length;
2884
- el.setSelectionRange(len, len);
2885
- }
2886
- }
2887
-
2888
- // initializes search's value with nextSearchTerm (if defined by user)
2889
- // ignore nextSearchTerm if the dropdown is opened by the user pressing a letter
2890
- if(this.search.val() === "") {
2891
- if(this.nextSearchTerm != undefined){
2892
- this.search.val(this.nextSearchTerm);
2893
- this.search.select();
2894
- }
2895
- }
2896
-
2897
- this.focusser.prop("disabled", true).val("");
2898
- this.updateResults(true);
2899
- this.opts.element.trigger($.Event("select2-open"));
2900
- },
2901
-
2902
- // single
2903
- close: function () {
2904
- if (!this.opened()) return;
2905
- this.parent.close.apply(this, arguments);
2906
-
2907
- this.focusser.prop("disabled", false);
2908
-
2909
- if (this.opts.shouldFocusInput(this)) {
2910
- this.focusser.focus();
2911
- }
2912
- },
2913
-
2914
- // single
2915
- focus: function () {
2916
- if (this.opened()) {
2917
- this.close();
2918
- } else {
2919
- this.focusser.prop("disabled", false);
2920
- if (this.opts.shouldFocusInput(this)) {
2921
- this.focusser.focus();
2922
- }
2923
- }
2924
- },
2925
-
2926
- // single
2927
- isFocused: function () {
2928
- return this.container.hasClass("select2-container-active");
2929
- },
2930
-
2931
- // single
2932
- cancel: function () {
2933
- this.parent.cancel.apply(this, arguments);
2934
- this.focusser.prop("disabled", false);
2935
-
2936
- if (this.opts.shouldFocusInput(this)) {
2937
- this.focusser.focus();
2938
- }
2939
- },
2940
-
2941
- // single
2942
- destroy: function() {
2943
- $("label[for='" + this.focusser.attr('id') + "']")
2944
- .attr('for', this.opts.element.attr("id"));
2945
- this.parent.destroy.apply(this, arguments);
2946
-
2947
- cleanupJQueryElements.call(this,
2948
- "selection",
2949
- "focusser"
2950
- );
2951
- },
2952
-
2953
- // single
2954
- initContainer: function () {
2955
-
2956
- var selection,
2957
- container = this.container,
2958
- dropdown = this.dropdown,
2959
- idSuffix = nextUid(),
2960
- elementLabel;
2961
-
2962
- if (this.opts.minimumResultsForSearch < 0) {
2963
- this.showSearch(false);
2964
- } else {
2965
- this.showSearch(true);
2966
- }
2967
-
2968
- this.selection = selection = container.find(".select2-choice");
2969
-
2970
- this.focusser = container.find(".select2-focusser");
2971
-
2972
- // add aria associations
2973
- selection.find(".select2-chosen").attr("id", "select2-chosen-"+idSuffix);
2974
- this.focusser.attr("aria-labelledby", "select2-chosen-"+idSuffix);
2975
- this.results.attr("id", "select2-results-"+idSuffix);
2976
- this.search.attr("aria-owns", "select2-results-"+idSuffix);
2977
-
2978
- // rewrite labels from original element to focusser
2979
- this.focusser.attr("id", "s2id_autogen"+idSuffix);
2980
-
2981
- elementLabel = $("label[for='" + this.opts.element.attr("id") + "']");
2982
-
2983
- this.focusser.prev()
2984
- .text(elementLabel.text())
2985
- .attr('for', this.focusser.attr('id'));
2986
-
2987
- // Ensure the original element retains an accessible name
2988
- var originalTitle = this.opts.element.attr("title");
2989
- this.opts.element.attr("title", (originalTitle || elementLabel.text()));
2990
-
2991
- this.focusser.attr("tabindex", this.elementTabIndex);
2992
-
2993
- // write label for search field using the label from the focusser element
2994
- this.search.attr("id", this.focusser.attr('id') + '_search');
2995
-
2996
- this.search.prev()
2997
- .text($("label[for='" + this.focusser.attr('id') + "']").text())
2998
- .attr('for', this.search.attr('id'));
2999
-
3000
- this.search.on("keydown", this.bind(function (e) {
3001
- if (!this.isInterfaceEnabled()) return;
3002
-
3003
- if (e.which === KEY.PAGE_UP || e.which === KEY.PAGE_DOWN) {
3004
- // prevent the page from scrolling
3005
- killEvent(e);
3006
- return;
3007
- }
3008
-
3009
- switch (e.which) {
3010
- case KEY.UP:
3011
- case KEY.DOWN:
3012
- this.moveHighlight((e.which === KEY.UP) ? -1 : 1);
3013
- killEvent(e);
3014
- return;
3015
- case KEY.ENTER:
3016
- this.selectHighlighted();
3017
- killEvent(e);
3018
- return;
3019
- case KEY.TAB:
3020
- this.selectHighlighted({noFocus: true});
3021
- return;
3022
- case KEY.ESC:
3023
- this.cancel(e);
3024
- killEvent(e);
3025
- return;
3026
- }
3027
- }));
3028
-
3029
- this.search.on("blur", this.bind(function(e) {
3030
- // a workaround for chrome to keep the search field focussed when the scroll bar is used to scroll the dropdown.
3031
- // without this the search field loses focus which is annoying
3032
- if (document.activeElement === this.body.get(0)) {
3033
- window.setTimeout(this.bind(function() {
3034
- if (this.opened()) {
3035
- this.search.focus();
3036
- }
3037
- }), 0);
3038
- }
3039
- }));
3040
-
3041
- this.focusser.on("keydown", this.bind(function (e) {
3042
- if (!this.isInterfaceEnabled()) return;
3043
-
3044
- if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.ESC) {
3045
- return;
3046
- }
3047
-
3048
- if (this.opts.openOnEnter === false && e.which === KEY.ENTER) {
3049
- killEvent(e);
3050
- return;
3051
- }
3052
-
3053
- if (e.which == KEY.DOWN || e.which == KEY.UP
3054
- || (e.which == KEY.ENTER && this.opts.openOnEnter)) {
3055
-
3056
- if (e.altKey || e.ctrlKey || e.shiftKey || e.metaKey) return;
3057
-
3058
- this.open();
3059
- killEvent(e);
3060
- return;
3061
- }
3062
-
3063
- if (e.which == KEY.DELETE || e.which == KEY.BACKSPACE) {
3064
- if (this.opts.allowClear) {
3065
- this.clear();
3066
- }
3067
- killEvent(e);
3068
- return;
3069
- }
3070
- }));
3071
-
3072
-
3073
- installKeyUpChangeEvent(this.focusser);
3074
- this.focusser.on("keyup-change input", this.bind(function(e) {
3075
- if (this.opts.minimumResultsForSearch >= 0) {
3076
- e.stopPropagation();
3077
- if (this.opened()) return;
3078
- this.open();
3079
- }
3080
- }));
3081
-
3082
- selection.on("mousedown touchstart", "abbr", this.bind(function (e) {
3083
- if (!this.isInterfaceEnabled()) return;
3084
- this.clear();
3085
- killEventImmediately(e);
3086
- this.close();
3087
- this.selection.focus();
3088
- }));
3089
-
3090
- selection.on("mousedown touchstart", this.bind(function (e) {
3091
- // Prevent IE from generating a click event on the body
3092
- reinsertElement(selection);
3093
-
3094
- if (!this.container.hasClass("select2-container-active")) {
3095
- this.opts.element.trigger($.Event("select2-focus"));
3096
- }
3097
-
3098
- if (this.opened()) {
3099
- this.close();
3100
- } else if (this.isInterfaceEnabled()) {
3101
- this.open();
3102
- }
3103
-
3104
- killEvent(e);
3105
- }));
3106
-
3107
- dropdown.on("mousedown touchstart", this.bind(function() {
3108
- if (this.opts.shouldFocusInput(this)) {
3109
- this.search.focus();
3110
- }
3111
- }));
3112
-
3113
- selection.on("focus", this.bind(function(e) {
3114
- killEvent(e);
3115
- }));
3116
-
3117
- this.focusser.on("focus", this.bind(function(){
3118
- if (!this.container.hasClass("select2-container-active")) {
3119
- this.opts.element.trigger($.Event("select2-focus"));
3120
- }
3121
- this.container.addClass("select2-container-active");
3122
- })).on("blur", this.bind(function() {
3123
- if (!this.opened()) {
3124
- this.container.removeClass("select2-container-active");
3125
- this.opts.element.trigger($.Event("select2-blur"));
3126
- }
3127
- }));
3128
- this.search.on("focus", this.bind(function(){
3129
- if (!this.container.hasClass("select2-container-active")) {
3130
- this.opts.element.trigger($.Event("select2-focus"));
3131
- }
3132
- this.container.addClass("select2-container-active");
3133
- }));
3134
-
3135
- this.initContainerWidth();
3136
- this.opts.element.addClass("select2-offscreen");
3137
- this.setPlaceholder();
3138
-
3139
- },
3140
-
3141
- // single
3142
- clear: function(triggerChange) {
3143
- var data=this.selection.data("select2-data");
3144
- if (data) { // guard against queued quick consecutive clicks
3145
- var evt = $.Event("select2-clearing");
3146
- this.opts.element.trigger(evt);
3147
- if (evt.isDefaultPrevented()) {
3148
- return;
3149
- }
3150
- var placeholderOption = this.getPlaceholderOption();
3151
- this.opts.element.val(placeholderOption ? placeholderOption.val() : "");
3152
- this.selection.find(".select2-chosen").empty();
3153
- this.selection.removeData("select2-data");
3154
- this.setPlaceholder();
3155
-
3156
- if (triggerChange !== false){
3157
- this.opts.element.trigger({ type: "select2-removed", val: this.id(data), choice: data });
3158
- this.triggerChange({removed:data});
3159
- }
3160
- }
3161
- },
3162
-
3163
- /**
3164
- * Sets selection based on source element's value
3165
- */
3166
- // single
3167
- initSelection: function () {
3168
- var selected;
3169
- if (this.isPlaceholderOptionSelected()) {
3170
- this.updateSelection(null);
3171
- this.close();
3172
- this.setPlaceholder();
3173
- } else {
3174
- var self = this;
3175
- this.opts.initSelection.call(null, this.opts.element, function(selected){
3176
- if (selected !== undefined && selected !== null) {
3177
- self.updateSelection(selected);
3178
- self.close();
3179
- self.setPlaceholder();
3180
- self.nextSearchTerm = self.opts.nextSearchTerm(selected, self.search.val());
3181
- }
3182
- });
3183
- }
3184
- },
3185
-
3186
- isPlaceholderOptionSelected: function() {
3187
- var placeholderOption;
3188
- if (this.getPlaceholder() === undefined) return false; // no placeholder specified so no option should be considered
3189
- return ((placeholderOption = this.getPlaceholderOption()) !== undefined && placeholderOption.prop("selected"))
3190
- || (this.opts.element.val() === "")
3191
- || (this.opts.element.val() === undefined)
3192
- || (this.opts.element.val() === null);
3193
- },
3194
-
3195
- // single
3196
- prepareOpts: function () {
3197
- var opts = this.parent.prepareOpts.apply(this, arguments),
3198
- self=this;
3199
-
3200
- if (opts.element.get(0).tagName.toLowerCase() === "select") {
3201
- // install the selection initializer
3202
- opts.initSelection = function (element, callback) {
3203
- var selected = element.find("option").filter(function() { return this.selected && !this.disabled });
3204
- // a single select box always has a value, no need to null check 'selected'
3205
- callback(self.optionToData(selected));
3206
- };
3207
- } else if ("data" in opts) {
3208
- // install default initSelection when applied to hidden input and data is local
3209
- opts.initSelection = opts.initSelection || function (element, callback) {
3210
- var id = element.val();
3211
- //search in data by id, storing the actual matching item
3212
- var match = null;
3213
- opts.query({
3214
- matcher: function(term, text, el){
3215
- var is_match = equal(id, opts.id(el));
3216
- if (is_match) {
3217
- match = el;
3218
- }
3219
- return is_match;
3220
- },
3221
- callback: !$.isFunction(callback) ? $.noop : function() {
3222
- callback(match);
3223
- }
3224
- });
3225
- };
3226
- }
3227
-
3228
- return opts;
3229
- },
3230
-
3231
- // single
3232
- getPlaceholder: function() {
3233
- // if a placeholder is specified on a single select without a valid placeholder option ignore it
3234
- if (this.select) {
3235
- if (this.getPlaceholderOption() === undefined) {
3236
- return undefined;
3237
- }
3238
- }
3239
-
3240
- return this.parent.getPlaceholder.apply(this, arguments);
3241
- },
3242
-
3243
- // single
3244
- setPlaceholder: function () {
3245
- var placeholder = this.getPlaceholder();
3246
-
3247
- if (this.isPlaceholderOptionSelected() && placeholder !== undefined) {
3248
-
3249
- // check for a placeholder option if attached to a select
3250
- if (this.select && this.getPlaceholderOption() === undefined) return;
3251
-
3252
- this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(placeholder));
3253
-
3254
- this.selection.addClass("select2-default");
3255
-
3256
- this.container.removeClass("select2-allowclear");
3257
- }
3258
- },
3259
-
3260
- // single
3261
- postprocessResults: function (data, initial, noHighlightUpdate) {
3262
- var selected = 0, self = this, showSearchInput = true;
3263
-
3264
- // find the selected element in the result list
3265
-
3266
- this.findHighlightableChoices().each2(function (i, elm) {
3267
- if (equal(self.id(elm.data("select2-data")), self.opts.element.val())) {
3268
- selected = i;
3269
- return false;
3270
- }
3271
- });
3272
-
3273
- // and highlight it
3274
- if (noHighlightUpdate !== false) {
3275
- if (initial === true && selected >= 0) {
3276
- this.highlight(selected);
3277
- } else {
3278
- this.highlight(0);
3279
- }
3280
- }
3281
-
3282
- // hide the search box if this is the first we got the results and there are enough of them for search
3283
-
3284
- if (initial === true) {
3285
- var min = this.opts.minimumResultsForSearch;
3286
- if (min >= 0) {
3287
- this.showSearch(countResults(data.results) >= min);
3288
- }
3289
- }
3290
- },
3291
-
3292
- // single
3293
- showSearch: function(showSearchInput) {
3294
- if (this.showSearchInput === showSearchInput) return;
3295
-
3296
- this.showSearchInput = showSearchInput;
3297
-
3298
- this.dropdown.find(".select2-search").toggleClass("select2-search-hidden", !showSearchInput);
3299
- this.dropdown.find(".select2-search").toggleClass("select2-offscreen", !showSearchInput);
3300
- //add "select2-with-searchbox" to the container if search box is shown
3301
- $(this.dropdown, this.container).toggleClass("select2-with-searchbox", showSearchInput);
3302
- },
3303
-
3304
- // single
3305
- onSelect: function (data, options) {
3306
-
3307
- if (!this.triggerSelect(data)) { return; }
3308
-
3309
- var old = this.opts.element.val(),
3310
- oldData = this.data();
3311
-
3312
- this.opts.element.val(this.id(data));
3313
- this.updateSelection(data);
3314
-
3315
- this.opts.element.trigger({ type: "select2-selected", val: this.id(data), choice: data });
3316
-
3317
- this.nextSearchTerm = this.opts.nextSearchTerm(data, this.search.val());
3318
- this.close();
3319
-
3320
- if ((!options || !options.noFocus) && this.opts.shouldFocusInput(this)) {
3321
- this.focusser.focus();
3322
- }
3323
-
3324
- if (!equal(old, this.id(data))) {
3325
- this.triggerChange({ added: data, removed: oldData });
3326
- }
3327
- },
3328
-
3329
- // single
3330
- updateSelection: function (data) {
3331
-
3332
- var container=this.selection.find(".select2-chosen"), formatted, cssClass;
3333
-
3334
- this.selection.data("select2-data", data);
3335
-
3336
- container.empty();
3337
- if (data !== null) {
3338
- formatted=this.opts.formatSelection(data, container, this.opts.escapeMarkup);
3339
- }
3340
- if (formatted !== undefined) {
3341
- container.append(formatted);
3342
- }
3343
- cssClass=this.opts.formatSelectionCssClass(data, container);
3344
- if (cssClass !== undefined) {
3345
- container.addClass(cssClass);
3346
- }
3347
-
3348
- this.selection.removeClass("select2-default");
3349
-
3350
- if (this.opts.allowClear && this.getPlaceholder() !== undefined) {
3351
- this.container.addClass("select2-allowclear");
3352
- }
3353
- },
3354
-
3355
- // single
3356
- val: function () {
3357
- var val,
3358
- triggerChange = false,
3359
- data = null,
3360
- self = this,
3361
- oldData = this.data();
3362
-
3363
- if (arguments.length === 0) {
3364
- return this.opts.element.val();
3365
- }
3366
-
3367
- val = arguments[0];
3368
-
3369
- if (arguments.length > 1) {
3370
- triggerChange = arguments[1];
3371
- }
3372
-
3373
- if (this.select) {
3374
- this.select
3375
- .val(val)
3376
- .find("option").filter(function() { return this.selected }).each2(function (i, elm) {
3377
- data = self.optionToData(elm);
3378
- return false;
3379
- });
3380
- this.updateSelection(data);
3381
- this.setPlaceholder();
3382
- if (triggerChange) {
3383
- this.triggerChange({added: data, removed:oldData});
3384
- }
3385
- } else {
3386
- // val is an id. !val is true for [undefined,null,'',0] - 0 is legal
3387
- if (!val && val !== 0) {
3388
- this.clear(triggerChange);
3389
- return;
3390
- }
3391
- if (this.opts.initSelection === undefined) {
3392
- throw new Error("cannot call val() if initSelection() is not defined");
3393
- }
3394
- this.opts.element.val(val);
3395
- this.opts.initSelection(this.opts.element, function(data){
3396
- self.opts.element.val(!data ? "" : self.id(data));
3397
- self.updateSelection(data);
3398
- self.setPlaceholder();
3399
- if (triggerChange) {
3400
- self.triggerChange({added: data, removed:oldData});
3401
- }
3402
- });
3403
- }
3404
- },
3405
-
3406
- // single
3407
- clearSearch: function () {
3408
- this.search.val("");
3409
- this.focusser.val("");
3410
- },
3411
-
3412
- // single
3413
- data: function(value) {
3414
- var data,
3415
- triggerChange = false;
3416
-
3417
- if (arguments.length === 0) {
3418
- data = this.selection.data("select2-data");
3419
- if (data == undefined) data = null;
3420
- return data;
3421
- } else {
3422
- if (arguments.length > 1) {
3423
- triggerChange = arguments[1];
3424
- }
3425
- if (!value) {
3426
- this.clear(triggerChange);
3427
- } else {
3428
- data = this.data();
3429
- this.opts.element.val(!value ? "" : this.id(value));
3430
- this.updateSelection(value);
3431
- if (triggerChange) {
3432
- this.triggerChange({added: value, removed:data});
3433
- }
3434
- }
3435
- }
3436
- }
3437
- });
3438
-
3439
- MultiSelect2 = clazz(AbstractSelect2, {
3440
-
3441
- // multi
3442
- createContainer: function () {
3443
- var container = $(document.createElement("div")).attr({
3444
- "class": "select2-container select2-container-multi"
3445
- }).html([
3446
- "<ul class='select2-choices'>",
3447
- " <li class='select2-search-field'>",
3448
- " <label for='' class='select2-offscreen'></label>",
3449
- " <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'>",
3450
- " </li>",
3451
- "</ul>",
3452
- "<div class='select2-drop select2-drop-multi select2-display-none'>",
3453
- " <ul class='select2-results'>",
3454
- " </ul>",
3455
- "</div>"].join(""));
3456
- return container;
3457
- },
3458
-
3459
- // multi
3460
- prepareOpts: function () {
3461
- var opts = this.parent.prepareOpts.apply(this, arguments),
3462
- self=this;
3463
-
3464
- // TODO validate placeholder is a string if specified
3465
-
3466
- if (opts.element.get(0).tagName.toLowerCase() === "select") {
3467
- // install the selection initializer
3468
- opts.initSelection = function (element, callback) {
3469
-
3470
- var data = [];
3471
-
3472
- element.find("option").filter(function() { return this.selected && !this.disabled }).each2(function (i, elm) {
3473
- data.push(self.optionToData(elm));
3474
- });
3475
- callback(data);
3476
- };
3477
- } else if ("data" in opts) {
3478
- // install default initSelection when applied to hidden input and data is local
3479
- opts.initSelection = opts.initSelection || function (element, callback) {
3480
- var ids = splitVal(element.val(), opts.separator);
3481
- //search in data by array of ids, storing matching items in a list
3482
- var matches = [];
3483
- opts.query({
3484
- matcher: function(term, text, el){
3485
- var is_match = $.grep(ids, function(id) {
3486
- return equal(id, opts.id(el));
3487
- }).length;
3488
- if (is_match) {
3489
- matches.push(el);
3490
- }
3491
- return is_match;
3492
- },
3493
- callback: !$.isFunction(callback) ? $.noop : function() {
3494
- // reorder matches based on the order they appear in the ids array because right now
3495
- // they are in the order in which they appear in data array
3496
- var ordered = [];
3497
- for (var i = 0; i < ids.length; i++) {
3498
- var id = ids[i];
3499
- for (var j = 0; j < matches.length; j++) {
3500
- var match = matches[j];
3501
- if (equal(id, opts.id(match))) {
3502
- ordered.push(match);
3503
- matches.splice(j, 1);
3504
- break;
3505
- }
3506
- }
3507
- }
3508
- callback(ordered);
3509
- }
3510
- });
3511
- };
3512
- }
3513
-
3514
- return opts;
3515
- },
3516
-
3517
- // multi
3518
- selectChoice: function (choice) {
3519
-
3520
- var selected = this.container.find(".select2-search-choice-focus");
3521
- if (selected.length && choice && choice[0] == selected[0]) {
3522
-
3523
- } else {
3524
- if (selected.length) {
3525
- this.opts.element.trigger("choice-deselected", selected);
3526
- }
3527
- selected.removeClass("select2-search-choice-focus");
3528
- if (choice && choice.length) {
3529
- this.close();
3530
- choice.addClass("select2-search-choice-focus");
3531
- this.opts.element.trigger("choice-selected", choice);
3532
- }
3533
- }
3534
- },
3535
-
3536
- // multi
3537
- destroy: function() {
3538
- $("label[for='" + this.search.attr('id') + "']")
3539
- .attr('for', this.opts.element.attr("id"));
3540
- this.parent.destroy.apply(this, arguments);
3541
-
3542
- cleanupJQueryElements.call(this,
3543
- "searchContainer",
3544
- "selection"
3545
- );
3546
- },
3547
-
3548
- // multi
3549
- initContainer: function () {
3550
-
3551
- var selector = ".select2-choices", selection;
3552
-
3553
- this.searchContainer = this.container.find(".select2-search-field");
3554
- this.selection = selection = this.container.find(selector);
3555
-
3556
- var _this = this;
3557
- this.selection.on("click", ".select2-search-choice:not(.select2-locked)", function (e) {
3558
- //killEvent(e);
3559
- _this.search[0].focus();
3560
- _this.selectChoice($(this));
3561
- });
3562
-
3563
- // rewrite labels from original element to focusser
3564
- this.search.attr("id", "s2id_autogen"+nextUid());
3565
-
3566
- this.search.prev()
3567
- .text($("label[for='" + this.opts.element.attr("id") + "']").text())
3568
- .attr('for', this.search.attr('id'));
3569
-
3570
- this.search.on("input paste", this.bind(function() {
3571
- if (!this.isInterfaceEnabled()) return;
3572
- if (!this.opened()) {
3573
- this.open();
3574
- }
3575
- }));
3576
-
3577
- this.search.attr("tabindex", this.elementTabIndex);
3578
-
3579
- this.keydowns = 0;
3580
- this.search.on("keydown", this.bind(function (e) {
3581
- if (!this.isInterfaceEnabled()) return;
3582
-
3583
- ++this.keydowns;
3584
- var selected = selection.find(".select2-search-choice-focus");
3585
- var prev = selected.prev(".select2-search-choice:not(.select2-locked)");
3586
- var next = selected.next(".select2-search-choice:not(.select2-locked)");
3587
- var pos = getCursorInfo(this.search);
3588
-
3589
- if (selected.length &&
3590
- (e.which == KEY.LEFT || e.which == KEY.RIGHT || e.which == KEY.BACKSPACE || e.which == KEY.DELETE || e.which == KEY.ENTER)) {
3591
- var selectedChoice = selected;
3592
- if (e.which == KEY.LEFT && prev.length) {
3593
- selectedChoice = prev;
3594
- }
3595
- else if (e.which == KEY.RIGHT) {
3596
- selectedChoice = next.length ? next : null;
3597
- }
3598
- else if (e.which === KEY.BACKSPACE) {
3599
- if (this.unselect(selected.first())) {
3600
- this.search.width(10);
3601
- selectedChoice = prev.length ? prev : next;
3602
- }
3603
- } else if (e.which == KEY.DELETE) {
3604
- if (this.unselect(selected.first())) {
3605
- this.search.width(10);
3606
- selectedChoice = next.length ? next : null;
3607
- }
3608
- } else if (e.which == KEY.ENTER) {
3609
- selectedChoice = null;
3610
- }
3611
-
3612
- this.selectChoice(selectedChoice);
3613
- killEvent(e);
3614
- if (!selectedChoice || !selectedChoice.length) {
3615
- this.open();
3616
- }
3617
- return;
3618
- } else if (((e.which === KEY.BACKSPACE && this.keydowns == 1)
3619
- || e.which == KEY.LEFT) && (pos.offset == 0 && !pos.length)) {
3620
-
3621
- this.selectChoice(selection.find(".select2-search-choice:not(.select2-locked)").last());
3622
- killEvent(e);
3623
- return;
3624
- } else {
3625
- this.selectChoice(null);
3626
- }
3627
-
3628
- if (this.opened()) {
3629
- switch (e.which) {
3630
- case KEY.UP:
3631
- case KEY.DOWN:
3632
- this.moveHighlight((e.which === KEY.UP) ? -1 : 1);
3633
- killEvent(e);
3634
- return;
3635
- case KEY.ENTER:
3636
- this.selectHighlighted();
3637
- killEvent(e);
3638
- return;
3639
- case KEY.TAB:
3640
- this.selectHighlighted({noFocus:true});
3641
- this.close();
3642
- return;
3643
- case KEY.ESC:
3644
- this.cancel(e);
3645
- killEvent(e);
3646
- return;
3647
- }
3648
- }
3649
-
3650
- if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e)
3651
- || e.which === KEY.BACKSPACE || e.which === KEY.ESC) {
3652
- return;
3653
- }
3654
-
3655
- if (e.which === KEY.ENTER) {
3656
- if (this.opts.openOnEnter === false) {
3657
- return;
3658
- } else if (e.altKey || e.ctrlKey || e.shiftKey || e.metaKey) {
3659
- return;
3660
- }
3661
- }
3662
-
3663
- this.open();
3664
-
3665
- if (e.which === KEY.PAGE_UP || e.which === KEY.PAGE_DOWN) {
3666
- // prevent the page from scrolling
3667
- killEvent(e);
3668
- }
3669
-
3670
- if (e.which === KEY.ENTER) {
3671
- // prevent form from being submitted
3672
- killEvent(e);
3673
- }
3674
-
3675
- }));
3676
-
3677
- this.search.on("keyup", this.bind(function (e) {
3678
- this.keydowns = 0;
3679
- this.resizeSearch();
3680
- })
3681
- );
3682
-
3683
- this.search.on("blur", this.bind(function(e) {
3684
- this.container.removeClass("select2-container-active");
3685
- this.search.removeClass("select2-focused");
3686
- this.selectChoice(null);
3687
- if (!this.opened()) this.clearSearch();
3688
- e.stopImmediatePropagation();
3689
- this.opts.element.trigger($.Event("select2-blur"));
3690
- }));
3691
-
3692
- this.container.on("click", selector, this.bind(function (e) {
3693
- if (!this.isInterfaceEnabled()) return;
3694
- if ($(e.target).closest(".select2-search-choice").length > 0) {
3695
- // clicked inside a select2 search choice, do not open
3696
- return;
3697
- }
3698
- this.selectChoice(null);
3699
- this.clearPlaceholder();
3700
- if (!this.container.hasClass("select2-container-active")) {
3701
- this.opts.element.trigger($.Event("select2-focus"));
3702
- }
3703
- this.open();
3704
- this.focusSearch();
3705
- e.preventDefault();
3706
- }));
3707
-
3708
- this.container.on("focus", selector, this.bind(function () {
3709
- if (!this.isInterfaceEnabled()) return;
3710
- if (!this.container.hasClass("select2-container-active")) {
3711
- this.opts.element.trigger($.Event("select2-focus"));
3712
- }
3713
- this.container.addClass("select2-container-active");
3714
- this.dropdown.addClass("select2-drop-active");
3715
- this.clearPlaceholder();
3716
- }));
3717
-
3718
- this.initContainerWidth();
3719
- this.opts.element.addClass("select2-offscreen");
3720
-
3721
- // set the placeholder if necessary
3722
- this.clearSearch();
3723
- },
3724
-
3725
- // multi
3726
- enableInterface: function() {
3727
- if (this.parent.enableInterface.apply(this, arguments)) {
3728
- this.search.prop("disabled", !this.isInterfaceEnabled());
3729
- }
3730
- },
3731
-
3732
- // multi
3733
- initSelection: function () {
3734
- var data;
3735
- if (this.opts.element.val() === "" && this.opts.element.text() === "") {
3736
- this.updateSelection([]);
3737
- this.close();
3738
- // set the placeholder if necessary
3739
- this.clearSearch();
3740
- }
3741
- if (this.select || this.opts.element.val() !== "") {
3742
- var self = this;
3743
- this.opts.initSelection.call(null, this.opts.element, function(data){
3744
- if (data !== undefined && data !== null) {
3745
- self.updateSelection(data);
3746
- self.close();
3747
- // set the placeholder if necessary
3748
- self.clearSearch();
3749
- }
3750
- });
3751
- }
3752
- },
3753
-
3754
- // multi
3755
- clearSearch: function () {
3756
- var placeholder = this.getPlaceholder(),
3757
- maxWidth = this.getMaxSearchWidth();
3758
-
3759
- if (placeholder !== undefined && this.getVal().length === 0 && this.search.hasClass("select2-focused") === false) {
3760
- this.search.val(placeholder).addClass("select2-default");
3761
- // stretch the search box to full width of the container so as much of the placeholder is visible as possible
3762
- // we could call this.resizeSearch(), but we do not because that requires a sizer and we do not want to create one so early because of a firefox bug, see #944
3763
- this.search.width(maxWidth > 0 ? maxWidth : this.container.css("width"));
3764
- } else {
3765
- this.search.val("").width(10);
3766
- }
3767
- },
3768
-
3769
- // multi
3770
- clearPlaceholder: function () {
3771
- if (this.search.hasClass("select2-default")) {
3772
- this.search.val("").removeClass("select2-default");
3773
- }
3774
- },
3775
-
3776
- // multi
3777
- opening: function () {
3778
- this.clearPlaceholder(); // should be done before super so placeholder is not used to search
3779
- this.resizeSearch();
3780
-
3781
- this.parent.opening.apply(this, arguments);
3782
-
3783
- this.focusSearch();
3784
-
3785
- // initializes search's value with nextSearchTerm (if defined by user)
3786
- // ignore nextSearchTerm if the dropdown is opened by the user pressing a letter
3787
- if(this.search.val() === "") {
3788
- if(this.nextSearchTerm != undefined){
3789
- this.search.val(this.nextSearchTerm);
3790
- this.search.select();
3791
- }
3792
- }
3793
-
3794
- this.updateResults(true);
3795
- if (this.opts.shouldFocusInput(this)) {
3796
- this.search.focus();
3797
- }
3798
- this.opts.element.trigger($.Event("select2-open"));
3799
- },
3800
-
3801
- // multi
3802
- close: function () {
3803
- if (!this.opened()) return;
3804
- this.parent.close.apply(this, arguments);
3805
- },
3806
-
3807
- // multi
3808
- focus: function () {
3809
- this.close();
3810
- this.search.focus();
3811
- },
3812
-
3813
- // multi
3814
- isFocused: function () {
3815
- return this.search.hasClass("select2-focused");
3816
- },
3817
-
3818
- // multi
3819
- updateSelection: function (data) {
3820
- var ids = [], filtered = [], self = this;
3821
-
3822
- // filter out duplicates
3823
- $(data).each(function () {
3824
- if (indexOf(self.id(this), ids) < 0) {
3825
- ids.push(self.id(this));
3826
- filtered.push(this);
3827
- }
3828
- });
3829
- data = filtered;
3830
-
3831
- this.selection.find(".select2-search-choice").remove();
3832
- $(data).each(function () {
3833
- self.addSelectedChoice(this);
3834
- });
3835
- self.postprocessResults();
3836
- },
3837
-
3838
- // multi
3839
- tokenize: function() {
3840
- var input = this.search.val();
3841
- input = this.opts.tokenizer.call(this, input, this.data(), this.bind(this.onSelect), this.opts);
3842
- if (input != null && input != undefined) {
3843
- this.search.val(input);
3844
- if (input.length > 0) {
3845
- this.open();
3846
- }
3847
- }
3848
-
3849
- },
3850
-
3851
- // multi
3852
- onSelect: function (data, options) {
3853
-
3854
- if (!this.triggerSelect(data)) { return; }
3855
-
3856
- this.addSelectedChoice(data);
3857
-
3858
- this.opts.element.trigger({ type: "selected", val: this.id(data), choice: data });
3859
-
3860
- // keep track of the search's value before it gets cleared
3861
- this.nextSearchTerm = this.opts.nextSearchTerm(data, this.search.val());
3862
-
3863
- this.clearSearch();
3864
- this.updateResults();
3865
-
3866
- if (this.select || !this.opts.closeOnSelect) this.postprocessResults(data, false, this.opts.closeOnSelect===true);
3867
-
3868
- if (this.opts.closeOnSelect) {
3869
- this.close();
3870
- this.search.width(10);
3871
- } else {
3872
- if (this.countSelectableResults()>0) {
3873
- this.search.width(10);
3874
- this.resizeSearch();
3875
- if (this.getMaximumSelectionSize() > 0 && this.val().length >= this.getMaximumSelectionSize()) {
3876
- // if we reached max selection size repaint the results so choices
3877
- // are replaced with the max selection reached message
3878
- this.updateResults(true);
3879
- } else {
3880
- // initializes search's value with nextSearchTerm and update search result
3881
- if(this.nextSearchTerm != undefined){
3882
- this.search.val(this.nextSearchTerm);
3883
- this.updateResults();
3884
- this.search.select();
3885
- }
3886
- }
3887
- this.positionDropdown();
3888
- } else {
3889
- // if nothing left to select close
3890
- this.close();
3891
- this.search.width(10);
3892
- }
3893
- }
3894
-
3895
- // since its not possible to select an element that has already been
3896
- // added we do not need to check if this is a new element before firing change
3897
- this.triggerChange({ added: data });
3898
-
3899
- if (!options || !options.noFocus)
3900
- this.focusSearch();
3901
- },
3902
-
3903
- // multi
3904
- cancel: function () {
3905
- this.close();
3906
- this.focusSearch();
3907
- },
3908
-
3909
- addSelectedChoice: function (data) {
3910
- var enableChoice = !data.locked,
3911
- enabledItem = $(
3912
- "<li class='select2-search-choice'>" +
3913
- " <div></div>" +
3914
- " <a href='#' class='select2-search-choice-close' tabindex='-1'></a>" +
3915
- "</li>"),
3916
- disabledItem = $(
3917
- "<li class='select2-search-choice select2-locked'>" +
3918
- "<div></div>" +
3919
- "</li>");
3920
- var choice = enableChoice ? enabledItem : disabledItem,
3921
- id = this.id(data),
3922
- val = this.getVal(),
3923
- formatted,
3924
- cssClass;
3925
-
3926
- formatted=this.opts.formatSelection(data, choice.find("div"), this.opts.escapeMarkup);
3927
- if (formatted != undefined) {
3928
- choice.find("div").replaceWith("<div>"+formatted+"</div>");
3929
- }
3930
- cssClass=this.opts.formatSelectionCssClass(data, choice.find("div"));
3931
- if (cssClass != undefined) {
3932
- choice.addClass(cssClass);
3933
- }
3934
-
3935
- if(enableChoice){
3936
- choice.find(".select2-search-choice-close")
3937
- .on("mousedown", killEvent)
3938
- .on("click dblclick", this.bind(function (e) {
3939
- if (!this.isInterfaceEnabled()) return;
3940
-
3941
- this.unselect($(e.target));
3942
- this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");
3943
- killEvent(e);
3944
- this.close();
3945
- this.focusSearch();
3946
- })).on("focus", this.bind(function () {
3947
- if (!this.isInterfaceEnabled()) return;
3948
- this.container.addClass("select2-container-active");
3949
- this.dropdown.addClass("select2-drop-active");
3950
- }));
3951
- }
3952
-
3953
- choice.data("select2-data", data);
3954
- choice.insertBefore(this.searchContainer);
3955
-
3956
- val.push(id);
3957
- this.setVal(val);
3958
- },
3959
-
3960
- // multi
3961
- unselect: function (selected) {
3962
- var val = this.getVal(),
3963
- data,
3964
- index;
3965
- selected = selected.closest(".select2-search-choice");
3966
-
3967
- if (selected.length === 0) {
3968
- throw "Invalid argument: " + selected + ". Must be .select2-search-choice";
3969
- }
3970
-
3971
- data = selected.data("select2-data");
3972
-
3973
- if (!data) {
3974
- // prevent a race condition when the 'x' is clicked really fast repeatedly the event can be queued
3975
- // and invoked on an element already removed
3976
- return;
3977
- }
3978
-
3979
- var evt = $.Event("select2-removing");
3980
- evt.val = this.id(data);
3981
- evt.choice = data;
3982
- this.opts.element.trigger(evt);
3983
-
3984
- if (evt.isDefaultPrevented()) {
3985
- return false;
3986
- }
3987
-
3988
- while((index = indexOf(this.id(data), val)) >= 0) {
3989
- val.splice(index, 1);
3990
- this.setVal(val);
3991
- if (this.select) this.postprocessResults();
3992
- }
3993
-
3994
- selected.remove();
3995
-
3996
- this.opts.element.trigger({ type: "select2-removed", val: this.id(data), choice: data });
3997
- this.triggerChange({ removed: data });
3998
-
3999
- return true;
4000
- },
4001
-
4002
- // multi
4003
- postprocessResults: function (data, initial, noHighlightUpdate) {
4004
- var val = this.getVal(),
4005
- choices = this.results.find(".select2-result"),
4006
- compound = this.results.find(".select2-result-with-children"),
4007
- self = this;
4008
-
4009
- choices.each2(function (i, choice) {
4010
- var id = self.id(choice.data("select2-data"));
4011
- if (indexOf(id, val) >= 0) {
4012
- choice.addClass("select2-selected");
4013
- // mark all children of the selected parent as selected
4014
- choice.find(".select2-result-selectable").addClass("select2-selected");
4015
- }
4016
- });
4017
-
4018
- compound.each2(function(i, choice) {
4019
- // hide an optgroup if it doesn't have any selectable children
4020
- if (!choice.is('.select2-result-selectable')
4021
- && choice.find(".select2-result-selectable:not(.select2-selected)").length === 0) {
4022
- choice.addClass("select2-selected");
4023
- }
4024
- });
4025
-
4026
- if (this.highlight() == -1 && noHighlightUpdate !== false){
4027
- self.highlight(0);
4028
- }
4029
-
4030
- //If all results are chosen render formatNoMatches
4031
- if(!this.opts.createSearchChoice && !choices.filter('.select2-result:not(.select2-selected)').length > 0){
4032
- if(!data || data && !data.more && this.results.find(".select2-no-results").length === 0) {
4033
- if (checkFormatter(self.opts.formatNoMatches, "formatNoMatches")) {
4034
- this.results.append("<li class='select2-no-results'>" + evaluate(self.opts.formatNoMatches, self.search.val()) + "</li>");
4035
- }
4036
- }
4037
- }
4038
-
4039
- },
4040
-
4041
- // multi
4042
- getMaxSearchWidth: function() {
4043
- return this.selection.width() - getSideBorderPadding(this.search);
4044
- },
4045
-
4046
- // multi
4047
- resizeSearch: function () {
4048
- var minimumWidth, left, maxWidth, containerLeft, searchWidth,
4049
- sideBorderPadding = getSideBorderPadding(this.search);
4050
-
4051
- minimumWidth = measureTextWidth(this.search) + 10;
4052
-
4053
- left = this.search.offset().left;
4054
-
4055
- maxWidth = this.selection.width();
4056
- containerLeft = this.selection.offset().left;
4057
-
4058
- searchWidth = maxWidth - (left - containerLeft) - sideBorderPadding;
4059
-
4060
- if (searchWidth < minimumWidth) {
4061
- searchWidth = maxWidth - sideBorderPadding;
4062
- }
4063
-
4064
- if (searchWidth < 40) {
4065
- searchWidth = maxWidth - sideBorderPadding;
4066
- }
4067
-
4068
- if (searchWidth <= 0) {
4069
- searchWidth = minimumWidth;
4070
- }
4071
-
4072
- this.search.width(Math.floor(searchWidth));
4073
- },
4074
-
4075
- // multi
4076
- getVal: function () {
4077
- var val;
4078
- if (this.select) {
4079
- val = this.select.val();
4080
- return val === null ? [] : val;
4081
- } else {
4082
- val = this.opts.element.val();
4083
- return splitVal(val, this.opts.separator);
4084
- }
4085
- },
4086
-
4087
- // multi
4088
- setVal: function (val) {
4089
- var unique;
4090
- if (this.select) {
4091
- this.select.val(val);
4092
- } else {
4093
- unique = [];
4094
- // filter out duplicates
4095
- $(val).each(function () {
4096
- if (indexOf(this, unique) < 0) unique.push(this);
4097
- });
4098
- this.opts.element.val(unique.length === 0 ? "" : unique.join(this.opts.separator));
4099
- }
4100
- },
4101
-
4102
- // multi
4103
- buildChangeDetails: function (old, current) {
4104
- var current = current.slice(0),
4105
- old = old.slice(0);
4106
-
4107
- // remove intersection from each array
4108
- for (var i = 0; i < current.length; i++) {
4109
- for (var j = 0; j < old.length; j++) {
4110
- if (equal(this.opts.id(current[i]), this.opts.id(old[j]))) {
4111
- current.splice(i, 1);
4112
- if(i>0){
4113
- i--;
4114
- }
4115
- old.splice(j, 1);
4116
- j--;
4117
- }
4118
- }
4119
- }
4120
-
4121
- return {added: current, removed: old};
4122
- },
4123
-
4124
-
4125
- // multi
4126
- val: function (val, triggerChange) {
4127
- var oldData, self=this;
4128
-
4129
- if (arguments.length === 0) {
4130
- return this.getVal();
4131
- }
4132
-
4133
- oldData=this.data();
4134
- if (!oldData.length) oldData=[];
4135
-
4136
- // val is an id. !val is true for [undefined,null,'',0] - 0 is legal
4137
- if (!val && val !== 0) {
4138
- this.opts.element.val("");
4139
- this.updateSelection([]);
4140
- this.clearSearch();
4141
- if (triggerChange) {
4142
- this.triggerChange({added: this.data(), removed: oldData});
4143
- }
4144
- return;
4145
- }
4146
-
4147
- // val is a list of ids
4148
- this.setVal(val);
4149
-
4150
- if (this.select) {
4151
- this.opts.initSelection(this.select, this.bind(this.updateSelection));
4152
- if (triggerChange) {
4153
- this.triggerChange(this.buildChangeDetails(oldData, this.data()));
4154
- }
4155
- } else {
4156
- if (this.opts.initSelection === undefined) {
4157
- throw new Error("val() cannot be called if initSelection() is not defined");
4158
- }
4159
-
4160
- this.opts.initSelection(this.opts.element, function(data){
4161
- var ids=$.map(data, self.id);
4162
- self.setVal(ids);
4163
- self.updateSelection(data);
4164
- self.clearSearch();
4165
- if (triggerChange) {
4166
- self.triggerChange(self.buildChangeDetails(oldData, self.data()));
4167
- }
4168
- });
4169
- }
4170
- this.clearSearch();
4171
- },
4172
-
4173
- // multi
4174
- onSortStart: function() {
4175
- if (this.select) {
4176
- throw new Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");
4177
- }
4178
-
4179
- // collapse search field into 0 width so its container can be collapsed as well
4180
- this.search.width(0);
4181
- // hide the container
4182
- this.searchContainer.hide();
4183
- },
4184
-
4185
- // multi
4186
- onSortEnd:function() {
4187
-
4188
- var val=[], self=this;
4189
-
4190
- // show search and move it to the end of the list
4191
- this.searchContainer.show();
4192
- // make sure the search container is the last item in the list
4193
- this.searchContainer.appendTo(this.searchContainer.parent());
4194
- // since we collapsed the width in dragStarted, we resize it here
4195
- this.resizeSearch();
4196
-
4197
- // update selection
4198
- this.selection.find(".select2-search-choice").each(function() {
4199
- val.push(self.opts.id($(this).data("select2-data")));
4200
- });
4201
- this.setVal(val);
4202
- this.triggerChange();
4203
- },
4204
-
4205
- // multi
4206
- data: function(values, triggerChange) {
4207
- var self=this, ids, old;
4208
- if (arguments.length === 0) {
4209
- return this.selection
4210
- .children(".select2-search-choice")
4211
- .map(function() { return $(this).data("select2-data"); })
4212
- .get();
4213
- } else {
4214
- old = this.data();
4215
- if (!values) { values = []; }
4216
- ids = $.map(values, function(e) { return self.opts.id(e); });
4217
- this.setVal(ids);
4218
- this.updateSelection(values);
4219
- this.clearSearch();
4220
- if (triggerChange) {
4221
- this.triggerChange(this.buildChangeDetails(old, this.data()));
4222
- }
4223
- }
4224
- }
4225
- });
4226
-
4227
- $.fn.select2 = function () {
4228
-
4229
- var args = Array.prototype.slice.call(arguments, 0),
4230
- opts,
4231
- select2,
4232
- method, value, multiple,
4233
- allowedMethods = ["val", "destroy", "opened", "open", "close", "focus", "isFocused", "container", "dropdown", "onSortStart", "onSortEnd", "enable", "disable", "readonly", "positionDropdown", "data", "search"],
4234
- valueMethods = ["opened", "isFocused", "container", "dropdown"],
4235
- propertyMethods = ["val", "data"],
4236
- methodsMap = { search: "externalSearch" };
4237
-
4238
- this.each(function () {
4239
- if (args.length === 0 || typeof(args[0]) === "object") {
4240
- opts = args.length === 0 ? {} : $.extend({}, args[0]);
4241
- opts.element = $(this);
4242
-
4243
- if (opts.element.get(0).tagName.toLowerCase() === "select") {
4244
- multiple = opts.element.prop("multiple");
4245
- } else {
4246
- multiple = opts.multiple || false;
4247
- if ("tags" in opts) {opts.multiple = multiple = true;}
4248
- }
4249
-
4250
- select2 = multiple ? new window.Select2["class"].multi() : new window.Select2["class"].single();
4251
- select2.init(opts);
4252
- } else if (typeof(args[0]) === "string") {
4253
-
4254
- if (indexOf(args[0], allowedMethods) < 0) {
4255
- throw "Unknown method: " + args[0];
4256
- }
4257
-
4258
- value = undefined;
4259
- select2 = $(this).data("select2");
4260
- if (select2 === undefined) return;
4261
-
4262
- method=args[0];
4263
-
4264
- if (method === "container") {
4265
- value = select2.container;
4266
- } else if (method === "dropdown") {
4267
- value = select2.dropdown;
4268
- } else {
4269
- if (methodsMap[method]) method = methodsMap[method];
4270
-
4271
- value = select2[method].apply(select2, args.slice(1));
4272
- }
4273
- if (indexOf(args[0], valueMethods) >= 0
4274
- || (indexOf(args[0], propertyMethods) >= 0 && args.length == 1)) {
4275
- return false; // abort the iteration, ready to return first matched value
4276
- }
4277
- } else {
4278
- throw "Invalid arguments to select2 plugin: " + args;
4279
- }
4280
- });
4281
- return (value === undefined) ? this : value;
4282
- };
4283
-
4284
- // plugin defaults, accessible to users
4285
- $.fn.select2.defaults = {
4286
- width: "copy",
4287
- loadMorePadding: 0,
4288
- closeOnSelect: true,
4289
- openOnEnter: true,
4290
- containerCss: {},
4291
- dropdownCss: {},
4292
- containerCssClass: "",
4293
- dropdownCssClass: "",
4294
- formatResult: function(result, container, query, escapeMarkup) {
4295
- var markup=[];
4296
- markMatch(result.text, query.term, markup, escapeMarkup);
4297
- return markup.join("");
4298
- },
4299
- formatSelection: function (data, container, escapeMarkup) {
4300
- return data ? escapeMarkup(data.text) : undefined;
4301
- },
4302
- sortResults: function (results, container, query) {
4303
- return results;
4304
- },
4305
- formatResultCssClass: function(data) {return data.css;},
4306
- formatSelectionCssClass: function(data, container) {return undefined;},
4307
- formatMatches: function (matches) { return matches + " results are available, use up and down arrow keys to navigate."; },
4308
- formatNoMatches: function () { return "No matches found"; },
4309
- formatInputTooShort: function (input, min) { var n = min - input.length; return "Please enter " + n + " or more character" + (n == 1? "" : "s"); },
4310
- formatInputTooLong: function (input, max) { var n = input.length - max; return "Please delete " + n + " character" + (n == 1? "" : "s"); },
4311
- formatSelectionTooBig: function (limit) { return "You can only select " + limit + " item" + (limit == 1 ? "" : "s"); },
4312
- formatLoadMore: function (pageNumber) { return "Loading more results…"; },
4313
- formatSearching: function () { return "Searching…"; },
4314
- minimumResultsForSearch: 0,
4315
- minimumInputLength: 0,
4316
- maximumInputLength: null,
4317
- maximumSelectionSize: 0,
4318
- id: function (e) { return e == undefined ? null : e.id; },
4319
- matcher: function(term, text) {
4320
- return stripDiacritics(''+text).toUpperCase().indexOf(stripDiacritics(''+term).toUpperCase()) >= 0;
4321
- },
4322
- separator: ",",
4323
- tokenSeparators: [],
4324
- tokenizer: defaultTokenizer,
4325
- escapeMarkup: defaultEscapeMarkup,
4326
- blurOnChange: false,
4327
- selectOnBlur: false,
4328
- adaptContainerCssClass: function(c) { return c; },
4329
- adaptDropdownCssClass: function(c) { return null; },
4330
- nextSearchTerm: function(selectedObject, currentSearchTerm) { return undefined; },
4331
- searchInputPlaceholder: '',
4332
- createSearchChoicePosition: 'top',
4333
- shouldFocusInput: function (instance) {
4334
- // Attempt to detect touch devices
4335
- var supportsTouchEvents = (('ontouchstart' in window) ||
4336
- (navigator.msMaxTouchPoints > 0));
4337
-
4338
- // Only devices which support touch events should be special cased
4339
- if (!supportsTouchEvents) {
4340
- return true;
4341
- }
4342
-
4343
- // Never focus the input if search is disabled
4344
- if (instance.opts.minimumResultsForSearch < 0) {
4345
- return false;
4346
- }
4347
-
4348
- return true;
4349
- }
4350
- };
4351
-
4352
- $.fn.select2.ajaxDefaults = {
4353
- transport: $.ajax,
4354
- params: {
4355
- type: "GET",
4356
- cache: false,
4357
- dataType: "json"
4358
- }
4359
- };
4360
-
4361
- // exports
4362
- window.Select2 = {
4363
- query: {
4364
- ajax: ajax,
4365
- local: local,
4366
- tags: tags
4367
- }, util: {
4368
- debounce: debounce,
4369
- markMatch: markMatch,
4370
- escapeMarkup: defaultEscapeMarkup,
4371
- stripDiacritics: stripDiacritics
4372
- }, "class": {
4373
- "abstract": AbstractSelect2,
4374
- "single": SingleSelect2,
4375
- "multi": MultiSelect2
4376
- }
4377
- };
4378
-
4379
- }(jQuery));
4380
-
4381
- jQuery(document).ready( function ( $ ) {
4382
- $('#filter_action, #filter_content, #filter_form').change(function() {
4383
- $('#leadin-contacts-filter-button').addClass('button-primary');
4384
- });
4385
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/build/leadin-admin.min.js DELETED
@@ -1,8 +0,0 @@
1
- function leadin_check_social_share_popup(){jQuery.ajax({type:"POST",url:li_admin_ajax.ajax_url,data:{action:"leadin_check_installation_date"},success:function(data){data||$.cookie("ignore_social_share",1)}})}!function(factory){"function"==typeof define&&define.amd?define(["jquery"],factory):factory(jQuery)}(function($){function encode(s){return config.raw?s:encodeURIComponent(s)}function decode(s){return config.raw?s:decodeURIComponent(s)}function stringifyCookieValue(value){return encode(config.json?JSON.stringify(value):String(value))}function parseCookieValue(s){0===s.indexOf('"')&&(s=s.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return s=decodeURIComponent(s.replace(pluses," ")),config.json?JSON.parse(s):s}catch(e){}}function read(s,converter){var value=config.raw?s:parseCookieValue(s);return $.isFunction(converter)?converter(value):value}var pluses=/\+/g,config=$.cookie=function(key,value,options){if(void 0!==value&&!$.isFunction(value)){if(options=$.extend({},config.defaults,options),"number"==typeof options.expires){var days=options.expires,t=options.expires=new Date;t.setDate(t.getDate()+days)}return document.cookie=[encode(key),"=",stringifyCookieValue(value),options.expires?"; expires="+options.expires.toUTCString():"",options.path?"; path="+options.path:"",options.domain?"; domain="+options.domain:"",options.secure?"; secure":""].join("")}for(var result=key?void 0:{},cookies=document.cookie?document.cookie.split("; "):[],i=0,l=cookies.length;l>i;i++){var parts=cookies[i].split("="),name=decode(parts.shift()),cookie=parts.join("=");if(key&&key===name){result=read(cookie,value);break}key||void 0===(cookie=read(cookie))||(result[name]=cookie)}return result};config.defaults={},$.removeCookie=function(key,options){return void 0===$.cookie(key)?!1:($.cookie(key,"",$.extend({},options,{expires:-1})),!$.cookie(key))}}),window.Highcharts||!function(){function q(a,b){var c;a||(a={});for(c in b)a[c]=b[c];return a}function w(){var a,c,b=arguments,d={},e=function(a,b){var c,d;"object"!=typeof a&&(a={});for(d in b)b.hasOwnProperty(d)&&(c=b[d],a[d]=c&&"object"==typeof c&&"[object Array]"!==Object.prototype.toString.call(c)&&"renderTo"!==d&&"number"!=typeof c.nodeType?e(a[d]||{},c):b[d]);return a};for(b[0]===!0&&(d=b[1],b=Array.prototype.slice.call(b,2)),c=b.length,a=0;c>a;a++)d=e(d,b[a]);return d}function z(a,b){return parseInt(a,b||10)}function Fa(a){return"string"==typeof a}function ca(a){return"object"==typeof a}function La(a){return"[object Array]"===Object.prototype.toString.call(a)}function ha(a){return"number"==typeof a}function za(a){return U.log(a)/U.LN10}function ia(a){return U.pow(10,a)}function ja(a,b){for(var c=a.length;c--;)if(a[c]===b){a.splice(c,1);break}}function r(a){return a!==t&&null!==a}function H(a,b,c){var d,e;if(Fa(b))r(c)?a.setAttribute(b,c):a&&a.getAttribute&&(e=a.getAttribute(b));else if(r(b)&&ca(b))for(d in b)a.setAttribute(d,b[d]);return e}function qa(a){return La(a)?a:[a]}function m(){var b,c,a=arguments,d=a.length;for(b=0;d>b;b++)if(c=a[b],"undefined"!=typeof c&&null!==c)return c}function G(a,b){Aa&&!aa&&b&&b.opacity!==t&&(b.filter="alpha(opacity="+100*b.opacity+")"),q(a.style,b)}function Y(a,b,c,d,e){return a=y.createElement(a),b&&q(a,b),e&&G(a,{padding:0,border:Q,margin:0}),c&&G(a,c),d&&d.appendChild(a),a}function ka(a,b){var c=function(){};return c.prototype=new a,q(c.prototype,b),c}function Ga(a,b,c,d){var e=E.lang,a=+a||0,f=-1===b?(a.toString().split(".")[1]||"").length:isNaN(b=M(b))?2:b,b=void 0===c?e.decimalPoint:c,d=void 0===d?e.thousandsSep:d,e=0>a?"-":"",c=String(z(a=M(a).toFixed(f))),g=c.length>3?c.length%3:0;return e+(g?c.substr(0,g)+d:"")+c.substr(g).replace(/(\d{3})(?=\d)/g,"$1"+d)+(f?b+M(a-c).toFixed(f).slice(2):"")}function Ha(a,b){return Array((b||2)+1-String(a).length).join(0)+a}function Ma(a,b,c){var d=a[b];a[b]=function(){var a=Array.prototype.slice.call(arguments);return a.unshift(d),c.apply(this,a)}}function Ia(a,b){for(var e,f,g,h,i,c="{",d=!1,j=[];-1!==(c=a.indexOf(c));){if(e=a.slice(0,c),d){for(f=e.split(":"),g=f.shift().split("."),i=g.length,e=b,h=0;i>h;h++)e=e[g[h]];f.length&&(f=f.join(":"),g=/\.([0-9])/,h=E.lang,i=void 0,/f$/.test(f)?(i=(i=f.match(g))?i[1]:-1,null!==e&&(e=Ga(e,i,h.decimalPoint,f.indexOf(",")>-1?h.thousandsSep:""))):e=cb(f,e))}j.push(e),a=a.slice(c+1),c=(d=!d)?"}":"{"}return j.push(a),j.join("")}function mb(a){return U.pow(10,T(U.log(a)/U.LN10))}function nb(a,b,c,d){var e,c=m(c,1);for(e=a/c,b||(b=[1,2,2.5,5,10],d&&d.allowDecimals===!1&&(1===c?b=[1,2,5,10]:.1>=c&&(b=[1/c]))),d=0;d<b.length&&(a=b[d],!(e<=(b[d]+(b[d+1]||b[d]))/2));d++);return a*=c}function Bb(){this.symbol=this.color=0}function ob(a,b){var d,e,c=a.length;for(e=0;c>e;e++)a[e].ss_i=e;for(a.sort(function(a,c){return d=b(a,c),0===d?a.ss_i-c.ss_i:d}),e=0;c>e;e++)delete a[e].ss_i}function Na(a){for(var b=a.length,c=a[0];b--;)a[b]<c&&(c=a[b]);return c}function Ba(a){for(var b=a.length,c=a[0];b--;)a[b]>c&&(c=a[b]);return c}function Oa(a,b){for(var c in a)a[c]&&a[c]!==b&&a[c].destroy&&a[c].destroy(),delete a[c]}function Pa(a){db||(db=Y(Ja)),a&&db.appendChild(a),db.innerHTML=""}function ra(a,b){var c="Highcharts error #"+a+": www.highcharts.com/errors/"+a;if(b)throw c;I.console&&console.log(c)}function da(a){return parseFloat(a.toPrecision(14))}function Qa(a,b){va=m(a,b.animation)}function Cb(){var a=E.global.useUTC,b=a?"getUTC":"get",c=a?"setUTC":"set";Ra=6e4*(a&&E.global.timezoneOffset||0),eb=a?Date.UTC:function(a,b,c,g,h,i){return new Date(a,b,m(c,1),m(g,0),m(h,0),m(i,0)).getTime()},pb=b+"Minutes",qb=b+"Hours",rb=b+"Day",Xa=b+"Date",fb=b+"Month",gb=b+"FullYear",Db=c+"Minutes",Eb=c+"Hours",sb=c+"Date",Fb=c+"Month",Gb=c+"FullYear"}function P(){}function Sa(a,b,c,d){this.axis=a,this.pos=b,this.type=c||"",this.isNew=!0,!c&&!d&&this.addLabel()}function la(){this.init.apply(this,arguments)}function Ya(){this.init.apply(this,arguments)}function Hb(a,b,c,d,e){var f=a.chart.inverted;this.axis=a,this.isNegative=c,this.options=b,this.x=d,this.total=null,this.points={},this.stack=e,this.alignOptions={align:b.align||(f?c?"left":"right":"center"),verticalAlign:b.verticalAlign||(f?"middle":c?"bottom":"top"),y:m(b.y,f?4:c?14:-6),x:m(b.x,f?c?-6:6:0)},this.textAlign=b.textAlign||(f?c?"right":"left":"center")}var t,Za,$a,db,E,cb,va,ub,A,eb,Ra,pb,qb,rb,Xa,fb,gb,Db,Eb,sb,Fb,Gb,y=document,I=window,U=Math,u=U.round,T=U.floor,Ka=U.ceil,v=U.max,C=U.min,M=U.abs,Z=U.cos,ea=U.sin,ma=U.PI,Ca=2*ma/360,wa=navigator.userAgent,Ib=I.opera,Aa=/msie/i.test(wa)&&!Ib,hb=8===y.documentMode,ib=/AppleWebKit/.test(wa),Ta=/Firefox/.test(wa),Jb=/(Mobile|Android|Windows Phone)/.test(wa),xa="http://www.w3.org/2000/svg",aa=!!y.createElementNS&&!!y.createElementNS(xa,"svg").createSVGRect,Nb=Ta&&parseInt(wa.split("Firefox/")[1],10)<4,fa=!aa&&!Aa&&!!y.createElement("canvas").getContext,Kb={},tb=0,sa=function(){},V=[],ab=0,Ja="div",Q="none",Ob=/^[0-9]+$/,Pb="stroke-width",F={},R=I.Highcharts=I.Highcharts?ra(16,!0):{};cb=function(a,b,c){if(!r(b)||isNaN(b))return"Invalid date";var e,a=m(a,"%Y-%m-%d %H:%M:%S"),d=new Date(b-Ra),f=d[qb](),g=d[rb](),h=d[Xa](),i=d[fb](),j=d[gb](),k=E.lang,l=k.weekdays,d=q({a:l[g].substr(0,3),A:l[g],d:Ha(h),e:h,b:k.shortMonths[i],B:k.months[i],m:Ha(i+1),y:j.toString().substr(2,2),Y:j,H:Ha(f),I:Ha(f%12||12),l:f%12||12,M:Ha(d[pb]()),p:12>f?"AM":"PM",P:12>f?"am":"pm",S:Ha(d.getSeconds()),L:Ha(u(b%1e3),3)},R.dateFormats);for(e in d)for(;-1!==a.indexOf("%"+e);)a=a.replace("%"+e,"function"==typeof d[e]?d[e](b):d[e]);return c?a.substr(0,1).toUpperCase()+a.substr(1):a},Bb.prototype={wrapColor:function(a){this.color>=a&&(this.color=0)},wrapSymbol:function(a){this.symbol>=a&&(this.symbol=0)}},A=function(){for(var a=0,b=arguments,c=b.length,d={};c>a;a++)d[b[a++]]=b[a];return d}("millisecond",1,"second",1e3,"minute",6e4,"hour",36e5,"day",864e5,"week",6048e5,"month",26784e5,"year",31556952e3),ub={init:function(a,b,c){var g,h,i,b=b||"",d=a.shift,e=b.indexOf("C")>-1,f=e?7:3,b=b.split(" "),c=[].concat(c),j=function(a){for(g=a.length;g--;)"M"===a[g]&&a.splice(g+1,0,a[g+1],a[g+2],a[g+1],a[g+2])};if(e&&(j(b),j(c)),a.isArea&&(h=b.splice(b.length-6,6),i=c.splice(c.length-6,6)),d<=c.length/f&&b.length===c.length)for(;d--;)c=[].concat(c).splice(0,f).concat(c);if(a.shift=0,b.length)for(a=c.length;b.length<a;)d=[].concat(b).splice(b.length-f,f),e&&(d[f-6]=d[f-2],d[f-5]=d[f-1]),b=b.concat(d);return h&&(b=b.concat(h),c=c.concat(i)),[b,c]},step:function(a,b,c,d){var e=[],f=a.length;if(1===c)e=d;else if(f===b.length&&1>c)for(;f--;)d=parseFloat(a[f]),e[f]=isNaN(d)?a[f]:c*parseFloat(b[f]-d)+d;else e=b;return e}},function(a){I.HighchartsAdapter=I.HighchartsAdapter||a&&{init:function(b){var e,c=a.fx,d=c.step,f=a.Tween,g=f&&f.propHooks;e=a.cssHooks.opacity,a.extend(a.easing,{easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c}}),a.each(["cur","_default","width","height","opacity"],function(a,b){var k,e=d;"cur"===b?e=c.prototype:"_default"===b&&f&&(e=g[b],b="set"),(k=e[b])&&(e[b]=function(c){var d,c=a?c:this;return"align"!==c.prop?(d=c.elem,d.attr?d.attr(c.prop,"cur"===b?t:c.now):k.apply(this,arguments)):void 0})}),Ma(e,"get",function(a,b,c){return b.attr?b.opacity||0:a.call(this,b,c)}),e=function(a){var d,c=a.elem;a.started||(d=b.init(c,c.d,c.toD),a.start=d[0],a.end=d[1],a.started=!0),c.attr("d",b.step(a.start,a.end,a.pos,c.toD))},f?g.d={set:e}:d.d=e,this.each=Array.prototype.forEach?function(a,b){return Array.prototype.forEach.call(a,b)}:function(a,b){for(var c=0,d=a.length;d>c;c++)if(b.call(a[c],a[c],c,a)===!1)return c},a.fn.highcharts=function(){var c,d,a="Chart",b=arguments;return this[0]&&(Fa(b[0])&&(a=b[0],b=Array.prototype.slice.call(b,1)),c=b[0],c!==t&&(c.chart=c.chart||{},c.chart.renderTo=this[0],new R[a](c,b[1]),d=this),c===t&&(d=V[H(this[0],"data-highcharts-chart")])),d}},getScript:a.getScript,inArray:a.inArray,adapterRun:function(b,c){return a(b)[c]()},grep:a.grep,map:function(a,c){for(var d=[],e=0,f=a.length;f>e;e++)d[e]=c.call(a[e],a[e],e,a);return d},offset:function(b){return a(b).offset()},addEvent:function(b,c,d){a(b).bind(c,d)},removeEvent:function(b,c,d){var e=y.removeEventListener?"removeEventListener":"detachEvent";y[e]&&b&&!b[e]&&(b[e]=function(){}),a(b).unbind(c,d)},fireEvent:function(b,c,d,e){var h,f=a.Event(c),g="detached"+c;!Aa&&d&&(delete d.layerX,delete d.layerY,delete d.returnValue),q(f,d),b[c]&&(b[g]=b[c],b[c]=null),a.each(["preventDefault","stopPropagation"],function(a,b){var c=f[b];f[b]=function(){try{c.call(f)}catch(a){"preventDefault"===b&&(h=!0)}}}),a(b).trigger(f),b[g]&&(b[c]=b[g],b[g]=null),e&&!f.isDefaultPrevented()&&!h&&e(f)},washMouseEvent:function(a){var c=a.originalEvent||a;return c.pageX===t&&(c.pageX=a.pageX,c.pageY=a.pageY),c},animate:function(b,c,d){var e=a(b);b.style||(b.style={}),c.d&&(b.toD=c.d,c.d=1),e.stop(),c.opacity!==t&&b.attr&&(c.opacity+="px"),e.animate(c,d)},stop:function(b){a(b).stop()}}}(I.jQuery);var S=I.HighchartsAdapter,N=S||{};S&&S.init.call(S,ub);var jb=N.adapterRun,Qb=N.getScript,Da=N.inArray,p=N.each,vb=N.grep,Rb=N.offset,Ua=N.map,K=N.addEvent,W=N.removeEvent,D=N.fireEvent,Sb=N.washMouseEvent,kb=N.animate,bb=N.stop,N={enabled:!0,x:0,y:15,style:{color:"#606060",cursor:"default",fontSize:"11px"}};E={colors:"#7cb5ec,#434348,#90ed7d,#f7a35c,#8085e9,#f15c80,#e4d354,#8085e8,#8d4653,#91e8e1".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/4.0.1/modules/canvas-tools.js",VMLRadialGradientURL:"http://code.highcharts.com/4.0.1/gfx/vml-radial-gradient.png"},chart:{borderColor:"#4572A7",borderRadius:0,defaultSeriesType:"line",ignoreHiddenSeries:!0,spacing:[10,10,15,10],backgroundColor:"#FFFFFF",plotBorderColor:"#C0C0C0",resetZoomButton:{theme:{zIndex:20},position:{align:"right",x:-10,y:10}}},title:{text:"Chart title",align:"center",margin:15,style:{color:"#333333",fontSize:"18px"}},subtitle:{text:"",align:"center",style:{color:"#555555"}},plotOptions:{line:{allowPointSelect:!1,showCheckbox:!1,animation:{duration:1e3},events:{},lineWidth:2,marker:{lineWidth:0,radius:4,lineColor:"#FFFFFF",states:{hover:{enabled:!0},select:{fillColor:"#FFFFFF",lineColor:"#000000",lineWidth:2}}},point:{events:{}},dataLabels:w(N,{align:"center",enabled:!1,formatter:function(){return null===this.y?"":Ga(this.y,-1)},verticalAlign:"bottom",y:0}),cropThreshold:300,pointRange:0,states:{hover:{marker:{},halo:{size:10,opacity:.25}},select:{marker:{}}},stickyTracking:!0,turboThreshold:1e3}},labels:{style:{position:"absolute",color:"#3E576F"}},legend:{enabled:!0,align:"center",layout:"horizontal",labelFormatter:function(){return this.name},borderColor:"#909090",borderRadius:0,navigation:{activeColor:"#274b6d",inactiveColor:"#CCC"},shadow:!1,itemStyle:{color:"#333333",fontSize:"12px",fontWeight:"bold"},itemHoverStyle:{color:"#000"},itemHiddenStyle:{color:"#CCC"},itemCheckboxStyle:{position:"absolute",width:"13px",height:"13px"},symbolPadding:5,verticalAlign:"bottom",x:0,y:0,title:{style:{fontWeight:"bold"}}},loading:{labelStyle:{fontWeight:"bold",position:"relative",top:"1em"},style:{position:"absolute",backgroundColor:"white",opacity:.5,textAlign:"center"}},tooltip:{enabled:!0,animation:aa,backgroundColor:"rgba(249, 249, 249, .85)",borderWidth:1,borderRadius:3,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}">●</span> {series.name}: <b>{point.y}</b><br/>',shadow:!0,snap:Jb?25:10,style:{color:"#333333",cursor:"default",fontSize:"12px",padding:"8px",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:"9px"}}};var ba=E.plotOptions,S=ba.line;Cb();var Tb=/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*\)/,Ub=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/,Vb=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/,ya=function(a){var c,d,b=[];return function(a){a&&a.stops?d=Ua(a.stops,function(a){return ya(a[1])}):(c=Tb.exec(a))?b=[z(c[1]),z(c[2]),z(c[3]),parseFloat(c[4],10)]:(c=Ub.exec(a))?b=[z(c[1],16),z(c[2],16),z(c[3],16),1]:(c=Vb.exec(a))&&(b=[z(c[1]),z(c[2]),z(c[3]),1])}(a),{get:function(c){var f;return d?(f=w(a),f.stops=[].concat(f.stops),p(d,function(a,b){f.stops[b]=[f.stops[b][0],a.get(c)]})):f=b&&!isNaN(b[0])?"rgb"===c?"rgb("+b[0]+","+b[1]+","+b[2]+")":"a"===c?b[3]:"rgba("+b.join(",")+")":a,f},brighten:function(a){if(d)p(d,function(b){b.brighten(a)});else if(ha(a)&&0!==a){var c;for(c=0;3>c;c++)b[c]+=z(255*a),b[c]<0&&(b[c]=0),b[c]>255&&(b[c]=255)}return this},rgba:b,setOpacity:function(a){return b[3]=a,this}}};P.prototype={init:function(a,b){this.element="span"===b?Y(b):y.createElementNS(xa,b),this.renderer=a},opacity:1,animate:function(a,b,c){b=m(b,va,!0),bb(this),b?(b=w(b,{}),c&&(b.complete=c),kb(this,a,b)):(this.attr(a),c&&c())},colorGradient:function(a,b,c){var e,f,g,h,i,j,k,l,o,n,d=this.renderer,s=[];if(a.linearGradient?f="linearGradient":a.radialGradient&&(f="radialGradient"),f){g=a[f],h=d.gradients,j=a.stops,o=c.radialReference,La(g)&&(a[f]=g={x1:g[0],y1:g[1],x2:g[2],y2:g[3],gradientUnits:"userSpaceOnUse"}),"radialGradient"===f&&o&&!r(g.gradientUnits)&&(g=w(g,{cx:o[0]-o[2]/2+g.cx*o[2],cy:o[1]-o[2]/2+g.cy*o[2],r:g.r*o[2],gradientUnits:"userSpaceOnUse"}));for(n in g)"id"!==n&&s.push(n,g[n]);for(n in j)s.push(j[n]);s=s.join(","),h[s]?a=h[s].attr("id"):(g.id=a="highcharts-"+tb++,h[s]=i=d.createElement(f).attr(g).add(d.defs),i.stops=[],p(j,function(a){0===a[1].indexOf("rgba")?(e=ya(a[1]),k=e.get("rgb"),l=e.get("a")):(k=a[1],l=1),a=d.createElement("stop").attr({offset:a[0],"stop-color":k,"stop-opacity":l}).add(i),i.stops.push(a)})),c.setAttribute(b,"url("+d.url+"#"+a+")")}},attr:function(a,b){var c,d,f,h,e=this.element,g=this;if("string"==typeof a&&b!==t&&(c=a,a={},a[c]=b),"string"==typeof a)g=(this[a+"Getter"]||this._defaultGetter).call(this,a,e);else{for(c in a)d=a[c],h=!1,this.symbolName&&/^(x|y|width|height|r|start|end|innerR|anchorX|anchorY)/.test(c)&&(f||(this.symbolAttr(a),f=!0),h=!0),!this.rotation||"x"!==c&&"y"!==c||(this.doTransform=!0),h||(this[c+"Setter"]||this._defaultSetter).call(this,d,c,e),this.shadows&&/^(width|height|visibility|x|y|d|transform|cx|cy|r)$/.test(c)&&this.updateShadows(c,d);this.doTransform&&(this.updateTransform(),this.doTransform=!1)}return g},updateShadows:function(a,b){for(var c=this.shadows,d=c.length;d--;)c[d].setAttribute(a,"height"===a?v(b-(c[d].cutHeight||0),0):"d"===a?this.d:b)},addClass:function(a){var b=this.element,c=H(b,"class")||"";return-1===c.indexOf(a)&&H(b,"class",c+" "+a),this},symbolAttr:function(a){var b=this;p("x,y,r,start,end,width,height,innerR,anchorX,anchorY".split(","),function(c){b[c]=m(a[c],b[c])}),b.attr({d:b.renderer.symbols[b.symbolName](b.x,b.y,b.width,b.height,b)})},clip:function(a){return this.attr("clip-path",a?"url("+this.renderer.url+"#"+a.id+")":Q)},crisp:function(a){var b,d,c={},e=a.strokeWidth||this.strokeWidth||this.attr&&this.attr("stroke-width")||0;d=u(e)%2/2,a.x=T(a.x||this.x||0)+d,a.y=T(a.y||this.y||0)+d,a.width=T((a.width||this.width||0)-2*d),a.height=T((a.height||this.height||0)-2*d),a.strokeWidth=e;for(b in a)this[b]!==a[b]&&(this[b]=c[b]=a[b]);return c},css:function(a){var e,f,b=this.styles,c={},d=this.element,g="";if(e=!b,a&&a.color&&(a.fill=a.color),b)for(f in a)a[f]!==b[f]&&(c[f]=a[f],e=!0);if(e){if(e=this.textWidth=a&&a.width&&"text"===d.nodeName.toLowerCase()&&z(a.width),b&&(a=q(b,c)),this.styles=a,e&&(fa||!aa&&this.renderer.forExport)&&delete a.width,Aa&&!aa)G(this.element,a);else{b=function(a,b){return"-"+b.toLowerCase()};for(f in a)g+=f.replace(/([A-Z])/g,b)+":"+a[f]+";";H(d,"style",g)}e&&this.added&&this.renderer.buildText(this)}return this},on:function(a,b){var c=this,d=c.element;return $a&&"click"===a?(d.ontouchstart=function(a){c.touchEventFired=Date.now(),a.preventDefault(),b.call(d,a)},d.onclick=function(a){(-1===wa.indexOf("Android")||Date.now()-(c.touchEventFired||0)>1100)&&b.call(d,a)}):d["on"+a]=b,this},setRadialReference:function(a){return this.element.radialReference=a,this},translate:function(a,b){return this.attr({translateX:a,translateY:b})},invert:function(){return this.inverted=!0,this.updateTransform(),this},updateTransform:function(){var a=this.translateX||0,b=this.translateY||0,c=this.scaleX,d=this.scaleY,e=this.inverted,f=this.rotation,g=this.element;e&&(a+=this.attr("width"),b+=this.attr("height")),a=["translate("+a+","+b+")"],e?a.push("rotate(90) scale(-1,1)"):f&&a.push("rotate("+f+" "+(g.getAttribute("x")||0)+" "+(g.getAttribute("y")||0)+")"),(r(c)||r(d))&&a.push("scale("+m(c,1)+" "+m(d,1)+")"),a.length&&g.setAttribute("transform",a.join(" "))},toFront:function(){var a=this.element;return a.parentNode.appendChild(a),this},align:function(a,b,c){var d,e,f,g,h={};return e=this.renderer,f=e.alignedObjects,a?(this.alignOptions=a,this.alignByTranslate=b,(!c||Fa(c))&&(this.alignTo=d=c||"renderer",ja(f,this),f.push(this),c=null)):(a=this.alignOptions,b=this.alignByTranslate,d=this.alignTo),c=m(c,e[d],e),d=a.align,e=a.verticalAlign,f=(c.x||0)+(a.x||0),g=(c.y||0)+(a.y||0),("right"===d||"center"===d)&&(f+=(c.width-(a.width||0))/{right:1,center:2}[d]),h[b?"translateX":"x"]=u(f),("bottom"===e||"middle"===e)&&(g+=(c.height-(a.height||0))/({bottom:1,middle:2}[e]||1)),h[b?"translateY":"y"]=u(g),this[this.placed?"animate":"attr"](h),this.placed=!0,this.alignAttr=h,this},getBBox:function(){var c,d,a=this.bBox,b=this.renderer,e=this.rotation;c=this.element;var f=this.styles,g=e*Ca;d=this.textStr;var h;if((""===d||Ob.test(d))&&(h="num."+d.toString().length+(f?"|"+f.fontSize+"|"+f.fontFamily:"")),h&&(a=b.cache[h]),!a){if(c.namespaceURI===xa||b.forExport){try{a=c.getBBox?q({},c.getBBox()):{width:c.offsetWidth,height:c.offsetHeight}}catch(i){}(!a||a.width<0)&&(a={width:0,height:0})}else a=this.htmlGetBBox();b.isSVG&&(c=a.width,d=a.height,Aa&&f&&"11px"===f.fontSize&&"16.9"===d.toPrecision(3)&&(a.height=d=14),e&&(a.width=M(d*ea(g))+M(c*Z(g)),a.height=M(d*Z(g))+M(c*ea(g)))),this.bBox=a,h&&(b.cache[h]=a)}return a},show:function(a){return a&&this.element.namespaceURI===xa?(this.element.removeAttribute("visibility"),this):this.attr({visibility:a?"inherit":"visible"})},hide:function(){return this.attr({visibility:"hidden"})},fadeOut:function(a){var b=this;b.animate({opacity:0},{duration:a||150,complete:function(){b.hide()}})},add:function(a){var g,h,b=this.renderer,c=a||b,d=c.element||b.box,e=this.element,f=this.zIndex;if(a&&(this.parentGroup=a),this.parentInverted=a&&a.inverted,void 0!==this.textStr&&b.buildText(this),f&&(c.handleZ=!0,f=z(f)),c.handleZ)for(a=d.childNodes,g=0;g<a.length;g++)if(b=a[g],c=H(b,"zIndex"),b!==e&&(z(c)>f||!r(f)&&r(c))){d.insertBefore(e,b),h=!0;break}return h||d.appendChild(e),this.added=!0,this.onAdd&&this.onAdd(),this},safeRemoveChild:function(a){var b=a.parentNode;b&&b.removeChild(a)},destroy:function(){var e,f,a=this,b=a.element||{},c=a.shadows,d=a.renderer.isSVG&&"SPAN"===b.nodeName&&a.parentGroup;if(b.onclick=b.onmouseout=b.onmouseover=b.onmousemove=b.point=null,bb(a),a.clipPath&&(a.clipPath=a.clipPath.destroy()),a.stops){for(f=0;f<a.stops.length;f++)a.stops[f]=a.stops[f].destroy();a.stops=null}for(a.safeRemoveChild(b),c&&p(c,function(b){a.safeRemoveChild(b)});d&&0===d.div.childNodes.length;)b=d.parentGroup,a.safeRemoveChild(d.div),delete d.div,d=b;a.alignTo&&ja(a.renderer.alignedObjects,a);for(e in a)delete a[e];return null},shadow:function(a,b,c){var e,f,h,i,j,k,d=[],g=this.element;if(a){for(i=m(a.width,3),j=(a.opacity||.15)/i,k=this.parentInverted?"(-1,-1)":"("+m(a.offsetX,1)+", "+m(a.offsetY,1)+")",e=1;i>=e;e++)f=g.cloneNode(0),h=2*i+1-2*e,H(f,{isShadow:"true",stroke:a.color||"black","stroke-opacity":j*e,"stroke-width":h,transform:"translate"+k,fill:Q}),c&&(H(f,"height",v(H(f,"height")-h,0)),f.cutHeight=h),b?b.element.appendChild(f):g.parentNode.insertBefore(f,g),d.push(f);this.shadows=d}return this},xGetter:function(a){return"circle"===this.element.nodeName&&(a={x:"cx",y:"cy"}[a]||a),this._defaultGetter(a)},_defaultGetter:function(a){return a=m(this[a],this.element?this.element.getAttribute(a):null,0),/^[0-9\.]+$/.test(a)&&(a=parseFloat(a)),a},dSetter:function(a,b,c){a&&a.join&&(a=a.join(" ")),/(NaN| {2}|^$)/.test(a)&&(a="M 0 0"),c.setAttribute(b,a),this[b]=a},dashstyleSetter:function(a){var b;if(a=a&&a.toLowerCase()){for(a=a.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(","),b=a.length;b--;)a[b]=z(a[b])*this.element.getAttribute("stroke-width");a=a.join(","),this.element.setAttribute("stroke-dasharray",a)}},alignSetter:function(a){this.element.setAttribute("text-anchor",{left:"start",center:"middle",right:"end"}[a])},opacitySetter:function(a,b,c){this[b]=a,c.setAttribute(b,a)},"stroke-widthSetter":function(a,b,c){0===a&&(a=1e-5),this.strokeWidth=a,c.setAttribute(b,a)},titleSetter:function(a){var b=this.element.getElementsByTagName("title")[0];b||(b=y.createElementNS(xa,"title"),this.element.appendChild(b)),b.textContent=a},textSetter:function(a){a!==this.textStr&&(delete this.bBox,this.textStr=a,this.added&&this.renderer.buildText(this))},fillSetter:function(a,b,c){"string"==typeof a?c.setAttribute(b,a):a&&this.colorGradient(a,b,c)},zIndexSetter:function(a,b,c){c.setAttribute(b,a),this[b]=a},_defaultSetter:function(a,b,c){c.setAttribute(b,a)}},P.prototype.yGetter=P.prototype.xGetter,P.prototype.translateXSetter=P.prototype.translateYSetter=P.prototype.rotationSetter=P.prototype.verticalAlignSetter=P.prototype.scaleXSetter=P.prototype.scaleYSetter=function(a,b){this[b]=a,this.doTransform=!0},P.prototype.strokeSetter=P.prototype.fillSetter;var ta=function(){this.init.apply(this,arguments)};ta.prototype={Element:P,init:function(a,b,c,d,e){var g,f=location,d=this.createElement("svg").attr({version:"1.1"}).css(this.getStyle(d));g=d.element,a.appendChild(g),-1===a.innerHTML.indexOf("xmlns")&&H(g,"xmlns",xa),this.isSVG=!0,this.box=g,this.boxWrapper=d,this.alignedObjects=[],this.url=(Ta||ib)&&y.getElementsByTagName("base").length?f.href.replace(/#.*?$/,"").replace(/([\('\)])/g,"\\$1").replace(/ /g,"%20"):"",this.createElement("desc").add().element.appendChild(y.createTextNode("Created with Highcharts 4.0.1")),this.defs=this.createElement("defs").add(),this.forExport=e,this.gradients={},this.cache={},this.setSize(b,c,!1);var h;Ta&&a.getBoundingClientRect&&(this.subPixelFix=b=function(){G(a,{left:0,top:0}),h=a.getBoundingClientRect(),G(a,{left:Ka(h.left)-h.left+"px",top:Ka(h.top)-h.top+"px"})},b(),K(I,"resize",b))},getStyle:function(a){return this.style=q({fontFamily:'"Lucida Grande", "Lucida Sans Unicode", Arial, Helvetica, sans-serif',fontSize:"12px"},a)},isHidden:function(){return!this.boxWrapper.getBBox().width},destroy:function(){var a=this.defs;return this.box=null,this.boxWrapper=this.boxWrapper.destroy(),Oa(this.gradients||{}),this.gradients=null,a&&(this.defs=a.destroy()),this.subPixelFix&&W(I,"resize",this.subPixelFix),this.alignedObjects=null},createElement:function(a){var b=new this.Element;return b.init(this,a),b},draw:function(){},buildText:function(a){for(var h,i,b=a.element,c=this,d=c.forExport,e=m(a.textStr,"").toString(),f=-1!==e.indexOf("<"),g=b.childNodes,j=H(b,"x"),k=a.styles,l=a.textWidth,o=k&&k.lineHeight,n=g.length,s=function(a){return o?z(o):c.fontMetrics(/(px|em)$/.test(a&&a.style.fontSize)?a.style.fontSize:k&&k.fontSize||c.style.fontSize||12).h};n--;)b.removeChild(g[n]);f||-1!==e.indexOf(" ")?(h=/<.*style="([^"]+)".*>/,i=/<.*href="(http[^"]+)".*>/,l&&!a.added&&this.box.appendChild(b),e=f?e.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):[e],""===e[e.length-1]&&e.pop(),p(e,function(e,f){var g,n=0,e=e.replace(/<span/g,"|||<span").replace(/<\/span>/g,"</span>|||");g=e.split("|||"),p(g,function(e){if(""!==e||1===g.length){var p,o={},m=y.createElementNS(xa,"tspan");if(h.test(e)&&(p=e.match(h)[1].replace(/(;| |^)color([ :])/,"$1fill$2"),H(m,"style",p)),i.test(e)&&!d&&(H(m,"onclick",'location.href="'+e.match(i)[1]+'"'),G(m,{cursor:"pointer"})),e=(e.replace(/<(.|\n)*?>/g,"")||" ").replace(/&lt;/g,"<").replace(/&gt;/g,">")," "!==e&&(m.appendChild(y.createTextNode(e)),n?o.dx=0:f&&null!==j&&(o.x=j),H(m,o),!n&&f&&(!aa&&d&&G(m,{display:"block"}),H(m,"dy",s(m),ib&&m.offsetHeight)),b.appendChild(m),n++,l))for(var $,r,e=e.replace(/([^\^])-/g,"$1- ").split(" "),o=e.length>1&&"nowrap"!==k.whiteSpace,B=a._clipHeight,q=[],v=s(),t=1;o&&(e.length||q.length);)delete a.bBox,$=a.getBBox(),r=$.width,!aa&&c.forExport&&(r=c.measureSpanWidth(m.firstChild.data,a.styles)),$=r>l,$&&1!==e.length?(m.removeChild(m.firstChild),q.unshift(e.pop())):(e=q,q=[],e.length&&(t++,B&&t*v>B?(e=["..."],a.attr("title",a.textStr)):(m=y.createElementNS(xa,"tspan"),H(m,{dy:v,x:j}),p&&H(m,"style",p),b.appendChild(m),r>l&&(l=r)))),e.length&&m.appendChild(y.createTextNode(e.join(" ").replace(/- /g,"-")))}})})):b.appendChild(y.createTextNode(e))},button:function(a,b,c,d,e,f,g,h,i){var l,o,n,s,m,p,j=this.label(a,b,c,i,null,null,null,null,"button"),k=0,a={x1:0,y1:0,x2:0,y2:1},e=w({"stroke-width":1,stroke:"#CCCCCC",fill:{linearGradient:a,stops:[[0,"#FEFEFE"],[1,"#F6F6F6"]]},r:2,padding:5,style:{color:"black"}},e);return n=e.style,delete e.style,f=w(e,{stroke:"#68A",fill:{linearGradient:a,stops:[[0,"#FFF"],[1,"#ACF"]]}},f),s=f.style,delete f.style,g=w(e,{stroke:"#68A",fill:{linearGradient:a,stops:[[0,"#9BD"],[1,"#CDF"]]}},g),m=g.style,delete g.style,h=w(e,{style:{color:"#CCC"}},h),p=h.style,delete h.style,K(j.element,Aa?"mouseover":"mouseenter",function(){3!==k&&j.attr(f).css(s)}),K(j.element,Aa?"mouseout":"mouseleave",function(){3!==k&&(l=[e,f,g][k],o=[n,s,m][k],j.attr(l).css(o))}),j.setState=function(a){(j.state=k=a)?2===a?j.attr(g).css(m):3===a&&j.attr(h).css(p):j.attr(e).css(n)},j.on("click",function(){3!==k&&d.call(j)}).attr(e).css(q({cursor:"default"},n))},crispLine:function(a,b){return a[1]===a[4]&&(a[1]=a[4]=u(a[1])-b%2/2),a[2]===a[5]&&(a[2]=a[5]=u(a[2])+b%2/2),a},path:function(a){var b={fill:Q};return La(a)?b.d=a:ca(a)&&q(b,a),this.createElement("path").attr(b)},circle:function(a,b,c){return a=ca(a)?a:{x:a,y:b,r:c},b=this.createElement("circle"),b.xSetter=function(a){this.element.setAttribute("cx",a)},b.ySetter=function(a){this.element.setAttribute("cy",a)},b.attr(a)},arc:function(a,b,c,d,e,f){return ca(a)&&(b=a.y,c=a.r,d=a.innerR,e=a.start,f=a.end,a=a.x),a=this.symbol("arc",a||0,b||0,c||0,c||0,{innerR:d||0,start:e||0,end:f||0}),a.r=c,a},rect:function(a,b,c,d,e,f){var e=ca(a)?a.r:e,g=this.createElement("rect"),a=ca(a)?a:a===t?{}:{x:a,y:b,width:v(c,0),height:v(d,0)};return f!==t&&(a.strokeWidth=f,a=g.crisp(a)),e&&(a.r=e),g.rSetter=function(a){H(this.element,{rx:a,ry:a})},g.attr(a)},setSize:function(a,b,c){var d=this.alignedObjects,e=d.length;for(this.width=a,this.height=b,this.boxWrapper[m(c,!0)?"animate":"attr"]({width:a,height:b});e--;)d[e].align()},g:function(a){var b=this.createElement("g");return r(a)?b.attr({"class":"highcharts-"+a}):b},image:function(a,b,c,d,e){var f={preserveAspectRatio:Q};return arguments.length>1&&q(f,{x:b,y:c,width:d,height:e}),f=this.createElement("image").attr(f),f.element.setAttributeNS?f.element.setAttributeNS("http://www.w3.org/1999/xlink","href",a):f.element.setAttribute("hc-svg-href",a),f},symbol:function(a,b,c,d,e,f){var g,j,k,h=this.symbols[a],h=h&&h(u(b),u(c),d,e,f),i=/^url\((.*?)\)$/;return h?(g=this.path(h),q(g,{symbolName:a,x:b,y:c,width:d,height:e}),f&&q(g,f)):i.test(a)&&(k=function(a,b){a.element&&(a.attr({width:b[0],height:b[1]}),a.alignByTranslate||a.translate(u((d-b[0])/2),u((e-b[1])/2)))},j=a.match(i)[1],a=Kb[j],g=this.image(j).attr({x:b,y:c}),g.isImg=!0,a?k(g,a):(g.attr({width:0,height:0}),Y("img",{onload:function(){k(g,Kb[j]=[this.width,this.height])},src:j}))),g},symbols:{circle:function(a,b,c,d){var e=.166*c;return["M",a+c/2,b,"C",a+c+e,b,a+c+e,b+d,a+c/2,b+d,"C",a-e,b+d,a-e,b,a+c/2,b,"Z"]},square:function(a,b,c,d){return["M",a,b,"L",a+c,b,a+c,b+d,a,b+d,"Z"]},triangle:function(a,b,c,d){return["M",a+c/2,b,"L",a+c,b+d,a,b+d,"Z"]},"triangle-down":function(a,b,c,d){return["M",a,b,"L",a+c,b,a+c/2,b+d,"Z"]},diamond:function(a,b,c,d){return["M",a+c/2,b,"L",a+c,b+d/2,a+c/2,b+d,a,b+d/2,"Z"]},arc:function(a,b,c,d,e){var f=e.start,c=e.r||c||d,g=e.end-.001,d=e.innerR,h=e.open,i=Z(f),j=ea(f),k=Z(g),g=ea(g),e=e.end-f<ma?0:1;return["M",a+c*i,b+c*j,"A",c,c,0,e,1,a+c*k,b+c*g,h?"M":"L",a+d*k,b+d*g,"A",d,d,0,e,0,a+d*i,b+d*j,h?"":"Z"]},callout:function(a,b,c,d,e){var f=C(e&&e.r||0,c,d),g=f+6,h=e&&e.anchorX,i=e&&e.anchorY,e=u(e.strokeWidth||0)%2/2;return a+=e,b+=e,e=["M",a+f,b,"L",a+c-f,b,"C",a+c,b,a+c,b,a+c,b+f,"L",a+c,b+d-f,"C",a+c,b+d,a+c,b+d,a+c-f,b+d,"L",a+f,b+d,"C",a,b+d,a,b+d,a,b+d-f,"L",a,b+f,"C",a,b,a,b,a+f,b],h&&h>c&&i>b+g&&b+d-g>i?e.splice(13,3,"L",a+c,i-6,a+c+6,i,a+c,i+6,a+c,b+d-f):h&&0>h&&i>b+g&&b+d-g>i?e.splice(33,3,"L",a,i+6,a-6,i,a,i-6,a,b+f):i&&i>d&&h>a+g&&a+c-g>h?e.splice(23,3,"L",h+6,b+d,h,b+d+6,h-6,b+d,a+f,b+d):i&&0>i&&h>a+g&&a+c-g>h&&e.splice(3,3,"L",h-6,b,h,b-6,h+6,b,c-f,b),e}},clipRect:function(a,b,c,d){var e="highcharts-"+tb++,f=this.createElement("clipPath").attr({id:e}).add(this.defs),a=this.rect(a,b,c,d,0).add(f);return a.id=e,a.clipPath=f,a
2
- },text:function(a,b,c,d){var e=fa||!aa&&this.forExport,f={};return d&&!this.forExport?this.html(a,b,c):(f.x=Math.round(b||0),c&&(f.y=Math.round(c)),(a||0===a)&&(f.text=a),a=this.createElement("text").attr(f),e&&a.css({position:"absolute"}),d||(a.xSetter=function(a,b,c){var e,f,d=c.childNodes;for(f=1;f<d.length;f++)e=d[f],e.getAttribute("x")===c.getAttribute("x")&&e.setAttribute("x",a);c.setAttribute(b,a)}),a)},fontMetrics:function(a){var a=a||this.style.fontSize,a=/px/.test(a)?z(a):/em/.test(a)?12*parseFloat(a):12,a=24>a?a+4:u(1.2*a),b=u(.8*a);return{h:a,b:b}},label:function(a,b,c,d,e,f,g,h,i){function j(){var a,b;a=s.element.style,J=(void 0===Va||void 0===wb||n.styles.textAlign)&&s.textStr&&s.getBBox(),n.width=(Va||J.width||0)+2*x+v,n.height=(wb||J.height||0)+2*x,na=x+o.fontMetrics(a&&a.fontSize).b,z&&(m||(a=u(-L*x),b=h?-na:0,n.box=m=d?o.symbol(d,a,b,n.width,n.height,B):o.rect(a,b,n.width,n.height,0,B[Pb]),m.attr("fill",Q).add(n)),m.isImg||m.attr(q({width:u(n.width),height:u(n.height)},B)),B=null)}function k(){var c,a=n.styles,a=a&&a.textAlign,b=v+x*(1-L);c=h?0:na,r(Va)&&J&&("center"===a||"right"===a)&&(b+={center:.5,right:1}[a]*(Va-J.width)),(b!==s.x||c!==s.y)&&(s.attr("x",b),c!==t&&s.attr("y",c)),s.x=b,s.y=c}function l(a,b){m?m.attr(a,b):B[a]=b}var m,J,Va,wb,xb,yb,na,z,o=this,n=o.g(i),s=o.text("",0,0,g).attr({zIndex:1}),L=0,x=3,v=0,y=0,B={};n.onAdd=function(){s.add(n),n.attr({text:a||"",x:b,y:c}),m&&r(e)&&n.attr({anchorX:e,anchorY:f})},n.widthSetter=function(a){Va=a},n.heightSetter=function(a){wb=a},n.paddingSetter=function(a){r(a)&&a!==x&&(x=a,k())},n.paddingLeftSetter=function(a){r(a)&&a!==v&&(v=a,k())},n.alignSetter=function(a){L={left:0,center:.5,right:1}[a]},n.textSetter=function(a){a!==t&&s.textSetter(a),j(),k()},n["stroke-widthSetter"]=function(a,b){a&&(z=!0),y=a%2/2,l(b,a)},n.strokeSetter=n.fillSetter=n.rSetter=function(a,b){"fill"===b&&a&&(z=!0),l(b,a)},n.anchorXSetter=function(a,b){e=a,l(b,a+y-xb)},n.anchorYSetter=function(a,b){f=a,l(b,a-yb)},n.xSetter=function(a){n.x=a,L&&(a-=L*((Va||J.width)+x)),xb=u(a),n.attr("translateX",xb)},n.ySetter=function(a){yb=n.y=u(a),n.attr("translateY",yb)};var A=n.css;return q(n,{css:function(a){if(a){var b={},a=w(a);p("fontSize,fontWeight,fontFamily,color,lineHeight,width,textDecoration,textShadow".split(","),function(c){a[c]!==t&&(b[c]=a[c],delete a[c])}),s.css(b)}return A.call(n,a)},getBBox:function(){return{width:J.width+2*x,height:J.height+2*x,x:J.x-x,y:J.y-x}},shadow:function(a){return m&&m.shadow(a),n},destroy:function(){W(n.element,"mouseenter"),W(n.element,"mouseleave"),s&&(s=s.destroy()),m&&(m=m.destroy()),P.prototype.destroy.call(n),n=o=j=k=l=null}})}},Za=ta,q(P.prototype,{htmlCss:function(a){var b=this.element;return(b=a&&"SPAN"===b.tagName&&a.width)&&(delete a.width,this.textWidth=b,this.updateTransform()),this.styles=q(this.styles,a),G(this.element,a),this},htmlGetBBox:function(){var a=this.element,b=this.bBox;return b||("text"===a.nodeName&&(a.style.position="absolute"),b=this.bBox={x:a.offsetLeft,y:a.offsetTop,width:a.offsetWidth,height:a.offsetHeight}),b},htmlUpdateTransform:function(){if(this.added){var a=this.renderer,b=this.element,c=this.translateX||0,d=this.translateY||0,e=this.x||0,f=this.y||0,g=this.textAlign||"left",h={left:0,center:.5,right:1}[g],i=this.shadows;if(G(b,{marginLeft:c,marginTop:d}),i&&p(i,function(a){G(a,{marginLeft:c+1,marginTop:d+1})}),this.inverted&&p(b.childNodes,function(c){a.invertChild(c,b)}),"SPAN"===b.tagName){var k,j=this.rotation,l=z(this.textWidth),o=[j,g,b.innerHTML,this.textWidth].join(",");o!==this.cTT&&(k=a.fontMetrics(b.style.fontSize).b,r(j)&&this.setSpanRotation(j,h,k),i=m(this.elemWidth,b.offsetWidth),i>l&&/[ \-]/.test(b.textContent||b.innerText)&&(G(b,{width:l+"px",display:"block",whiteSpace:"normal"}),i=l),this.getSpanCorrection(i,k,h,j,g)),G(b,{left:e+(this.xCorr||0)+"px",top:f+(this.yCorr||0)+"px"}),ib&&(k=b.offsetHeight),this.cTT=o}}else this.alignOnAdd=!0},setSpanRotation:function(a,b,c){var d={},e=Aa?"-ms-transform":ib?"-webkit-transform":Ta?"MozTransform":Ib?"-o-transform":"";d[e]=d.transform="rotate("+a+"deg)",d[e+(Ta?"Origin":"-origin")]=d.transformOrigin=100*b+"% "+c+"px",G(this.element,d)},getSpanCorrection:function(a,b,c){this.xCorr=-a*c,this.yCorr=-b}}),q(ta.prototype,{html:function(a,b,c){var d=this.createElement("span"),e=d.element,f=d.renderer;return d.textSetter=function(a){a!==e.innerHTML&&delete this.bBox,e.innerHTML=this.textStr=a},d.xSetter=d.ySetter=d.alignSetter=d.rotationSetter=function(a,b){"align"===b&&(b="textAlign"),d[b]=a,d.htmlUpdateTransform()},d.attr({text:a,x:u(b),y:u(c)}).css({position:"absolute",whiteSpace:"nowrap",fontFamily:this.style.fontFamily,fontSize:this.style.fontSize}),d.css=d.htmlCss,f.isSVG&&(d.add=function(a){var b,c=f.box.parentNode,j=[];if(this.parentGroup=a){if(b=a.div,!b){for(;a;)j.push(a),a=a.parentGroup;p(j.reverse(),function(a){var d;b=a.div=a.div||Y(Ja,{className:H(a.element,"class")},{position:"absolute",left:(a.translateX||0)+"px",top:(a.translateY||0)+"px"},b||c),d=b.style,q(a,{translateXSetter:function(b,c){d.left=b+"px",a[c]=b,a.doTransform=!0},translateYSetter:function(b,c){d.top=b+"px",a[c]=b,a.doTransform=!0},visibilitySetter:function(a,b){d[b]=a}})})}}else b=c;return b.appendChild(e),d.added=!0,d.alignOnAdd&&d.htmlUpdateTransform(),d}),d}});var X;if(!aa&&!fa){R.VMLElement=X={init:function(a,b){var c=["<",b,' filled="f" stroked="f"'],d=["position: ","absolute",";"],e=b===Ja;("shape"===b||e)&&d.push("left:0;top:0;width:1px;height:1px;"),d.push("visibility: ",e?"hidden":"visible"),c.push(' style="',d.join(""),'"/>'),b&&(c=e||"span"===b||"img"===b?c.join(""):a.prepVML(c),this.element=Y(c)),this.renderer=a},add:function(a){var b=this.renderer,c=this.element,d=b.box,d=a?a.element||a:d;return a&&a.inverted&&b.invertChild(c,d),d.appendChild(c),this.added=!0,this.alignOnAdd&&!this.deferUpdateTransform&&this.updateTransform(),this.onAdd&&this.onAdd(),this},updateTransform:P.prototype.htmlUpdateTransform,setSpanRotation:function(){var a=this.rotation,b=Z(a*Ca),c=ea(a*Ca);G(this.element,{filter:a?["progid:DXImageTransform.Microsoft.Matrix(M11=",b,", M12=",-c,", M21=",c,", M22=",b,", sizingMethod='auto expand')"].join(""):Q})},getSpanCorrection:function(a,b,c,d,e){var i,f=d?Z(d*Ca):1,g=d?ea(d*Ca):0,h=m(this.elemHeight,this.element.offsetHeight);this.xCorr=0>f&&-a,this.yCorr=0>g&&-h,i=0>f*g,this.xCorr+=g*b*(i?1-c:c),this.yCorr-=f*b*(d?i?c:1-c:1),e&&"left"!==e&&(this.xCorr-=a*c*(0>f?-1:1),d&&(this.yCorr-=h*c*(0>g?-1:1)),G(this.element,{textAlign:e}))},pathToVML:function(a){for(var b=a.length,c=[];b--;)ha(a[b])?c[b]=u(10*a[b])-5:"Z"===a[b]?c[b]="x":(c[b]=a[b],!a.isArc||"wa"!==a[b]&&"at"!==a[b]||(c[b+5]===c[b+7]&&(c[b+7]+=a[b+7]>a[b+5]?1:-1),c[b+6]===c[b+8]&&(c[b+8]+=a[b+8]>a[b+6]?1:-1)));return c.join(" ")||"x"},clip:function(a){var c,b=this;return a?(c=a.members,ja(c,b),c.push(b),b.destroyClip=function(){ja(c,b)},a=a.getCSS(b)):(b.destroyClip&&b.destroyClip(),a={clip:hb?"inherit":"rect(auto)"}),b.css(a)},css:P.prototype.htmlCss,safeRemoveChild:function(a){a.parentNode&&Pa(a)},destroy:function(){return this.destroyClip&&this.destroyClip(),P.prototype.destroy.apply(this)},on:function(a,b){return this.element["on"+a]=function(){var a=I.event;a.target=a.srcElement,b(a)},this},cutOffPath:function(a,b){var c,a=a.split(/[ ,]/);return c=a.length,(9===c||11===c)&&(a[c-4]=a[c-2]=z(a[c-2])-10*b),a.join(" ")},shadow:function(a,b,c){var e,h,j,l,o,n,s,d=[],f=this.element,g=this.renderer,i=f.style,k=f.path;if(k&&"string"!=typeof k.value&&(k="x"),o=k,a){for(n=m(a.width,3),s=(a.opacity||.15)/n,e=1;3>=e;e++)l=2*n+1-2*e,c&&(o=this.cutOffPath(k.value,l+.5)),j=['<shape isShadow="true" strokeweight="',l,'" filled="false" path="',o,'" coordsize="10 10" style="',f.style.cssText,'" />'],h=Y(g.prepVML(j),null,{left:z(i.left)+m(a.offsetX,1),top:z(i.top)+m(a.offsetY,1)}),c&&(h.cutOff=l+1),j=['<stroke color="',a.color||"black",'" opacity="',s*e,'"/>'],Y(g.prepVML(j),null,null,h),b?b.element.appendChild(h):f.parentNode.insertBefore(h,f),d.push(h);this.shadows=d}return this},updateShadows:sa,setAttr:function(a,b){hb?this.element[a]=b:this.element.setAttribute(a,b)},classSetter:function(a){this.element.className=a},dashstyleSetter:function(a,b,c){(c.getElementsByTagName("stroke")[0]||Y(this.renderer.prepVML(["<stroke/>"]),null,null,c))[b]=a||"solid",this[b]=a},dSetter:function(a,b,c){var d=this.shadows,a=a||[];if(this.d=a.join(" "),c.path=a=this.pathToVML(a),d)for(c=d.length;c--;)d[c].path=d[c].cutOff?this.cutOffPath(a,d[c].cutOff):a;this.setAttr(b,a)},fillSetter:function(a,b,c){var d=c.nodeName;"SPAN"===d?c.style.color=a:"IMG"!==d&&(c.filled=a!==Q,this.setAttr("fillcolor",this.renderer.color(a,c,b,this)))},opacitySetter:sa,rotationSetter:function(a,b,c){c=c.style,this[b]=c[b]=a,c.left=-u(ea(a*Ca)+1)+"px",c.top=u(Z(a*Ca))+"px"},strokeSetter:function(a,b,c){this.setAttr("strokecolor",this.renderer.color(a,c,b))},"stroke-widthSetter":function(a,b,c){c.stroked=!!a,this[b]=a,ha(a)&&(a+="px"),this.setAttr("strokeweight",a)},titleSetter:function(a,b){this.setAttr(b,a)},visibilitySetter:function(a,b,c){"inherit"===a&&(a="visible"),this.shadows&&p(this.shadows,function(c){c.style[b]=a}),"DIV"===c.nodeName&&(a="hidden"===a?"-999em":0,hb||(c.style[b]=a?"visible":"hidden"),b="top"),c.style[b]=a},xSetter:function(a,b,c){this[b]=a,"x"===b?b="left":"y"===b&&(b="top"),this.updateClipping?(this[b]=a,this.updateClipping()):c.style[b]=a},zIndexSetter:function(a,b,c){c.style[b]=a}},X=ka(P,X),X.prototype.ySetter=X.prototype.widthSetter=X.prototype.heightSetter=X.prototype.xSetter;var ga={Element:X,isIE8:wa.indexOf("MSIE 8.0")>-1,init:function(a,b,c,d){var e;if(this.alignedObjects=[],d=this.createElement(Ja).css(q(this.getStyle(d),{position:"relative"})),e=d.element,a.appendChild(d.element),this.isVML=!0,this.box=e,this.boxWrapper=d,this.cache={},this.setSize(b,c,!1),!y.namespaces.hcv){y.namespaces.add("hcv","urn:schemas-microsoft-com:vml");try{y.createStyleSheet().cssText="hcv\\:fill, hcv\\:path, hcv\\:shape, hcv\\:stroke{ behavior:url(#default#VML); display: inline-block; } "}catch(f){y.styleSheets[0].cssText+="hcv\\:fill, hcv\\:path, hcv\\:shape, hcv\\:stroke{ behavior:url(#default#VML); display: inline-block; } "}}},isHidden:function(){return!this.box.offsetWidth},clipRect:function(a,b,c,d){var e=this.createElement(),f=ca(a);return q(e,{members:[],left:(f?a.x:a)+1,top:(f?a.y:b)+1,width:(f?a.width:c)-1,height:(f?a.height:d)-1,getCSS:function(a){var b=a.element,c=b.nodeName,a=a.inverted,d=this.top-("shape"===c?b.offsetTop:0),e=this.left,b=e+this.width,f=d+this.height,d={clip:"rect("+u(a?e:d)+"px,"+u(a?f:b)+"px,"+u(a?b:f)+"px,"+u(a?d:e)+"px)"};return!a&&hb&&"DIV"===c&&q(d,{width:b+"px",height:f+"px"}),d},updateClipping:function(){p(e.members,function(a){a.element&&a.css(e.getCSS(a))})}})},color:function(a,b,c,d){var f,h,i,e=this,g=/^rgba/,j=Q;if(a&&a.linearGradient?i="gradient":a&&a.radialGradient&&(i="pattern"),i){var k,l,n,s,m,J,L,r,o=a.linearGradient||a.radialGradient,x="",a=a.stops,v=[],q=function(){h=['<fill colors="'+v.join(",")+'" opacity="',m,'" o:opacity2="',s,'" type="',i,'" ',x,'focus="100%" method="any" />'],Y(e.prepVML(h),null,null,b)};if(n=a[0],r=a[a.length-1],n[0]>0&&a.unshift([0,n[1]]),r[0]<1&&a.push([1,r[1]]),p(a,function(a,b){g.test(a[1])?(f=ya(a[1]),k=f.get("rgb"),l=f.get("a")):(k=a[1],l=1),v.push(100*a[0]+"% "+k),b?(m=l,J=k):(s=l,L=k)}),"fill"===c)if("gradient"===i)c=o.x1||o[0]||0,a=o.y1||o[1]||0,n=o.x2||o[2]||0,o=o.y2||o[3]||0,x='angle="'+(90-180*U.atan((o-a)/(n-c))/ma)+'"',q();else{var w,j=o.r,t=2*j,u=2*j,y=o.cx,B=o.cy,na=b.radialReference,j=function(){na&&(w=d.getBBox(),y+=(na[0]-w.x)/w.width-.5,B+=(na[1]-w.y)/w.height-.5,t*=na[2]/w.width,u*=na[2]/w.height),x='src="'+E.global.VMLRadialGradientURL+'" size="'+t+","+u+'" origin="0.5,0.5" position="'+y+","+B+'" color2="'+L+'" ',q()};d.added?j():d.onAdd=j,j=J}else j=k}else g.test(a)&&"IMG"!==b.tagName?(f=ya(a),h=["<",c,' opacity="',f.get("a"),'"/>'],Y(this.prepVML(h),null,null,b),j=f.get("rgb")):(j=b.getElementsByTagName(c),j.length&&(j[0].opacity=1,j[0].type="solid"),j=a);return j},prepVML:function(a){var b=this.isIE8,a=a.join("");return b?(a=a.replace("/>",' xmlns="urn:schemas-microsoft-com:vml" />'),a=-1===a.indexOf('style="')?a.replace("/>",' style="display:inline-block;behavior:url(#default#VML);" />'):a.replace('style="','style="display:inline-block;behavior:url(#default#VML);')):a=a.replace("<","<hcv:"),a},text:ta.prototype.html,path:function(a){var b={coordsize:"10 10"};return La(a)?b.d=a:ca(a)&&q(b,a),this.createElement("shape").attr(b)},circle:function(a,b,c){var d=this.symbol("circle");return ca(a)&&(c=a.r,b=a.y,a=a.x),d.isCircle=!0,d.r=c,d.attr({x:a,y:b})},g:function(a){var b;return a&&(b={className:"highcharts-"+a,"class":"highcharts-"+a}),this.createElement(Ja).attr(b)},image:function(a,b,c,d,e){var f=this.createElement("img").attr({src:a});return arguments.length>1&&f.attr({x:b,y:c,width:d,height:e}),f},createElement:function(a){return"rect"===a?this.symbol(a):ta.prototype.createElement.call(this,a)},invertChild:function(a,b){var c=this,d=b.style,e="IMG"===a.tagName&&a.style;G(a,{flip:"x",left:z(d.width)-(e?z(e.top):1),top:z(d.height)-(e?z(e.left):1),rotation:-90}),p(a.childNodes,function(b){c.invertChild(b,a)})},symbols:{arc:function(a,b,c,d,e){var f=e.start,g=e.end,h=e.r||c||d,c=e.innerR,d=Z(f),i=ea(f),j=Z(g),k=ea(g);return g-f===0?["x"]:(f=["wa",a-h,b-h,a+h,b+h,a+h*d,b+h*i,a+h*j,b+h*k],e.open&&!c&&f.push("e","M",a,b),f.push("at",a-c,b-c,a+c,b+c,a+c*j,b+c*k,a+c*d,b+c*i,"x","e"),f.isArc=!0,f)},circle:function(a,b,c,d,e){return e&&(c=d=2*e.r),e&&e.isCircle&&(a-=c/2,b-=d/2),["wa",a,b,a+c,b+d,a+c,b+d/2,a+c,b+d/2,"e"]},rect:function(a,b,c,d,e){return ta.prototype.symbols[r(e)&&e.r?"callout":"square"].call(0,a,b,c,d,e)}}};R.VMLRenderer=X=function(){this.init.apply(this,arguments)},X.prototype=w(ta.prototype,ga),Za=X}ta.prototype.measureSpanWidth=function(a,b){var d,c=y.createElement("span");return d=y.createTextNode(a),c.appendChild(d),G(c,b),this.box.appendChild(c),d=c.offsetWidth,Pa(c),d};var Lb;fa&&(R.CanVGRenderer=X=function(){xa="http://www.w3.org/1999/xhtml"},X.prototype.symbols={},Lb=function(){function a(){var d,a=b.length;for(d=0;a>d;d++)b[d]();b=[]}var b=[];return{push:function(c,d){0===b.length&&Qb(d,a),b.push(c)}}}(),Za=X),Sa.prototype={addLabel:function(){var l,a=this.axis,b=a.options,c=a.chart,d=a.horiz,e=a.categories,f=a.names,g=this.pos,h=b.labels,i=a.tickPositions,d=d&&e&&!h.step&&!h.staggerLines&&!h.rotation&&c.plotWidth/i.length||!d&&(c.margin[3]||.33*c.chartWidth),j=g===i[0],k=g===i[i.length-1],f=e?m(e[g],f[g],g):g,e=this.label,o=i.info;a.isDatetimeAxis&&o&&(l=b.dateTimeLabelFormats[o.higherRanks[g]||o.unitName]),this.isFirst=j,this.isLast=k,b=a.labelFormatter.call({axis:a,chart:c,isFirst:j,isLast:k,dateTimeLabelFormat:l,value:a.isLog?da(ia(f)):f}),g=d&&{width:v(1,u(d-2*(h.padding||10)))+"px"},g=q(g,h.style),r(e)?e&&e.attr({text:b}).css(g):(l={align:a.labelAlign},ha(h.rotation)&&(l.rotation=h.rotation),d&&h.ellipsis&&(l._clipHeight=a.len/i.length),this.label=r(b)&&h.enabled?c.renderer.text(b,0,0,h.useHTML).attr(l).css(g).add(a.labelGroup):null)},getLabelSize:function(){var a=this.label,b=this.axis;return a?a.getBBox()[b.horiz?"height":"width"]:0},getLabelSides:function(){var a=this.label.getBBox(),b=this.axis,c=b.horiz,d=b.options.labels,a=c?a.width:a.height,b=c?d.x-a*{left:0,center:.5,right:1}[b.labelAlign]:0;return[b,c?a+b:a]},handleOverflow:function(a,b){var l,o,n,c=!0,d=this.axis,e=this.isFirst,f=this.isLast,g=d.horiz?b.x:b.y,h=d.reversed,i=d.tickPositions,j=this.getLabelSides(),k=j[0],j=j[1],s=this.label.line||0;if(l=d.labelEdge,o=d.justifyLabels&&(e||f),l[s]===t||g+k>l[s]?l[s]=g+j:o||(c=!1),o){l=(o=d.justifyToPlot)?d.pos:0,o=o?l+d.len:d.chart.chartWidth;do a+=e?1:-1,n=d.ticks[i[a]];while(i[a]&&(!n||n.label.line!==s));d=n&&n.label.xy&&n.label.xy.x+n.getLabelSides()[e?0:1],e&&!h||f&&h?l>g+k&&(g=l-k,n&&g+j>d&&(c=!1)):g+j>o&&(g=o-j,n&&d>g+k&&(c=!1)),b.x=g}return c},getPosition:function(a,b,c,d){var e=this.axis,f=e.chart,g=d&&f.oldChartHeight||f.chartHeight;return{x:a?e.translate(b+c,null,null,d)+e.transB:e.left+e.offset+(e.opposite?(d&&f.oldChartWidth||f.chartWidth)-e.right-e.left:0),y:a?g-e.bottom+e.offset-(e.opposite?e.height:0):g-e.translate(b+c,null,null,d)-e.transB}},getLabelPosition:function(a,b,c,d,e,f,g,h){var i=this.axis,j=i.transA,k=i.reversed,l=i.staggerLines,o=i.chart.renderer.fontMetrics(e.style.fontSize).b,n=e.rotation,a=a+e.x-(f&&d?f*j*(k?-1:1):0),b=b+e.y-(f&&!d?f*j*(k?1:-1):0);return n&&2===i.side&&(b-=o-o*Z(n*Ca)),!r(e.y)&&!n&&(b+=o-c.getBBox().height/2),l&&(c.line=g/(h||1)%l,b+=c.line*(i.labelOffset/l)),{x:a,y:b}},getMarkPath:function(a,b,c,d,e,f){return f.crispLine(["M",a,b,"L",a+(e?0:-c),b+(e?c:0)],d)},render:function(a,b,c){var d=this.axis,e=d.options,f=d.chart.renderer,g=d.horiz,h=this.type,i=this.label,j=this.pos,k=e.labels,l=this.gridLine,o=h?h+"Grid":"grid",n=h?h+"Tick":"tick",s=e[o+"LineWidth"],p=e[o+"LineColor"],J=e[o+"LineDashStyle"],L=e[n+"Length"],o=e[n+"Width"]||0,x=e[n+"Color"],r=e[n+"Position"],n=this.mark,v=k.step,q=!0,u=d.tickmarkOffset,w=this.getPosition(g,j,u,b),y=w.x,w=w.y,B=g&&y===d.pos+d.len||!g&&w===d.pos?-1:1;this.isActive=!0,s&&(j=d.getPlotLinePath(j+u,s*B,b,!0),l===t&&(l={stroke:p,"stroke-width":s},J&&(l.dashstyle=J),h||(l.zIndex=1),b&&(l.opacity=0),this.gridLine=l=s?f.path(j).attr(l).add(d.gridGroup):null),!b&&l&&j&&l[this.isNew?"attr":"animate"]({d:j,opacity:c})),o&&L&&("inside"===r&&(L=-L),d.opposite&&(L=-L),h=this.getMarkPath(y,w,L,o*B,g,f),n?n.animate({d:h,opacity:c}):this.mark=f.path(h).attr({stroke:x,"stroke-width":o,opacity:c}).add(d.axisGroup)),i&&!isNaN(y)&&(i.xy=w=this.getLabelPosition(y,w,i,g,k,u,a,v),this.isFirst&&!this.isLast&&!m(e.showFirstLabel,1)||this.isLast&&!this.isFirst&&!m(e.showLastLabel,1)?q=!1:!d.isRadial&&!k.step&&!k.rotation&&!b&&0!==c&&(q=this.handleOverflow(a,w)),v&&a%v&&(q=!1),q&&!isNaN(w.y)?(w.opacity=c,i[this.isNew?"attr":"animate"](w),this.isNew=!1):i.attr("y",-9999))},destroy:function(){Oa(this,this.axis)}},R.PlotLineOrBand=function(a,b){this.axis=a,b&&(this.options=b,this.id=b.id)},R.PlotLineOrBand.prototype={render:function(){var p,a=this,b=a.axis,c=b.horiz,d=(b.pointRange||0)/2,e=a.options,f=e.label,g=a.label,h=e.width,i=e.to,j=e.from,k=r(j)&&r(i),l=e.value,o=e.dashStyle,n=a.svgElem,s=[],J=e.color,L=e.zIndex,x=e.events,q={},t=b.chart.renderer;if(b.isLog&&(j=za(j),i=za(i),l=za(l)),h)s=b.getPlotLinePath(l,h),q={stroke:J,"stroke-width":h},o&&(q.dashstyle=o);else{if(!k)return;j=v(j,b.min-d),i=C(i,b.max+d),s=b.getPlotBandPath(j,i,e),J&&(q.fill=J),e.borderWidth&&(q.stroke=e.borderColor,q["stroke-width"]=e.borderWidth)}if(r(L)&&(q.zIndex=L),n)s?n.animate({d:s},null,n.onGetPath):(n.hide(),n.onGetPath=function(){n.show()},g&&(a.label=g=g.destroy()));else if(s&&s.length&&(a.svgElem=n=t.path(s).attr(q).add(),x))for(p in d=function(b){n.on(b,function(c){x[b].apply(a,[c])})},x)d(p);return f&&r(f.text)&&s&&s.length&&b.width>0&&b.height>0?(f=w({align:c&&k&&"center",x:c?!k&&4:10,verticalAlign:!c&&k&&"middle",y:c?k?16:10:k?6:-4,rotation:c&&!k&&90},f),g||(q={align:f.textAlign||f.align,rotation:f.rotation},r(L)&&(q.zIndex=L),a.label=g=t.text(f.text,0,0,f.useHTML).attr(q).css(f.style).add()),b=[s[1],s[4],m(s[6],s[1])],s=[s[2],s[5],m(s[7],s[2])],c=Na(b),k=Na(s),g.align(f,!1,{x:c,y:k,width:Ba(b)-c,height:Ba(s)-k}),g.show()):g&&g.hide(),a},destroy:function(){ja(this.axis.plotLinesAndBands,this),delete this.axis,Oa(this)}},la.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:N,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:10,tickmarkPlacement:"between",tickPixelInterval:100,tickPosition:"outside",tickWidth:1,title:{align:"middle",style:{color:"#707070"}},type:"linear"},defaultYAxisOptions:{endOnTick:!0,gridLineWidth:1,tickPixelInterval:72,showLastLabel:!0,labels:{x:-8,y:3},lineWidth:0,maxPadding:.05,minPadding:.05,startOnTick:!0,tickWidth:0,title:{rotation:270,text:"Values"},stackLabels:{enabled:!1,formatter:function(){return Ga(this.total,-1)},style:N.style}},defaultLeftAxisOptions:{labels:{x:-15,y:null},title:{rotation:270}},defaultRightAxisOptions:{labels:{x:15,y:null},title:{rotation:90}},defaultBottomAxisOptions:{labels:{x:0,y:20},title:{rotation:0}},defaultTopAxisOptions:{labels:{x:0,y:-15},title:{rotation:0}},init:function(a,b){var c=b.isX;this.horiz=a.inverted?!c:c,this.coll=(this.isXAxis=c)?"xAxis":"yAxis",this.opposite=b.opposite,this.side=b.side||(this.horiz?this.opposite?0:2:this.opposite?1:3),this.setOptions(b);var d=this.options,e=d.type;this.labelFormatter=d.labels.formatter||this.defaultLabelFormatter,this.userOptions=b,this.minPixelPadding=0,this.chart=a,this.reversed=d.reversed,this.zoomEnabled=d.zoomEnabled!==!1,this.categories=d.categories||"category"===e,this.names=[],this.isLog="logarithmic"===e,this.isDatetimeAxis="datetime"===e,this.isLinked=r(d.linkedTo),this.tickmarkOffset=this.categories&&"between"===d.tickmarkPlacement?.5:0,this.ticks={},this.labelEdge=[],this.minorTicks={},this.plotLinesAndBands=[],this.alternateBands={},this.len=0,this.minRange=this.userMinRange=d.minRange||d.maxZoom,this.range=d.range,this.offset=d.offset||0,this.stacks={},this.oldStacks={},this.min=this.max=null,this.crosshair=m(d.crosshair,qa(a.options.tooltip.crosshairs)[c?0:1],!1);var f,d=this.options.events;-1===Da(this,a.axes)&&(c&&!this.isColorAxis?a.axes.splice(a.xAxis.length,0,this):a.axes.push(this),a[this.coll].push(this)),this.series=this.series||[],a.inverted&&c&&this.reversed===t&&(this.reversed=!0),this.removePlotLine=this.removePlotBand=this.removePlotBandOrLine;for(f in d)K(this,f,d[f]);this.isLog&&(this.val2lin=za,this.lin2val=ia)},setOptions:function(a){this.options=w(this.defaultOptions,this.isXAxis?{}:this.defaultYAxisOptions,[this.defaultTopAxisOptions,this.defaultRightAxisOptions,this.defaultBottomAxisOptions,this.defaultLeftAxisOptions][this.side],w(E[this.coll],a))},defaultLabelFormatter:function(){var g,a=this.axis,b=this.value,c=a.categories,d=this.dateTimeLabelFormat,e=E.lang.numericSymbols,f=e&&e.length,h=a.options.labels.format,a=a.isLog?b:a.tickInterval;if(h)g=Ia(h,this);else if(c)g=b;else if(d)g=cb(d,b);else if(f&&a>=1e3)for(;f--&&g===t;)c=Math.pow(1e3,f+1),a>=c&&null!==e[f]&&(g=Ga(b/c,-1)+e[f]);return g===t&&(g=M(b)>=1e4?Ga(b,0):Ga(b,-1,t,"")),g},getSeriesExtremes:function(){var a=this,b=a.chart;a.hasVisibleSeries=!1,a.dataMin=a.dataMax=null,a.buildStacks&&a.buildStacks(),p(a.series,function(c){if(c.visible||!b.options.chart.ignoreHiddenSeries){var d;d=c.options.threshold;var e;a.hasVisibleSeries=!0,a.isLog&&0>=d&&(d=null),a.isXAxis?(d=c.xData,d.length&&(a.dataMin=C(m(a.dataMin,d[0]),Na(d)),a.dataMax=v(m(a.dataMax,d[0]),Ba(d)))):(c.getExtremes(),e=c.dataMax,c=c.dataMin,r(c)&&r(e)&&(a.dataMin=C(m(a.dataMin,c),c),a.dataMax=v(m(a.dataMax,e),e)),r(d)&&(a.dataMin>=d?(a.dataMin=d,a.ignoreMinPadding=!0):a.dataMax<d&&(a.dataMax=d,a.ignoreMaxPadding=!0)))}})},translate:function(a,b,c,d,e,f){var g=1,h=0,i=d?this.oldTransA:this.transA,d=d?this.oldMin:this.min,j=this.minPixelPadding,e=(this.options.ordinal||this.isLog&&e)&&this.lin2val;return i||(i=this.transA),c&&(g*=-1,h=this.len),this.reversed&&(g*=-1,h-=g*(this.sector||this.len)),b?(a=a*g+h,a-=j,a=a/i+d,e&&(a=this.lin2val(a))):(e&&(a=this.val2lin(a)),"between"===f&&(f=.5),a=g*(a-d)*i+h+g*j+(ha(f)?i*f*this.pointRange:0)),a},toPixels:function(a,b){return this.translate(a,!1,!this.horiz,null,!0)+(b?0:this.pos)},toValue:function(a,b){return this.translate(a-(b?0:this.pos),!0,!this.horiz,null,!0)},getPlotLinePath:function(a,b,c,d,e){var i,j,o,f=this.chart,g=this.left,h=this.top,k=c&&f.oldChartHeight||f.chartHeight,l=c&&f.oldChartWidth||f.chartWidth;return i=this.transB,e=m(e,this.translate(a,null,null,c)),a=c=u(e+i),i=j=u(k-e-i),isNaN(e)?o=!0:this.horiz?(i=h,j=k-this.bottom,(g>a||a>g+this.width)&&(o=!0)):(a=g,c=l-this.right,(h>i||i>h+this.height)&&(o=!0)),o&&!d?null:f.renderer.crispLine(["M",a,i,"L",c,j],b||1)},getLinearTickPositions:function(a,b,c){var d,e=da(T(b/a)*a),f=da(Ka(c/a)*a),g=[];if(b===c&&ha(b))return[b];for(b=e;f>=b&&(g.push(b),b=da(b+a),b!==d);)d=b;return g},getMinorTickPositions:function(){var e,a=this.options,b=this.tickPositions,c=this.minorTickInterval,d=[];if(this.isLog)for(e=b.length,a=1;e>a;a++)d=d.concat(this.getLogTickPositions(c,b[a-1],b[a],!0));else if(this.isDatetimeAxis&&"auto"===a.minorTickInterval)d=d.concat(this.getTimeTicks(this.normalizeTimeTickInterval(c),this.min,this.max,a.startOfWeek)),d[0]<this.min&&d.shift();else for(b=this.min+(b[0]-this.min)%c;b<=this.max;b+=c)d.push(b);return d},adjustForMinRange:function(){var d,f,g,h,i,j,a=this.options,b=this.min,c=this.max,e=this.dataMax-this.dataMin>=this.minRange;if(this.isXAxis&&this.minRange===t&&!this.isLog&&(r(a.min)||r(a.max)?this.minRange=null:(p(this.series,function(a){for(i=a.xData,g=j=a.xIncrement?1:i.length-1;g>0;g--)h=i[g]-i[g-1],(f===t||f>h)&&(f=h)}),this.minRange=C(5*f,this.dataMax-this.dataMin))),c-b<this.minRange){var k=this.minRange;d=(k-c+b)/2,d=[b-d,m(a.min,b-d)],e&&(d[2]=this.dataMin),b=Ba(d),c=[b+k,m(a.max,b+k)],e&&(c[2]=this.dataMax),c=Na(c),k>c-b&&(d[0]=c-k,d[1]=m(a.min,c-k),b=Ba(d))}this.min=b,this.max=c},setAxisTranslation:function(a){var e,b=this,c=b.max-b.min,d=b.axisPointRange||0,f=0,g=0,h=b.linkedParent,i=!!b.categories,j=b.transA;(b.isXAxis||i||d)&&(h?(f=h.minPointOffset,g=h.pointRangePadding):p(b.series,function(a){var h=i?1:b.isXAxis?a.pointRange:b.axisPointRange||0,j=a.options.pointPlacement,n=a.closestPointRange;h>c&&(h=0),d=v(d,h),f=v(f,Fa(j)?0:h/2),g=v(g,"on"===j?0:h),!a.noSharedTooltip&&r(n)&&(e=r(e)?C(e,n):n)}),h=b.ordinalSlope&&e?b.ordinalSlope/e:1,b.minPointOffset=f*=h,b.pointRangePadding=g*=h,b.pointRange=C(d,c),b.closestPointRange=e),a&&(b.oldTransA=j),b.translationSlope=b.transA=j=b.len/(c+g||1),b.transB=b.horiz?b.left:b.bottom,b.minPixelPadding=j*f},setTickPositions:function(a){var s,b=this,c=b.chart,d=b.options,e=b.isLog,f=b.isDatetimeAxis,g=b.isXAxis,h=b.isLinked,i=b.options.tickPositioner,j=d.maxPadding,k=d.minPadding,l=d.tickInterval,o=d.minTickInterval,n=d.tickPixelInterval,$=b.categories;h?(b.linkedParent=c[b.coll][d.linkedTo],c=b.linkedParent.getExtremes(),b.min=m(c.min,c.dataMin),b.max=m(c.max,c.dataMax),d.type!==b.linkedParent.options.type&&ra(11,1)):(b.min=m(b.userMin,d.min,b.dataMin),b.max=m(b.userMax,d.max,b.dataMax)),e&&(!a&&C(b.min,m(b.dataMin,b.min))<=0&&ra(10,1),b.min=da(za(b.min)),b.max=da(za(b.max))),b.range&&r(b.max)&&(b.userMin=b.min=v(b.min,b.max-b.range),b.userMax=b.max,b.range=null),b.beforePadding&&b.beforePadding(),b.adjustForMinRange(),$||b.axisPointRange||b.usePercentage||h||!r(b.min)||!r(b.max)||!(c=b.max-b.min)||(r(d.min)||r(b.userMin)||!k||!(b.dataMin<0)&&b.ignoreMinPadding||(b.min-=c*k),r(d.max)||r(b.userMax)||!j||!(b.dataMax>0)&&b.ignoreMaxPadding||(b.max+=c*j)),ha(d.floor)&&(b.min=v(b.min,d.floor)),ha(d.ceiling)&&(b.max=C(b.max,d.ceiling)),b.min===b.max||void 0===b.min||void 0===b.max?b.tickInterval=1:h&&!l&&n===b.linkedParent.options.tickPixelInterval?b.tickInterval=b.linkedParent.tickInterval:(b.tickInterval=m(l,$?1:(b.max-b.min)*n/v(b.len,n)),!r(l)&&b.len<n&&!this.isRadial&&!this.isLog&&!$&&d.startOnTick&&d.endOnTick&&(s=!0,b.tickInterval/=4)),g&&!a&&p(b.series,function(a){a.processData(b.min!==b.oldMin||b.max!==b.oldMax)}),b.setAxisTranslation(!0),b.beforeSetTickPositions&&b.beforeSetTickPositions(),b.postProcessTickInterval&&(b.tickInterval=b.postProcessTickInterval(b.tickInterval)),b.pointRange&&(b.tickInterval=v(b.pointRange,b.tickInterval)),!l&&b.tickInterval<o&&(b.tickInterval=o),f||e||l||(b.tickInterval=nb(b.tickInterval,null,mb(b.tickInterval),d)),b.minorTickInterval="auto"===d.minorTickInterval&&b.tickInterval?b.tickInterval/5:d.minorTickInterval,b.tickPositions=a=d.tickPositions?[].concat(d.tickPositions):i&&i.apply(b,[b.min,b.max]),a||(!b.ordinalPositions&&(b.max-b.min)/b.tickInterval>v(2*b.len,200)&&ra(19,!0),a=f?b.getTimeTicks(b.normalizeTimeTickInterval(b.tickInterval,d.units),b.min,b.max,d.startOfWeek,b.ordinalPositions,b.closestPointRange,!0):e?b.getLogTickPositions(b.tickInterval,b.min,b.max):b.getLinearTickPositions(b.tickInterval,b.min,b.max),s&&a.splice(1,a.length-2),b.tickPositions=a),h||(e=a[0],f=a[a.length-1],h=b.minPointOffset||0,d.startOnTick?b.min=e:b.min-h>e&&a.shift(),d.endOnTick?b.max=f:b.max+h<f&&a.pop(),1===a.length&&(d=M(b.max)>1e13?1:.001,b.min-=d,b.max+=d))},setMaxTicks:function(){var a=this.chart,b=a.maxTicks||{},c=this.tickPositions,d=this._maxTicksKey=[this.coll,this.pos,this.len].join("-");!this.isLinked&&!this.isDatetimeAxis&&c&&c.length>(b[d]||0)&&this.options.alignTicks!==!1&&(b[d]=c.length),a.maxTicks=b},adjustTickAmount:function(){var a=this._maxTicksKey,b=this.tickPositions,c=this.chart.maxTicks;if(c&&c[a]&&!this.isDatetimeAxis&&!this.categories&&!this.isLinked&&this.options.alignTicks!==!1&&this.min!==t){var d=this.tickAmount,e=b.length;if(this.tickAmount=a=c[a],a>e){for(;b.length<a;)b.push(da(b[b.length-1]+this.tickInterval));this.transA*=(e-1)/(a-1),this.max=b[b.length-1]}r(d)&&a!==d&&(this.isDirty=!0)}},setScale:function(){var b,c,d,e,a=this.stacks;if(this.oldMin=this.min,this.oldMax=this.max,this.oldAxisLength=this.len,this.setAxisSize(),e=this.len!==this.oldAxisLength,p(this.series,function(a){(a.isDirtyData||a.isDirty||a.xAxis.isDirty)&&(d=!0)}),e||d||this.isLinked||this.forceRedraw||this.userMin!==this.oldUserMin||this.userMax!==this.oldUserMax){if(!this.isXAxis)for(b in a)for(c in a[b])a[b][c].total=null,a[b][c].cum=0;this.forceRedraw=!1,this.getSeriesExtremes(),this.setTickPositions(),this.oldUserMin=this.userMin,this.oldUserMax=this.userMax,this.isDirty||(this.isDirty=e||this.min!==this.oldMin||this.max!==this.oldMax)}else if(!this.isXAxis){this.oldStacks&&(a=this.stacks=this.oldStacks);for(b in a)for(c in a[b])a[b][c].cum=a[b][c].total}this.setMaxTicks()},setExtremes:function(a,b,c,d,e){var f=this,g=f.chart,c=m(c,!0),e=q(e,{min:a,max:b});D(f,"setExtremes",e,function(){f.userMin=a,f.userMax=b,f.eventArgs=e,f.isDirtyExtremes=!0,c&&g.redraw(d)})},zoom:function(a,b){var c=this.dataMin,d=this.dataMax,e=this.options;return this.allowZoomOutside||(r(c)&&a<=C(c,m(e.min,c))&&(a=t),r(d)&&b>=v(d,m(e.max,d))&&(b=t)),this.displayBtn=a!==t||b!==t,this.setExtremes(a,b,!1,t,{trigger:"zoom"}),!0},setAxisSize:function(){var a=this.chart,b=this.options,c=b.offsetLeft||0,d=this.horiz,e=m(b.width,a.plotWidth-c+(b.offsetRight||0)),f=m(b.height,a.plotHeight),g=m(b.top,a.plotTop),b=m(b.left,a.plotLeft+c),c=/%$/;c.test(f)&&(f=parseInt(f,10)/100*a.plotHeight),c.test(g)&&(g=parseInt(g,10)/100*a.plotHeight+a.plotTop),this.left=b,this.top=g,this.width=e,this.height=f,this.bottom=a.chartHeight-f-g,this.right=a.chartWidth-e-b,this.len=v(d?e:f,0),this.pos=d?b:g},getExtremes:function(){var a=this.isLog;return{min:a?da(ia(this.min)):this.min,max:a?da(ia(this.max)):this.max,dataMin:this.dataMin,dataMax:this.dataMax,userMin:this.userMin,userMax:this.userMax}},getThreshold:function(a){var b=this.isLog,c=b?ia(this.min):this.min,b=b?ia(this.max):this.max;return c>a||null===a?a=c:a>b&&(a=b),this.translate(a,0,1,0,1)},autoLabelAlign:function(a){return a=(m(a,0)-90*this.side+720)%360,a>15&&165>a?"right":a>195&&345>a?"left":"center"},getOffset:function(){var j,l,q,y,z,A,B,a=this,b=a.chart,c=b.renderer,d=a.options,e=a.tickPositions,f=a.ticks,g=a.horiz,h=a.side,i=b.inverted?[1,0,3,2][h]:h,k=0,o=0,n=d.title,s=d.labels,$=0,J=b.axisOffset,L=b.clipOffset,x=[-1,1,1,-1][h],u=1,w=m(s.maxStaggerLines,5),na=2===h?c.fontMetrics(s.style.fontSize).b:0;if(a.hasData=j=a.hasVisibleSeries||r(a.min)&&r(a.max)&&!!e,a.showAxis=b=j||m(d.showEmpty,!0),a.staggerLines=a.horiz&&s.staggerLines,a.axisGroup||(a.gridGroup=c.g("grid").attr({zIndex:d.gridZIndex||1}).add(),a.axisGroup=c.g("axis").attr({zIndex:d.zIndex||2}).add(),a.labelGroup=c.g("axis-labels").attr({zIndex:s.zIndex||7}).addClass("highcharts-"+a.coll.toLowerCase()+"-labels").add()),j||a.isLinked){if(a.labelAlign=m(s.align||a.autoLabelAlign(s.rotation)),p(e,function(b){f[b]?f[b].addLabel():f[b]=new Sa(a,b)
3
- }),a.horiz&&!a.staggerLines&&w&&!s.rotation){for(q=a.reversed?[].concat(e).reverse():e;w>u;){for(j=[],y=!1,s=0;s<q.length;s++)z=q[s],A=(A=f[z].label&&f[z].label.getBBox())?A.width:0,B=s%u,A&&(z=a.translate(z),j[B]!==t&&z<j[B]&&(y=!0),j[B]=z+A);if(!y)break;u++}u>1&&(a.staggerLines=u)}p(e,function(b){(0===h||2===h||{1:"left",3:"right"}[h]===a.labelAlign)&&($=v(f[b].getLabelSize(),$))}),a.staggerLines&&($*=a.staggerLines,a.labelOffset=$)}else for(q in f)f[q].destroy(),delete f[q];n&&n.text&&n.enabled!==!1&&(a.axisTitle||(a.axisTitle=c.text(n.text,0,0,n.useHTML).attr({zIndex:7,rotation:n.rotation||0,align:n.textAlign||{low:"left",middle:"center",high:"right"}[n.align]}).addClass("highcharts-"+this.coll.toLowerCase()+"-title").css(n.style).add(a.axisGroup),a.axisTitle.isNew=!0),b&&(k=a.axisTitle.getBBox()[g?"height":"width"],o=m(n.margin,g?5:10),l=n.offset),a.axisTitle[b?"show":"hide"]()),a.offset=x*m(d.offset,J[h]),a.axisTitleMargin=m(l,$+o+($&&x*d.labels[g?"y":"x"]-na)),J[h]=v(J[h],a.axisTitleMargin+k+x*a.offset),L[i]=v(L[i],2*T(d.lineWidth/2))},getLinePath:function(a){var b=this.chart,c=this.opposite,d=this.offset,e=this.horiz,f=this.left+(c?this.width:0)+d,d=b.chartHeight-this.bottom-(c?this.height:0)+d;return c&&(a*=-1),b.renderer.crispLine(["M",e?this.left:f,e?d:this.top,"L",e?b.chartWidth-this.right:f,e?d:b.chartHeight-this.bottom],a)},getTitlePosition:function(){var a=this.horiz,b=this.left,c=this.top,d=this.len,e=this.options.title,f=a?b:c,g=this.opposite,h=this.offset,i=z(e.style.fontSize||12),d={low:f+(a?0:d),middle:f+d/2,high:f+(a?d:0)}[e.align],b=(a?c+this.height:b)+(a?1:-1)*(g?-1:1)*this.axisTitleMargin+(2===this.side?i:0);return{x:a?d:b+(g?this.width:0)+h+(e.x||0),y:a?b-(g?this.height:0)+h:d+(e.y||0)}},render:function(){var j,u,z,a=this,b=a.horiz,c=a.reversed,d=a.chart,e=d.renderer,f=a.options,g=a.isLog,h=a.isLinked,i=a.tickPositions,k=a.axisTitle,l=a.ticks,o=a.minorTicks,n=a.alternateBands,s=f.stackLabels,m=f.alternateGridColor,J=a.tickmarkOffset,L=f.lineWidth,x=d.hasRendered&&r(a.oldMin)&&!isNaN(a.oldMin),q=a.hasData,v=a.showAxis,w=f.labels.overflow,y=a.justifyLabels=b&&w!==!1;a.labelEdge.length=0,a.justifyToPlot="justify"===w,p([l,o,n],function(a){for(var b in a)a[b].isActive=!1}),(q||h)&&(a.minorTickInterval&&!a.categories&&p(a.getMinorTickPositions(),function(b){o[b]||(o[b]=new Sa(a,b,"minor")),x&&o[b].isNew&&o[b].render(null,!0),o[b].render(null,!1,1)}),i.length&&(j=i.slice(),(b&&c||!b&&!c)&&j.reverse(),y&&(j=j.slice(1).concat([j[0]])),p(j,function(b,c){y&&(c=c===j.length-1?0:c+1),(!h||b>=a.min&&b<=a.max)&&(l[b]||(l[b]=new Sa(a,b)),x&&l[b].isNew&&l[b].render(c,!0,.1),l[b].render(c,!1,1))}),J&&0===a.min&&(l[-1]||(l[-1]=new Sa(a,-1,null,!0)),l[-1].render(-1))),m&&p(i,function(b,c){c%2===0&&b<a.max&&(n[b]||(n[b]=new R.PlotLineOrBand(a)),u=b+J,z=i[c+1]!==t?i[c+1]+J:a.max,n[b].options={from:g?ia(u):u,to:g?ia(z):z,color:m},n[b].render(),n[b].isActive=!0)}),a._addedPlotLB||(p((f.plotLines||[]).concat(f.plotBands||[]),function(b){a.addPlotBandOrLine(b)}),a._addedPlotLB=!0)),p([l,o,n],function(a){var b,c,e=[],f=va?va.duration||500:0,g=function(){for(c=e.length;c--;)a[e[c]]&&!a[e[c]].isActive&&(a[e[c]].destroy(),delete a[e[c]])};for(b in a)a[b].isActive||(a[b].render(b,!1,0),a[b].isActive=!1,e.push(b));a!==n&&d.hasRendered&&f?f&&setTimeout(g,f):g()}),L&&(b=a.getLinePath(L),a.axisLine?a.axisLine.animate({d:b}):a.axisLine=e.path(b).attr({stroke:f.lineColor,"stroke-width":L,zIndex:7}).add(a.axisGroup),a.axisLine[v?"show":"hide"]()),k&&v&&(k[k.isNew?"attr":"animate"](a.getTitlePosition()),k.isNew=!1),s&&s.enabled&&a.renderStackTotals(),a.isDirty=!1},redraw:function(){var a=this.chart.pointer;a&&a.reset(!0),this.render(),p(this.plotLinesAndBands,function(a){a.render()}),p(this.series,function(a){a.isDirty=!0})},destroy:function(a){var d,b=this,c=b.stacks,e=b.plotLinesAndBands;a||W(b);for(d in c)Oa(c[d]),c[d]=null;for(p([b.ticks,b.minorTicks,b.alternateBands],function(a){Oa(a)}),a=e.length;a--;)e[a].destroy();p("stackTotalGroup,axisLine,axisTitle,axisGroup,cross,gridGroup,labelGroup".split(","),function(a){b[a]&&(b[a]=b[a].destroy())}),this.cross&&this.cross.destroy()},drawCrosshair:function(a,b){if(this.crosshair)if((r(b)||!m(this.crosshair.snap,!0))===!1)this.hideCrosshair();else{var c,d=this.crosshair,e=d.animation;m(d.snap,!0)?r(b)&&(c=this.chart.inverted!=this.horiz?b.plotX:this.len-b.plotY):c=this.horiz?a.chartX-this.pos:this.len-a.chartY+this.pos,c=this.isRadial?this.getPlotLinePath(this.isXAxis?b.x:m(b.stackY,b.y)):this.getPlotLinePath(null,null,null,null,c),null===c?this.hideCrosshair():this.cross?this.cross.attr({visibility:"visible"})[e?"animate":"attr"]({d:c},e):(e={"stroke-width":d.width||1,stroke:d.color||"#C0C0C0",zIndex:d.zIndex||2},d.dashStyle&&(e.dashstyle=d.dashStyle),this.cross=this.chart.renderer.path(c).attr(e).add())}},hideCrosshair:function(){this.cross&&this.cross.hide()}},q(la.prototype,{getPlotBandPath:function(a,b){var c=this.getPlotLinePath(b),d=this.getPlotLinePath(a);return d&&c?d.push(c[4],c[5],c[1],c[2]):d=null,d},addPlotBand:function(a){this.addPlotBandOrLine(a,"plotBands")},addPlotLine:function(a){this.addPlotBandOrLine(a,"plotLines")},addPlotBandOrLine:function(a,b){var c=new R.PlotLineOrBand(this,a).render(),d=this.userOptions;return c&&(b&&(d[b]=d[b]||[],d[b].push(a)),this.plotLinesAndBands.push(c)),c},removePlotBandOrLine:function(a){for(var b=this.plotLinesAndBands,c=this.options,d=this.userOptions,e=b.length;e--;)b[e].id===a&&b[e].destroy();p([c.plotLines||[],d.plotLines||[],c.plotBands||[],d.plotBands||[]],function(b){for(e=b.length;e--;)b[e].id===a&&ja(b,b[e])})}}),la.prototype.getTimeTicks=function(a,b,c,d){var h,e=[],f={},g=E.global.useUTC,i=new Date(b-Ra),j=a.unitRange,k=a.count;if(r(b)){j>=A.second&&(i.setMilliseconds(0),i.setSeconds(j>=A.minute?0:k*T(i.getSeconds()/k))),j>=A.minute&&i[Db](j>=A.hour?0:k*T(i[pb]()/k)),j>=A.hour&&i[Eb](j>=A.day?0:k*T(i[qb]()/k)),j>=A.day&&i[sb](j>=A.month?1:k*T(i[Xa]()/k)),j>=A.month&&(i[Fb](j>=A.year?0:k*T(i[fb]()/k)),h=i[gb]()),j>=A.year&&(h-=h%k,i[Gb](h)),j===A.week&&i[sb](i[Xa]()-i[rb]()+m(d,1)),b=1,Ra&&(i=new Date(i.getTime()+Ra)),h=i[gb]();for(var d=i.getTime(),l=i[fb](),o=i[Xa](),n=g?Ra:(864e5+6e4*i.getTimezoneOffset())%864e5;c>d;)e.push(d),j===A.year?d=eb(h+b*k,0):j===A.month?d=eb(h,l+b*k):g||j!==A.day&&j!==A.week?d+=j*k:d=eb(h,l,o+b*k*(j===A.day?1:7)),b++;e.push(d),p(vb(e,function(a){return j<=A.hour&&a%A.day===n}),function(a){f[a]="day"})}return e.info=q(a,{higherRanks:f,totalRange:j*k}),e},la.prototype.normalizeTimeTickInterval=function(a,b){var g,c=b||[["millisecond",[1,2,5,10,20,25,50,100,200,500]],["second",[1,2,5,10,15,30]],["minute",[1,2,5,10,15,30]],["hour",[1,2,3,4,6,8,12]],["day",[1,2]],["week",[1,2]],["month",[1,2,3,4,6]],["year",null]],d=c[c.length-1],e=A[d[0]],f=d[1];for(g=0;g<c.length&&(d=c[g],e=A[d[0]],f=d[1],!(c[g+1]&&a<=(e*f[f.length-1]+A[c[g+1][0]])/2));g++);return e===A.year&&5*e>a&&(f=[1,2,5]),c=nb(a/e,f,"year"===d[0]?v(mb(a/e),1):1),{unitRange:e,count:c,unitName:d[0]}},la.prototype.getLogTickPositions=function(a,b,c,d){var e=this.options,f=this.len,g=[];if(d||(this._minorAutoInterval=null),a>=.5)a=u(a),g=this.getLinearTickPositions(a,b,c);else if(a>=.08)for(var h,i,j,k,l,f=T(b),e=a>.3?[1,2,4]:a>.15?[1,2,4,6,8]:[1,2,3,4,5,6,7,8,9];c+1>f&&!l;f++)for(i=e.length,h=0;i>h&&!l;h++)j=za(ia(f)*e[h]),j>b&&(!d||c>=k)&&g.push(k),k>c&&(l=!0),k=j;else b=ia(b),c=ia(c),a=e[d?"minorTickInterval":"tickInterval"],a=m("auto"===a?null:a,this._minorAutoInterval,(c-b)*(e.tickPixelInterval/(d?5:1))/((d?f/this.tickPositions.length:f)||1)),a=nb(a,null,mb(a)),g=Ua(this.getLinearTickPositions(a,b,c),za),d||(this._minorAutoInterval=a/5);return d||(this.tickInterval=a),g};var Mb=R.Tooltip=function(){this.init.apply(this,arguments)};Mb.prototype={init:function(a,b){var c=b.borderWidth,d=b.style,e=z(d.padding);this.chart=a,this.options=b,this.crosshairs=[],this.now={x:0,y:0},this.isHidden=!0,this.label=a.renderer.label("",0,0,b.shape||"callout",null,null,b.useHTML,null,"tooltip").attr({padding:e,fill:b.backgroundColor,"stroke-width":c,r:b.borderRadius,zIndex:8}).css(d).css({padding:0}).add().attr({y:-9999}),fa||this.label.shadow(b.shadow),this.shared=b.shared},destroy:function(){this.label&&(this.label=this.label.destroy()),clearTimeout(this.hideTimer),clearTimeout(this.tooltipTimeout)},move:function(a,b,c,d){var e=this,f=e.now,g=e.options.animation!==!1&&!e.isHidden,h=e.followPointer||e.len>1;q(f,{x:g?(2*f.x+a)/3:a,y:g?(f.y+b)/2:b,anchorX:h?t:g?(2*f.anchorX+c)/3:c,anchorY:h?t:g?(f.anchorY+d)/2:d}),e.label.attr(f),g&&(M(a-f.x)>1||M(b-f.y)>1)&&(clearTimeout(this.tooltipTimeout),this.tooltipTimeout=setTimeout(function(){e&&e.move(a,b,c,d)},32))},hide:function(){var b,a=this;clearTimeout(this.hideTimer),this.isHidden||(b=this.chart.hoverPoints,this.hideTimer=setTimeout(function(){a.label.fadeOut(),a.isHidden=!0},m(this.options.hideDelay,500)),b&&p(b,function(a){a.setState()}),this.chart.hoverPoints=null)},getAnchor:function(a,b){var c,i,d=this.chart,e=d.inverted,f=d.plotTop,g=0,h=0,a=qa(a);return c=a[0].tooltipPos,this.followPointer&&b&&(b.chartX===t&&(b=d.pointer.normalize(b)),c=[b.chartX-d.plotLeft,b.chartY-f]),c||(p(a,function(a){i=a.series.yAxis,g+=a.plotX,h+=(a.plotLow?(a.plotLow+a.plotHigh)/2:a.plotY)+(!e&&i?i.top-f:0)}),g/=a.length,h/=a.length,c=[e?d.plotWidth-h:g,this.shared&&!e&&a.length>1&&b?b.chartY-f:e?d.plotHeight-g:h]),Ua(c,u)},getPosition:function(a,b,c){var g,d=this.chart,e=this.distance,f={},h=["y",d.chartHeight,b,c.plotY+d.plotTop],i=["x",d.chartWidth,a,c.plotX+d.plotLeft],j=c.ttBelow||d.inverted&&!c.negative||!d.inverted&&c.negative,k=function(a,b,c,d){var g=d-e>c,b=b>d+e+c,c=d-e-c;if(d+=e,j&&b)f[a]=d;else if(!j&&g)f[a]=c;else if(g)f[a]=c;else{if(!b)return!1;f[a]=d}},l=function(a,b,c,d){return e>d||d>b-e?!1:void(f[a]=c/2>d?1:d>b-c/2?b-c-2:d-c/2)},o=function(a){var b=h;h=i,i=b,g=a},n=function(){k.apply(0,h)!==!1?l.apply(0,i)===!1&&!g&&(o(!0),n()):g?f.x=f.y=0:(o(!0),n())};return(d.inverted||this.len>1)&&o(),n(),f},defaultFormatter:function(a){var d,b=this.points||qa(this),c=b[0].series;return d=[a.tooltipHeaderFormatter(b[0])],p(b,function(a){c=a.series,d.push(c.tooltipFormatter&&c.tooltipFormatter(a)||a.point.tooltipFormatter(c.tooltipOptions.pointFormat))}),d.push(a.options.footerFormat||""),d.join("")},refresh:function(a,b){var f,g,i,c=this.chart,d=this.label,e=this.options,h={},j=[];i=e.formatter||this.defaultFormatter;var k,h=c.hoverPoints,l=this.shared;clearTimeout(this.hideTimer),this.followPointer=qa(a)[0].series.tooltipOptions.followPointer,g=this.getAnchor(a,b),f=g[0],g=g[1],!l||a.series&&a.series.noSharedTooltip?h=a.getLabelConfig():(c.hoverPoints=a,h&&p(h,function(a){a.setState()}),p(a,function(a){a.setState("hover"),j.push(a.getLabelConfig())}),h={x:a[0].category,y:a[0].y},h.points=j,this.len=j.length,a=a[0]),i=i.call(h,this),h=a.series,this.distance=m(h.tooltipOptions.distance,16),i===!1?this.hide():(this.isHidden&&(bb(d),d.attr("opacity",1).show()),d.attr({text:i}),k=e.borderColor||a.color||h.color||"#606060",d.attr({stroke:k}),this.updatePosition({plotX:f,plotY:g,negative:a.negative,ttBelow:a.ttBelow}),this.isHidden=!1),D(c,"tooltipRefresh",{text:i,x:f+c.plotLeft,y:g+c.plotTop,borderColor:k})},updatePosition:function(a){var b=this.chart,c=this.label,c=(this.options.positioner||this.getPosition).call(this,c.width,c.height,a);this.move(u(c.x),u(c.y),a.plotX+b.plotLeft,a.plotY+b.plotTop)},tooltipHeaderFormatter:function(a){var h,b=a.series,c=b.tooltipOptions,d=c.dateTimeLabelFormats,e=c.xDateFormat,f=b.xAxis,g=f&&"datetime"===f.options.type&&ha(a.key),c=c.headerFormat,f=f&&f.closestPointRange;if(g&&!e){if(f){for(h in A)if(A[h]>=f||A[h]<=A.day&&a.key%A[h]>0){e=d[h];break}}else e=d.day;e=e||d.year}return g&&e&&(c=c.replace("{point.key}","{point.key:"+e+"}")),Ia(c,{point:a,series:b})}};var oa;$a=y.documentElement.ontouchstart!==t;var Wa=R.Pointer=function(a,b){this.init(a,b)};if(Wa.prototype={init:function(a,b){var f,c=b.chart,d=c.events,e=fa?"":c.zoomType,c=a.inverted;this.options=b,this.chart=a,this.zoomX=f=/x/.test(e),this.zoomY=e=/y/.test(e),this.zoomHor=f&&!c||e&&c,this.zoomVert=e&&!c||f&&c,this.hasZoom=f||e,this.runChartClick=d&&!!d.click,this.pinchDown=[],this.lastValidTouch={},R.Tooltip&&b.tooltip.enabled&&(a.tooltip=new Mb(a,b.tooltip),this.followTouchMove=b.tooltip.followTouchMove),this.setDOMEvents()},normalize:function(a,b){var c,d,a=a||window.event,a=Sb(a);return a.target||(a.target=a.srcElement),d=a.touches?a.touches.length?a.touches.item(0):a.changedTouches[0]:a,b||(this.chartPosition=b=Rb(this.chart.container)),d.pageX===t?(c=v(a.x,a.clientX-b.left),d=a.y):(c=d.pageX-b.left,d=d.pageY-b.top),q(a,{chartX:u(c),chartY:u(d)})},getCoordinates:function(a){var b={xAxis:[],yAxis:[]};return p(this.chart.axes,function(c){b[c.isXAxis?"xAxis":"yAxis"].push({axis:c,value:c.toValue(a[c.horiz?"chartX":"chartY"])})}),b},getIndex:function(a){var b=this.chart;return b.inverted?b.plotHeight+b.plotTop-a.chartY:a.chartX-b.plotLeft},runPointActions:function(a){var e,f,i,j,b=this.chart,c=b.series,d=b.tooltip,g=b.hoverPoint,h=b.hoverSeries,k=b.chartWidth,l=this.getIndex(a);if(d&&this.options.tooltip.shared&&(!h||!h.noSharedTooltip)){for(f=[],i=c.length,j=0;i>j;j++)c[j].visible&&c[j].options.enableMouseTracking!==!1&&!c[j].noSharedTooltip&&c[j].singularTooltips!==!0&&c[j].tooltipPoints.length&&(e=c[j].tooltipPoints[l])&&e.series&&(e._dist=M(l-e.clientX),k=C(k,e._dist),f.push(e));for(i=f.length;i--;)f[i]._dist>k&&f.splice(i,1);f.length&&f[0].clientX!==this.hoverX&&(d.refresh(f,a),this.hoverX=f[0].clientX)}c=h&&h.tooltipOptions.followPointer,h&&h.tracker&&!c?(e=h.tooltipPoints[l])&&e!==g&&e.onMouseOver(a):d&&c&&!d.isHidden&&(h=d.getAnchor([{}],a),d.updatePosition({plotX:h[0],plotY:h[1]})),d&&!this._onDocumentMouseMove&&(this._onDocumentMouseMove=function(a){V[oa]&&V[oa].pointer.onDocumentMouseMove(a)},K(y,"mousemove",this._onDocumentMouseMove)),p(b.axes,function(b){b.drawCrosshair(a,m(e,g))})},reset:function(a){var b=this.chart,c=b.hoverSeries,d=b.hoverPoint,e=b.tooltip,f=e&&e.shared?b.hoverPoints:d;(a=a&&e&&f)&&qa(f)[0].plotX===t&&(a=!1),a?(e.refresh(f),d&&d.setState(d.state,!0)):(d&&d.onMouseOut(),c&&c.onMouseOut(),e&&e.hide(),this._onDocumentMouseMove&&(W(y,"mousemove",this._onDocumentMouseMove),this._onDocumentMouseMove=null),p(b.axes,function(a){a.hideCrosshair()}),this.hoverX=null)},scaleGroups:function(a,b){var d,c=this.chart;p(c.series,function(e){d=a||e.getPlotBox(),e.xAxis&&e.xAxis.zoomEnabled&&(e.group.attr(d),e.markerGroup&&(e.markerGroup.attr(d),e.markerGroup.clip(b?c.clipRect:null)),e.dataLabelsGroup&&e.dataLabelsGroup.attr(d))}),c.clipRect.attr(b||c.clipBox)},dragStart:function(a){var b=this.chart;b.mouseIsDown=a.type,b.cancelClick=!1,b.mouseDownX=this.mouseDownX=a.chartX,b.mouseDownY=this.mouseDownY=a.chartY},drag:function(a){var l,b=this.chart,c=b.options.chart,d=a.chartX,e=a.chartY,f=this.zoomHor,g=this.zoomVert,h=b.plotLeft,i=b.plotTop,j=b.plotWidth,k=b.plotHeight,o=this.mouseDownX,n=this.mouseDownY;h>d?d=h:d>h+j&&(d=h+j),i>e?e=i:e>i+k&&(e=i+k),this.hasDragged=Math.sqrt(Math.pow(o-d,2)+Math.pow(n-e,2)),this.hasDragged>10&&(l=b.isInsidePlot(o-h,n-i),b.hasCartesianSeries&&(this.zoomX||this.zoomY)&&l&&!this.selectionMarker&&(this.selectionMarker=b.renderer.rect(h,i,f?1:j,g?1:k,0).attr({fill:c.selectionMarkerFill||"rgba(69,114,167,0.25)",zIndex:7}).add()),this.selectionMarker&&f&&(d-=o,this.selectionMarker.attr({width:M(d),x:(d>0?0:d)+o})),this.selectionMarker&&g&&(d=e-n,this.selectionMarker.attr({height:M(d),y:(d>0?0:d)+n})),l&&!this.selectionMarker&&c.panning&&b.pan(a,c.panning))},drop:function(a){var b=this.chart,c=this.hasPinched;if(this.selectionMarker){var i,d={xAxis:[],yAxis:[],originalEvent:a.originalEvent||a},a=this.selectionMarker,e=a.attr?a.attr("x"):a.x,f=a.attr?a.attr("y"):a.y,g=a.attr?a.attr("width"):a.width,h=a.attr?a.attr("height"):a.height;(this.hasDragged||c)&&(p(b.axes,function(a){if(a.zoomEnabled){var b=a.horiz,c=a.toValue(b?e:f),b=a.toValue(b?e+g:f+h);!isNaN(c)&&!isNaN(b)&&(d[a.coll].push({axis:a,min:C(c,b),max:v(c,b)}),i=!0)}}),i&&D(b,"selection",d,function(a){b.zoom(q(a,c?{animation:!1}:null))})),this.selectionMarker=this.selectionMarker.destroy(),c&&this.scaleGroups()}b&&(G(b.container,{cursor:b._cursor}),b.cancelClick=this.hasDragged>10,b.mouseIsDown=this.hasDragged=this.hasPinched=!1,this.pinchDown=[])},onContainerMouseDown:function(a){a=this.normalize(a),a.preventDefault&&a.preventDefault(),this.dragStart(a)},onDocumentMouseUp:function(a){V[oa]&&V[oa].pointer.drop(a)},onDocumentMouseMove:function(a){var b=this.chart,c=this.chartPosition,d=b.hoverSeries,a=this.normalize(a,c);c&&d&&!this.inClass(a.target,"highcharts-tracker")&&!b.isInsidePlot(a.chartX-b.plotLeft,a.chartY-b.plotTop)&&this.reset()},onContainerMouseLeave:function(){var a=V[oa];a&&(a.pointer.reset(),a.pointer.chartPosition=null)},onContainerMouseMove:function(a){var b=this.chart;oa=b.index,a=this.normalize(a),"mousedown"===b.mouseIsDown&&this.drag(a),(this.inClass(a.target,"highcharts-tracker")||b.isInsidePlot(a.chartX-b.plotLeft,a.chartY-b.plotTop))&&!b.openMenu&&this.runPointActions(a)},inClass:function(a,b){for(var c;a;){if(c=H(a,"class")){if(-1!==c.indexOf(b))return!0;if(-1!==c.indexOf("highcharts-container"))return!1}a=a.parentNode}},onTrackerMouseOut:function(a){var b=this.chart.hoverSeries,c=(a=a.relatedTarget||a.toElement)&&a.point&&a.point.series;!b||b.options.stickyTracking||this.inClass(a,"highcharts-tooltip")||c===b||b.onMouseOut()},onContainerClick:function(a){var b=this.chart,c=b.hoverPoint,d=b.plotLeft,e=b.plotTop,a=this.normalize(a);a.cancelBubble=!0,b.cancelClick||(c&&this.inClass(a.target,"highcharts-tracker")?(D(c.series,"click",q(a,{point:c})),b.hoverPoint&&c.firePointEvent("click",a)):(q(a,this.getCoordinates(a)),b.isInsidePlot(a.chartX-d,a.chartY-e)&&D(b,"click",a)))},setDOMEvents:function(){var a=this,b=a.chart.container;b.onmousedown=function(b){a.onContainerMouseDown(b)},b.onmousemove=function(b){a.onContainerMouseMove(b)},b.onclick=function(b){a.onContainerClick(b)},K(b,"mouseleave",a.onContainerMouseLeave),1===ab&&K(y,"mouseup",a.onDocumentMouseUp),$a&&(b.ontouchstart=function(b){a.onContainerTouchStart(b)},b.ontouchmove=function(b){a.onContainerTouchMove(b)},1===ab&&K(y,"touchend",a.onDocumentTouchEnd))},destroy:function(){var a;W(this.chart.container,"mouseleave",this.onContainerMouseLeave),ab||(W(y,"mouseup",this.onDocumentMouseUp),W(y,"touchend",this.onDocumentTouchEnd)),clearInterval(this.tooltipTimeout);for(a in this)this[a]=null}},q(R.Pointer.prototype,{pinchTranslate:function(a,b,c,d,e,f){(this.zoomHor||this.pinchHor)&&this.pinchTranslateDirection(!0,a,b,c,d,e,f),(this.zoomVert||this.pinchVert)&&this.pinchTranslateDirection(!1,a,b,c,d,e,f)},pinchTranslateDirection:function(a,b,c,d,e,f,g,h){var s,m,y,i=this.chart,j=a?"x":"y",k=a?"X":"Y",l="chart"+k,o=a?"width":"height",n=i["plot"+(a?"Left":"Top")],p=h||1,q=i.inverted,x=i.bounds[a?"h":"v"],r=1===b.length,v=b[0][l],u=c[0][l],t=!r&&b[1][l],w=!r&&c[1][l],c=function(){!r&&M(v-t)>20&&(p=h||M(u-w)/M(v-t)),m=(n-u)/p+v,s=i["plot"+(a?"Width":"Height")]/p};c(),b=m,b<x.min?(b=x.min,y=!0):b+s>x.max&&(b=x.max-s,y=!0),y?(u-=.8*(u-g[j][0]),r||(w-=.8*(w-g[j][1])),c()):g[j]=[u,w],q||(f[j]=m-n,f[o]=s),f=q?1/p:p,e[o]=s,e[j]=b,d[q?a?"scaleY":"scaleX":"scale"+k]=p,d["translate"+k]=f*n+(u-f*v)},pinch:function(a){var b=this,c=b.chart,d=b.pinchDown,e=b.followTouchMove,f=a.touches,g=f.length,h=b.lastValidTouch,i=b.hasZoom,j=b.selectionMarker,k={},l=1===g&&(b.inClass(a.target,"highcharts-tracker")&&c.runTrackerClick||c.runChartClick),o={};(i||e)&&!l&&a.preventDefault(),Ua(f,function(a){return b.normalize(a)}),"touchstart"===a.type?(p(f,function(a,b){d[b]={chartX:a.chartX,chartY:a.chartY}}),h.x=[d[0].chartX,d[1]&&d[1].chartX],h.y=[d[0].chartY,d[1]&&d[1].chartY],p(c.axes,function(a){if(a.zoomEnabled){var b=c.bounds[a.horiz?"h":"v"],d=a.minPixelPadding,e=a.toPixels(a.dataMin),f=a.toPixels(a.dataMax),g=C(e,f),e=v(e,f);b.min=C(a.pos,g-d),b.max=v(a.pos+a.len,e+d)}})):d.length&&(j||(b.selectionMarker=j=q({destroy:sa},c.plotBox)),b.pinchTranslate(d,f,k,j,o,h),b.hasPinched=i,b.scaleGroups(k,o),!i&&e&&1===g&&this.runPointActions(b.normalize(a)))},onContainerTouchStart:function(a){var b=this.chart;oa=b.index,1===a.touches.length?(a=this.normalize(a),b.isInsidePlot(a.chartX-b.plotLeft,a.chartY-b.plotTop)?(this.runPointActions(a),this.pinch(a)):this.reset()):2===a.touches.length&&this.pinch(a)},onContainerTouchMove:function(a){(1===a.touches.length||2===a.touches.length)&&this.pinch(a)},onDocumentTouchEnd:function(a){V[oa]&&V[oa].pointer.drop(a)}}),I.PointerEvent||I.MSPointerEvent){var ua={},zb=!!I.PointerEvent,Wb=function(){var a,b=[];b.item=function(a){return this[a]};for(a in ua)ua.hasOwnProperty(a)&&b.push({pageX:ua[a].pageX,pageY:ua[a].pageY,target:ua[a].target});return b},Ab=function(a,b,c,d){a=a.originalEvent||a,"touch"!==a.pointerType&&a.pointerType!==a.MSPOINTER_TYPE_TOUCH||!V[oa]||(d(a),d=V[oa].pointer,d[b]({type:c,target:a.currentTarget,preventDefault:sa,touches:Wb()}))};q(Wa.prototype,{onContainerPointerDown:function(a){Ab(a,"onContainerTouchStart","touchstart",function(a){ua[a.pointerId]={pageX:a.pageX,pageY:a.pageY,target:a.currentTarget}})},onContainerPointerMove:function(a){Ab(a,"onContainerTouchMove","touchmove",function(a){ua[a.pointerId]={pageX:a.pageX,pageY:a.pageY},ua[a.pointerId].target||(ua[a.pointerId].target=a.currentTarget)})},onDocumentPointerUp:function(a){Ab(a,"onContainerTouchEnd","touchend",function(a){delete ua[a.pointerId]})},batchMSEvents:function(a){a(this.chart.container,zb?"pointerdown":"MSPointerDown",this.onContainerPointerDown),a(this.chart.container,zb?"pointermove":"MSPointerMove",this.onContainerPointerMove),a(y,zb?"pointerup":"MSPointerUp",this.onDocumentPointerUp)}}),Ma(Wa.prototype,"init",function(a,b,c){a.call(this,b,c),(this.hasZoom||this.followTouchMove)&&G(b.container,{"-ms-touch-action":Q,"touch-action":Q})}),Ma(Wa.prototype,"setDOMEvents",function(a){a.apply(this),(this.hasZoom||this.followTouchMove)&&this.batchMSEvents(K)}),Ma(Wa.prototype,"destroy",function(a){this.batchMSEvents(W),a.call(this)})}var lb=R.Legend=function(a,b){this.init(a,b)};lb.prototype={init:function(a,b){var c=this,d=b.itemStyle,e=m(b.padding,8),f=b.itemMarginTop||0;this.options=b,b.enabled&&(c.baseline=z(d.fontSize)+3+f,c.itemStyle=d,c.itemHiddenStyle=w(d,b.itemHiddenStyle),c.itemMarginTop=f,c.padding=e,c.initialItemX=e,c.initialItemY=e-5,c.maxItemWidth=0,c.chart=a,c.itemHeight=0,c.lastLineHeight=0,c.symbolWidth=m(b.symbolWidth,16),c.pages=[],c.render(),K(c.chart,"endResize",function(){c.positionCheckboxes()}))},colorizeItem:function(a,b){var j,c=this.options,d=a.legendItem,e=a.legendLine,f=a.legendSymbol,g=this.itemHiddenStyle.color,c=b?c.itemStyle.color:g,h=b?a.legendColor||a.color||"#CCC":g,g=a.options&&a.options.marker,i={fill:h};if(d&&d.css({fill:c,color:c}),e&&e.attr({stroke:h}),f){if(g&&f.isMarker)for(j in i.stroke=h,g=a.convertAttribs(g))d=g[j],d!==t&&(i[j]=d);f.attr(i)}},positionItem:function(a){var b=this.options,c=b.symbolPadding,b=!b.rtl,d=a._legendItemPos,e=d[0],d=d[1],f=a.checkbox;a.legendGroup&&a.legendGroup.translate(b?e:this.legendWidth-e-2*c-4,d),f&&(f.x=e,f.y=d)},destroyItem:function(a){var b=a.checkbox;p(["legendItem","legendLine","legendSymbol","legendGroup"],function(b){a[b]&&(a[b]=a[b].destroy())}),b&&Pa(a.checkbox)},destroy:function(){var a=this.group,b=this.box;b&&(this.box=b.destroy()),a&&(this.group=a.destroy())},positionCheckboxes:function(a){var c,b=this.group.alignAttr,d=this.clipHeight||this.legendHeight;b&&(c=b.translateY,p(this.allItems,function(e){var g,f=e.checkbox;f&&(g=c+f.y+(a||0)+3,G(f,{left:b.translateX+e.checkboxOffset+f.x-20+"px",top:g+"px",display:g>c-6&&c+d-6>g?"":Q}))}))},renderTitle:function(){var a=this.padding,b=this.options.title,c=0;b.text&&(this.title||(this.title=this.chart.renderer.label(b.text,a-3,a-4,null,null,null,null,null,"legend-title").attr({zIndex:1}).css(b.style).add(this.group)),a=this.title.getBBox(),c=a.height,this.offsetWidth=a.width,this.contentGroup.attr({translateY:c})),this.titleHeight=c},renderItem:function(a){var b=this.chart,c=b.renderer,d=this.options,e="horizontal"===d.layout,f=this.symbolWidth,g=d.symbolPadding,h=this.itemStyle,i=this.itemHiddenStyle,j=this.padding,k=e?m(d.itemDistance,20):0,l=!d.rtl,o=d.width,n=d.itemMarginBottom||0,s=this.itemMarginTop,p=this.initialItemX,q=a.legendItem,r=a.series&&a.series.drawLegendSymbol?a.series:a,x=r.options,x=this.createCheckboxForItem&&x&&x.showCheckbox,t=d.useHTML;q||(a.legendGroup=c.g("legend-item").attr({zIndex:1}).add(this.scrollGroup),r.drawLegendSymbol(this,a),a.legendItem=q=c.text(d.labelFormat?Ia(d.labelFormat,a):d.labelFormatter.call(a),l?f+g:-g,this.baseline,t).css(w(a.visible?h:i)).attr({align:l?"left":"right",zIndex:2}).add(a.legendGroup),this.setItemEvents&&this.setItemEvents(a,q,t,h,i),this.colorizeItem(a,a.visible),x&&this.createCheckboxForItem(a)),c=q.getBBox(),f=a.checkboxOffset=d.itemWidth||a.legendItemWidth||f+g+c.width+k+(x?20:0),this.itemHeight=g=u(a.legendItemHeight||c.height),e&&this.itemX-p+f>(o||b.chartWidth-2*j-p-d.x)&&(this.itemX=p,this.itemY+=s+this.lastLineHeight+n,this.lastLineHeight=0),this.maxItemWidth=v(this.maxItemWidth,f),this.lastItemY=s+this.itemY+n,this.lastLineHeight=v(g,this.lastLineHeight),a._legendItemPos=[this.itemX,this.itemY],e?this.itemX+=f:(this.itemY+=s+g+n,this.lastLineHeight=g),this.offsetWidth=o||v((e?this.itemX-p-k:f)+j,this.offsetWidth)},getAllItems:function(){var a=[];return p(this.chart.series,function(b){var c=b.options;m(c.showInLegend,r(c.linkedTo)?!1:t,!0)&&(a=a.concat(b.legendItems||("point"===c.legendType?b.data:b)))}),a},render:function(){var e,f,g,h,a=this,b=a.chart,c=b.renderer,d=a.group,i=a.box,j=a.options,k=a.padding,l=j.borderWidth,o=j.backgroundColor;a.itemX=a.initialItemX,a.itemY=a.initialItemY,a.offsetWidth=0,a.lastItemY=0,d||(a.group=d=c.g("legend").attr({zIndex:7}).add(),a.contentGroup=c.g().attr({zIndex:1}).add(d),a.scrollGroup=c.g().add(a.contentGroup)),a.renderTitle(),e=a.getAllItems(),ob(e,function(a,b){return(a.options&&a.options.legendIndex||0)-(b.options&&b.options.legendIndex||0)}),j.reversed&&e.reverse(),a.allItems=e,a.display=f=!!e.length,p(e,function(b){a.renderItem(b)}),g=j.width||a.offsetWidth,h=a.lastItemY+a.lastLineHeight+a.titleHeight,h=a.handleOverflow(h),(l||o)&&(g+=k,h+=k,i?g>0&&h>0&&(i[i.isNew?"attr":"animate"](i.crisp({width:g,height:h})),i.isNew=!1):(a.box=i=c.rect(0,0,g,h,j.borderRadius,l||0).attr({stroke:j.borderColor,"stroke-width":l||0,fill:o||Q}).add(d).shadow(j.shadow),i.isNew=!0),i[f?"show":"hide"]()),a.legendWidth=g,a.legendHeight=h,p(e,function(b){a.positionItem(b)}),f&&d.align(q({width:g,height:h},j),!0,"spacingBox"),b.isResizing||this.positionCheckboxes()},handleOverflow:function(a){var h,s,b=this,c=this.chart,d=c.renderer,e=this.options,f=e.y,f=c.spacingBox.height+("top"===e.verticalAlign?-f:f)-this.padding,g=e.maxHeight,i=this.clipRect,j=e.navigation,k=m(j.animation,!0),l=j.arrowSize||12,o=this.nav,n=this.pages,q=this.allItems;return"horizontal"===e.layout&&(f/=2),g&&(f=C(f,g)),n.length=0,a>f&&!e.useHTML?(this.clipHeight=h=f-20-this.titleHeight-this.padding,this.currentPage=m(this.currentPage,1),this.fullHeight=a,p(q,function(a,b){var c=a._legendItemPos[1],d=u(a.legendItem.getBBox().height),e=n.length;(!e||c-n[e-1]>h&&(s||c)!==n[e-1])&&(n.push(s||c),e++),b===q.length-1&&c+d-n[e-1]>h&&n.push(c),c!==s&&(s=c)}),i||(i=b.clipRect=d.clipRect(0,this.padding,9999,0),b.contentGroup.clip(i)),i.attr({height:h}),o||(this.nav=o=d.g().attr({zIndex:1}).add(this.group),this.up=d.symbol("triangle",0,0,l,l).on("click",function(){b.scroll(-1,k)}).add(o),this.pager=d.text("",15,10).css(j.style).add(o),this.down=d.symbol("triangle-down",0,0,l,l).on("click",function(){b.scroll(1,k)}).add(o)),b.scroll(0),a=f):o&&(i.attr({height:c.chartHeight}),o.hide(),this.scrollGroup.attr({translateY:1}),this.clipHeight=0),a},scroll:function(a,b){var c=this.pages,d=c.length,e=this.currentPage+a,f=this.clipHeight,g=this.options.navigation,h=g.activeColor,g=g.inactiveColor,i=this.pager,j=this.padding;e>d&&(e=d),e>0&&(b!==t&&Qa(b,this.chart),this.nav.attr({translateX:j,translateY:f+this.padding+7+this.titleHeight,visibility:"visible"}),this.up.attr({fill:1===e?g:h}).css({cursor:1===e?"default":"pointer"}),i.attr({text:e+"/"+d}),this.down.attr({x:18+this.pager.getBBox().width,fill:e===d?g:h}).css({cursor:e===d?"default":"pointer"}),c=-c[e-1]+this.initialItemY,this.scrollGroup.animate({translateY:c}),this.currentPage=e,this.positionCheckboxes(c))}},N=R.LegendSymbolMixin={drawRectangle:function(a,b){var c=a.options.symbolHeight||12;b.legendSymbol=this.chart.renderer.rect(0,a.baseline-5-c/2,a.symbolWidth,c,a.options.symbolRadius||0).attr({zIndex:3}).add(b.legendGroup)},drawLineMarker:function(a){var d,b=this.options,c=b.marker;d=a.symbolWidth;var g,e=this.chart.renderer,f=this.legendGroup,a=a.baseline-u(.3*e.fontMetrics(a.options.itemStyle.fontSize).b);b.lineWidth&&(g={"stroke-width":b.lineWidth},b.dashStyle&&(g.dashstyle=b.dashStyle),this.legendLine=e.path(["M",0,a,"L",d,a]).attr(g).add(f)),c&&c.enabled!==!1&&(b=c.radius,this.legendSymbol=d=e.symbol(this.symbol,d/2-b,a-b,2*b,2*b).add(f),d.isMarker=!0)}},(/Trident\/7\.0/.test(wa)||Ta)&&Ma(lb.prototype,"positionItem",function(a,b){var c=this,d=function(){b._legendItemPos&&a.call(c,b)};d(),setTimeout(d)}),Ya.prototype={init:function(a,b){var c,d=a.series;a.series=null,c=w(E,a),c.series=a.series=d,this.userOptions=a,d=c.chart,this.margin=this.splashArray("margin",d),this.spacing=this.splashArray("spacing",d);var e=d.events;this.bounds={h:{},v:{}},this.callback=b,this.isResizing=0,this.options=c,this.axes=[],this.series=[],this.hasCartesianSeries=d.showAxes;var g,f=this;if(f.index=V.length,V.push(f),ab++,d.reflow!==!1&&K(f,"load",function(){f.initReflow()}),e)for(g in e)K(f,g,e[g]);f.xAxis=[],f.yAxis=[],f.animation=fa?!1:m(d.animation,!0),f.pointCount=0,f.counters=new Bb,f.firstRender()},initSeries:function(a){var b=this.options.chart;return(b=F[a.type||b.type||b.defaultSeriesType])||ra(17,!0),b=new b,b.init(this,a),b},isInsidePlot:function(a,b,c){var d=c?b:a,a=c?a:b;return d>=0&&d<=this.plotWidth&&a>=0&&a<=this.plotHeight},adjustTickAmounts:function(){this.options.chart.alignTicks!==!1&&p(this.axes,function(a){a.adjustTickAmount()}),this.maxTicks=null},redraw:function(a){var g,h,b=this.axes,c=this.series,d=this.pointer,e=this.legend,f=this.isDirtyLegend,i=this.isDirtyBox,j=c.length,k=j,l=this.renderer,o=l.isHidden(),n=[];for(Qa(a,this),o&&this.cloneRenderTo(),this.layOutTitles();k--;)if(a=c[k],a.options.stacking&&(g=!0,a.isDirty)){h=!0;break}if(h)for(k=j;k--;)a=c[k],a.options.stacking&&(a.isDirty=!0);p(c,function(a){a.isDirty&&"point"===a.options.legendType&&(f=!0)}),f&&e.options.enabled&&(e.render(),this.isDirtyLegend=!1),g&&this.getStacks(),this.hasCartesianSeries&&(this.isResizing||(this.maxTicks=null,p(b,function(a){a.setScale()})),this.adjustTickAmounts(),this.getMargins(),p(b,function(a){a.isDirty&&(i=!0)}),p(b,function(a){a.isDirtyExtremes&&(a.isDirtyExtremes=!1,n.push(function(){D(a,"afterSetExtremes",q(a.eventArgs,a.getExtremes())),delete a.eventArgs})),(i||g)&&a.redraw()})),i&&this.drawChartBox(),p(c,function(a){a.isDirty&&a.visible&&(!a.isCartesian||a.xAxis)&&a.redraw()}),d&&d.reset(!0),l.draw(),D(this,"redraw"),o&&this.cloneRenderTo(!0),p(n,function(a){a.call()})},get:function(a){var d,e,b=this.axes,c=this.series;for(d=0;d<b.length;d++)if(b[d].options.id===a)return b[d];for(d=0;d<c.length;d++)if(c[d].options.id===a)return c[d];for(d=0;d<c.length;d++)for(e=c[d].points||[],b=0;b<e.length;b++)if(e[b].id===a)return e[b];return null},getAxes:function(){var a=this,b=this.options,c=b.xAxis=qa(b.xAxis||{}),b=b.yAxis=qa(b.yAxis||{});p(c,function(a,b){a.index=b,a.isX=!0}),p(b,function(a,b){a.index=b}),c=c.concat(b),p(c,function(b){new la(a,b)}),a.adjustTickAmounts()},getSelectedPoints:function(){var a=[];return p(this.series,function(b){a=a.concat(vb(b.points||[],function(a){return a.selected}))
4
- }),a},getSelectedSeries:function(){return vb(this.series,function(a){return a.selected})},getStacks:function(){var a=this;p(a.yAxis,function(a){a.stacks&&a.hasVisibleSeries&&(a.oldStacks=a.stacks)}),p(a.series,function(b){!b.options.stacking||b.visible!==!0&&a.options.chart.ignoreHiddenSeries!==!1||(b.stackKey=b.type+m(b.options.stack,""))})},setTitle:function(a,b,c){var g,f,d=this,e=d.options;f=e.title=w(e.title,a),g=e.subtitle=w(e.subtitle,b),e=g,p([["title",a,f],["subtitle",b,e]],function(a){var b=a[0],c=d[b],e=a[1],a=a[2];c&&e&&(d[b]=c=c.destroy()),a&&a.text&&!c&&(d[b]=d.renderer.text(a.text,0,0,a.useHTML).attr({align:a.align,"class":"highcharts-"+b,zIndex:a.zIndex||4}).css(a.style).add())}),d.layOutTitles(c)},layOutTitles:function(a){var b=0,c=this.title,d=this.subtitle,e=this.options,f=e.title,e=e.subtitle,g=this.spacingBox.width-44;!c||(c.css({width:(f.width||g)+"px"}).align(q({y:15},f),!1,"spacingBox"),f.floating||f.verticalAlign)||(b=c.getBBox().height),d&&(d.css({width:(e.width||g)+"px"}).align(q({y:b+f.margin},e),!1,"spacingBox"),!e.floating&&!e.verticalAlign&&(b=Ka(b+d.getBBox().height))),c=this.titleOffset!==b,this.titleOffset=b,!this.isDirtyBox&&c&&(this.isDirtyBox=c,this.hasRendered&&m(a,!0)&&this.isDirtyBox&&this.redraw())},getChartSize:function(){var a=this.options.chart,b=a.width,a=a.height,c=this.renderToClone||this.renderTo;r(b)||(this.containerWidth=jb(c,"width")),r(a)||(this.containerHeight=jb(c,"height")),this.chartWidth=v(0,b||this.containerWidth||600),this.chartHeight=v(0,m(a,this.containerHeight>19?this.containerHeight:400))},cloneRenderTo:function(a){var b=this.renderToClone,c=this.container;a?b&&(this.renderTo.appendChild(c),Pa(b),delete this.renderToClone):(c&&c.parentNode===this.renderTo&&this.renderTo.removeChild(c),this.renderToClone=b=this.renderTo.cloneNode(0),G(b,{position:"absolute",top:"-9999px",display:"block"}),b.style.setProperty&&b.style.setProperty("display","block","important"),y.body.appendChild(b),c&&b.appendChild(c))},getContainer:function(){var a,c,d,e,b=this.options.chart;this.renderTo=a=b.renderTo,e="highcharts-"+tb++,Fa(a)&&(this.renderTo=a=y.getElementById(a)),a||ra(13,!0),c=z(H(a,"data-highcharts-chart")),!isNaN(c)&&V[c]&&V[c].hasRendered&&V[c].destroy(),H(a,"data-highcharts-chart",this.index),a.innerHTML="",!b.skipClone&&!a.offsetWidth&&this.cloneRenderTo(),this.getChartSize(),c=this.chartWidth,d=this.chartHeight,this.container=a=Y(Ja,{className:"highcharts-container"+(b.className?" "+b.className:""),id:e},q({position:"relative",overflow:"hidden",width:c+"px",height:d+"px",textAlign:"left",lineHeight:"normal",zIndex:0,"-webkit-tap-highlight-color":"rgba(0,0,0,0)"},b.style),this.renderToClone||a),this._cursor=a.style.cursor,this.renderer=b.forExport?new ta(a,c,d,b.style,!0):new Za(a,c,d,b.style),fa&&this.renderer.create(this,a,c,d)},getMargins:function(){var b,a=this.spacing,c=this.legend,d=this.margin,e=this.options.legend,f=m(e.margin,20),g=e.x,h=e.y,i=e.align,j=e.verticalAlign,k=this.titleOffset;this.resetMargins(),b=this.axisOffset,k&&!r(d[0])&&(this.plotTop=v(this.plotTop,k+this.options.title.margin+a[0])),c.display&&!e.floating&&("right"===i?r(d[1])||(this.marginRight=v(this.marginRight,c.legendWidth-g+f+a[1])):"left"===i?r(d[3])||(this.plotLeft=v(this.plotLeft,c.legendWidth+g+f+a[3])):"top"===j?r(d[0])||(this.plotTop=v(this.plotTop,c.legendHeight+h+f+a[0])):"bottom"!==j||r(d[2])||(this.marginBottom=v(this.marginBottom,c.legendHeight-h+f+a[2]))),this.extraBottomMargin&&(this.marginBottom+=this.extraBottomMargin),this.extraTopMargin&&(this.plotTop+=this.extraTopMargin),this.hasCartesianSeries&&p(this.axes,function(a){a.getOffset()}),r(d[3])||(this.plotLeft+=b[3]),r(d[0])||(this.plotTop+=b[0]),r(d[2])||(this.marginBottom+=b[2]),r(d[1])||(this.marginRight+=b[1]),this.setChartSize()},reflow:function(a){var b=this,c=b.options.chart,d=b.renderTo,e=c.width||jb(d,"width"),f=c.height||jb(d,"height"),c=a?a.target:I,d=function(){b.container&&(b.setSize(e,f,!1),b.hasUserSize=null)};b.hasUserSize||!e||!f||c!==I&&c!==y||((e!==b.containerWidth||f!==b.containerHeight)&&(clearTimeout(b.reflowTimeout),a?b.reflowTimeout=setTimeout(d,100):d()),b.containerWidth=e,b.containerHeight=f)},initReflow:function(){var a=this,b=function(b){a.reflow(b)};K(I,"resize",b),K(a,"destroy",function(){W(I,"resize",b)})},setSize:function(a,b,c){var e,f,g,d=this;d.isResizing+=1,g=function(){d&&D(d,"endResize",null,function(){d.isResizing-=1})},Qa(c,d),d.oldChartHeight=d.chartHeight,d.oldChartWidth=d.chartWidth,r(a)&&(d.chartWidth=e=v(0,u(a)),d.hasUserSize=!!e),r(b)&&(d.chartHeight=f=v(0,u(b))),(va?kb:G)(d.container,{width:e+"px",height:f+"px"},va),d.setChartSize(!0),d.renderer.setSize(e,f,c),d.maxTicks=null,p(d.axes,function(a){a.isDirty=!0,a.setScale()}),p(d.series,function(a){a.isDirty=!0}),d.isDirtyLegend=!0,d.isDirtyBox=!0,d.layOutTitles(),d.getMargins(),d.redraw(c),d.oldChartHeight=null,D(d,"resize"),va===!1?g():setTimeout(g,va&&va.duration||500)},setChartSize:function(a){var i,j,k,l,b=this.inverted,c=this.renderer,d=this.chartWidth,e=this.chartHeight,f=this.options.chart,g=this.spacing,h=this.clipOffset;this.plotLeft=i=u(this.plotLeft),this.plotTop=j=u(this.plotTop),this.plotWidth=k=v(0,u(d-i-this.marginRight)),this.plotHeight=l=v(0,u(e-j-this.marginBottom)),this.plotSizeX=b?l:k,this.plotSizeY=b?k:l,this.plotBorderWidth=f.plotBorderWidth||0,this.spacingBox=c.spacingBox={x:g[3],y:g[0],width:d-g[3]-g[1],height:e-g[0]-g[2]},this.plotBox=c.plotBox={x:i,y:j,width:k,height:l},d=2*T(this.plotBorderWidth/2),b=Ka(v(d,h[3])/2),c=Ka(v(d,h[0])/2),this.clipBox={x:b,y:c,width:T(this.plotSizeX-v(d,h[1])/2-b),height:T(this.plotSizeY-v(d,h[2])/2-c)},a||p(this.axes,function(a){a.setAxisSize(),a.setAxisTranslation()})},resetMargins:function(){var a=this.spacing,b=this.margin;this.plotTop=m(b[0],a[0]),this.marginRight=m(b[1],a[1]),this.marginBottom=m(b[2],a[2]),this.plotLeft=m(b[3],a[3]),this.axisOffset=[0,0,0,0],this.clipOffset=[0,0,0,0]},drawChartBox:function(){var n,a=this.options.chart,b=this.renderer,c=this.chartWidth,d=this.chartHeight,e=this.chartBackground,f=this.plotBackground,g=this.plotBorder,h=this.plotBGImage,i=a.borderWidth||0,j=a.backgroundColor,k=a.plotBackgroundColor,l=a.plotBackgroundImage,o=a.plotBorderWidth||0,s=this.plotLeft,m=this.plotTop,p=this.plotWidth,q=this.plotHeight,r=this.plotBox,v=this.clipRect,u=this.clipBox;n=i+(a.shadow?8:0),(i||j)&&(e?e.animate(e.crisp({width:c-n,height:d-n})):(e={fill:j||Q},i&&(e.stroke=a.borderColor,e["stroke-width"]=i),this.chartBackground=b.rect(n/2,n/2,c-n,d-n,a.borderRadius,i).attr(e).addClass("highcharts-background").add().shadow(a.shadow))),k&&(f?f.animate(r):this.plotBackground=b.rect(s,m,p,q,0).attr({fill:k}).add().shadow(a.plotShadow)),l&&(h?h.animate(r):this.plotBGImage=b.image(l,s,m,p,q).add()),v?v.animate({width:u.width,height:u.height}):this.clipRect=b.clipRect(u),o&&(g?g.animate(g.crisp({x:s,y:m,width:p,height:q})):this.plotBorder=b.rect(s,m,p,q,0,-o).attr({stroke:a.plotBorderColor,"stroke-width":o,fill:Q,zIndex:1}).add()),this.isDirtyBox=!1},propFromSeries:function(){var c,e,f,a=this,b=a.options.chart,d=a.options.series;p(["inverted","angular","polar"],function(g){for(c=F[b.type||b.defaultSeriesType],f=a[g]||b[g]||c&&c.prototype[g],e=d&&d.length;!f&&e--;)(c=F[d[e].type])&&c.prototype[g]&&(f=!0);a[g]=f})},linkSeries:function(){var a=this,b=a.series;p(b,function(a){a.linkedSeries.length=0}),p(b,function(b){var d=b.options.linkedTo;Fa(d)&&(d=":previous"===d?a.series[b.index-1]:a.get(d))&&(d.linkedSeries.push(b),b.linkedParent=d)})},renderSeries:function(){p(this.series,function(a){a.translate(),a.setTooltipPoints&&a.setTooltipPoints(),a.render()})},render:function(){var g,a=this,b=a.axes,c=a.renderer,d=a.options,e=d.labels,f=d.credits;a.setTitle(),a.legend=new lb(a,d.legend),a.getStacks(),p(b,function(a){a.setScale()}),a.getMargins(),a.maxTicks=null,p(b,function(a){a.setTickPositions(!0),a.setMaxTicks()}),a.adjustTickAmounts(),a.getMargins(),a.drawChartBox(),a.hasCartesianSeries&&p(b,function(a){a.render()}),a.seriesGroup||(a.seriesGroup=c.g("series-group").attr({zIndex:3}).add()),a.renderSeries(),e.items&&p(e.items,function(b){var d=q(e.style,b.style),f=z(d.left)+a.plotLeft,g=z(d.top)+a.plotTop+12;delete d.left,delete d.top,c.text(b.html,f,g).attr({zIndex:2}).css(d).add()}),f.enabled&&!a.credits&&(g=f.href,a.credits=c.text(f.text,0,0).on("click",function(){g&&(location.href=g)}).attr({align:f.position.align,zIndex:8}).css(f.style).add().align(f.position)),a.hasRendered=!0},destroy:function(){var e,a=this,b=a.axes,c=a.series,d=a.container,f=d&&d.parentNode;for(D(a,"destroy"),V[a.index]=t,ab--,a.renderTo.removeAttribute("data-highcharts-chart"),W(a),e=b.length;e--;)b[e]=b[e].destroy();for(e=c.length;e--;)c[e]=c[e].destroy();p("title,subtitle,chartBackground,plotBackground,plotBGImage,plotBorder,seriesGroup,clipRect,credits,pointer,scroller,rangeSelector,legend,resetZoomButton,tooltip,renderer".split(","),function(b){var c=a[b];c&&c.destroy&&(a[b]=c.destroy())}),d&&(d.innerHTML="",W(d),f&&Pa(d));for(e in a)delete a[e]},isReadyToRender:function(){var a=this;return!aa&&I==I.top&&"complete"!==y.readyState||fa&&!I.canvg?(fa?Lb.push(function(){a.firstRender()},a.options.global.canvasToolsURL):y.attachEvent("onreadystatechange",function(){y.detachEvent("onreadystatechange",a.firstRender),"complete"===y.readyState&&a.firstRender()}),!1):!0},firstRender:function(){var a=this,b=a.options,c=a.callback;a.isReadyToRender()&&(a.getContainer(),D(a,"init"),a.resetMargins(),a.setChartSize(),a.propFromSeries(),a.getAxes(),p(b.series||[],function(b){a.initSeries(b)}),a.linkSeries(),D(a,"beforeRender"),R.Pointer&&(a.pointer=new Wa(a,b)),a.render(),a.renderer.draw(),c&&c.apply(a,[a]),p(a.callbacks,function(b){b.apply(a,[a])}),a.cloneRenderTo(!0),D(a,"load"))},splashArray:function(a,b){var c=b[a],c=ca(c)?c:[c,c,c,c];return[m(b[a+"Top"],c[0]),m(b[a+"Right"],c[1]),m(b[a+"Bottom"],c[2]),m(b[a+"Left"],c[3])]}},Ya.prototype.callbacks=[],X=R.CenteredSeriesMixin={getCenter:function(){var d,h,a=this.options,b=this.chart,c=2*(a.slicedOffset||0),e=b.plotWidth-2*c,f=b.plotHeight-2*c,b=a.center,a=[m(b[0],"50%"),m(b[1],"50%"),a.size||"100%",a.innerSize||0],g=C(e,f);return Ua(a,function(a,b){return h=/%$/.test(a),d=2>b||2===b&&h,(h?[e,f,g,g][b]*z(a)/100:a)+(d?c:0)})}};var Ea=function(){};Ea.prototype={init:function(a,b,c){return this.series=a,this.applyOptions(b,c),this.pointAttr={},a.options.colorByPoint&&(b=a.options.colors||a.chart.options.colors,this.color=this.color||b[a.colorCounter++],a.colorCounter===b.length)&&(a.colorCounter=0),a.chart.pointCount++,this},applyOptions:function(a,b){var c=this.series,d=c.pointValKey,a=Ea.prototype.optionsToObject.call(this,a);return q(this,a),this.options=this.options?q(this.options,a):a,d&&(this.y=this[d]),this.x===t&&c&&(this.x=b===t?c.autoIncrement():b),this},optionsToObject:function(a){var b={},c=this.series,d=c.pointArrayMap||["y"],e=d.length,f=0,g=0;if("number"==typeof a||null===a)b[d[0]]=a;else if(La(a))for(a.length>e&&(c=typeof a[0],"string"===c?b.name=a[0]:"number"===c&&(b.x=a[0]),f++);e>g;)b[d[g++]]=a[f++];else"object"==typeof a&&(b=a,a.dataLabels&&(c._hasPointLabels=!0),a.marker&&(c._hasPointMarkers=!0));return b},destroy:function(){var c,a=this.series.chart,b=a.hoverPoints;a.pointCount--,b&&(this.setState(),ja(b,this),!b.length)&&(a.hoverPoints=null),this===a.hoverPoint&&this.onMouseOut(),(this.graphic||this.dataLabel)&&(W(this),this.destroyElements()),this.legendItem&&a.legend.destroyItem(this);for(c in this)this[c]=null},destroyElements:function(){for(var b,a="graphic,dataLabel,dataLabelUpper,group,connector,shadowGroup".split(","),c=6;c--;)b=a[c],this[b]&&(this[b]=this[b].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}},tooltipFormatter:function(a){var b=this.series,c=b.tooltipOptions,d=m(c.valueDecimals,""),e=c.valuePrefix||"",f=c.valueSuffix||"";return p(b.pointArrayMap||["y"],function(b){b="{point."+b,(e||f)&&(a=a.replace(b+"}",e+b+"}"+f)),a=a.replace(b+"}",b+":,."+d+"f}")}),Ia(a,{point:this,series:this.series})},firePointEvent:function(a,b,c){var d=this,e=this.series.options;(e.point.events[a]||d.options&&d.options.events&&d.options.events[a])&&this.importEvents(),"click"===a&&e.allowPointSelect&&(c=function(a){d.select(null,a.ctrlKey||a.metaKey||a.shiftKey)}),D(this,a,b,c)}};var O=function(){};O.prototype={isCartesian:!0,type:"line",pointClass:Ea,sorted:!0,requireSorting:!0,pointAttrToOptions:{stroke:"lineColor","stroke-width":"lineWidth",fill:"fillColor",r:"radius"},axisTypes:["xAxis","yAxis"],colorCounter:0,parallelArrays:["x","y"],init:function(a,b){var d,e,c=this,f=a.series,g=function(a,b){return m(a.options.index,a._i)-m(b.options.index,b._i)};c.chart=a,c.options=b=c.setOptions(b),c.linkedSeries=[],c.bindAxes(),q(c,{name:b.name,state:"",pointAttr:{},visible:b.visible!==!1,selected:b.selected===!0}),fa&&(b.animation=!1),e=b.events;for(d in e)K(c,d,e[d]);(e&&e.click||b.point&&b.point.events&&b.point.events.click||b.allowPointSelect)&&(a.runTrackerClick=!0),c.getColor(),c.getSymbol(),p(c.parallelArrays,function(a){c[a+"Data"]=[]}),c.setData(b.data,!1),c.isCartesian&&(a.hasCartesianSeries=!0),f.push(c),c._i=f.length-1,ob(f,g),this.yAxis&&ob(this.yAxis.series,g),p(f,function(a,b){a.index=b,a.name=a.name||"Series "+(b+1)})},bindAxes:function(){var d,a=this,b=a.options,c=a.chart;p(a.axisTypes||[],function(e){p(c[e],function(c){d=c.options,(b[e]===d.index||b[e]!==t&&b[e]===d.id||b[e]===t&&0===d.index)&&(c.series.push(a),a[e]=c,c.isDirty=!0)}),!a[e]&&a.optionalAxis!==e&&ra(18,!0)})},updateParallelArrays:function(a,b){var c=a.series,d=arguments;p(c.parallelArrays,"number"==typeof b?function(d){var f="y"===d&&c.toYData?c.toYData(a):a[d];c[d+"Data"][b]=f}:function(a){Array.prototype[b].apply(c[a+"Data"],Array.prototype.slice.call(d,2))})},autoIncrement:function(){var a=this.options,b=this.xIncrement,b=m(b,a.pointStart,0);return this.pointInterval=m(this.pointInterval,a.pointInterval,1),this.xIncrement=b+this.pointInterval,b},getSegments:function(){var c,a=-1,b=[],d=this.points,e=d.length;if(e)if(this.options.connectNulls){for(c=e;c--;)null===d[c].y&&d.splice(c,1);d.length&&(b=[d])}else p(d,function(c,g){null===c.y?(g>a+1&&b.push(d.slice(a+1,g)),a=g):g===e-1&&b.push(d.slice(a+1,g+1))});this.segments=b},setOptions:function(a){var b=this.chart,c=b.options.plotOptions,b=b.userOptions||{},d=b.plotOptions||{},e=c[this.type];return this.userOptions=a,c=w(e,c.series,a),this.tooltipOptions=w(E.tooltip,E.plotOptions[this.type].tooltip,b.tooltip,d.series&&d.series.tooltip,d[this.type]&&d[this.type].tooltip,a.tooltip),null===e.marker&&delete c.marker,c},getColor:function(){var e,a=this.options,b=this.userOptions,c=this.chart.options.colors,d=this.chart.counters;e=a.color||ba[this.type].color,e||a.colorByPoint||(r(b._colorIndex)?a=b._colorIndex:(b._colorIndex=d.color,a=d.color++),e=c[a]),this.color=e,d.wrapColor(c.length)},getSymbol:function(){var a=this.userOptions,b=this.options.marker,c=this.chart,d=c.options.symbols,c=c.counters;this.symbol=b.symbol,this.symbol||(r(a._symbolIndex)?a=a._symbolIndex:(a._symbolIndex=c.symbol,a=c.symbol++),this.symbol=d[a]),/^url/.test(this.symbol)&&(b.radius=0),c.wrapSymbol(d.length)},drawLegendSymbol:N.drawLineMarker,setData:function(a,b,c,d){var h,e=this,f=e.points,g=f&&f.length||0,i=e.options,j=e.chart,k=null,l=e.xAxis,o=l&&!!l.categories,n=e.tooltipPoints,s=i.turboThreshold,q=this.xData,r=this.yData,v=(h=e.pointArrayMap)&&h.length,a=a||[];if(h=a.length,b=m(b,!0),d===!1||!h||g!==h||e.cropped||e.hasGroupedData){if(e.xIncrement=null,e.pointRange=o?1:i.pointRange,e.colorCounter=0,p(this.parallelArrays,function(a){e[a+"Data"].length=0}),s&&h>s){for(c=0;null===k&&h>c;)k=a[c],c++;if(ha(k)){for(o=m(i.pointStart,0),i=m(i.pointInterval,1),c=0;h>c;c++)q[c]=o,r[c]=a[c],o+=i;e.xIncrement=o}else if(La(k))if(v)for(c=0;h>c;c++)i=a[c],q[c]=i[0],r[c]=i.slice(1,v+1);else for(c=0;h>c;c++)i=a[c],q[c]=i[0],r[c]=i[1];else ra(12)}else for(c=0;h>c;c++)a[c]!==t&&(i={series:e},e.pointClass.prototype.applyOptions.apply(i,[a[c]]),e.updateParallelArrays(i,c),o&&i.name)&&(l.names[i.x]=i.name);for(Fa(r[0])&&ra(14,!0),e.data=[],e.options.data=a,c=g;c--;)f[c]&&f[c].destroy&&f[c].destroy();n&&(n.length=0),l&&(l.minRange=l.userMinRange),e.isDirty=e.isDirtyData=j.isDirtyBox=!0,c=!1}else p(a,function(a,b){f[b].update(a,!1)});b&&j.redraw(c)},processData:function(a){var e,b=this.xData,c=this.yData,d=b.length;e=0;var f,g,o,n,h=this.xAxis,i=this.options,j=i.cropThreshold,k=0,l=this.isCartesian;if(l&&!this.isDirty&&!h.isDirty&&!this.yAxis.isDirty&&!a)return!1;for(l&&this.sorted&&(!j||d>j||this.forceCrop)&&(o=h.min,n=h.max,b[d-1]<o||b[0]>n?(b=[],c=[]):(b[0]<o||b[d-1]>n)&&(e=this.cropData(this.xData,this.yData,o,n),b=e.xData,c=e.yData,e=e.start,f=!0,k=b.length)),d=b.length-1;d>=0;d--)a=b[d]-b[d-1],!f&&b[d]>o&&b[d]<n&&k++,a>0&&(g===t||g>a)?g=a:0>a&&this.requireSorting&&ra(15);this.cropped=f,this.cropStart=e,this.processedXData=b,this.processedYData=c,this.activePointCount=k,null===i.pointRange&&(this.pointRange=g||1),this.closestPointRange=g},cropData:function(a,b,c,d){var i,e=a.length,f=0,g=e,h=m(this.cropShoulder,1);for(i=0;e>i;i++)if(a[i]>=c){f=v(0,i-h);break}for(;e>i;i++)if(a[i]>d){g=i+h;break}return{xData:a.slice(f,g),yData:b.slice(f,g),start:f,end:g}},generatePoints:function(){var c,i,k,o,a=this.options.data,b=this.data,d=this.processedXData,e=this.processedYData,f=this.pointClass,g=d.length,h=this.cropStart||0,j=this.hasGroupedData,l=[];for(b||j||(b=[],b.length=a.length,b=this.data=b),o=0;g>o;o++)i=h+o,j?l[o]=(new f).init(this,[d[o]].concat(qa(e[o]))):(b[i]?k=b[i]:a[i]!==t&&(b[i]=k=(new f).init(this,a[i],d[o])),l[o]=k);if(b&&(g!==(c=b.length)||j))for(o=0;c>o;o++)o===h&&!j&&(o+=g),b[o]&&(b[o].destroyElements(),b[o].plotX=t);this.data=b,this.points=l},getExtremes:function(a){var d,b=this.yAxis,c=this.processedXData,e=[],f=0;d=this.xAxis.getExtremes();var i,j,k,l,g=d.min,h=d.max,a=a||this.stackedYData||this.processedYData;for(d=a.length,l=0;d>l;l++)if(j=c[l],k=a[l],i=null!==k&&k!==t&&(!b.isLog||k.length||k>0),j=this.getExtremesFromAll||this.cropped||(c[l+1]||j)>=g&&(c[l-1]||j)<=h,i&&j)if(i=k.length)for(;i--;)null!==k[i]&&(e[f++]=k[i]);else e[f++]=k;this.dataMin=m(void 0,Na(e)),this.dataMax=m(void 0,Ba(e))},translate:function(){this.processedXData||this.processData(),this.generatePoints();for(var a=this.options,b=a.stacking,c=this.xAxis,d=c.categories,e=this.yAxis,f=this.points,g=f.length,h=!!this.modifyValue,i=a.pointPlacement,j="between"===i||ha(i),k=a.threshold,a=0;g>a;a++){var l=f[a],o=l.x,n=l.y,s=l.low,p=b&&e.stacks[(this.negStacks&&k>n?"-":"")+this.stackKey];e.isLog&&0>=n&&(l.y=n=null),l.plotX=c.translate(o,0,0,0,1,i,"flags"===this.type),b&&this.visible&&p&&p[o]&&(p=p[o],n=p.points[this.index+","+a],s=n[0],n=n[1],0===s&&(s=m(k,e.min)),e.isLog&&0>=s&&(s=null),l.total=l.stackTotal=p.total,l.percentage=p.total&&l.y/p.total*100,l.stackY=n,p.setOffset(this.pointXOffset||0,this.barW||0)),l.yBottom=r(s)?e.translate(s,0,1,0,1):null,h&&(n=this.modifyValue(n,l)),l.plotY="number"==typeof n&&1/0!==n?e.translate(n,0,1,0,1):t,l.clientX=j?c.translate(o,0,0,0,1):l.plotX,l.negative=l.y<(k||0),l.category=d&&d[l.x]!==t?d[l.x]:l.x}this.getSegments()},animate:function(a){var d,b=this.chart,c=b.renderer;d=this.options.animation;var g,e=this.clipBox||b.clipBox,f=b.inverted;d&&!ca(d)&&(d=ba[this.type].animation),g=["_sharedClip",d.duration,d.easing,e.height].join(","),a?(a=b[g],d=b[g+"m"],a||(b[g]=a=c.clipRect(q(e,{width:0})),b[g+"m"]=d=c.clipRect(-99,f?-b.plotLeft:-b.plotTop,99,f?b.chartWidth:b.chartHeight)),this.group.clip(a),this.markerGroup.clip(d),this.sharedClipKey=g):((a=b[g])&&a.animate({width:b.plotSizeX},d),b[g+"m"]&&b[g+"m"].animate({width:b.plotSizeX+99},d),this.animate=null)},afterAnimate:function(){var a=this.chart,b=this.sharedClipKey,c=this.group,d=this.clipBox;c&&this.options.clip!==!1&&(b&&d||c.clip(d?a.renderer.clipRect(d):a.clipRect),this.markerGroup.clip()),D(this,"afterAnimate"),setTimeout(function(){b&&a[b]&&(d||(a[b]=a[b].destroy()),a[b+"m"]&&(a[b+"m"]=a[b+"m"].destroy()))},100)},drawPoints:function(){var a,d,e,f,g,h,i,j,k,b=this.points,c=this.chart;d=this.options.marker;var o,l=this.pointAttr[""],n=this.markerGroup,s=m(d.enabled,this.activePointCount<.5*this.xAxis.len/d.radius);if(d.enabled!==!1||this._hasPointMarkers)for(f=b.length;f--;)g=b[f],d=T(g.plotX),e=g.plotY,k=g.graphic,i=g.marker||{},a=s&&i.enabled===t||i.enabled,o=c.isInsidePlot(u(d),e,c.inverted),a&&e!==t&&!isNaN(e)&&null!==g.y?(a=g.pointAttr[g.selected?"select":""]||l,h=a.r,i=m(i.symbol,this.symbol),j=0===i.indexOf("url"),k?k[o?"show":"hide"](!0).animate(q({x:d-h,y:e-h},k.symbolName?{width:2*h,height:2*h}:{})):o&&(h>0||j)&&(g.graphic=c.renderer.symbol(i,d-h,e-h,2*h,2*h).attr(a).add(n))):k&&(g.graphic=k.destroy())},convertAttribs:function(a,b,c,d){var f,g,e=this.pointAttrToOptions,h={},a=a||{},b=b||{},c=c||{},d=d||{};for(f in e)g=e[f],h[f]=m(a[g],b[f],c[f],d[f]);return h},getAttribs:function(){var f,a=this,b=a.options,c=ba[a.type].marker?b.marker:b,d=c.states,e=d.hover,g=a.color;f={stroke:g,fill:g};var i,k,h=a.points||[],j=[],l=a.pointAttrToOptions;k=a.hasPointSpecificOptions;var o=b.negativeColor,n=c.lineColor,s=c.fillColor;i=b.turboThreshold;var m;if(b.marker?(e.radius=e.radius||c.radius+2,e.lineWidth=e.lineWidth||c.lineWidth+1):e.color=e.color||ya(e.color||g).brighten(e.brightness).get(),j[""]=a.convertAttribs(c,f),p(["hover","select"],function(b){j[b]=a.convertAttribs(d[b],j[""])}),a.pointAttr=j,g=h.length,!i||i>g||k)for(;g--;){if(i=h[g],(c=i.options&&i.options.marker||i.options)&&c.enabled===!1&&(c.radius=0),i.negative&&o&&(i.color=i.fillColor=o),k=b.colorByPoint||i.color,i.options)for(m in l)r(c[l[m]])&&(k=!0);k?(c=c||{},k=[],d=c.states||{},f=d.hover=d.hover||{},b.marker||(f.color=f.color||!i.options.color&&e.color||ya(i.color).brighten(f.brightness||e.brightness).get()),f={color:i.color},s||(f.fillColor=i.color),n||(f.lineColor=i.color),k[""]=a.convertAttribs(q(f,c),j[""]),k.hover=a.convertAttribs(d.hover,j.hover,k[""]),k.select=a.convertAttribs(d.select,j.select,k[""])):k=j,i.pointAttr=k}},destroy:function(){var d,e,g,h,i,a=this,b=a.chart,c=/AppleWebKit\/533/.test(wa),f=a.data||[];for(D(a,"destroy"),W(a),p(a.axisTypes||[],function(b){(i=a[b])&&(ja(i.series,a),i.isDirty=i.forceRedraw=!0)}),a.legendItem&&a.chart.legend.destroyItem(a),e=f.length;e--;)(g=f[e])&&g.destroy&&g.destroy();a.points=null,clearTimeout(a.animationTimeout),p("area,graph,dataLabelsGroup,group,markerGroup,tracker,graphNeg,areaNeg,posClip,negClip".split(","),function(b){a[b]&&(d=c&&"group"===b?"hide":"destroy",a[b][d]())}),b.hoverSeries===a&&(b.hoverSeries=null),ja(b.series,a);for(h in a)delete a[h]},getSegmentPath:function(a){var b=this,c=[],d=b.options.step;return p(a,function(e,f){var i,g=e.plotX,h=e.plotY;b.getPointSpline?c.push.apply(c,b.getPointSpline(a,e,f)):(c.push(f?"L":"M"),d&&f&&(i=a[f-1],"right"===d?c.push(i.plotX,h):"center"===d?c.push((i.plotX+g)/2,i.plotY,(i.plotX+g)/2,h):c.push(g,i.plotY)),c.push(e.plotX,e.plotY))}),c},getGraphPath:function(){var c,a=this,b=[],d=[];return p(a.segments,function(e){c=a.getSegmentPath(e),e.length>1?b=b.concat(c):d.push(e[0])}),a.singlePoints=d,a.graphPath=b},drawGraph:function(){var a=this,b=this.options,c=[["graph",b.lineColor||this.color]],d=b.lineWidth,e=b.dashStyle,f="square"!==b.linecap,g=this.getGraphPath(),h=b.negativeColor;h&&c.push(["graphNeg",h]),p(c,function(c,h){var k=c[0],l=a[k];l?(bb(l),l.animate({d:g})):d&&g.length&&(l={stroke:c[1],"stroke-width":d,fill:Q,zIndex:1},e?l.dashstyle=e:f&&(l["stroke-linecap"]=l["stroke-linejoin"]="round"),a[k]=a.chart.renderer.path(g).attr(l).add(a.group).shadow(!h&&b.shadow))})},clipNeg:function(){var e,a=this.options,b=this.chart,c=b.renderer,d=a.negativeColor||a.negativeFillColor,f=this.graph,g=this.area,h=this.posClip,i=this.negClip;e=b.chartWidth;var j=b.chartHeight,k=v(e,j),l=this.yAxis;d&&(f||g)&&(d=u(l.toPixels(a.threshold||0,!0)),0>d&&(k-=d),a={x:0,y:0,width:k,height:d},k={x:0,y:d,width:k,height:k},b.inverted&&(a.height=k.y=b.plotWidth-d,c.isVML&&(a={x:b.plotWidth-d-b.plotLeft,y:0,width:e,height:j},k={x:d+b.plotLeft-e,y:0,width:b.plotLeft+d,height:e})),l.reversed?(b=k,e=a):(b=a,e=k),h?(h.animate(b),i.animate(e)):(this.posClip=h=c.clipRect(b),this.negClip=i=c.clipRect(e),f&&this.graphNeg&&(f.clip(h),this.graphNeg.clip(i)),g&&(g.clip(h),this.areaNeg.clip(i))))},invertGroups:function(){function a(){var a={width:b.yAxis.len,height:b.xAxis.len};p(["group","markerGroup"],function(c){b[c]&&b[c].attr(a).invert()})}var b=this,c=b.chart;b.xAxis&&(K(c,"resize",a),K(b,"destroy",function(){W(c,"resize",a)}),a(),b.invertGroups=a)},plotGroup:function(a,b,c,d,e){var f=this[a],g=!f;return g&&(this[a]=f=this.chart.renderer.g(b).attr({visibility:c,zIndex:d||.1}).add(e)),f[g?"attr":"animate"](this.getPlotBox()),f},getPlotBox:function(){var a=this.chart,b=this.xAxis,c=this.yAxis;return a.inverted&&(b=c,c=this.xAxis),{translateX:b?b.left:a.plotLeft,translateY:c?c.top:a.plotTop,scaleX:1,scaleY:1}},render:function(){var c,a=this,b=a.chart,d=a.options,e=(c=d.animation)&&!!a.animate&&b.renderer.isSVG&&m(c.duration,500)||0,f=a.visible?"visible":"hidden",g=d.zIndex,h=a.hasRendered,i=b.seriesGroup;c=a.plotGroup("group","series",f,g,i),a.markerGroup=a.plotGroup("markerGroup","markers",f,g,i),e&&a.animate(!0),a.getAttribs(),c.inverted=a.isCartesian?b.inverted:!1,a.drawGraph&&(a.drawGraph(),a.clipNeg()),a.drawDataLabels&&a.drawDataLabels(),a.visible&&a.drawPoints(),a.drawTracker&&a.options.enableMouseTracking!==!1&&a.drawTracker(),b.inverted&&a.invertGroups(),d.clip!==!1&&!a.sharedClipKey&&!h&&c.clip(b.clipRect),e&&a.animate(),h||(e?a.animationTimeout=setTimeout(function(){a.afterAnimate()},e):a.afterAnimate()),a.isDirty=a.isDirtyData=!1,a.hasRendered=!0},redraw:function(){var a=this.chart,b=this.isDirtyData,c=this.group,d=this.xAxis,e=this.yAxis;c&&(a.inverted&&c.attr({width:a.plotWidth,height:a.plotHeight}),c.animate({translateX:m(d&&d.left,a.plotLeft),translateY:m(e&&e.top,a.plotTop)})),this.translate(),this.setTooltipPoints&&this.setTooltipPoints(!0),this.render(),b&&D(this,"updatedData")}},Hb.prototype={destroy:function(){Oa(this,this.axis)},render:function(a){var b=this.options,c=b.format,c=c?Ia(c,this):b.formatter.call(this);this.label?this.label.attr({text:c,visibility:"hidden"}):this.label=this.axis.chart.renderer.text(c,null,null,b.useHTML).css(b.style).attr({align:this.textAlign,rotation:b.rotation,visibility:"hidden"}).add(a)},setOffset:function(a,b){var c=this.axis,d=c.chart,e=d.inverted,f=this.isNegative,g=c.translate(c.usePercentage?100:this.total,0,0,0,1),c=c.translate(0),c=M(g-c),h=d.xAxis[0].translate(this.x)+a,i=d.plotHeight,f={x:e?f?g:g-c:h,y:e?i-h-b:f?i-g-c:i-g,width:e?c:b,height:e?b:c};(e=this.label)&&(e.align(this.alignOptions,null,f),f=e.alignAttr,e[this.options.crop===!1||d.isInsidePlot(f.x,f.y)?"show":"hide"](!0))}},la.prototype.buildStacks=function(){var a=this.series,b=m(this.options.reversedStacks,!0),c=a.length;if(!this.isXAxis){for(this.usePercentage=!1;c--;)a[b?c:a.length-c-1].setStackedPoints();if(this.usePercentage)for(c=0;c<a.length;c++)a[c].setPercentStacks()}},la.prototype.renderStackTotals=function(){var d,e,a=this.chart,b=a.renderer,c=this.stacks,f=this.stackTotalGroup;f||(this.stackTotalGroup=f=b.g("stack-labels").attr({visibility:"visible",zIndex:6}).add()),f.translate(a.plotLeft,a.plotTop);for(d in c)for(e in a=c[d])a[e].render(f)},O.prototype.setStackedPoints=function(){if(this.options.stacking&&(this.visible===!0||this.chart.options.chart.ignoreHiddenSeries===!1)){var n,m,p,q,r,u,a=this.processedXData,b=this.processedYData,c=[],d=b.length,e=this.options,f=e.threshold,g=e.stack,e=e.stacking,h=this.stackKey,i="-"+h,j=this.negStacks,k=this.yAxis,l=k.stacks,o=k.oldStacks;for(q=0;d>q;q++)r=a[q],u=b[q],p=this.index+","+q,m=(n=j&&f>u)?i:h,l[m]||(l[m]={}),l[m][r]||(o[m]&&o[m][r]?(l[m][r]=o[m][r],l[m][r].total=null):l[m][r]=new Hb(k,k.options.stackLabels,n,r,g)),m=l[m][r],m.points[p]=[m.cum||0],"percent"===e?(n=n?h:i,j&&l[n]&&l[n][r]?(n=l[n][r],m.total=n.total=v(n.total,m.total)+M(u)||0):m.total=da(m.total+(M(u)||0))):m.total=da(m.total+(u||0)),m.cum=(m.cum||0)+(u||0),m.points[p].push(m.cum),c[q]=m.cum;"percent"===e&&(k.usePercentage=!0),this.stackedYData=c,k.oldStacks={}}},O.prototype.setPercentStacks=function(){var a=this,b=a.stackKey,c=a.yAxis.stacks,d=a.processedXData;p([b,"-"+b],function(b){for(var e,g,h,f=d.length;f--;)g=d[f],e=(h=c[b]&&c[b][g])&&h.points[a.index+","+f],(g=e)&&(h=h.total?100/h.total:0,g[0]=da(g[0]*h),g[1]=da(g[1]*h),a.stackedYData[f]=g[1])})},q(Ya.prototype,{addSeries:function(a,b,c){var d,e=this;return a&&(b=m(b,!0),D(e,"addSeries",{options:a},function(){d=e.initSeries(a),e.isDirtyLegend=!0,e.linkSeries(),b&&e.redraw(c)})),d},addAxis:function(a,b,c,d){var e=b?"xAxis":"yAxis",f=this.options;new la(this,w(a,{index:this[e].length,isX:b})),f[e]=qa(f[e]||{}),f[e].push(a),m(c,!0)&&this.redraw(d)},showLoading:function(a){var b=this.options,c=this.loadingDiv,d=b.loading;c||(this.loadingDiv=c=Y(Ja,{className:"highcharts-loading"},q(d.style,{zIndex:10,display:Q}),this.container),this.loadingSpan=Y("span",null,d.labelStyle,c)),this.loadingSpan.innerHTML=a||b.lang.loading,this.loadingShown||(G(c,{opacity:0,display:"",left:this.plotLeft+"px",top:this.plotTop+"px",width:this.plotWidth+"px",height:this.plotHeight+"px"}),kb(c,{opacity:d.style.opacity},{duration:d.showDuration||0}),this.loadingShown=!0)},hideLoading:function(){var a=this.options,b=this.loadingDiv;b&&kb(b,{opacity:0},{duration:a.loading.hideDuration||100,complete:function(){G(b,{display:Q})}}),this.loadingShown=!1}}),q(Ea.prototype,{update:function(a,b,c){var g,d=this,e=d.series,f=d.graphic,h=e.data,i=e.chart,j=e.options,b=m(b,!0);d.firePointEvent("update",{options:a},function(){d.applyOptions(a),ca(a)&&(e.getAttribs(),f&&(a&&a.marker&&a.marker.symbol?d.graphic=f.destroy():f.attr(d.pointAttr[d.state||""])),a&&a.dataLabels&&d.dataLabel&&(d.dataLabel=d.dataLabel.destroy())),g=Da(d,h),e.updateParallelArrays(d,g),j.data[g]=d.options,e.isDirty=e.isDirtyData=!0,!e.fixedBox&&e.hasCartesianSeries&&(i.isDirtyBox=!0),"point"===j.legendType&&i.legend.destroyItem(d),b&&i.redraw(c)})},remove:function(a,b){var g,c=this,d=c.series,e=d.points,f=d.chart,h=d.data;Qa(b,f),a=m(a,!0),c.firePointEvent("remove",null,function(){g=Da(c,h),h.length===e.length&&e.splice(g,1),h.splice(g,1),d.options.data.splice(g,1),d.updateParallelArrays(c,"splice",g,1),c.destroy(),d.isDirty=!0,d.isDirtyData=!0,a&&f.redraw()})}}),q(O.prototype,{addPoint:function(a,b,c,d){var o,e=this.options,f=this.data,g=this.graph,h=this.area,i=this.chart,j=this.xAxis&&this.xAxis.names,k=g&&g.shift||0,l=e.data,n=this.xData;if(Qa(d,i),c&&p([g,h,this.graphNeg,this.areaNeg],function(a){a&&(a.shift=k+1)}),h&&(h.isArea=!0),b=m(b,!0),d={series:this},this.pointClass.prototype.applyOptions.apply(d,[a]),g=d.x,h=n.length,this.requireSorting&&g<n[h-1])for(o=!0;h&&n[h-1]>g;)h--;this.updateParallelArrays(d,"splice",h,0,0),this.updateParallelArrays(d,h),j&&(j[g]=d.name),l.splice(h,0,a),o&&(this.data.splice(h,0,null),this.processData()),"point"===e.legendType&&this.generatePoints(),c&&(f[0]&&f[0].remove?f[0].remove(!1):(f.shift(),this.updateParallelArrays(d,"shift"),l.shift())),this.isDirtyData=this.isDirty=!0,b&&(this.getAttribs(),i.redraw())},remove:function(a,b){var c=this,d=c.chart,a=m(a,!0);c.isRemoving||(c.isRemoving=!0,D(c,"remove",null,function(){c.destroy(),d.isDirtyLegend=d.isDirtyBox=!0,d.linkSeries(),a&&d.redraw(b)})),c.isRemoving=!1},update:function(a,b){var f,c=this.chart,d=this.type,e=F[d].prototype,a=w(this.userOptions,{animation:!1,index:this.index,pointStart:this.xData[0]},{data:this.options.data},a);this.remove(!1);for(f in e)e.hasOwnProperty(f)&&(this[f]=t);q(this,F[a.type||d].prototype),this.init(c,a),m(b,!0)&&c.redraw(!1)}}),q(la.prototype,{update:function(a,b){var c=this.chart,a=c.options[this.coll][this.options.index]=w(this.userOptions,a);
5
- this.destroy(!0),this._addedPlotLB=t,this.init(c,q(a,{events:t})),c.isDirtyBox=!0,m(b,!0)&&c.redraw()},remove:function(a){for(var b=this.chart,c=this.coll,d=this.series,e=d.length;e--;)d[e]&&d[e].remove(!1);ja(b.axes,this),ja(b[c],this),b.options[c].splice(this.options.index,1),p(b[c],function(a,b){a.options.index=b}),this.destroy(),b.isDirtyBox=!0,m(a,!0)&&b.redraw()},setTitle:function(a,b){this.update({title:a},b)},setCategories:function(a,b){this.update({categories:a},b)}}),ga=ka(O),F.line=ga,ba.area=w(S,{threshold:0});var pa=ka(O,{type:"area",getSegments:function(){var h,i,l,o,n,a=[],b=[],c=[],d=this.xAxis,e=this.yAxis,f=e.stacks[this.stackKey],g={},j=this.points,k=this.options.connectNulls;if(this.options.stacking&&!this.cropped){for(o=0;o<j.length;o++)g[j[o].x]=j[o];for(n in f)null!==f[n].total&&c.push(+n);c.sort(function(a,b){return a-b}),p(c,function(a){(!k||g[a]&&null!==g[a].y)&&(g[a]?b.push(g[a]):(h=d.translate(a),l=f[a].percent?f[a].total?100*f[a].cum/f[a].total:0:f[a].cum,i=e.toPixels(l,!0),b.push({y:null,plotX:h,clientX:h,plotY:i,yBottom:i,onMouseOver:sa})))}),b.length&&a.push(b)}else O.prototype.getSegments.call(this),a=this.segments;this.segments=a},getSegmentPath:function(a){var d,b=O.prototype.getSegmentPath.call(this,a),c=[].concat(b),e=this.options;d=b.length;var g,f=this.yAxis.getThreshold(e.threshold);if(3===d&&c.push("L",b[1],b[2]),e.stacking&&!this.closedStacks)for(d=a.length-1;d>=0;d--)g=m(a[d].yBottom,f),d<a.length-1&&e.step&&c.push(a[d+1].plotX,g),c.push(a[d].plotX,g);else this.closeSegment(c,a,f);return this.areaPath=this.areaPath.concat(c),b},closeSegment:function(a,b,c){a.push("L",b[b.length-1].plotX,c,"L",b[0].plotX,c)},drawGraph:function(){this.areaPath=[],O.prototype.drawGraph.apply(this);var a=this,b=this.areaPath,c=this.options,d=c.negativeColor,e=c.negativeFillColor,f=[["area",this.color,c.fillColor]];(d||e)&&f.push(["areaNeg",d,e]),p(f,function(d){var e=d[0],f=a[e];f?f.animate({d:b}):a[e]=a.chart.renderer.path(b).attr({fill:m(d[2],ya(d[1]).setOpacity(m(c.fillOpacity,.75)).get()),zIndex:0}).add(a.group)})},drawLegendSymbol:N.drawRectangle});F.area=pa,ba.spline=w(S),ga=ka(O,{type:"spline",getPointSpline:function(a,b,c){var h,i,j,k,d=b.plotX,e=b.plotY,f=a[c-1],g=a[c+1];if(f&&g){a=f.plotY,j=g.plotX;var l,g=g.plotY;h=(1.5*d+f.plotX)/2.5,i=(1.5*e+a)/2.5,j=(1.5*d+j)/2.5,k=(1.5*e+g)/2.5,l=(k-i)*(j-d)/(j-h)+e-k,i+=l,k+=l,i>a&&i>e?(i=v(a,e),k=2*e-i):a>i&&e>i&&(i=C(a,e),k=2*e-i),k>g&&k>e?(k=v(g,e),i=2*e-k):g>k&&e>k&&(k=C(g,e),i=2*e-k),b.rightContX=j,b.rightContY=k}return c?(b=["C",f.rightContX||f.plotX,f.rightContY||f.plotY,h||d,i||e,d,e],f.rightContX=f.rightContY=null):b=["M",d,e],b}}),F.spline=ga,ba.areaspline=w(ba.area),pa=pa.prototype,ga=ka(ga,{type:"areaspline",closedStacks:!0,getSegmentPath:pa.getSegmentPath,closeSegment:pa.closeSegment,drawGraph:pa.drawGraph,drawLegendSymbol:N.drawRectangle}),F.areaspline=ga,ba.column=w(S,{borderColor:"#FFFFFF",borderRadius:0,groupPadding:.2,marker:null,pointPadding:.1,minPointLength:0,cropThreshold:50,pointRange:null,states:{hover:{brightness:.1,shadow:!1,halo:!1},select:{color:"#C0C0C0",borderColor:"#000000",shadow:!1}},dataLabels:{align:null,verticalAlign:null,y:null},stickyTracking:!1,tooltip:{distance:6},threshold:0}),ga=ka(O,{type:"column",pointAttrToOptions:{stroke:"borderColor",fill:"color",r:"borderRadius"},cropShoulder:0,trackerGroups:["group","dataLabelsGroup"],negStacks:!0,init:function(){O.prototype.init.apply(this,arguments);var a=this,b=a.chart;b.hasRendered&&p(b.series,function(b){b.type===a.type&&(b.isDirty=!0)})},getColumnMetrics:function(){var f,h,a=this,b=a.options,c=a.xAxis,d=a.yAxis,e=c.reversed,g={},i=0;b.grouping===!1?i=1:p(a.chart.series,function(b){var c=b.options,e=b.yAxis;b.type===a.type&&b.visible&&d.len===e.len&&d.pos===e.pos&&(c.stacking?(f=b.stackKey,g[f]===t&&(g[f]=i++),h=g[f]):c.grouping!==!1&&(h=i++),b.columnIndex=h)});var c=C(M(c.transA)*(c.ordinalSlope||b.pointRange||c.closestPointRange||c.tickInterval||1),c.len),j=c*b.groupPadding,k=(c-2*j)/i,l=b.pointWidth,b=r(l)?(k-l)/2:k*b.pointPadding,l=m(l,k-2*b);return a.columnMetrics={width:l,offset:b+(j+((e?i-(a.columnIndex||0):a.columnIndex)||0)*k-c/2)*(e?-1:1)}},translate:function(){var a=this,b=a.chart,c=a.options,d=a.borderWidth=m(c.borderWidth,a.activePointCount>.5*a.xAxis.len?0:1),e=a.yAxis,f=a.translatedThreshold=e.getThreshold(c.threshold),g=m(c.minPointLength,5),c=a.getColumnMetrics(),h=c.width,i=a.barW=Ka(v(h,1+2*d)),j=a.pointXOffset=c.offset,k=-(d%2?.5:0),l=d%2?.5:1;b.renderer.isVML&&b.inverted&&(l+=1),O.prototype.translate.apply(a),p(a.points,function(c){var x,d=m(c.yBottom,f),p=C(v(-999-d,c.plotY),e.len+999+d),q=c.plotX+j,r=i,t=C(p,d);x=v(p,d)-t,M(x)<g&&g&&(x=g,t=u(M(t-f)>g?d-g:f-(e.translate(c.y,0,1,0,1)<=f?g:0))),c.barX=q,c.pointWidth=h,c.tooltipPos=b.inverted?[e.len-p,a.xAxis.len-q-r/2]:[q+r/2,p],d=M(q)<.5,r=u(q+r)+k,q=u(q)+k,r-=q,p=M(t)<.5,x=u(t+x)+l,t=u(t)+l,x-=t,d&&(q+=1,r-=1),p&&(t-=1,x+=1),c.shapeType="rect",c.shapeArgs={x:q,y:t,width:r,height:x}})},getSymbol:sa,drawLegendSymbol:N.drawRectangle,drawGraph:sa,drawPoints:function(){var f,g,h,a=this,b=this.chart,c=a.options,d=b.renderer,e=c.animationLimit||250;p(a.points,function(i){var j=i.plotY,k=i.graphic;j===t||isNaN(j)||null===i.y?k&&(i.graphic=k.destroy()):(f=i.shapeArgs,h=r(a.borderWidth)?{"stroke-width":a.borderWidth}:{},g=i.pointAttr[i.selected?"select":""]||a.pointAttr[""],k?(bb(k),k.attr(h)[b.pointCount<e?"animate":"attr"](w(f))):i.graphic=d[i.shapeType](f).attr(g).attr(h).add(a.group).shadow(c.shadow,null,c.stacking&&!c.borderRadius))})},animate:function(a){var b=this.yAxis,c=this.options,d=this.chart.inverted,e={};aa&&(a?(e.scaleY=.001,a=C(b.pos+b.len,v(b.pos,b.toPixels(c.threshold))),d?e.translateX=a-b.len:e.translateY=a,this.group.attr(e)):(e.scaleY=1,e[d?"translateX":"translateY"]=b.pos,this.group.animate(e,this.options.animation),this.animate=null))},remove:function(){var a=this,b=a.chart;b.hasRendered&&p(b.series,function(b){b.type===a.type&&(b.isDirty=!0)}),O.prototype.remove.apply(a,arguments)}}),F.column=ga,ba.bar=w(ba.column),pa=ka(ga,{type:"bar",inverted:!0}),F.bar=pa,ba.scatter=w(S,{lineWidth:0,tooltip:{headerFormat:'<span style="color:{series.color}">●</span> <span style="font-size: 10px;"> {series.name}</span><br/>',pointFormat:"x: <b>{point.x}</b><br/>y: <b>{point.y}</b><br/>"},stickyTracking:!1}),pa=ka(O,{type:"scatter",sorted:!1,requireSorting:!1,noSharedTooltip:!0,trackerGroups:["markerGroup"],takeOrdinalPosition:!1,singularTooltips:!0,drawGraph:function(){this.options.lineWidth&&O.prototype.drawGraph.call(this)}}),F.scatter=pa,ba.pie=w(S,{borderColor:"#FFFFFF",borderWidth:1,center:[null,null],clip:!1,colorByPoint:!0,dataLabels:{distance:30,enabled:!0,formatter:function(){return this.point.name}},ignoreHiddenPoint:!0,legendType:"point",marker:null,size:null,showInLegend:!1,slicedOffset:10,states:{hover:{brightness:.1,shadow:!1}},stickyTracking:!1,tooltip:{followPointer:!0}}),S={type:"pie",isCartesian:!1,pointClass:ka(Ea,{init:function(){Ea.prototype.init.apply(this,arguments);var b,a=this;return a.y<0&&(a.y=null),q(a,{visible:a.visible!==!1,name:m(a.name,"Slice")}),b=function(b){a.slice("select"===b.type)},K(a,"select",b),K(a,"unselect",b),a},setVisible:function(a){var b=this,c=b.series,d=c.chart;b.visible=b.options.visible=a=a===t?!b.visible:a,c.options.data[Da(b,c.data)]=b.options,p(["graphic","dataLabel","connector","shadowGroup"],function(c){b[c]&&b[c][a?"show":"hide"](!0)}),b.legendItem&&d.legend.colorizeItem(b,a),!c.isDirty&&c.options.ignoreHiddenPoint&&(c.isDirty=!0,d.redraw())},slice:function(a,b,c){var d=this.series;Qa(c,d.chart),m(b,!0),this.sliced=this.options.sliced=a=r(a)?a:!this.sliced,d.options.data[Da(this,d.data)]=this.options,a=a?this.slicedTranslation:{translateX:0,translateY:0},this.graphic.animate(a),this.shadowGroup&&this.shadowGroup.animate(a)},haloPath:function(a){var b=this.shapeArgs,c=this.series.chart;return this.series.chart.renderer.symbols.arc(c.plotLeft+b.x,c.plotTop+b.y,b.r+a,b.r+a,{innerR:this.shapeArgs.r,start:b.start,end:b.end})}}),requireSorting:!1,noSharedTooltip:!0,trackerGroups:["group","dataLabelsGroup"],axisTypes:[],pointAttrToOptions:{stroke:"borderColor","stroke-width":"borderWidth",fill:"color"},singularTooltips:!0,getColor:sa,animate:function(a){var b=this,c=b.points,d=b.startAngleRad;a||(p(c,function(a){var c=a.graphic,a=a.shapeArgs;c&&(c.attr({r:b.center[3]/2,start:d,end:d}),c.animate({r:a.r,start:a.start,end:a.end},b.options.animation))}),b.animate=null)},setData:function(a,b,c,d){O.prototype.setData.call(this,a,!1,c,d),this.processData(),this.generatePoints(),m(b,!0)&&this.chart.redraw(c)},generatePoints:function(){var a,c,d,e,b=0,f=this.options.ignoreHiddenPoint;for(O.prototype.generatePoints.call(this),c=this.points,d=c.length,a=0;d>a;a++)e=c[a],b+=f&&!e.visible?0:e.y;for(this.total=b,a=0;d>a;a++)e=c[a],e.percentage=b>0?e.y/b*100:0,e.total=b},translate:function(a){this.generatePoints();var f,g,h,o,p,b=0,c=this.options,d=c.slicedOffset,e=d+c.borderWidth,i=c.startAngle||0,j=this.startAngleRad=ma/180*(i-90),i=(this.endAngleRad=ma/180*(m(c.endAngle,i+360)-90))-j,k=this.points,l=c.dataLabels.distance,c=c.ignoreHiddenPoint,n=k.length;for(a||(this.center=a=this.getCenter()),this.getX=function(b,c){return h=U.asin(C((b-a[1])/(a[2]/2+l),1)),a[0]+(c?-1:1)*Z(h)*(a[2]/2+l)},o=0;n>o;o++)p=k[o],f=j+b*i,(!c||p.visible)&&(b+=p.percentage/100),g=j+b*i,p.shapeType="arc",p.shapeArgs={x:a[0],y:a[1],r:a[2]/2,innerR:a[3]/2,start:u(1e3*f)/1e3,end:u(1e3*g)/1e3},h=(g+f)/2,h>1.5*ma?h-=2*ma:-ma/2>h&&(h+=2*ma),p.slicedTranslation={translateX:u(Z(h)*d),translateY:u(ea(h)*d)},f=Z(h)*a[2]/2,g=ea(h)*a[2]/2,p.tooltipPos=[a[0]+.7*f,a[1]+.7*g],p.half=-ma/2>h||h>ma/2?1:0,p.angle=h,e=C(e,l/2),p.labelPos=[a[0]+f+Z(h)*l,a[1]+g+ea(h)*l,a[0]+f+Z(h)*e,a[1]+g+ea(h)*e,a[0]+f,a[1]+g,0>l?"center":p.half?"right":"left",h]},drawGraph:null,drawPoints:function(){var c,d,f,g,a=this,b=a.chart.renderer,e=a.options.shadow;e&&!a.shadowGroup&&(a.shadowGroup=b.g("shadow").add(a.group)),p(a.points,function(h){d=h.graphic,g=h.shapeArgs,f=h.shadowGroup,e&&!f&&(f=h.shadowGroup=b.g("shadow").add(a.shadowGroup)),c=h.sliced?h.slicedTranslation:{translateX:0,translateY:0},f&&f.attr(c),d?d.animate(q(g,c)):h.graphic=d=b[h.shapeType](g).setRadialReference(a.center).attr(h.pointAttr[h.selected?"select":""]).attr({"stroke-linejoin":"round"}).attr(c).add(a.group).shadow(e,f),void 0!==h.visible&&h.setVisible(h.visible)})},sortByAngle:function(a,b){a.sort(function(a,d){return void 0!==a.angle&&(d.angle-a.angle)*b})},drawLegendSymbol:N.drawRectangle,getCenter:X.getCenter,getSymbol:sa},S=ka(O,S),F.pie=S,O.prototype.drawDataLabels=function(){var f,g,h,i,a=this,b=a.options,c=b.cursor,d=b.dataLabels,e=a.points;(d.enabled||a._hasPointLabels)&&(a.dlProcessOptions&&a.dlProcessOptions(d),i=a.plotGroup("dataLabelsGroup","data-labels","hidden",d.zIndex||6),!a.hasRendered&&m(d.defer,!0)&&(i.attr({opacity:0}),K(a,"afterAnimate",function(){a.dataLabelsGroup.show()[b.animation?"animate":"attr"]({opacity:1},{duration:200})})),g=d,p(e,function(b){var e,o,n,l=b.dataLabel,p=b.connector,u=!0;if(f=b.options&&b.options.dataLabels,e=m(f&&f.enabled,g.enabled),l&&!e)b.dataLabel=l.destroy();else if(e){if(d=w(g,f),e=d.rotation,o=b.getLabelConfig(),h=d.format?Ia(d.format,o):d.formatter.call(o,d),d.style.color=m(d.color,d.style.color,a.color,"black"),l)r(h)?(l.attr({text:h}),u=!1):(b.dataLabel=l=l.destroy(),p&&(b.connector=p.destroy()));else if(r(h)){l={fill:d.backgroundColor,stroke:d.borderColor,"stroke-width":d.borderWidth,r:d.borderRadius||0,rotation:e,padding:d.padding,zIndex:1};for(n in l)l[n]===t&&delete l[n];l=b.dataLabel=a.chart.renderer[e?"text":"label"](h,0,-999,null,null,null,d.useHTML).attr(l).css(q(d.style,c&&{cursor:c})).add(i).shadow(d.shadow)}l&&a.alignDataLabel(b,l,d,null,u)}}))},O.prototype.alignDataLabel=function(a,b,c,d,e){var f=this.chart,g=f.inverted,h=m(a.plotX,-999),i=m(a.plotY,-999),j=b.getBBox();(a=this.visible&&(a.series.forceDL||f.isInsidePlot(h,u(i),g)||d&&f.isInsidePlot(h,g?d.x+1:d.y+d.height-1,g)))&&(d=q({x:g?f.plotWidth-i:h,y:u(g?f.plotHeight-h:i),width:0,height:0},d),q(c,{width:j.width,height:j.height}),c.rotation?(g={align:c.align,x:d.x+c.x+d.width/2,y:d.y+c.y+d.height/2},b[e?"attr":"animate"](g)):(b.align(c,null,d),g=b.alignAttr,"justify"===m(c.overflow,"justify")?this.justifyDataLabel(b,c,g,j,d,e):m(c.crop,!0)&&(a=f.isInsidePlot(g.x,g.y)&&f.isInsidePlot(g.x+j.width,g.y+j.height)))),a||(b.attr({y:-999}),b.placed=!1)},O.prototype.justifyDataLabel=function(a,b,c,d,e,f){var j,k,g=this.chart,h=b.align,i=b.verticalAlign;j=c.x,0>j&&("right"===h?b.align="left":b.x=-j,k=!0),j=c.x+d.width,j>g.plotWidth&&("left"===h?b.align="right":b.x=g.plotWidth-j,k=!0),j=c.y,0>j&&("bottom"===i?b.verticalAlign="top":b.y=-j,k=!0),j=c.y+d.height,j>g.plotHeight&&("top"===i?b.verticalAlign="bottom":b.y=g.plotHeight-j,k=!0),k&&(a.placed=!f,a.align(b,null,e))},F.pie&&(F.pie.prototype.drawDataLabels=function(){var c,i,j,t,w,x,y,A,C,G,D,B,a=this,b=a.data,d=a.chart,e=a.options.dataLabels,f=m(e.connectorPadding,10),g=m(e.connectorWidth,1),h=d.plotWidth,d=d.plotHeight,k=m(e.softConnector,!0),l=e.distance,o=a.center,n=o[2]/2,q=o[1],r=l>0,z=[[],[]],F=[0,0,0,0],N=function(a,b){return b.y-a.y};if(a.visible&&(e.enabled||a._hasPointLabels)){for(O.prototype.drawDataLabels.apply(a),p(b,function(a){a.dataLabel&&a.visible&&z[a.half].push(a)}),D=0;!y&&b[D];)y=b[D]&&b[D].dataLabel&&(b[D].dataLabel.getBBox().height||21),D++;for(D=2;D--;){var E,b=[],K=[],H=z[D],I=H.length;if(a.sortByAngle(H,D-.5),l>0){for(B=q-n-l;q+n+l>=B;B+=y)b.push(B);if(w=b.length,I>w){for(c=[].concat(H),c.sort(N),B=I;B--;)c[B].rank=B;for(B=I;B--;)H[B].rank>=w&&H.splice(B,1);I=H.length}for(B=0;I>B;B++){c=H[B],x=c.labelPos,c=9999;var Q,P;for(P=0;w>P;P++)Q=M(b[P]-x[1]),c>Q&&(c=Q,E=P);if(B>E&&null!==b[B])E=B;else for(I-B+E>w&&null!==b[B]&&(E=w-I+B);null===b[E];)E++;K.push({i:E,y:b[E]}),b[E]=null}K.sort(N)}for(B=0;I>B;B++)c=H[B],x=c.labelPos,t=c.dataLabel,G=c.visible===!1?"hidden":"visible",c=x[1],l>0?(w=K.pop(),E=w.i,C=w.y,(c>C&&null!==b[E+1]||C>c&&null!==b[E-1])&&(C=c)):C=c,A=e.justify?o[0]+(D?-1:1)*(n+l):a.getX(0===E||E===b.length-1?c:C,D),t._attr={visibility:G,align:x[6]},t._pos={x:A+e.x+({left:f,right:-f}[x[6]]||0),y:C+e.y-10},t.connX=A,t.connY=C,null===this.options.size&&(w=t.width,f>A-w?F[3]=v(u(w-A+f),F[3]):A+w>h-f&&(F[1]=v(u(A+w-h+f),F[1])),0>C-y/2?F[0]=v(u(-C+y/2),F[0]):C+y/2>d&&(F[2]=v(u(C+y/2-d),F[2])))}(0===Ba(F)||this.verifyDataLabelOverflow(F))&&(this.placeDataLabels(),r&&g&&p(this.points,function(b){i=b.connector,x=b.labelPos,(t=b.dataLabel)&&t._pos?(G=t._attr.visibility,A=t.connX,C=t.connY,j=k?["M",A+("left"===x[6]?5:-5),C,"C",A,C,2*x[2]-x[4],2*x[3]-x[5],x[2],x[3],"L",x[4],x[5]]:["M",A+("left"===x[6]?5:-5),C,"L",x[2],x[3],"L",x[4],x[5]],i?(i.animate({d:j}),i.attr("visibility",G)):b.connector=i=a.chart.renderer.path(j).attr({"stroke-width":g,stroke:e.connectorColor||b.color||"#606060",visibility:G}).add(a.dataLabelsGroup)):i&&(b.connector=i.destroy())}))}},F.pie.prototype.placeDataLabels=function(){p(this.points,function(a){var b,a=a.dataLabel;a&&((b=a._pos)?(a.attr(a._attr),a[a.moved?"animate":"attr"](b),a.moved=!0):a&&a.attr({y:-999}))})},F.pie.prototype.alignDataLabel=sa,F.pie.prototype.verifyDataLabelOverflow=function(a){var f,b=this.center,c=this.options,d=c.center,e=c=c.minSize||80;return null!==d[0]?e=v(b[2]-v(a[1],a[3]),c):(e=v(b[2]-a[1]-a[3],c),b[0]+=(a[3]-a[1])/2),null!==d[1]?e=v(C(e,b[2]-v(a[0],a[2])),c):(e=v(C(e,b[2]-a[0]-a[2]),c),b[1]+=(a[0]-a[2])/2),e<b[2]?(b[2]=e,this.translate(b),p(this.points,function(a){a.dataLabel&&(a.dataLabel._pos=null)}),this.drawDataLabels&&this.drawDataLabels()):f=!0,f}),F.column&&(F.column.prototype.alignDataLabel=function(a,b,c,d,e){var f=this.chart,g=f.inverted,h=a.dlBox||a.shapeArgs,i=a.below||a.plotY>m(this.translatedThreshold,f.plotSizeY),j=m(c.inside,!!this.options.stacking);h&&(d=w(h),g&&(d={x:f.plotWidth-d.y-d.height,y:f.plotHeight-d.x-d.width,width:d.height,height:d.width}),!j)&&(g?(d.x+=i?0:d.width,d.width=0):(d.y+=i?d.height:0,d.height=0)),c.align=m(c.align,!g||j?"center":i?"right":"left"),c.verticalAlign=m(c.verticalAlign,g||j?"middle":i?"top":"bottom"),O.prototype.alignDataLabel.call(this,a,b,c,d,e)}),S=R.TrackerMixin={drawTrackerPoint:function(){var a=this,b=a.chart,c=b.pointer,d=a.options.cursor,e=d&&{cursor:d},f=function(c){var e,d=c.target;for(b.hoverSeries!==a&&a.onMouseOver();d&&!e;)e=d.point,d=d.parentNode;e!==t&&e!==b.hoverPoint&&e.onMouseOver(c)};p(a.points,function(a){a.graphic&&(a.graphic.element.point=a),a.dataLabel&&(a.dataLabel.element.point=a)}),a._hasTracking||(p(a.trackerGroups,function(b){a[b]&&(a[b].addClass("highcharts-tracker").on("mouseover",f).on("mouseout",function(a){c.onTrackerMouseOut(a)}).css(e),$a)&&a[b].on("touchstart",f)}),a._hasTracking=!0)},drawTrackerGraph:function(){var m,a=this,b=a.options,c=b.trackByArea,d=[].concat(c?a.areaPath:a.graphPath),e=d.length,f=a.chart,g=f.pointer,h=f.renderer,i=f.options.tooltip.snap,j=a.tracker,k=b.cursor,l=k&&{cursor:k},k=a.singlePoints,n=function(){f.hoverSeries!==a&&a.onMouseOver()},q="rgba(192,192,192,"+(aa?1e-4:.002)+")";if(e&&!c)for(m=e+1;m--;)"M"===d[m]&&d.splice(m+1,0,d[m+1]-i,d[m+2],"L"),(m&&"M"===d[m]||m===e)&&d.splice(m,0,"L",d[m-2]+i,d[m-1]);for(m=0;m<k.length;m++)e=k[m],d.push("M",e.plotX-i,e.plotY,"L",e.plotX+i,e.plotY);j?j.attr({d:d}):(a.tracker=h.path(d).attr({"stroke-linejoin":"round",visibility:a.visible?"visible":"hidden",stroke:q,fill:c?q:Q,"stroke-width":b.lineWidth+(c?0:2*i),zIndex:2}).add(a.group),p([a.tracker,a.markerGroup],function(a){a.addClass("highcharts-tracker").on("mouseover",n).on("mouseout",function(a){g.onTrackerMouseOut(a)}).css(l),$a&&a.on("touchstart",n)}))}},F.column&&(ga.prototype.drawTracker=S.drawTrackerPoint),F.pie&&(F.pie.prototype.drawTracker=S.drawTrackerPoint),F.scatter&&(pa.prototype.drawTracker=S.drawTrackerPoint),q(lb.prototype,{setItemEvents:function(a,b,c,d,e){var f=this;(c?b:a.legendGroup).on("mouseover",function(){a.setState("hover"),b.css(f.options.itemHoverStyle)}).on("mouseout",function(){b.css(a.visible?d:e),a.setState()}).on("click",function(b){var c=function(){a.setVisible()},b={browserEvent:b};a.firePointEvent?a.firePointEvent("legendItemClick",b,c):D(a,"legendItemClick",b,c)})},createCheckboxForItem:function(a){a.checkbox=Y("input",{type:"checkbox",checked:a.selected,defaultChecked:a.selected},this.options.itemCheckboxStyle,this.chart.container),K(a.checkbox,"click",function(b){D(a,"checkboxClick",{checked:b.target.checked},function(){a.select()})})}}),E.legend.itemStyle.cursor="pointer",q(Ya.prototype,{showResetZoom:function(){var a=this,b=E.lang,c=a.options.chart.resetZoomButton,d=c.theme,e=d.states,f="chart"===c.relativeTo?null:"plotBox";this.resetZoomButton=a.renderer.button(b.resetZoom,null,null,function(){a.zoomOut()},d,e&&e.hover).attr({align:c.position.align,title:b.resetZoomTitle}).add().align(c.position,!1,f)},zoomOut:function(){var a=this;D(a,"selection",{resetSelection:!0},function(){a.zoom()})},zoom:function(a){var b,e,c=this.pointer,d=!1;!a||a.resetSelection?p(this.axes,function(a){b=a.zoom()}):p(a.xAxis.concat(a.yAxis),function(a){var e=a.axis,h=e.isXAxis;(c[h?"zoomX":"zoomY"]||c[h?"pinchX":"pinchY"])&&(b=e.zoom(a.min,a.max),e.displayBtn&&(d=!0))}),e=this.resetZoomButton,d&&!e?this.showResetZoom():!d&&ca(e)&&(this.resetZoomButton=e.destroy()),b&&this.redraw(m(this.options.chart.animation,a&&a.animation,this.pointCount<100))},pan:function(a,b){var e,c=this,d=c.hoverPoints;d&&p(d,function(a){a.setState()}),p("xy"===b?[1,0]:[1],function(b){var d=a[b?"chartX":"chartY"],h=c[b?"xAxis":"yAxis"][0],i=c[b?"mouseDownX":"mouseDownY"],j=(h.pointRange||0)/2,k=h.getExtremes(),l=h.toValue(i-d,!0)+j,i=h.toValue(i+c[b?"plotWidth":"plotHeight"]-d,!0)-j;h.series.length&&l>C(k.dataMin,k.min)&&i<v(k.dataMax,k.max)&&(h.setExtremes(l,i,!1,!1,{trigger:"pan"}),e=!0),c[b?"mouseDownX":"mouseDownY"]=d}),e&&c.redraw(!1),G(c.container,{cursor:"move"})}}),q(Ea.prototype,{select:function(a,b){var c=this,d=c.series,e=d.chart,a=m(a,!c.selected);c.firePointEvent(a?"select":"unselect",{accumulate:b},function(){c.selected=c.options.selected=a,d.options.data[Da(c,d.data)]=c.options,c.setState(a&&"select"),b||p(e.getSelectedPoints(),function(a){a.selected&&a!==c&&(a.selected=a.options.selected=!1,d.options.data[Da(a,d.data)]=a.options,a.setState(""),a.firePointEvent("unselect"))})})},onMouseOver:function(a){var b=this.series,c=b.chart,d=c.tooltip,e=c.hoverPoint;e&&e!==this&&e.onMouseOut(),this.firePointEvent("mouseOver"),d&&(!d.shared||b.noSharedTooltip)&&d.refresh(this,a),this.setState("hover"),c.hoverPoint=this},onMouseOut:function(){var a=this.series.chart,b=a.hoverPoints;b&&-1!==Da(this,b)||(this.firePointEvent("mouseOut"),this.setState(),a.hoverPoint=null)},importEvents:function(){if(!this.hasImportedEvents){var b,a=w(this.series.options.point,this.options).events;this.events=a;for(b in a)K(this,b,a[b]);this.hasImportedEvents=!0}},setState:function(a,b){var p,c=this.plotX,d=this.plotY,e=this.series,f=e.options.states,g=ba[e.type].marker&&e.options.marker,h=g&&!g.enabled,i=g&&g.states[a],j=i&&i.enabled===!1,k=e.stateMarkerGraphic,l=this.marker||{},m=e.chart,n=e.halo,a=a||"";p=this.pointAttr[a]||e.pointAttr[a],a===this.state&&!b||this.selected&&"select"!==a||f[a]&&f[a].enabled===!1||a&&(j||h&&i.enabled===!1)||a&&l.states&&l.states[a]&&l.states[a].enabled===!1||(this.graphic?(g=g&&this.graphic.symbolName&&p.r,this.graphic.attr(w(p,g?{x:c-g,y:d-g,width:2*g,height:2*g}:{})),k&&k.hide()):(a&&i&&(g=i.radius,l=l.symbol||e.symbol,k&&k.currentSymbol!==l&&(k=k.destroy()),k?k[b?"animate":"attr"]({x:c-g,y:d-g}):l&&(e.stateMarkerGraphic=k=m.renderer.symbol(l,c-g,d-g,2*g,2*g).attr(p).add(e.markerGroup),k.currentSymbol=l)),k&&k[a&&m.isInsidePlot(c,d,m.inverted)?"show":"hide"]()),(c=f[a]&&f[a].halo)&&c.size?(n||(e.halo=n=m.renderer.path().add(e.seriesGroup)),n.attr(q({fill:ya(this.color||e.color).setOpacity(c.opacity).get()},c.attributes))[b?"animate":"attr"]({d:this.haloPath(c.size)})):n&&n.attr({d:[]}),this.state=a)},haloPath:function(a){var b=this.series,c=b.chart,d=b.getPlotBox(),e=c.inverted;return c.renderer.symbols.circle(d.translateX+(e?b.yAxis.len-this.plotY:this.plotX)-a,d.translateY+(e?b.xAxis.len-this.plotX:this.plotY)-a,2*a,2*a)}}),q(O.prototype,{onMouseOver:function(){var a=this.chart,b=a.hoverSeries;b&&b!==this&&b.onMouseOut(),this.options.events.mouseOver&&D(this,"mouseOver"),this.setState("hover"),a.hoverSeries=this},onMouseOut:function(){var a=this.options,b=this.chart,c=b.tooltip,d=b.hoverPoint;d&&d.onMouseOut(),this&&a.events.mouseOut&&D(this,"mouseOut"),c&&!a.stickyTracking&&(!c.shared||this.noSharedTooltip)&&c.hide(),this.setState(),b.hoverSeries=null},setState:function(a){var b=this.options,c=this.graph,d=this.graphNeg,e=b.states,b=b.lineWidth,a=a||"";this.state!==a&&(this.state=a,e[a]&&e[a].enabled===!1||(a&&(b=e[a].lineWidth||b+1),c&&!c.dashstyle&&(a={"stroke-width":b},c.attr(a),d&&d.attr(a))))},setVisible:function(a,b){var f,c=this,d=c.chart,e=c.legendItem,g=d.options.chart.ignoreHiddenSeries,h=c.visible;f=(c.visible=a=c.userOptions.visible=a===t?!h:a)?"show":"hide",p(["group","dataLabelsGroup","markerGroup","tracker"],function(a){c[a]&&c[a][f]()}),d.hoverSeries===c&&c.onMouseOut(),e&&d.legend.colorizeItem(c,a),c.isDirty=!0,c.options.stacking&&p(d.series,function(a){a.options.stacking&&a.visible&&(a.isDirty=!0)}),p(c.linkedSeries,function(b){b.setVisible(a,!1)}),g&&(d.isDirtyBox=!0),b!==!1&&d.redraw(),D(c,f)},setTooltipPoints:function(a){var c,d,h,i,b=[],e=this.xAxis,f=e&&e.getExtremes(),g=e?e.tooltipLen||e.len:this.chart.plotSizeX,j=[];if(this.options.enableMouseTracking!==!1&&!this.singularTooltips){for(a&&(this.tooltipPoints=null),p(this.segments||this.points,function(a){b=b.concat(a)}),e&&e.reversed&&(b=b.reverse()),this.orderTooltipPoints&&this.orderTooltipPoints(b),a=b.length,i=0;a>i;i++)if(e=b[i],c=e.x,c>=f.min&&c<=f.max)for(h=b[i+1],c=d===t?0:d+1,d=b[i+1]?C(v(0,T((e.clientX+(h?h.wrappedClientX||h.clientX:g))/2)),g):g;c>=0&&d>=c;)j[c++]=e;this.tooltipPoints=j}},show:function(){this.setVisible(!0)},hide:function(){this.setVisible(!1)},select:function(a){this.selected=a=a===t?!this.selected:a,this.checkbox&&(this.checkbox.checked=a),D(this,a?"select":"unselect")},drawTracker:S.drawTrackerGraph}),q(R,{Axis:la,Chart:Ya,Color:ya,Point:Ea,Tick:Sa,Renderer:Za,Series:O,SVGElement:P,SVGRenderer:ta,arrayMin:Na,arrayMax:Ba,charts:V,dateFormat:cb,format:Ia,pathAnim:ub,getOptions:function(){return E},hasBidiBug:Nb,isTouchDevice:Jb,numberFormat:Ga,seriesTypes:F,setOptions:function(a){return E=w(!0,E,a),Cb(),E},addEvent:K,removeEvent:W,createElement:Y,discardElement:Pa,css:G,each:p,extend:q,map:Ua,merge:w,pick:m,splat:qa,extendClass:ka,pInt:z,wrap:Ma,svg:aa,canvas:fa,vml:!aa&&!fa,product:"Highcharts",version:"4.0.1"})}(),function(factory){"function"==typeof define&&define.amd?define(["jquery"],factory):factory(jQuery)}(function($){function args(elem){var newAttrs={},rinlinejQuery=/^jQuery\d+$/;return $.each(elem.attributes,function(i,attr){attr.specified&&!rinlinejQuery.test(attr.name)&&(newAttrs[attr.name]=attr.value)}),newAttrs}function clearPlaceholder(event,value){var input=this,$input=$(input);if(input.value==$input.attr("placeholder")&&$input.hasClass(settings.customClass))if($input.data("placeholder-password")){if($input=$input.hide().nextAll('input[type="password"]:first').show().attr("id",$input.removeAttr("id").data("placeholder-id")),event===!0)return $input[0].value=value;$input.focus()}else input.value="",$input.removeClass(settings.customClass),input==safeActiveElement()&&input.select()}function setPlaceholder(){var $replacement,input=this,$input=$(input),id=this.id;if(""===input.value){if("password"===input.type){if(!$input.data("placeholder-textinput")){try{$replacement=$input.clone().attr({type:"text"})}catch(e){$replacement=$("<input>").attr($.extend(args(this),{type:"text"}))}$replacement.removeAttr("name").data({"placeholder-password":$input,"placeholder-id":id}).bind("focus.placeholder",clearPlaceholder),$input.data({"placeholder-textinput":$replacement,"placeholder-id":id}).before($replacement)}$input=$input.removeAttr("id").hide().prevAll('input[type="text"]:first').attr("id",id).show()}$input.addClass(settings.customClass),$input[0].value=$input.attr("placeholder")}else $input.removeClass(settings.customClass)}function safeActiveElement(){try{return document.activeElement}catch(exception){}}var hooks,placeholder,isOperaMini="[object OperaMini]"==Object.prototype.toString.call(window.operamini),isInputSupported="placeholder"in document.createElement("input")&&!isOperaMini,isTextareaSupported="placeholder"in document.createElement("textarea")&&!isOperaMini,valHooks=$.valHooks,propHooks=$.propHooks;if(isInputSupported&&isTextareaSupported)placeholder=$.fn.placeholder=function(){return this},placeholder.input=placeholder.textarea=!0;else{var settings={};placeholder=$.fn.placeholder=function(options){var defaults={customClass:"placeholder"};settings=$.extend({},defaults,options);var $this=this;return $this.filter((isInputSupported?"textarea":":input")+"[placeholder]").not("."+settings.customClass).bind({"focus.placeholder":clearPlaceholder,"blur.placeholder":setPlaceholder}).data("placeholder-enabled",!0).trigger("blur.placeholder"),$this},placeholder.input=isInputSupported,placeholder.textarea=isTextareaSupported,hooks={get:function(element){var $element=$(element),$passwordInput=$element.data("placeholder-password");return $passwordInput?$passwordInput[0].value:$element.data("placeholder-enabled")&&$element.hasClass(settings.customClass)?"":element.value},set:function(element,value){var $element=$(element),$passwordInput=$element.data("placeholder-password");return $passwordInput?$passwordInput[0].value=value:$element.data("placeholder-enabled")?(""===value?(element.value=value,element!=safeActiveElement()&&setPlaceholder.call(element)):$element.hasClass(settings.customClass)?clearPlaceholder.call(element,!0,value)||(element.value=value):element.value=value,$element):element.value=value}},isInputSupported||(valHooks.input=hooks,propHooks.value=hooks),isTextareaSupported||(valHooks.textarea=hooks,propHooks.value=hooks),$(function(){$(document).delegate("form","submit.placeholder",function(){var $inputs=$("."+settings.customClass,this).each(clearPlaceholder);setTimeout(function(){$inputs.each(setPlaceholder)},10)})}),$(window).bind("beforeunload.placeholder",function(){$("."+settings.customClass).each(function(){this.value=""})})}}),jQuery(document).ready(function($){$("#close-share").click(function(){$.cookie("ignore_social_share",1,{expires:30})}),$(".big-button--share").click(function(){$.cookie("ignore_social_share",1)}),$.cookie("ignore_social_share")||leadin_check_social_share_popup(),$("#filter_action").select2(),$("#filter_action").change(function(){var $this=$(this);"submitted"==$this.val()?$("#form-filter-input").show():($("#form-filter-input").hide(),$("#filter_form").select2("val","any form"))}),$("#view-all-do-not-track-selectors").click(function(){$(".form-do-not-track, #view-less-do-not-track-selectors").not(".do-not-track-always-show").show(),$("#view-all-do-not-track-selectors").hide()}),$("#view-less-do-not-track-selectors").click(function(){$(".form-do-not-track, #view-less-do-not-track-selectors").not(".do-not-track-always-show").hide(),$("#view-all-do-not-track-selectors").show()}),$("#filter_content").select2({query:function(query){var key=query.term;$.ajax({type:"POST",url:li_admin_ajax.ajax_url,data:{action:"leadin_get_posts_and_pages",search_term:key},success:function(data){var i,json_data=jQuery.parseJSON(data),data_test={results:[]};for(i=0;i<json_data.length;i++)data_test.results.push({id:json_data[i].post_title,text:json_data[i].post_title});query.callback(data_test)}})},initSelection:function(){$("#filter_content").val()?$("#filter_content").select2("data",{id:$("#filter_content").val(),text:$("#filter_content").val()}):$("#filter_content").select2("data",{id:"any page",text:"any page"})}}),$("#filter_form").select2({query:function(query){var key=query.term;$.ajax({type:"POST",url:li_admin_ajax.ajax_url,data:{action:"leadin_get_form_selectors",search_term:key},success:function(data){var i,json_data=jQuery.parseJSON(data),data_test={results:[]};for(i=0;i<json_data.length;i++)data_test.results.push({id:json_data[i],text:json_data[i]});query.callback(data_test)}})},initSelection:function(){$("#filter_form").val()?$("#filter_form").select2("data",{id:$("#filter_form").val(),text:$("#filter_form").val()}):$("#filter_form").select2("data",{id:"any form",text:"any form"})}}),$("#leadin-contact-status").change(function(){$("#leadin-contact-status-button").addClass("button-primary")}),$("input[name=popup-position]:radio").change(function(){$("#btn-activate-subscribe").attr("href",window.location.href+"&leadin_action=activate&power_up=subscribe_widget&redirect_to="+encodeURIComponent(window.location.href+"&activate_popup=true&popup_position="+$("input:radio[name='popup-position']:checked").val()))}),$("input[name=esp]:radio").change(function(){$("#btn-activate-esp").attr("href",window.location.href+"&leadin_action=activate&power_up="+$("input:radio[name='esp']:checked").val()+"&redirect_to="+encodeURIComponent(window.location.href+"&activate_esp=true"))}),$("#pro-upgrade-button").click(function(e){return e.preventDefault(),$("#agree-pp").is(":checked")?($("#agree-pp-error").hide(),$(this).addClass("btn-submitting").text("Upgrading..."),void $.ajax({type:"POST",url:li_admin_ajax.ajax_url,data:{action:"leadin_upgrade_to_pro_ajax_call"},success:function(redirect_to){redirect_to&&(window.location.href=redirect_to+"&pro_upgrade=1")}})):($("#agree-pp-error").show(),!1)}),$("#onboarding-step-1-button").click(function(e){return $("#agree-pp").is(":checked")?void 0:(e.preventDefault(),$("#agree-pp-error").show(),!1)}),$("input, textarea").placeholder()}),jQuery(document).ready(function($){var $bulk_opt_selected=$('.bulkactions select option[value="add_tag_to_selected"], .bulkactions select option[value="remove_tag_from_selected"], .bulkactions select option[value="delete_selected"]');
6
- $("#leadin-contacts input:checkbox").not("thead input:checkbox, tfoot input:checkbox").bind("change",function(){var cb_count=0,selected_vals="",$btn_selected=$("#leadin-export-selected-leads"),$input_selected_vals=$(".leadin-selected-contacts"),$cb_selected=$("#leadin-contacts input:checkbox:checked").not("thead input:checkbox, tfoot input:checkbox");$cb_selected.length>0?($btn_selected.attr("disabled",!1),$bulk_opt_selected.attr("disabled",!1)):($btn_selected.attr("disabled",!0),$bulk_opt_selected.attr("disabled",!0)),$cb_selected.each(function(){selected_vals+=$(this).val(),cb_count!=$cb_selected.length-1&&(selected_vals+=","),cb_count++}),$input_selected_vals.val(selected_vals),$(".selected-contacts-count").text(cb_count)}),$("#cb-select-all-1, #cb-select-all-2").bind("change",function(){var cb_count=0,selected_vals="",$this=$(this),$btn_selected=$("#leadin-export-selected-leads"),$cb_selected=$("#leadin-contacts input:checkbox").not("thead input:checkbox, tfoot input:checkbox"),$input_selected_vals=$(".leadin-selected-contacts");$cb_selected.each(function(){selected_vals+=$(this).val(),cb_count!=$cb_selected.length-1&&(selected_vals+=","),cb_count++}),$input_selected_vals.val(selected_vals),$this.is(":checked")?($btn_selected.attr("disabled",!1),$bulk_opt_selected.attr("disabled",!1)):($btn_selected.attr("disabled",!0),$bulk_opt_selected.attr("disabled",!0),$(".selected-contacts-count").text($("#contact-count").text())),$(".selected-contacts-count").text(cb_count)}),$(".postbox .handlediv").bind("click",function(){var $postbox=$(this).parent();$postbox.hasClass("closed")?$postbox.removeClass("closed"):$postbox.addClass("closed")}),$(".selected-contacts-count").text($("#contact-count").text()),$bulk_opt_selected.attr("disabled",!0),$(".bulkactions select").change(function(){{var $this=$(this);$("#contact-count").text()}"add_tag_to_all"==$this.val()||"add_tag_to_selected"==$this.val()?($("#bulk-edit-tags h2").html($("#bulk-edit-tags h2").html().replace("remove from","add to")),$("#bulk-edit-button").val("Add Tag"),$("#bulk-edit-tag-action").val("add_tag"),tb_show("","#TB_inline?width=400&height=175&inlineId=bulk-edit-tags"),$(".bulkactions select").val("-1")):("remove_tag_from_all"==$this.val()||"remove_tag_from_selected"==$this.val())&&($("#bulk-edit-tags h2").html($("#bulk-edit-tags h2").html().replace("add to","remove from")),$("#bulk-edit-button").val("Remove Tag"),$("#bulk-edit-tag-action").val("remove_tag"),tb_show("","#TB_inline?width=400&height=175&inlineId=bulk-edit-tags"),$(".bulkactions select").val("-1"))}),$("#contact-detail-read-more").click(function(){$("#company-detail-overview-short").hide(),$("#company-detail-overview-full").show()}),$("#contact-detail-read-less").click(function(){$("#company-detail-overview-full").hide(),$("#company-detail-overview-short").show()})}),function($){"undefined"==typeof $.fn.each2&&$.extend($.fn,{each2:function(c){for(var j=$([0]),i=-1,l=this.length;++i<l&&(j.context=j[0]=this[i])&&c.call(j[0],i,j)!==!1;);return this}})}(jQuery),function($,undefined){"use strict";function reinsertElement(element){var placeholder=$(document.createTextNode(""));element.before(placeholder),placeholder.before(element),placeholder.remove()}function stripDiacritics(str){function match(a){return DIACRITICS[a]||a}return str.replace(/[^\u0000-\u007E]/g,match)}function indexOf(value,array){for(var i=0,l=array.length;l>i;i+=1)if(equal(value,array[i]))return i;return-1}function measureScrollbar(){var $template=$(MEASURE_SCROLLBAR_TEMPLATE);$template.appendTo("body");var dim={width:$template.width()-$template[0].clientWidth,height:$template.height()-$template[0].clientHeight};return $template.remove(),dim}function equal(a,b){return a===b?!0:a===undefined||b===undefined?!1:null===a||null===b?!1:a.constructor===String?a+""==b+"":b.constructor===String?b+""==a+"":!1}function splitVal(string,separator){var val,i,l;if(null===string||string.length<1)return[];for(val=string.split(separator),i=0,l=val.length;l>i;i+=1)val[i]=$.trim(val[i]);return val}function getSideBorderPadding(element){return element.outerWidth(!1)-element.width()}function installKeyUpChangeEvent(element){var key="keyup-change-value";element.on("keydown",function(){$.data(element,key)===undefined&&$.data(element,key,element.val())}),element.on("keyup",function(){var val=$.data(element,key);val!==undefined&&element.val()!==val&&($.removeData(element,key),element.trigger("keyup-change"))})}function installFilteredMouseMove(element){element.on("mousemove",function(e){var lastpos=lastMousePosition;(lastpos===undefined||lastpos.x!==e.pageX||lastpos.y!==e.pageY)&&$(e.target).trigger("mousemove-filtered",e)})}function debounce(quietMillis,fn,ctx){ctx=ctx||undefined;var timeout;return function(){var args=arguments;window.clearTimeout(timeout),timeout=window.setTimeout(function(){fn.apply(ctx,args)},quietMillis)}}function installDebouncedScroll(threshold,element){var notify=debounce(threshold,function(e){element.trigger("scroll-debounced",e)});element.on("scroll",function(e){indexOf(e.target,element.get())>=0&&notify(e)})}function focus($el){$el[0]!==document.activeElement&&window.setTimeout(function(){var range,el=$el[0],pos=$el.val().length;$el.focus();var isVisible=el.offsetWidth>0||el.offsetHeight>0;isVisible&&el===document.activeElement&&(el.setSelectionRange?el.setSelectionRange(pos,pos):el.createTextRange&&(range=el.createTextRange(),range.collapse(!1),range.select()))},0)}function getCursorInfo(el){el=$(el)[0];var offset=0,length=0;if("selectionStart"in el)offset=el.selectionStart,length=el.selectionEnd-offset;else if("selection"in document){el.focus();var sel=document.selection.createRange();length=document.selection.createRange().text.length,sel.moveStart("character",-el.value.length),offset=sel.text.length-length}return{offset:offset,length:length}}function killEvent(event){event.preventDefault(),event.stopPropagation()}function killEventImmediately(event){event.preventDefault(),event.stopImmediatePropagation()}function measureTextWidth(e){if(!sizer){var style=e[0].currentStyle||window.getComputedStyle(e[0],null);sizer=$(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:style.fontSize,fontFamily:style.fontFamily,fontStyle:style.fontStyle,fontWeight:style.fontWeight,letterSpacing:style.letterSpacing,textTransform:style.textTransform,whiteSpace:"nowrap"}),sizer.attr("class","select2-sizer"),$("body").append(sizer)}return sizer.text(e.val()),sizer.width()}function syncCssClasses(dest,src,adapter){var classes,adapted,replacements=[];classes=dest.attr("class"),classes&&(classes=""+classes,$(classes.split(" ")).each2(function(){0===this.indexOf("select2-")&&replacements.push(this)})),classes=src.attr("class"),classes&&(classes=""+classes,$(classes.split(" ")).each2(function(){0!==this.indexOf("select2-")&&(adapted=adapter(this),adapted&&replacements.push(adapted))})),dest.attr("class",replacements.join(" "))}function markMatch(text,term,markup,escapeMarkup){var match=stripDiacritics(text.toUpperCase()).indexOf(stripDiacritics(term.toUpperCase())),tl=term.length;return 0>match?void markup.push(escapeMarkup(text)):(markup.push(escapeMarkup(text.substring(0,match))),markup.push("<span class='select2-match'>"),markup.push(escapeMarkup(text.substring(match,match+tl))),markup.push("</span>"),void markup.push(escapeMarkup(text.substring(match+tl,text.length))))}function defaultEscapeMarkup(markup){var replace_map={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return String(markup).replace(/[&<>"'\/\\]/g,function(match){return replace_map[match]})}function ajax(options){var timeout,handler=null,quietMillis=options.quietMillis||100,ajaxUrl=options.url,self=this;return function(query){window.clearTimeout(timeout),timeout=window.setTimeout(function(){var data=options.data,url=ajaxUrl,transport=options.transport||$.fn.select2.ajaxDefaults.transport,deprecated={type:options.type||"GET",cache:options.cache||!1,jsonpCallback:options.jsonpCallback||undefined,dataType:options.dataType||"json"},params=$.extend({},$.fn.select2.ajaxDefaults.params,deprecated);data=data?data.call(self,query.term,query.page,query.context):null,url="function"==typeof url?url.call(self,query.term,query.page,query.context):url,handler&&"function"==typeof handler.abort&&handler.abort(),options.params&&($.isFunction(options.params)?$.extend(params,options.params.call(self)):$.extend(params,options.params)),$.extend(params,{url:url,dataType:options.dataType,data:data,success:function(data){var results=options.results(data,query.page);query.callback(results)}}),handler=transport.call(self,params)},quietMillis)}}function local(options){var dataText,tmp,data=options,text=function(item){return""+item.text};$.isArray(data)&&(tmp=data,data={results:tmp}),$.isFunction(data)===!1&&(tmp=data,data=function(){return tmp});var dataItem=data();return dataItem.text&&(text=dataItem.text,$.isFunction(text)||(dataText=dataItem.text,text=function(item){return item[dataText]})),function(query){var process,t=query.term,filtered={results:[]};return""===t?void query.callback(data()):(process=function(datum,collection){var group,attr;if(datum=datum[0],datum.children){group={};for(attr in datum)datum.hasOwnProperty(attr)&&(group[attr]=datum[attr]);group.children=[],$(datum.children).each2(function(i,childDatum){process(childDatum,group.children)}),(group.children.length||query.matcher(t,text(group),datum))&&collection.push(group)}else query.matcher(t,text(datum),datum)&&collection.push(datum)},$(data().results).each2(function(i,datum){process(datum,filtered.results)}),void query.callback(filtered))}}function tags(data){var isFunc=$.isFunction(data);return function(query){var t=query.term,filtered={results:[]},result=isFunc?data(query):data;$.isArray(result)&&($(result).each(function(){var isObject=this.text!==undefined,text=isObject?this.text:this;(""===t||query.matcher(t,text))&&filtered.results.push(isObject?this:{id:this,text:this})}),query.callback(filtered))}}function checkFormatter(formatter,formatterName){if($.isFunction(formatter))return!0;if(!formatter)return!1;if("string"==typeof formatter)return!0;throw new Error(formatterName+" must be a string, function, or falsy value")}function evaluate(val){if($.isFunction(val)){var args=Array.prototype.slice.call(arguments,1);return val.apply(null,args)}return val}function countResults(results){var count=0;return $.each(results,function(i,item){item.children?count+=countResults(item.children):count++}),count}function defaultTokenizer(input,selection,selectCallback,opts){var token,index,i,l,separator,original=input,dupe=!1;if(!opts.createSearchChoice||!opts.tokenSeparators||opts.tokenSeparators.length<1)return undefined;for(;;){for(index=-1,i=0,l=opts.tokenSeparators.length;l>i&&(separator=opts.tokenSeparators[i],index=input.indexOf(separator),!(index>=0));i++);if(0>index)break;if(token=input.substring(0,index),input=input.substring(index+separator.length),token.length>0&&(token=opts.createSearchChoice.call(this,token,selection),token!==undefined&&null!==token&&opts.id(token)!==undefined&&null!==opts.id(token))){for(dupe=!1,i=0,l=selection.length;l>i;i++)if(equal(opts.id(token),opts.id(selection[i]))){dupe=!0;break}dupe||selectCallback(token)}}return original!==input?input:void 0}function cleanupJQueryElements(){var self=this;Array.prototype.forEach.call(arguments,function(element){self[element].remove(),self[element]=null})}function clazz(SuperClass,methods){var constructor=function(){};return constructor.prototype=new SuperClass,constructor.prototype.constructor=constructor,constructor.prototype.parent=SuperClass.prototype,constructor.prototype=$.extend(constructor.prototype,methods),constructor}if(window.Select2===undefined){var KEY,AbstractSelect2,SingleSelect2,MultiSelect2,nextUid,sizer,$document,scrollBarDimensions,lastMousePosition={x:0,y:0},KEY={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(k){switch(k=k.which?k.which:k){case KEY.LEFT:case KEY.RIGHT:case KEY.UP:case KEY.DOWN:return!0}return!1},isControl:function(e){var k=e.which;switch(k){case KEY.SHIFT:case KEY.CTRL:case KEY.ALT:return!0}return e.metaKey?!0:!1},isFunctionKey:function(k){return k=k.which?k.which:k,k>=112&&123>=k}},MEASURE_SCROLLBAR_TEMPLATE="<div class='select2-measure-scrollbar'></div>",DIACRITICS={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z"};$document=$(document),nextUid=function(){var counter=1;return function(){return counter++}}(),$document.on("mousemove",function(e){lastMousePosition.x=e.pageX,lastMousePosition.y=e.pageY}),AbstractSelect2=clazz(Object,{bind:function(func){var self=this;return function(){func.apply(self,arguments)}},init:function(opts){var results,search,resultsSelector=".select2-results";this.opts=opts=this.prepareOpts(opts),this.id=opts.id,opts.element.data("select2")!==undefined&&null!==opts.element.data("select2")&&opts.element.data("select2").destroy(),this.container=this.createContainer(),this.liveRegion=$("<span>",{role:"status","aria-live":"polite"}).addClass("select2-hidden-accessible").appendTo(document.body),this.containerId="s2id_"+(opts.element.attr("id")||"autogen"+nextUid()),this.containerEventName=this.containerId.replace(/([.])/g,"_").replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.container.attr("title",opts.element.attr("title")),this.body=$("body"),syncCssClasses(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",opts.element.attr("style")),this.container.css(evaluate(opts.containerCss)),this.container.addClass(evaluate(opts.containerCssClass)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container).on("click.select2",killEvent),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),syncCssClasses(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(evaluate(opts.dropdownCssClass)),this.dropdown.data("select2",this),this.dropdown.on("click",killEvent),this.results=results=this.container.find(resultsSelector),this.search=search=this.container.find("input.select2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",killEvent),installFilteredMouseMove(this.results),this.dropdown.on("mousemove-filtered",resultsSelector,this.bind(this.highlightUnderEvent)),this.dropdown.on("touchstart touchmove touchend",resultsSelector,this.bind(function(event){this._touchEvent=!0,this.highlightUnderEvent(event)})),this.dropdown.on("touchmove",resultsSelector,this.bind(this.touchMoved)),this.dropdown.on("touchstart touchend",resultsSelector,this.bind(this.clearTouchMoved)),this.dropdown.on("click",this.bind(function(){this._touchEvent&&(this._touchEvent=!1,this.selectHighlighted())})),installDebouncedScroll(80,this.results),this.dropdown.on("scroll-debounced",resultsSelector,this.bind(this.loadMoreIfNeeded)),$(this.container).on("change",".select2-input",function(e){e.stopPropagation()}),$(this.dropdown).on("change",".select2-input",function(e){e.stopPropagation()}),$.fn.mousewheel&&results.mousewheel(function(e,delta,deltaX,deltaY){var top=results.scrollTop();deltaY>0&&0>=top-deltaY?(results.scrollTop(0),killEvent(e)):0>deltaY&&results.get(0).scrollHeight-results.scrollTop()+deltaY<=results.height()&&(results.scrollTop(results.get(0).scrollHeight-results.height()),killEvent(e))}),installKeyUpChangeEvent(search),search.on("keyup-change input paste",this.bind(this.updateResults)),search.on("focus",function(){search.addClass("select2-focused")}),search.on("blur",function(){search.removeClass("select2-focused")}),this.dropdown.on("mouseup",resultsSelector,this.bind(function(e){$(e.target).closest(".select2-result-selectable").length>0&&(this.highlightUnderEvent(e),this.selectHighlighted(e))})),this.dropdown.on("click mouseup mousedown touchstart touchend focusin",function(e){e.stopPropagation()}),this.nextSearchTerm=undefined,$.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==opts.maximumInputLength&&this.search.attr("maxlength",opts.maximumInputLength);var disabled=opts.element.prop("disabled");disabled===undefined&&(disabled=!1),this.enable(!disabled);var readonly=opts.element.prop("readonly");readonly===undefined&&(readonly=!1),this.readonly(readonly),scrollBarDimensions=scrollBarDimensions||measureScrollbar(),this.autofocus=opts.element.prop("autofocus"),opts.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.search.attr("placeholder",opts.searchInputPlaceholder)},destroy:function(){var element=this.opts.element,select2=element.data("select2");this.close(),this.propertyObserver&&(this.propertyObserver.disconnect(),this.propertyObserver=null),select2!==undefined&&(select2.container.remove(),select2.liveRegion.remove(),select2.dropdown.remove(),element.removeClass("select2-offscreen").removeData("select2").off(".select2").prop("autofocus",this.autofocus||!1),this.elementTabIndex?element.attr({tabindex:this.elementTabIndex}):element.removeAttr("tabindex"),element.show()),cleanupJQueryElements.call(this,"container","liveRegion","dropdown","results","search")},optionToData:function(element){return element.is("option")?{id:element.prop("value"),text:element.text(),element:element.get(),css:element.attr("class"),disabled:element.prop("disabled"),locked:equal(element.attr("locked"),"locked")||equal(element.data("locked"),!0)}:element.is("optgroup")?{text:element.attr("label"),children:[],element:element.get(),css:element.attr("class")}:void 0},prepareOpts:function(opts){var element,select,idKey,ajaxUrl,self=this;if(element=opts.element,"select"===element.get(0).tagName.toLowerCase()&&(this.select=select=opts.element),select&&$.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in opts)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.")}),opts=$.extend({},{populateResults:function(container,results,query){var populate,id=this.opts.id,liveRegion=this.liveRegion;(populate=function(results,container,depth){var i,l,result,selectable,disabled,compound,node,label,innerContainer,formatted;for(results=opts.sortResults(results,container,query),i=0,l=results.length;l>i;i+=1)result=results[i],disabled=result.disabled===!0,selectable=!disabled&&id(result)!==undefined,compound=result.children&&result.children.length>0,node=$("<li></li>"),node.addClass("select2-results-dept-"+depth),node.addClass("select2-result"),node.addClass(selectable?"select2-result-selectable":"select2-result-unselectable"),disabled&&node.addClass("select2-disabled"),compound&&node.addClass("select2-result-with-children"),node.addClass(self.opts.formatResultCssClass(result)),node.attr("role","presentation"),label=$(document.createElement("div")),label.addClass("select2-result-label"),label.attr("id","select2-result-label-"+nextUid()),label.attr("role","option"),formatted=opts.formatResult(result,label,query,self.opts.escapeMarkup),formatted!==undefined&&(label.html(formatted),node.append(label)),compound&&(innerContainer=$("<ul></ul>"),innerContainer.addClass("select2-result-sub"),populate(result.children,innerContainer,depth+1),node.append(innerContainer)),node.data("select2-data",result),container.append(node);liveRegion.text(opts.formatMatches(results.length))})(results,container,0)}},$.fn.select2.defaults,opts),"function"!=typeof opts.id&&(idKey=opts.id,opts.id=function(e){return e[idKey]}),$.isArray(opts.element.data("select2Tags"))){if("tags"in opts)throw"tags specified as both an attribute 'data-select2-tags' and in options of Select2 "+opts.element.attr("id");opts.tags=opts.element.data("select2Tags")}if(select?(opts.query=this.bind(function(query){var children,placeholderOption,process,data={results:[],more:!1},term=query.term;process=function(element,collection){var group;element.is("option")?query.matcher(term,element.text(),element)&&collection.push(self.optionToData(element)):element.is("optgroup")&&(group=self.optionToData(element),element.children().each2(function(i,elm){process(elm,group.children)}),group.children.length>0&&collection.push(group))},children=element.children(),this.getPlaceholder()!==undefined&&children.length>0&&(placeholderOption=this.getPlaceholderOption(),placeholderOption&&(children=children.not(placeholderOption))),children.each2(function(i,elm){process(elm,data.results)}),query.callback(data)}),opts.id=function(e){return e.id}):"query"in opts||("ajax"in opts?(ajaxUrl=opts.element.data("ajax-url"),ajaxUrl&&ajaxUrl.length>0&&(opts.ajax.url=ajaxUrl),opts.query=ajax.call(opts.element,opts.ajax)):"data"in opts?opts.query=local(opts.data):"tags"in opts&&(opts.query=tags(opts.tags),opts.createSearchChoice===undefined&&(opts.createSearchChoice=function(term){return{id:$.trim(term),text:$.trim(term)}}),opts.initSelection===undefined&&(opts.initSelection=function(element,callback){var data=[];$(splitVal(element.val(),opts.separator)).each(function(){var obj={id:this,text:this},tags=opts.tags;$.isFunction(tags)&&(tags=tags()),$(tags).each(function(){return equal(this.id,obj.id)?(obj=this,!1):void 0}),data.push(obj)}),callback(data)}))),"function"!=typeof opts.query)throw"query function not defined for Select2 "+opts.element.attr("id");if("top"===opts.createSearchChoicePosition)opts.createSearchChoicePosition=function(list,item){list.unshift(item)};else if("bottom"===opts.createSearchChoicePosition)opts.createSearchChoicePosition=function(list,item){list.push(item)};else if("function"!=typeof opts.createSearchChoicePosition)throw"invalid createSearchChoicePosition option must be 'top', 'bottom' or a custom function";return opts},monitorSource:function(){var sync,observer,el=this.opts.element;el.on("change.select2",this.bind(function(){this.opts.element.data("select2-change-triggered")!==!0&&this.initSelection()})),sync=this.bind(function(){var disabled=el.prop("disabled");disabled===undefined&&(disabled=!1),this.enable(!disabled);var readonly=el.prop("readonly");readonly===undefined&&(readonly=!1),this.readonly(readonly),syncCssClasses(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.addClass(evaluate(this.opts.containerCssClass)),syncCssClasses(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(evaluate(this.opts.dropdownCssClass))}),el.length&&el[0].attachEvent&&el.each(function(){this.attachEvent("onpropertychange",sync)}),observer=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,observer!==undefined&&(this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),this.propertyObserver=new observer(function(mutations){mutations.forEach(sync)}),this.propertyObserver.observe(el.get(0),{attributes:!0,subtree:!1}))},triggerSelect:function(data){var evt=$.Event("select2-selecting",{val:this.id(data),object:data});return this.opts.element.trigger(evt),!evt.isDefaultPrevented()},triggerChange:function(details){details=details||{},details=$.extend({},details,{type:"change",val:this.val()}),this.opts.element.data("select2-change-triggered",!0),this.opts.element.trigger(details),this.opts.element.data("select2-change-triggered",!1),this.opts.element.click(),this.opts.blurOnChange&&this.opts.element.blur()},isInterfaceEnabled:function(){return this.enabledInterface===!0},enableInterface:function(){var enabled=this._enabled&&!this._readonly,disabled=!enabled;return enabled===this.enabledInterface?!1:(this.container.toggleClass("select2-container-disabled",disabled),this.close(),this.enabledInterface=enabled,!0)},enable:function(enabled){enabled===undefined&&(enabled=!0),this._enabled!==enabled&&(this._enabled=enabled,this.opts.element.prop("disabled",!enabled),this.enableInterface())},disable:function(){this.enable(!1)},readonly:function(enabled){enabled===undefined&&(enabled=!1),this._readonly!==enabled&&(this._readonly=enabled,this.opts.element.prop("readonly",enabled),this.enableInterface())},opened:function(){return this.container.hasClass("select2-dropdown-open")},positionDropdown:function(){var bodyOffset,above,changeDirection,css,resultsListNode,$dropdown=this.dropdown,offset=this.container.offset(),height=this.container.outerHeight(!1),width=this.container.outerWidth(!1),dropHeight=$dropdown.outerHeight(!1),$window=$(window),windowWidth=$window.width(),windowHeight=$window.height(),viewPortRight=$window.scrollLeft()+windowWidth,viewportBottom=$window.scrollTop()+windowHeight,dropTop=offset.top+height,dropLeft=offset.left,enoughRoomBelow=viewportBottom>=dropTop+dropHeight,enoughRoomAbove=offset.top-dropHeight>=$window.scrollTop(),dropWidth=$dropdown.outerWidth(!1),enoughRoomOnRight=viewPortRight>=dropLeft+dropWidth,aboveNow=$dropdown.hasClass("select2-drop-above");aboveNow?(above=!0,!enoughRoomAbove&&enoughRoomBelow&&(changeDirection=!0,above=!1)):(above=!1,!enoughRoomBelow&&enoughRoomAbove&&(changeDirection=!0,above=!0)),changeDirection&&($dropdown.hide(),offset=this.container.offset(),height=this.container.outerHeight(!1),width=this.container.outerWidth(!1),dropHeight=$dropdown.outerHeight(!1),viewPortRight=$window.scrollLeft()+windowWidth,viewportBottom=$window.scrollTop()+windowHeight,dropTop=offset.top+height,dropLeft=offset.left,dropWidth=$dropdown.outerWidth(!1),enoughRoomOnRight=viewPortRight>=dropLeft+dropWidth,$dropdown.show(),this.focusSearch()),this.opts.dropdownAutoWidth?(resultsListNode=$(".select2-results",$dropdown)[0],$dropdown.addClass("select2-drop-auto-width"),$dropdown.css("width",""),dropWidth=$dropdown.outerWidth(!1)+(resultsListNode.scrollHeight===resultsListNode.clientHeight?0:scrollBarDimensions.width),dropWidth>width?width=dropWidth:dropWidth=width,dropHeight=$dropdown.outerHeight(!1),enoughRoomOnRight=viewPortRight>=dropLeft+dropWidth):this.container.removeClass("select2-drop-auto-width"),"static"!==this.body.css("position")&&(bodyOffset=this.body.offset(),dropTop-=bodyOffset.top,dropLeft-=bodyOffset.left),enoughRoomOnRight||(dropLeft=offset.left+this.container.outerWidth(!1)-dropWidth),css={left:dropLeft,width:width},above?(css.top=offset.top-dropHeight,css.bottom="auto",this.container.addClass("select2-drop-above"),$dropdown.addClass("select2-drop-above")):(css.top=dropTop,css.bottom="auto",this.container.removeClass("select2-drop-above"),$dropdown.removeClass("select2-drop-above")),css=$.extend(css,evaluate(this.opts.dropdownCss)),$dropdown.css(css)
7
- },shouldOpen:function(){var event;return this.opened()?!1:this._enabled===!1||this._readonly===!0?!1:(event=$.Event("select2-opening"),this.opts.element.trigger(event),!event.isDefaultPrevented())},clearDropdownAlignmentPreference:function(){this.container.removeClass("select2-drop-above"),this.dropdown.removeClass("select2-drop-above")},open:function(){return this.shouldOpen()?(this.opening(),!0):!1},opening:function(){var mask,cid=this.containerEventName,scroll="scroll."+cid,resize="resize."+cid,orient="orientationchange."+cid;this.container.addClass("select2-dropdown-open").addClass("select2-container-active"),this.clearDropdownAlignmentPreference(),this.dropdown[0]!==this.body.children().last()[0]&&this.dropdown.detach().appendTo(this.body),mask=$("#select2-drop-mask"),0==mask.length&&(mask=$(document.createElement("div")),mask.attr("id","select2-drop-mask").attr("class","select2-drop-mask"),mask.hide(),mask.appendTo(this.body),mask.on("mousedown touchstart click",function(e){reinsertElement(mask);var self,dropdown=$("#select2-drop");dropdown.length>0&&(self=dropdown.data("select2"),self.opts.selectOnBlur&&self.selectHighlighted({noFocus:!0}),self.close(),e.preventDefault(),e.stopPropagation())})),this.dropdown.prev()[0]!==mask[0]&&this.dropdown.before(mask),$("#select2-drop").removeAttr("id"),this.dropdown.attr("id","select2-drop"),mask.show(),this.positionDropdown(),this.dropdown.show(),this.positionDropdown(),this.dropdown.addClass("select2-drop-active");var that=this;this.container.parents().add(window).each(function(){$(this).on(resize+" "+scroll+" "+orient,function(){that.opened()&&that.positionDropdown()})})},close:function(){if(this.opened()){var cid=this.containerEventName,scroll="scroll."+cid,resize="resize."+cid,orient="orientationchange."+cid;this.container.parents().add(window).each(function(){$(this).off(scroll).off(resize).off(orient)}),this.clearDropdownAlignmentPreference(),$("#select2-drop-mask").hide(),this.dropdown.removeAttr("id"),this.dropdown.hide(),this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active"),this.results.empty(),this.clearSearch(),this.search.removeClass("select2-active"),this.opts.element.trigger($.Event("select2-close"))}},externalSearch:function(term){this.open(),this.search.val(term),this.updateResults(!1)},clearSearch:function(){},getMaximumSelectionSize:function(){return evaluate(this.opts.maximumSelectionSize)},ensureHighlightVisible:function(){var children,index,child,hb,rb,y,more,results=this.results;if(index=this.highlight(),!(0>index)){if(0==index)return void results.scrollTop(0);children=this.findHighlightableChoices().find(".select2-result-label"),child=$(children[index]),hb=child.offset().top+child.outerHeight(!0),index===children.length-1&&(more=results.find("li.select2-more-results"),more.length>0&&(hb=more.offset().top+more.outerHeight(!0))),rb=results.offset().top+results.outerHeight(!0),hb>rb&&results.scrollTop(results.scrollTop()+(hb-rb)),y=child.offset().top-results.offset().top,0>y&&"none"!=child.css("display")&&results.scrollTop(results.scrollTop()+y)}},findHighlightableChoices:function(){return this.results.find(".select2-result-selectable:not(.select2-disabled):not(.select2-selected)")},moveHighlight:function(delta){for(var choices=this.findHighlightableChoices(),index=this.highlight();index>-1&&index<choices.length;){index+=delta;var choice=$(choices[index]);if(choice.hasClass("select2-result-selectable")&&!choice.hasClass("select2-disabled")&&!choice.hasClass("select2-selected")){this.highlight(index);break}}},highlight:function(index){var choice,data,choices=this.findHighlightableChoices();return 0===arguments.length?indexOf(choices.filter(".select2-highlighted")[0],choices.get()):(index>=choices.length&&(index=choices.length-1),0>index&&(index=0),this.removeHighlight(),choice=$(choices[index]),choice.addClass("select2-highlighted"),this.search.attr("aria-activedescendant",choice.find(".select2-result-label").attr("id")),this.ensureHighlightVisible(),this.liveRegion.text(choice.text()),data=choice.data("select2-data"),void(data&&this.opts.element.trigger({type:"select2-highlight",val:this.id(data),choice:data})))},removeHighlight:function(){this.results.find(".select2-highlighted").removeClass("select2-highlighted")},touchMoved:function(){this._touchMoved=!0},clearTouchMoved:function(){this._touchMoved=!1},countSelectableResults:function(){return this.findHighlightableChoices().length},highlightUnderEvent:function(event){var el=$(event.target).closest(".select2-result-selectable");if(el.length>0&&!el.is(".select2-highlighted")){var choices=this.findHighlightableChoices();this.highlight(choices.index(el))}else 0==el.length&&this.removeHighlight()},loadMoreIfNeeded:function(){var below,results=this.results,more=results.find("li.select2-more-results"),page=this.resultsPage+1,self=this,term=this.search.val(),context=this.context;0!==more.length&&(below=more.offset().top-results.offset().top-results.height(),below<=this.opts.loadMorePadding&&(more.addClass("select2-active"),this.opts.query({element:this.opts.element,term:term,page:page,context:context,matcher:this.opts.matcher,callback:this.bind(function(data){self.opened()&&(self.opts.populateResults.call(this,results,data.results,{term:term,page:page,context:context}),self.postprocessResults(data,!1,!1),data.more===!0?(more.detach().appendTo(results).text(evaluate(self.opts.formatLoadMore,page+1)),window.setTimeout(function(){self.loadMoreIfNeeded()},10)):more.remove(),self.positionDropdown(),self.resultsPage=page,self.context=data.context,this.opts.element.trigger({type:"select2-loaded",items:data}))})})))},tokenize:function(){},updateResults:function(initial){function postRender(){search.removeClass("select2-active"),self.positionDropdown(),self.liveRegion.text(results.find(".select2-no-results,.select2-selection-limit,.select2-searching").length?results.text():self.opts.formatMatches(results.find(".select2-result-selectable").length))}function render(html){results.html(html),postRender()}var data,input,queryNumber,search=this.search,results=this.results,opts=this.opts,self=this,term=search.val(),lastTerm=$.data(this.container,"select2-last-term");if((initial===!0||!lastTerm||!equal(term,lastTerm))&&($.data(this.container,"select2-last-term",term),initial===!0||this.showSearchInput!==!1&&this.opened())){queryNumber=++this.queryCount;var maxSelSize=this.getMaximumSelectionSize();if(maxSelSize>=1&&(data=this.data(),$.isArray(data)&&data.length>=maxSelSize&&checkFormatter(opts.formatSelectionTooBig,"formatSelectionTooBig")))return void render("<li class='select2-selection-limit'>"+evaluate(opts.formatSelectionTooBig,maxSelSize)+"</li>");if(search.val().length<opts.minimumInputLength)return render(checkFormatter(opts.formatInputTooShort,"formatInputTooShort")?"<li class='select2-no-results'>"+evaluate(opts.formatInputTooShort,search.val(),opts.minimumInputLength)+"</li>":""),void(initial&&this.showSearch&&this.showSearch(!0));if(opts.maximumInputLength&&search.val().length>opts.maximumInputLength)return void render(checkFormatter(opts.formatInputTooLong,"formatInputTooLong")?"<li class='select2-no-results'>"+evaluate(opts.formatInputTooLong,search.val(),opts.maximumInputLength)+"</li>":"");opts.formatSearching&&0===this.findHighlightableChoices().length&&render("<li class='select2-searching'>"+evaluate(opts.formatSearching)+"</li>"),search.addClass("select2-active"),this.removeHighlight(),input=this.tokenize(),input!=undefined&&null!=input&&search.val(input),this.resultsPage=1,opts.query({element:opts.element,term:search.val(),page:this.resultsPage,context:null,matcher:opts.matcher,callback:this.bind(function(data){var def;if(queryNumber==this.queryCount){if(!this.opened())return void this.search.removeClass("select2-active");if(this.context=data.context===undefined?null:data.context,this.opts.createSearchChoice&&""!==search.val()&&(def=this.opts.createSearchChoice.call(self,search.val(),data.results),def!==undefined&&null!==def&&self.id(def)!==undefined&&null!==self.id(def)&&0===$(data.results).filter(function(){return equal(self.id(this),self.id(def))}).length&&this.opts.createSearchChoicePosition(data.results,def)),0===data.results.length&&checkFormatter(opts.formatNoMatches,"formatNoMatches"))return void render("<li class='select2-no-results'>"+evaluate(opts.formatNoMatches,search.val())+"</li>");results.empty(),self.opts.populateResults.call(this,results,data.results,{term:search.val(),page:this.resultsPage,context:null}),data.more===!0&&checkFormatter(opts.formatLoadMore,"formatLoadMore")&&(results.append("<li class='select2-more-results'>"+self.opts.escapeMarkup(evaluate(opts.formatLoadMore,this.resultsPage))+"</li>"),window.setTimeout(function(){self.loadMoreIfNeeded()},10)),this.postprocessResults(data,initial),postRender(),this.opts.element.trigger({type:"select2-loaded",items:data})}})})}},cancel:function(){this.close()},blur:function(){this.opts.selectOnBlur&&this.selectHighlighted({noFocus:!0}),this.close(),this.container.removeClass("select2-container-active"),this.search[0]===document.activeElement&&this.search.blur(),this.clearSearch(),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus")},focusSearch:function(){focus(this.search)},selectHighlighted:function(options){if(this._touchMoved)return void this.clearTouchMoved();var index=this.highlight(),highlighted=this.results.find(".select2-highlighted"),data=highlighted.closest(".select2-result").data("select2-data");data?(this.highlight(index),this.onSelect(data,options)):options&&options.noFocus&&this.close()},getPlaceholder:function(){var placeholderOption;return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||this.opts.placeholder||((placeholderOption=this.getPlaceholderOption())!==undefined?placeholderOption.text():undefined)},getPlaceholderOption:function(){if(this.select){var firstOption=this.select.children("option").first();if(this.opts.placeholderOption!==undefined)return"first"===this.opts.placeholderOption&&firstOption||"function"==typeof this.opts.placeholderOption&&this.opts.placeholderOption(this.select);if(""===$.trim(firstOption.text())&&""===firstOption.val())return firstOption}},initContainerWidth:function(){function resolveContainerWidth(){var style,attrs,matches,i,l,attr;if("off"===this.opts.width)return null;if("element"===this.opts.width)return 0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px";if("copy"===this.opts.width||"resolve"===this.opts.width){if(style=this.opts.element.attr("style"),style!==undefined)for(attrs=style.split(";"),i=0,l=attrs.length;l>i;i+=1)if(attr=attrs[i].replace(/\s/g,""),matches=attr.match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i),null!==matches&&matches.length>=1)return matches[1];return"resolve"===this.opts.width?(style=this.opts.element.css("width"),style.indexOf("%")>0?style:0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px"):null}return $.isFunction(this.opts.width)?this.opts.width():this.opts.width}var width=resolveContainerWidth.call(this);null!==width&&this.container.css("width",width)}}),SingleSelect2=clazz(AbstractSelect2,{createContainer:function(){var container=$(document.createElement("div")).attr({"class":"select2-container"}).html(["<a href='javascript:void(0)' class='select2-choice' tabindex='-1'>"," <span class='select2-chosen'>&#160;</span><abbr class='select2-search-choice-close'></abbr>"," <span class='select2-arrow' role='presentation'><b role='presentation'></b></span>","</a>","<label for='' class='select2-offscreen'></label>","<input class='select2-focusser select2-offscreen' type='text' aria-haspopup='true' role='button' />","<div class='select2-drop select2-display-none'>"," <div class='select2-search'>"," <label for='' class='select2-offscreen'></label>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input' role='combobox' aria-expanded='true'"," aria-autocomplete='list' />"," </div>"," <ul class='select2-results' role='listbox'>"," </ul>","</div>"].join(""));return container},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var el,range,len;this.opts.minimumResultsForSearch>=0&&this.showSearch(!0),this.parent.opening.apply(this,arguments),this.showSearchInput!==!1&&this.search.val(this.focusser.val()),this.opts.shouldFocusInput(this)&&(this.search.focus(),el=this.search.get(0),el.createTextRange?(range=el.createTextRange(),range.collapse(!1),range.select()):el.setSelectionRange&&(len=this.search.val().length,el.setSelectionRange(len,len))),""===this.search.val()&&this.nextSearchTerm!=undefined&&(this.search.val(this.nextSearchTerm),this.search.select()),this.focusser.prop("disabled",!0).val(""),this.updateResults(!0),this.opts.element.trigger($.Event("select2-open"))},close:function(){this.opened()&&(this.parent.close.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},focus:function(){this.opened()?this.close():(this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},isFocused:function(){return this.container.hasClass("select2-container-active")},cancel:function(){this.parent.cancel.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus()},destroy:function(){$("label[for='"+this.focusser.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),cleanupJQueryElements.call(this,"selection","focusser")},initContainer:function(){var selection,elementLabel,container=this.container,dropdown=this.dropdown,idSuffix=nextUid();this.showSearch(this.opts.minimumResultsForSearch<0?!1:!0),this.selection=selection=container.find(".select2-choice"),this.focusser=container.find(".select2-focusser"),selection.find(".select2-chosen").attr("id","select2-chosen-"+idSuffix),this.focusser.attr("aria-labelledby","select2-chosen-"+idSuffix),this.results.attr("id","select2-results-"+idSuffix),this.search.attr("aria-owns","select2-results-"+idSuffix),this.focusser.attr("id","s2id_autogen"+idSuffix),elementLabel=$("label[for='"+this.opts.element.attr("id")+"']"),this.focusser.prev().text(elementLabel.text()).attr("for",this.focusser.attr("id"));var originalTitle=this.opts.element.attr("title");this.opts.element.attr("title",originalTitle||elementLabel.text()),this.focusser.attr("tabindex",this.elementTabIndex),this.search.attr("id",this.focusser.attr("id")+"_search"),this.search.prev().text($("label[for='"+this.focusser.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.search.on("keydown",this.bind(function(e){if(this.isInterfaceEnabled()){if(e.which===KEY.PAGE_UP||e.which===KEY.PAGE_DOWN)return void killEvent(e);switch(e.which){case KEY.UP:case KEY.DOWN:return this.moveHighlight(e.which===KEY.UP?-1:1),void killEvent(e);case KEY.ENTER:return this.selectHighlighted(),void killEvent(e);case KEY.TAB:return void this.selectHighlighted({noFocus:!0});case KEY.ESC:return this.cancel(e),void killEvent(e)}}})),this.search.on("blur",this.bind(function(){document.activeElement===this.body.get(0)&&window.setTimeout(this.bind(function(){this.opened()&&this.search.focus()}),0)})),this.focusser.on("keydown",this.bind(function(e){if(this.isInterfaceEnabled()&&e.which!==KEY.TAB&&!KEY.isControl(e)&&!KEY.isFunctionKey(e)&&e.which!==KEY.ESC){if(this.opts.openOnEnter===!1&&e.which===KEY.ENTER)return void killEvent(e);if(e.which==KEY.DOWN||e.which==KEY.UP||e.which==KEY.ENTER&&this.opts.openOnEnter){if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey)return;return this.open(),void killEvent(e)}return e.which==KEY.DELETE||e.which==KEY.BACKSPACE?(this.opts.allowClear&&this.clear(),void killEvent(e)):void 0}})),installKeyUpChangeEvent(this.focusser),this.focusser.on("keyup-change input",this.bind(function(e){if(this.opts.minimumResultsForSearch>=0){if(e.stopPropagation(),this.opened())return;this.open()}})),selection.on("mousedown touchstart","abbr",this.bind(function(e){this.isInterfaceEnabled()&&(this.clear(),killEventImmediately(e),this.close(),this.selection.focus())})),selection.on("mousedown touchstart",this.bind(function(e){reinsertElement(selection),this.container.hasClass("select2-container-active")||this.opts.element.trigger($.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),killEvent(e)})),dropdown.on("mousedown touchstart",this.bind(function(){this.opts.shouldFocusInput(this)&&this.search.focus()})),selection.on("focus",this.bind(function(e){killEvent(e)})),this.focusser.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger($.Event("select2-focus")),this.container.addClass("select2-container-active")})).on("blur",this.bind(function(){this.opened()||(this.container.removeClass("select2-container-active"),this.opts.element.trigger($.Event("select2-blur")))})),this.search.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger($.Event("select2-focus")),this.container.addClass("select2-container-active")})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.setPlaceholder()},clear:function(triggerChange){var data=this.selection.data("select2-data");if(data){var evt=$.Event("select2-clearing");if(this.opts.element.trigger(evt),evt.isDefaultPrevented())return;var placeholderOption=this.getPlaceholderOption();this.opts.element.val(placeholderOption?placeholderOption.val():""),this.selection.find(".select2-chosen").empty(),this.selection.removeData("select2-data"),this.setPlaceholder(),triggerChange!==!1&&(this.opts.element.trigger({type:"select2-removed",val:this.id(data),choice:data}),this.triggerChange({removed:data}))}},initSelection:function(){if(this.isPlaceholderOptionSelected())this.updateSelection(null),this.close(),this.setPlaceholder();else{var self=this;this.opts.initSelection.call(null,this.opts.element,function(selected){selected!==undefined&&null!==selected&&(self.updateSelection(selected),self.close(),self.setPlaceholder(),self.nextSearchTerm=self.opts.nextSearchTerm(selected,self.search.val()))})}},isPlaceholderOptionSelected:function(){var placeholderOption;return this.getPlaceholder()===undefined?!1:(placeholderOption=this.getPlaceholderOption())!==undefined&&placeholderOption.prop("selected")||""===this.opts.element.val()||this.opts.element.val()===undefined||null===this.opts.element.val()},prepareOpts:function(){var opts=this.parent.prepareOpts.apply(this,arguments),self=this;return"select"===opts.element.get(0).tagName.toLowerCase()?opts.initSelection=function(element,callback){var selected=element.find("option").filter(function(){return this.selected&&!this.disabled});callback(self.optionToData(selected))}:"data"in opts&&(opts.initSelection=opts.initSelection||function(element,callback){var id=element.val(),match=null;opts.query({matcher:function(term,text,el){var is_match=equal(id,opts.id(el));return is_match&&(match=el),is_match},callback:$.isFunction(callback)?function(){callback(match)}:$.noop})}),opts},getPlaceholder:function(){return this.select&&this.getPlaceholderOption()===undefined?undefined:this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var placeholder=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&placeholder!==undefined){if(this.select&&this.getPlaceholderOption()===undefined)return;this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(placeholder)),this.selection.addClass("select2-default"),this.container.removeClass("select2-allowclear")}},postprocessResults:function(data,initial,noHighlightUpdate){var selected=0,self=this;if(this.findHighlightableChoices().each2(function(i,elm){return equal(self.id(elm.data("select2-data")),self.opts.element.val())?(selected=i,!1):void 0}),noHighlightUpdate!==!1&&this.highlight(initial===!0&&selected>=0?selected:0),initial===!0){var min=this.opts.minimumResultsForSearch;min>=0&&this.showSearch(countResults(data.results)>=min)}},showSearch:function(showSearchInput){this.showSearchInput!==showSearchInput&&(this.showSearchInput=showSearchInput,this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!showSearchInput),this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!showSearchInput),$(this.dropdown,this.container).toggleClass("select2-with-searchbox",showSearchInput))},onSelect:function(data,options){if(this.triggerSelect(data)){var old=this.opts.element.val(),oldData=this.data();this.opts.element.val(this.id(data)),this.updateSelection(data),this.opts.element.trigger({type:"select2-selected",val:this.id(data),choice:data}),this.nextSearchTerm=this.opts.nextSearchTerm(data,this.search.val()),this.close(),options&&options.noFocus||!this.opts.shouldFocusInput(this)||this.focusser.focus(),equal(old,this.id(data))||this.triggerChange({added:data,removed:oldData})}},updateSelection:function(data){var formatted,cssClass,container=this.selection.find(".select2-chosen");this.selection.data("select2-data",data),container.empty(),null!==data&&(formatted=this.opts.formatSelection(data,container,this.opts.escapeMarkup)),formatted!==undefined&&container.append(formatted),cssClass=this.opts.formatSelectionCssClass(data,container),cssClass!==undefined&&container.addClass(cssClass),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==undefined&&this.container.addClass("select2-allowclear")},val:function(){var val,triggerChange=!1,data=null,self=this,oldData=this.data();if(0===arguments.length)return this.opts.element.val();if(val=arguments[0],arguments.length>1&&(triggerChange=arguments[1]),this.select)this.select.val(val).find("option").filter(function(){return this.selected}).each2(function(i,elm){return data=self.optionToData(elm),!1}),this.updateSelection(data),this.setPlaceholder(),triggerChange&&this.triggerChange({added:data,removed:oldData});else{if(!val&&0!==val)return void this.clear(triggerChange);if(this.opts.initSelection===undefined)throw new Error("cannot call val() if initSelection() is not defined");this.opts.element.val(val),this.opts.initSelection(this.opts.element,function(data){self.opts.element.val(data?self.id(data):""),self.updateSelection(data),self.setPlaceholder(),triggerChange&&self.triggerChange({added:data,removed:oldData})})}},clearSearch:function(){this.search.val(""),this.focusser.val("")},data:function(value){var data,triggerChange=!1;return 0===arguments.length?(data=this.selection.data("select2-data"),data==undefined&&(data=null),data):(arguments.length>1&&(triggerChange=arguments[1]),void(value?(data=this.data(),this.opts.element.val(value?this.id(value):""),this.updateSelection(value),triggerChange&&this.triggerChange({added:value,removed:data})):this.clear(triggerChange)))}}),MultiSelect2=clazz(AbstractSelect2,{createContainer:function(){var container=$(document.createElement("div")).attr({"class":"select2-container select2-container-multi"}).html(["<ul class='select2-choices'>"," <li class='select2-search-field'>"," <label for='' class='select2-offscreen'></label>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'>"," </li>","</ul>","<div class='select2-drop select2-drop-multi select2-display-none'>"," <ul class='select2-results'>"," </ul>","</div>"].join(""));return container},prepareOpts:function(){var opts=this.parent.prepareOpts.apply(this,arguments),self=this;return"select"===opts.element.get(0).tagName.toLowerCase()?opts.initSelection=function(element,callback){var data=[];element.find("option").filter(function(){return this.selected&&!this.disabled}).each2(function(i,elm){data.push(self.optionToData(elm))}),callback(data)}:"data"in opts&&(opts.initSelection=opts.initSelection||function(element,callback){var ids=splitVal(element.val(),opts.separator),matches=[];opts.query({matcher:function(term,text,el){var is_match=$.grep(ids,function(id){return equal(id,opts.id(el))}).length;return is_match&&matches.push(el),is_match},callback:$.isFunction(callback)?function(){for(var ordered=[],i=0;i<ids.length;i++)for(var id=ids[i],j=0;j<matches.length;j++){var match=matches[j];if(equal(id,opts.id(match))){ordered.push(match),matches.splice(j,1);break}}callback(ordered)}:$.noop})}),opts},selectChoice:function(choice){var selected=this.container.find(".select2-search-choice-focus");selected.length&&choice&&choice[0]==selected[0]||(selected.length&&this.opts.element.trigger("choice-deselected",selected),selected.removeClass("select2-search-choice-focus"),choice&&choice.length&&(this.close(),choice.addClass("select2-search-choice-focus"),this.opts.element.trigger("choice-selected",choice)))},destroy:function(){$("label[for='"+this.search.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),cleanupJQueryElements.call(this,"searchContainer","selection")},initContainer:function(){var selection,selector=".select2-choices";this.searchContainer=this.container.find(".select2-search-field"),this.selection=selection=this.container.find(selector);var _this=this;this.selection.on("click",".select2-search-choice:not(.select2-locked)",function(){_this.search[0].focus(),_this.selectChoice($(this))}),this.search.attr("id","s2id_autogen"+nextUid()),this.search.prev().text($("label[for='"+this.opts.element.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.search.on("input paste",this.bind(function(){this.isInterfaceEnabled()&&(this.opened()||this.open())})),this.search.attr("tabindex",this.elementTabIndex),this.keydowns=0,this.search.on("keydown",this.bind(function(e){if(this.isInterfaceEnabled()){++this.keydowns;var selected=selection.find(".select2-search-choice-focus"),prev=selected.prev(".select2-search-choice:not(.select2-locked)"),next=selected.next(".select2-search-choice:not(.select2-locked)"),pos=getCursorInfo(this.search);if(selected.length&&(e.which==KEY.LEFT||e.which==KEY.RIGHT||e.which==KEY.BACKSPACE||e.which==KEY.DELETE||e.which==KEY.ENTER)){var selectedChoice=selected;return e.which==KEY.LEFT&&prev.length?selectedChoice=prev:e.which==KEY.RIGHT?selectedChoice=next.length?next:null:e.which===KEY.BACKSPACE?this.unselect(selected.first())&&(this.search.width(10),selectedChoice=prev.length?prev:next):e.which==KEY.DELETE?this.unselect(selected.first())&&(this.search.width(10),selectedChoice=next.length?next:null):e.which==KEY.ENTER&&(selectedChoice=null),this.selectChoice(selectedChoice),killEvent(e),void(selectedChoice&&selectedChoice.length||this.open())}if((e.which===KEY.BACKSPACE&&1==this.keydowns||e.which==KEY.LEFT)&&0==pos.offset&&!pos.length)return this.selectChoice(selection.find(".select2-search-choice:not(.select2-locked)").last()),void killEvent(e);if(this.selectChoice(null),this.opened())switch(e.which){case KEY.UP:case KEY.DOWN:return this.moveHighlight(e.which===KEY.UP?-1:1),void killEvent(e);case KEY.ENTER:return this.selectHighlighted(),void killEvent(e);case KEY.TAB:return this.selectHighlighted({noFocus:!0}),void this.close();case KEY.ESC:return this.cancel(e),void killEvent(e)}if(e.which!==KEY.TAB&&!KEY.isControl(e)&&!KEY.isFunctionKey(e)&&e.which!==KEY.BACKSPACE&&e.which!==KEY.ESC){if(e.which===KEY.ENTER){if(this.opts.openOnEnter===!1)return;if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey)return}this.open(),(e.which===KEY.PAGE_UP||e.which===KEY.PAGE_DOWN)&&killEvent(e),e.which===KEY.ENTER&&killEvent(e)}}})),this.search.on("keyup",this.bind(function(){this.keydowns=0,this.resizeSearch()})),this.search.on("blur",this.bind(function(e){this.container.removeClass("select2-container-active"),this.search.removeClass("select2-focused"),this.selectChoice(null),this.opened()||this.clearSearch(),e.stopImmediatePropagation(),this.opts.element.trigger($.Event("select2-blur"))})),this.container.on("click",selector,this.bind(function(e){this.isInterfaceEnabled()&&($(e.target).closest(".select2-search-choice").length>0||(this.selectChoice(null),this.clearPlaceholder(),this.container.hasClass("select2-container-active")||this.opts.element.trigger($.Event("select2-focus")),this.open(),this.focusSearch(),e.preventDefault()))})),this.container.on("focus",selector,this.bind(function(){this.isInterfaceEnabled()&&(this.container.hasClass("select2-container-active")||this.opts.element.trigger($.Event("select2-focus")),this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"),this.clearPlaceholder())})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.clearSearch()},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.search.prop("disabled",!this.isInterfaceEnabled())},initSelection:function(){if(""===this.opts.element.val()&&""===this.opts.element.text()&&(this.updateSelection([]),this.close(),this.clearSearch()),this.select||""!==this.opts.element.val()){var self=this;this.opts.initSelection.call(null,this.opts.element,function(data){data!==undefined&&null!==data&&(self.updateSelection(data),self.close(),self.clearSearch())})}},clearSearch:function(){var placeholder=this.getPlaceholder(),maxWidth=this.getMaxSearchWidth();placeholder!==undefined&&0===this.getVal().length&&this.search.hasClass("select2-focused")===!1?(this.search.val(placeholder).addClass("select2-default"),this.search.width(maxWidth>0?maxWidth:this.container.css("width"))):this.search.val("").width(10)},clearPlaceholder:function(){this.search.hasClass("select2-default")&&this.search.val("").removeClass("select2-default")},opening:function(){this.clearPlaceholder(),this.resizeSearch(),this.parent.opening.apply(this,arguments),this.focusSearch(),""===this.search.val()&&this.nextSearchTerm!=undefined&&(this.search.val(this.nextSearchTerm),this.search.select()),this.updateResults(!0),this.opts.shouldFocusInput(this)&&this.search.focus(),this.opts.element.trigger($.Event("select2-open"))},close:function(){this.opened()&&this.parent.close.apply(this,arguments)},focus:function(){this.close(),this.search.focus()},isFocused:function(){return this.search.hasClass("select2-focused")},updateSelection:function(data){var ids=[],filtered=[],self=this;$(data).each(function(){indexOf(self.id(this),ids)<0&&(ids.push(self.id(this)),filtered.push(this))}),data=filtered,this.selection.find(".select2-search-choice").remove(),$(data).each(function(){self.addSelectedChoice(this)}),self.postprocessResults()},tokenize:function(){var input=this.search.val();input=this.opts.tokenizer.call(this,input,this.data(),this.bind(this.onSelect),this.opts),null!=input&&input!=undefined&&(this.search.val(input),input.length>0&&this.open())},onSelect:function(data,options){this.triggerSelect(data)&&(this.addSelectedChoice(data),this.opts.element.trigger({type:"selected",val:this.id(data),choice:data}),this.nextSearchTerm=this.opts.nextSearchTerm(data,this.search.val()),this.clearSearch(),this.updateResults(),(this.select||!this.opts.closeOnSelect)&&this.postprocessResults(data,!1,this.opts.closeOnSelect===!0),this.opts.closeOnSelect?(this.close(),this.search.width(10)):this.countSelectableResults()>0?(this.search.width(10),this.resizeSearch(),this.getMaximumSelectionSize()>0&&this.val().length>=this.getMaximumSelectionSize()?this.updateResults(!0):this.nextSearchTerm!=undefined&&(this.search.val(this.nextSearchTerm),this.updateResults(),this.search.select()),this.positionDropdown()):(this.close(),this.search.width(10)),this.triggerChange({added:data}),options&&options.noFocus||this.focusSearch())},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(data){var formatted,cssClass,enableChoice=!data.locked,enabledItem=$("<li class='select2-search-choice'> <div></div> <a href='#' class='select2-search-choice-close' tabindex='-1'></a></li>"),disabledItem=$("<li class='select2-search-choice select2-locked'><div></div></li>"),choice=enableChoice?enabledItem:disabledItem,id=this.id(data),val=this.getVal();
8
- formatted=this.opts.formatSelection(data,choice.find("div"),this.opts.escapeMarkup),formatted!=undefined&&choice.find("div").replaceWith("<div>"+formatted+"</div>"),cssClass=this.opts.formatSelectionCssClass(data,choice.find("div")),cssClass!=undefined&&choice.addClass(cssClass),enableChoice&&choice.find(".select2-search-choice-close").on("mousedown",killEvent).on("click dblclick",this.bind(function(e){this.isInterfaceEnabled()&&(this.unselect($(e.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),killEvent(e),this.close(),this.focusSearch())})).on("focus",this.bind(function(){this.isInterfaceEnabled()&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))})),choice.data("select2-data",data),choice.insertBefore(this.searchContainer),val.push(id),this.setVal(val)},unselect:function(selected){var data,index,val=this.getVal();if(selected=selected.closest(".select2-search-choice"),0===selected.length)throw"Invalid argument: "+selected+". Must be .select2-search-choice";if(data=selected.data("select2-data")){var evt=$.Event("select2-removing");if(evt.val=this.id(data),evt.choice=data,this.opts.element.trigger(evt),evt.isDefaultPrevented())return!1;for(;(index=indexOf(this.id(data),val))>=0;)val.splice(index,1),this.setVal(val),this.select&&this.postprocessResults();return selected.remove(),this.opts.element.trigger({type:"select2-removed",val:this.id(data),choice:data}),this.triggerChange({removed:data}),!0}},postprocessResults:function(data,initial,noHighlightUpdate){var val=this.getVal(),choices=this.results.find(".select2-result"),compound=this.results.find(".select2-result-with-children"),self=this;choices.each2(function(i,choice){var id=self.id(choice.data("select2-data"));indexOf(id,val)>=0&&(choice.addClass("select2-selected"),choice.find(".select2-result-selectable").addClass("select2-selected"))}),compound.each2(function(i,choice){choice.is(".select2-result-selectable")||0!==choice.find(".select2-result-selectable:not(.select2-selected)").length||choice.addClass("select2-selected")}),-1==this.highlight()&&noHighlightUpdate!==!1&&self.highlight(0),!this.opts.createSearchChoice&&!choices.filter(".select2-result:not(.select2-selected)").length>0&&(!data||data&&!data.more&&0===this.results.find(".select2-no-results").length)&&checkFormatter(self.opts.formatNoMatches,"formatNoMatches")&&this.results.append("<li class='select2-no-results'>"+evaluate(self.opts.formatNoMatches,self.search.val())+"</li>")},getMaxSearchWidth:function(){return this.selection.width()-getSideBorderPadding(this.search)},resizeSearch:function(){var minimumWidth,left,maxWidth,containerLeft,searchWidth,sideBorderPadding=getSideBorderPadding(this.search);minimumWidth=measureTextWidth(this.search)+10,left=this.search.offset().left,maxWidth=this.selection.width(),containerLeft=this.selection.offset().left,searchWidth=maxWidth-(left-containerLeft)-sideBorderPadding,minimumWidth>searchWidth&&(searchWidth=maxWidth-sideBorderPadding),40>searchWidth&&(searchWidth=maxWidth-sideBorderPadding),0>=searchWidth&&(searchWidth=minimumWidth),this.search.width(Math.floor(searchWidth))},getVal:function(){var val;return this.select?(val=this.select.val(),null===val?[]:val):(val=this.opts.element.val(),splitVal(val,this.opts.separator))},setVal:function(val){var unique;this.select?this.select.val(val):(unique=[],$(val).each(function(){indexOf(this,unique)<0&&unique.push(this)}),this.opts.element.val(0===unique.length?"":unique.join(this.opts.separator)))},buildChangeDetails:function(old,current){for(var current=current.slice(0),old=old.slice(0),i=0;i<current.length;i++)for(var j=0;j<old.length;j++)equal(this.opts.id(current[i]),this.opts.id(old[j]))&&(current.splice(i,1),i>0&&i--,old.splice(j,1),j--);return{added:current,removed:old}},val:function(val,triggerChange){var oldData,self=this;if(0===arguments.length)return this.getVal();if(oldData=this.data(),oldData.length||(oldData=[]),!val&&0!==val)return this.opts.element.val(""),this.updateSelection([]),this.clearSearch(),void(triggerChange&&this.triggerChange({added:this.data(),removed:oldData}));if(this.setVal(val),this.select)this.opts.initSelection(this.select,this.bind(this.updateSelection)),triggerChange&&this.triggerChange(this.buildChangeDetails(oldData,this.data()));else{if(this.opts.initSelection===undefined)throw new Error("val() cannot be called if initSelection() is not defined");this.opts.initSelection(this.opts.element,function(data){var ids=$.map(data,self.id);self.setVal(ids),self.updateSelection(data),self.clearSearch(),triggerChange&&self.triggerChange(self.buildChangeDetails(oldData,self.data()))})}this.clearSearch()},onSortStart:function(){if(this.select)throw new Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");this.search.width(0),this.searchContainer.hide()},onSortEnd:function(){var val=[],self=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each(function(){val.push(self.opts.id($(this).data("select2-data")))}),this.setVal(val),this.triggerChange()},data:function(values,triggerChange){var ids,old,self=this;return 0===arguments.length?this.selection.children(".select2-search-choice").map(function(){return $(this).data("select2-data")}).get():(old=this.data(),values||(values=[]),ids=$.map(values,function(e){return self.opts.id(e)}),this.setVal(ids),this.updateSelection(values),this.clearSearch(),triggerChange&&this.triggerChange(this.buildChangeDetails(old,this.data())),void 0)}}),$.fn.select2=function(){var opts,select2,method,value,multiple,args=Array.prototype.slice.call(arguments,0),allowedMethods=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","disable","readonly","positionDropdown","data","search"],valueMethods=["opened","isFocused","container","dropdown"],propertyMethods=["val","data"],methodsMap={search:"externalSearch"};return this.each(function(){if(0===args.length||"object"==typeof args[0])opts=0===args.length?{}:$.extend({},args[0]),opts.element=$(this),"select"===opts.element.get(0).tagName.toLowerCase()?multiple=opts.element.prop("multiple"):(multiple=opts.multiple||!1,"tags"in opts&&(opts.multiple=multiple=!0)),select2=multiple?new window.Select2["class"].multi:new window.Select2["class"].single,select2.init(opts);else{if("string"!=typeof args[0])throw"Invalid arguments to select2 plugin: "+args;if(indexOf(args[0],allowedMethods)<0)throw"Unknown method: "+args[0];if(value=undefined,select2=$(this).data("select2"),select2===undefined)return;if(method=args[0],"container"===method?value=select2.container:"dropdown"===method?value=select2.dropdown:(methodsMap[method]&&(method=methodsMap[method]),value=select2[method].apply(select2,args.slice(1))),indexOf(args[0],valueMethods)>=0||indexOf(args[0],propertyMethods)>=0&&1==args.length)return!1}}),value===undefined?this:value},$.fn.select2.defaults={width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(result,container,query,escapeMarkup){var markup=[];return markMatch(result.text,query.term,markup,escapeMarkup),markup.join("")},formatSelection:function(data,container,escapeMarkup){return data?escapeMarkup(data.text):undefined},sortResults:function(results){return results},formatResultCssClass:function(data){return data.css},formatSelectionCssClass:function(){return undefined},formatMatches:function(matches){return matches+" results are available, use up and down arrow keys to navigate."},formatNoMatches:function(){return"No matches found"},formatInputTooShort:function(input,min){var n=min-input.length;return"Please enter "+n+" or more character"+(1==n?"":"s")},formatInputTooLong:function(input,max){var n=input.length-max;return"Please delete "+n+" character"+(1==n?"":"s")},formatSelectionTooBig:function(limit){return"You can only select "+limit+" item"+(1==limit?"":"s")},formatLoadMore:function(){return"Loading more results…"},formatSearching:function(){return"Searching…"},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(e){return e==undefined?null:e.id},matcher:function(term,text){return stripDiacritics(""+text).toUpperCase().indexOf(stripDiacritics(""+term).toUpperCase())>=0},separator:",",tokenSeparators:[],tokenizer:defaultTokenizer,escapeMarkup:defaultEscapeMarkup,blurOnChange:!1,selectOnBlur:!1,adaptContainerCssClass:function(c){return c},adaptDropdownCssClass:function(){return null},nextSearchTerm:function(){return undefined},searchInputPlaceholder:"",createSearchChoicePosition:"top",shouldFocusInput:function(instance){var supportsTouchEvents="ontouchstart"in window||navigator.msMaxTouchPoints>0;return supportsTouchEvents&&instance.opts.minimumResultsForSearch<0?!1:!0}},$.fn.select2.ajaxDefaults={transport:$.ajax,params:{type:"GET",cache:!1,dataType:"json"}},window.Select2={query:{ajax:ajax,local:local,tags:tags},util:{debounce:debounce,markMatch:markMatch,escapeMarkup:defaultEscapeMarkup,stripDiacritics:stripDiacritics},"class":{"abstract":AbstractSelect2,single:SingleSelect2,multi:MultiSelect2}}}}(jQuery),jQuery(document).ready(function($){$("#filter_action, #filter_content, #filter_form").change(function(){$("#leadin-contacts-filter-button").addClass("button-primary")})});
 
 
 
 
 
 
 
 
assets/js/build/leadin-lazyload.js DELETED
File without changes
assets/js/build/leadin-lazyload.min.js DELETED
File without changes
assets/js/build/leadin-subscribe.js DELETED
@@ -1,520 +0,0 @@
1
- (function() {
2
- var vexFactory;
3
-
4
- vexFactory = function($) {
5
- var animationEndSupport, vex;
6
- animationEndSupport = false;
7
- $(function() {
8
- var s;
9
- s = (document.body || document.documentElement).style;
10
- animationEndSupport = s.animation !== void 0 || s.WebkitAnimation !== void 0 || s.MozAnimation !== void 0 || s.MsAnimation !== void 0 || s.OAnimation !== void 0;
11
- return $(window).bind('keyup.vex', function(event) {
12
- if (event.keyCode === 27) {
13
- return vex.closeByEscape();
14
- }
15
- });
16
- });
17
- return vex = {
18
- globalID: 1,
19
- animationEndEvent: 'animationend webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend',
20
- baseClassNames: {
21
- vex: 'vex',
22
- content: 'vex-content',
23
- overlay: 'vex-overlay',
24
- close: 'vex-close',
25
- closing: 'vex-closing',
26
- open: 'vex-open'
27
- },
28
- defaultOptions: {
29
- content: '',
30
- showCloseButton: true,
31
- escapeButtonCloses: true,
32
- overlayClosesOnClick: true,
33
- appendLocation: 'body',
34
- className: '',
35
- css: {},
36
- overlayClassName: '',
37
- overlayCSS: {},
38
- contentClassName: '',
39
- contentCSS: {},
40
- closeClassName: '',
41
- closeCSS: {}
42
- },
43
- open: function(options) {
44
- options = $.extend({}, vex.defaultOptions, options);
45
- options.id = vex.globalID;
46
- vex.globalID += 1;
47
- options.$vex = $('<div>').addClass(vex.baseClassNames.vex).addClass(options.className).css(options.css).data({
48
- vex: options
49
- });
50
- options.$vexOverlay = $('<div>').addClass(vex.baseClassNames.overlay).addClass(options.overlayClassName).css(options.overlayCSS).data({
51
- vex: options
52
- });
53
- if (options.overlayClosesOnClick) {
54
- options.$vexOverlay.bind('click.vex', function(e) {
55
- if (e.target !== this) {
56
- return;
57
- }
58
- return vex.close($(this).data().vex.id);
59
- });
60
- }
61
- options.$vex.append(options.$vexOverlay);
62
- options.$vexContent = $('<div>').addClass(vex.baseClassNames.content).addClass(options.contentClassName).css(options.contentCSS).append(options.content).data({
63
- vex: options
64
- });
65
- options.$vex.append(options.$vexContent);
66
- if (options.showCloseButton) {
67
- options.$closeButton = $('<div>').addClass(vex.baseClassNames.close).addClass(options.closeClassName).css(options.closeCSS).data({
68
- vex: options
69
- }).bind('click.vex', function() {
70
- return vex.close($(this).data().vex.id);
71
- });
72
- options.$vexContent.append(options.$closeButton);
73
- }
74
- $(options.appendLocation).append(options.$vex);
75
- vex.setupBodyClassName(options.$vex);
76
- if (options.afterOpen) {
77
- options.afterOpen(options.$vexContent, options);
78
- }
79
- setTimeout((function() {
80
- return options.$vexContent.trigger('vexOpen', options);
81
- }), 0);
82
- return options.$vexContent;
83
- },
84
- getAllVexes: function() {
85
- return $("." + vex.baseClassNames.vex + ":not(\"." + vex.baseClassNames.closing + "\") ." + vex.baseClassNames.content);
86
- },
87
- getVexByID: function(id) {
88
- return vex.getAllVexes().filter(function() {
89
- return $(this).data().vex.id === id;
90
- });
91
- },
92
- close: function(id) {
93
- var $lastVex;
94
- if (!id) {
95
- $lastVex = vex.getAllVexes().last();
96
- if (!$lastVex.length) {
97
- return false;
98
- }
99
- id = $lastVex.data().vex.id;
100
- }
101
- return vex.closeByID(id);
102
- },
103
- closeAll: function() {
104
- var ids;
105
- ids = vex.getAllVexes().map(function() {
106
- return $(this).data().vex.id;
107
- }).toArray();
108
- if (!(ids != null ? ids.length : void 0)) {
109
- return false;
110
- }
111
- $.each(ids.reverse(), function(index, id) {
112
- return vex.closeByID(id);
113
- });
114
- return true;
115
- },
116
- closeByID: function(id) {
117
- var $vex, $vexContent, beforeClose, close, options;
118
- $vexContent = vex.getVexByID(id);
119
- if (!$vexContent.length) {
120
- return;
121
- }
122
- $vex = $vexContent.data().vex.$vex;
123
- options = $.extend({}, $vexContent.data().vex);
124
- beforeClose = function() {
125
- if (options.beforeClose) {
126
- return options.beforeClose($vexContent, options);
127
- }
128
- };
129
- close = function() {
130
- $vexContent.trigger('vexClose', options);
131
- $vex.remove();
132
- if (options.afterClose) {
133
- return options.afterClose($vexContent, options);
134
- }
135
- };
136
- if (animationEndSupport) {
137
- beforeClose();
138
- $vex.unbind(vex.animationEndEvent).bind(vex.animationEndEvent, function() {
139
- return close();
140
- }).addClass(vex.baseClassNames.closing);
141
- } else {
142
- beforeClose();
143
- close();
144
- }
145
- return true;
146
- },
147
- closeByEscape: function() {
148
- var $lastVex, id, ids;
149
- ids = vex.getAllVexes().map(function() {
150
- return $(this).data().vex.id;
151
- }).toArray();
152
- if (!(ids != null ? ids.length : void 0)) {
153
- return false;
154
- }
155
- id = Math.max.apply(Math, ids);
156
- $lastVex = vex.getVexByID(id);
157
- if ($lastVex.data().vex.escapeButtonCloses !== true) {
158
- return false;
159
- }
160
- return vex.closeByID(id);
161
- },
162
- setupBodyClassName: function($vex) {
163
- return $vex.bind('vexOpen.vex', function() {
164
- return $('body').addClass(vex.baseClassNames.open);
165
- }).bind('vexClose.vex', function() {
166
- if (!vex.getAllVexes().length) {
167
- return $('body').removeClass(vex.baseClassNames.open);
168
- }
169
- });
170
- },
171
- hideLoading: function() {
172
- return $('.vex-loading-spinner').remove();
173
- },
174
- showLoading: function() {
175
- vex.hideLoading();
176
- return $('body').append("<div class=\"vex-loading-spinner " + vex.defaultOptions.className + "\"></div>");
177
- }
178
- };
179
- };
180
-
181
- if (typeof define === 'function' && define.amd) {
182
- define(['jquery'], vexFactory);
183
- } else if (typeof exports === 'object') {
184
- module.exports = vexFactory(require('jquery'));
185
- } else {
186
- window.vex = vexFactory(jQuery);
187
- }
188
-
189
- }).call(this);
190
-
191
- (function() {
192
- var vexDialogFactory;
193
-
194
- vexDialogFactory = function($, vex) {
195
- var $formToObject, dialog;
196
- if (vex == null) {
197
- return $.error('Vex is required to use vex.dialog');
198
- }
199
- $formToObject = function($form) {
200
- var object;
201
- object = {};
202
- $.each($form.serializeArray(), function() {
203
- if (object[this.name]) {
204
- if (!object[this.name].push) {
205
- object[this.name] = [object[this.name]];
206
- }
207
- return object[this.name].push(this.value || '');
208
- } else {
209
- return object[this.name] = this.value || '';
210
- }
211
- });
212
- return object;
213
- };
214
- dialog = {};
215
- dialog.buttons = {
216
- YES: {
217
- text: 'OK',
218
- type: 'submit',
219
- className: 'vex-dialog-button-primary'
220
- },
221
- NO: {
222
- text: 'Cancel',
223
- type: 'button',
224
- className: 'vex-dialog-button-secondary',
225
- click: function($vexContent, event) {
226
- $vexContent.data().vex.value = false;
227
- return vex.close($vexContent.data().vex.id);
228
- }
229
- }
230
- };
231
- dialog.defaultOptions = {
232
- callback: function(value) {},
233
- afterOpen: function() {},
234
- message: 'Message',
235
- input: "<input name=\"vex\" type=\"hidden\" value=\"_vex-empty-value\" />",
236
- value: false,
237
- buttons: [dialog.buttons.YES, dialog.buttons.NO],
238
- showCloseButton: false,
239
- onSubmit: function(event) {
240
- var $form, $vexContent;
241
- $form = $(this);
242
- $vexContent = $form.parent();
243
- event.preventDefault();
244
- event.stopPropagation();
245
- $vexContent.data().vex.value = dialog.getFormValueOnSubmit($formToObject($form));
246
- return vex.close($vexContent.data().vex.id);
247
- },
248
- focusFirstInput: true
249
- };
250
- dialog.defaultAlertOptions = {
251
- message: 'Alert',
252
- buttons: [dialog.buttons.YES]
253
- };
254
- dialog.defaultConfirmOptions = {
255
- message: 'Confirm'
256
- };
257
- dialog.open = function(options) {
258
- var $vexContent;
259
- options = $.extend({}, vex.defaultOptions, dialog.defaultOptions, options);
260
- options.content = dialog.buildDialogForm(options);
261
- options.beforeClose = function($vexContent) {
262
- return options.callback($vexContent.data().vex.value);
263
- };
264
- $vexContent = vex.open(options);
265
- if (options.focusFirstInput) {
266
- $vexContent.find('input[type="submit"], textarea, input[type="date"], input[type="datetime"], input[type="datetime-local"], input[type="email"], input[type="month"], input[type="number"], input[type="password"], input[type="search"], input[type="tel"], input[type="text"], input[type="time"], input[type="url"], input[type="week"]').first().focus();
267
- }
268
- return $vexContent;
269
- };
270
- dialog.alert = function(options) {
271
- if (typeof options === 'string') {
272
- options = {
273
- message: options
274
- };
275
- }
276
- options = $.extend({}, dialog.defaultAlertOptions, options);
277
- return dialog.open(options);
278
- };
279
- dialog.confirm = function(options) {
280
- if (typeof options === 'string') {
281
- return $.error('dialog.confirm(options) requires options.callback.');
282
- }
283
- options = $.extend({}, dialog.defaultConfirmOptions, options);
284
- return dialog.open(options);
285
- };
286
- dialog.prompt = function(options) {
287
- var defaultPromptOptions;
288
- if (typeof options === 'string') {
289
- return $.error('dialog.prompt(options) requires options.callback.');
290
- }
291
- defaultPromptOptions = {
292
- message: "<label for=\"vex\">" + (options.label || 'Prompt:') + "</label>",
293
- input: "<input name=\"vex\" type=\"text\" class=\"vex-dialog-prompt-input\" placeholder=\"" + (options.placeholder || '') + "\" value=\"" + (options.value || '') + "\" />"
294
- };
295
- options = $.extend({}, defaultPromptOptions, options);
296
- return dialog.open(options);
297
- };
298
- dialog.buildDialogForm = function(options) {
299
- var $form, $input, $message;
300
- $form = $('<form class="vex-dialog-form" />');
301
- $message = $('<div class="vex-dialog-message" />');
302
- $input = $('<div class="vex-dialog-input" />');
303
- $form.append($message.append(options.message)).append($input.append(options.input)).append(dialog.buttonsToDOM(options.buttons)).bind('submit.vex', options.onSubmit);
304
- return $form;
305
- };
306
- dialog.getFormValueOnSubmit = function(formData) {
307
- if (formData.vex || formData.vex === '') {
308
- if (formData.vex === '_vex-empty-value') {
309
- return true;
310
- }
311
- return formData.vex;
312
- } else {
313
- return formData;
314
- }
315
- };
316
- dialog.buttonsToDOM = function(buttons) {
317
- var $buttons;
318
- $buttons = $('<div class="vex-dialog-buttons" />');
319
- $.each(buttons, function(index, button) {
320
- return $buttons.append($("<input type=\"" + button.type + "\" />").val(button.text).addClass(button.className + ' vex-dialog-button ' + (index === 0 ? 'vex-first ' : '') + (index === buttons.length - 1 ? 'vex-last ' : '')).bind('click.vex', function(e) {
321
- if (button.click) {
322
- return button.click($(this).parents("." + vex.baseClassNames.content), e);
323
- }
324
- }));
325
- });
326
- return $buttons;
327
- };
328
- return dialog;
329
- };
330
-
331
- if (typeof define === 'function' && define.amd) {
332
- define(['jquery', 'vex'], vexDialogFactory);
333
- } else if (typeof exports === 'object') {
334
- module.exports = vexDialogFactory(require('jquery'), require('vex'));
335
- } else {
336
- window.vex.dialog = vexDialogFactory(window.jQuery, window.vex);
337
- }
338
-
339
- }).call(this);
340
-
341
- var ignore_date = new Date();
342
- ignore_date.setTime(ignore_date.getTime() + (60 * 60 * 24 * 14 * 1000));
343
-
344
- jQuery(document).ready( function ( $ ) {
345
- var li_subscribe_flag = $.cookie('li_subscribe');
346
-
347
- if ( ! li_subscribe_flag )
348
- {
349
- leadin_check_visitor_status($.cookie("li_hash"), function ( data ) {
350
- if ( data != 'vex_set' )
351
- {
352
- $.cookie("li_subscribe", 'show', {path: "/", domain: ""});
353
- bind_leadin_subscribe_widget(
354
- $('#leadin-subscribe-heading').val(),
355
- $('#leadin-subscribe-text').val(),
356
- $('#leadin-subscribe-name-fields').val(),
357
- $('#leadin-subscribe-phone-field').val(),
358
- $('#leadin-subscribe-btn-label').val(),
359
- $('#leadin-subscribe-btn-color').val(),
360
- $('#leadin-subscribe-vex-class').val(),
361
- $('#leadin-subscribe-confirmation').val(),
362
- $('#leadin-subscribe-mobile-popup').val()
363
- );
364
- }
365
- else
366
- {
367
- $.cookie("li_subscribe", 'ignore', {path: "/", domain: "", expires: ignore_date});
368
- }
369
- });
370
- }
371
- else
372
- {
373
- if ( li_subscribe_flag == 'show' )
374
- {
375
- bind_leadin_subscribe_widget(
376
- $('#leadin-subscribe-heading').val(),
377
- $('#leadin-subscribe-text').val(),
378
- $('#leadin-subscribe-name-fields').val(),
379
- $('#leadin-subscribe-phone-field').val(),
380
- $('#leadin-subscribe-btn-label').val(),
381
- $('#leadin-subscribe-btn-color').val(),
382
- $('#leadin-subscribe-vex-class').val(),
383
- $('#leadin-subscribe-confirmation').val(),
384
- $('#leadin-subscribe-mobile-popup').val()
385
- );
386
- }
387
- }
388
- });
389
-
390
- function bind_leadin_subscribe_widget ( lis_heading, lis_desc, lis_show_names, lis_show_phone, lis_btn_label, lis_btn_color, lis_vex_class, lis_confirmation, lis_mobile_popup )
391
- {
392
-
393
- lis_heading = ( lis_heading ? lis_heading : 'Sign up for email updates' );
394
- lis_desc = ( lis_desc ? lis_desc : '' );
395
- lis_btn_label = ( lis_btn_label ? lis_btn_label : 'SUBSCRIBE' );
396
- lis_btn_color = ( lis_btn_color ? lis_btn_color : 'leadin-popup-color-blue' );
397
- lis_vex_class = ( lis_vex_class ? lis_vex_class : 'vex-theme-bottom-right-corner' );
398
- lis_confirmation = ( lis_confirmation ? lis_confirmation : 1 );
399
- lis_mobile_popup = ( lis_mobile_popup ? lis_mobile_popup : 1 );
400
-
401
- (function(){
402
- var $ = jQuery;
403
- var subscribe = {};
404
-
405
- subscribe.vex = undefined;
406
-
407
- subscribe.init = function() {
408
- if ($(window).scrollTop() + $(window).height() > $(document).height() / 2) {
409
- subscribe.open();
410
- } else {
411
- //subscribe.close();
412
- }
413
-
414
- $(window).scroll(function() {
415
- if ($(window).scrollTop() + $(window).height() > $(document).height() / 2) {
416
- subscribe.open();
417
- } else {
418
- //subscribe.close();
419
- }
420
- });
421
- };
422
-
423
- subscribe.open = function() {
424
- if (subscribe.vex) {
425
- return subscribe._open();
426
- }
427
-
428
- subscribe.vex = vex.dialog.open({
429
- showCloseButton: true,
430
- className: 'leadin-subscribe ' + lis_vex_class + ' ' + lis_btn_color + ( lis_mobile_popup == 1 ? '' : ' leadin-subscribe-mobile-hide' ),
431
- message: '<h4>' + lis_heading + '</h4>' + '<p>' + lis_desc + '</p>',
432
- input: '<input id="leadin-subscribe-email" name="email" type="email" placeholder="Email address" />' +
433
- ( parseInt(lis_show_names) ? '<input id="leadin-subscribe-fname" name="fname" type="text" placeholder="First Name" /><input id="leadin-subscribe-lname" name="lname" type="text" placeholder="Last Name" />' : '' ) +
434
- ( parseInt(lis_show_phone) ? '<input id="leadin-subscribe-phone" name="phone" type="tel" placeholder="Phone" />' : '' ),
435
- buttons: [$.extend({}, vex.dialog.buttons.YES, { text: ( lis_btn_label ? lis_btn_label : 'SUBSCRIBE' ) })],
436
- onSubmit: function ( data )
437
- {
438
- $subscribe_form = $(this);
439
- $subscribe_form.find('input.error').removeClass('error');
440
- var form_validated = true;
441
-
442
- $subscribe_form.find('input').each( function ( e ) {
443
- var $input = $(this);
444
- if ( ! $input.val() )
445
- {
446
- $input.addClass('error');
447
- form_validated = false;
448
- }
449
- });
450
-
451
- if ( ! form_validated )
452
- return false;
453
-
454
- $('.vex-dialog-form').fadeOut(300, function ( e ) {
455
- $('.vex-dialog-form').html(
456
- '<div class="vex-close"></div>' +
457
- ( parseInt(lis_confirmation) ? '<h3>Thanks!<br>You should receive a confirmation email in your inbox shortly.</h3>' : '<h3>Thanks!<br>We received your submission.</h3>' ) +
458
- '<div id="powered-by-leadin-thank-you">' +
459
- '<span class="powered-by">Powered by</span><br>' +
460
- '<a href="http://leadin.com/wordpress-subscribe-widget?utm_source=virality&utm_medium=referral&utm_term=' + window.location.host + '&utm_content=e11&utm_campaign=subscribe%20widget"><img alt="Leadin" height="20px" width="99px" src="' + document.location.protocol + '//leadin.com/wp-content/themes/LeadIn-WP-Theme/library/images/logos/Leadin_logo@2x.png" alt="leadin.com"/></a>' +
461
- '</div>'
462
- ).css('text-align', 'center').fadeIn(250);
463
- });
464
-
465
- leadin_submit_form($('.leadin-subscribe form'), $);
466
- $.cookie("li_subscribe", 'ignore', {path: "/", domain: "", expires: ignore_date});
467
- return false;
468
- },
469
- callback: function(data) {
470
- if (data === false) {
471
- $.cookie("li_subscribe", 'ignore', {path: "/", domain: "", expires: ignore_date});
472
- }
473
-
474
- $.cookie("li_subscribe", 'ignore', {path: "/", domain: "", expires: ignore_date});
475
- }
476
- });
477
-
478
- $('.leadin-subscribe form.vex-dialog-form').append('<a href="http://leadin.com/wordpress-subscribe-widget?utm_source=virality&utm_medium=referral&utm_term=' + window.location.host + '&utm_content=e11&utm_campaign=subscribe%20widget" id="leadin-subscribe-powered-by" class="leadin-subscribe-powered-by">Powered by Leadin</a>');
479
- };
480
-
481
- subscribe._open = function() {
482
- subscribe.vex.parent().removeClass('vex-closing');
483
- }
484
-
485
- subscribe.close = function() {
486
-
487
- if (!subscribe.vex) {
488
- return;
489
- }
490
- subscribe.vex.parent().addClass('vex-closing');
491
- }
492
-
493
- subscribe.init();
494
- window.subscribe = subscribe;
495
- })();
496
- }
497
-
498
- function leadin_subscribe_show ()
499
- {
500
- jQuery.ajax({
501
- type: 'POST',
502
- url: li_ajax.ajax_url,
503
- data: {
504
- "action": "leadin_subscribe_show"
505
- },
506
- success: function(data){
507
- },
508
- error: function ( error_data ) {
509
- //alert(error_data);
510
- }
511
- });
512
- }
513
-
514
- function leadin_get_parameter_by_name ( name )
515
- {
516
- name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
517
- var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
518
- results = regex.exec(location.search);
519
- return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
520
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/build/leadin-subscribe.min.js DELETED
@@ -1 +0,0 @@
1
- function bind_leadin_subscribe_widget(lis_heading,lis_desc,lis_show_names,lis_show_phone,lis_btn_label,lis_btn_color,lis_vex_class,lis_confirmation,lis_mobile_popup){lis_heading=lis_heading?lis_heading:"Sign up for email updates",lis_desc=lis_desc?lis_desc:"",lis_btn_label=lis_btn_label?lis_btn_label:"SUBSCRIBE",lis_btn_color=lis_btn_color?lis_btn_color:"leadin-popup-color-blue",lis_vex_class=lis_vex_class?lis_vex_class:"vex-theme-bottom-right-corner",lis_confirmation=lis_confirmation?lis_confirmation:1,lis_mobile_popup=lis_mobile_popup?lis_mobile_popup:1,function(){var $=jQuery,subscribe={};subscribe.vex=void 0,subscribe.init=function(){$(window).scrollTop()+$(window).height()>$(document).height()/2&&subscribe.open(),$(window).scroll(function(){$(window).scrollTop()+$(window).height()>$(document).height()/2&&subscribe.open()})},subscribe.open=function(){return subscribe.vex?subscribe._open():(subscribe.vex=vex.dialog.open({showCloseButton:!0,className:"leadin-subscribe "+lis_vex_class+" "+lis_btn_color+(1==lis_mobile_popup?"":" leadin-subscribe-mobile-hide"),message:"<h4>"+lis_heading+"</h4><p>"+lis_desc+"</p>",input:'<input id="leadin-subscribe-email" name="email" type="email" placeholder="Email address" />'+(parseInt(lis_show_names)?'<input id="leadin-subscribe-fname" name="fname" type="text" placeholder="First Name" /><input id="leadin-subscribe-lname" name="lname" type="text" placeholder="Last Name" />':"")+(parseInt(lis_show_phone)?'<input id="leadin-subscribe-phone" name="phone" type="tel" placeholder="Phone" />':""),buttons:[$.extend({},vex.dialog.buttons.YES,{text:lis_btn_label?lis_btn_label:"SUBSCRIBE"})],onSubmit:function(){$subscribe_form=$(this),$subscribe_form.find("input.error").removeClass("error");var form_validated=!0;return $subscribe_form.find("input").each(function(){var $input=$(this);$input.val()||($input.addClass("error"),form_validated=!1)}),form_validated?($(".vex-dialog-form").fadeOut(300,function(){$(".vex-dialog-form").html('<div class="vex-close"></div>'+(parseInt(lis_confirmation)?"<h3>Thanks!<br>You should receive a confirmation email in your inbox shortly.</h3>":"<h3>Thanks!<br>We received your submission.</h3>")+'<div id="powered-by-leadin-thank-you"><span class="powered-by">Powered by</span><br><a href="http://leadin.com/wordpress-subscribe-widget?utm_source=virality&utm_medium=referral&utm_term='+window.location.host+'&utm_content=e11&utm_campaign=subscribe%20widget"><img alt="Leadin" height="20px" width="99px" src="'+document.location.protocol+'//leadin.com/wp-content/themes/LeadIn-WP-Theme/library/images/logos/Leadin_logo@2x.png" alt="leadin.com"/></a></div>').css("text-align","center").fadeIn(250)}),leadin_submit_form($(".leadin-subscribe form"),$),$.cookie("li_subscribe","ignore",{path:"/",domain:"",expires:ignore_date}),!1):!1},callback:function(data){data===!1&&$.cookie("li_subscribe","ignore",{path:"/",domain:"",expires:ignore_date}),$.cookie("li_subscribe","ignore",{path:"/",domain:"",expires:ignore_date})}}),void $(".leadin-subscribe form.vex-dialog-form").append('<a href="http://leadin.com/wordpress-subscribe-widget?utm_source=virality&utm_medium=referral&utm_term='+window.location.host+'&utm_content=e11&utm_campaign=subscribe%20widget" id="leadin-subscribe-powered-by" class="leadin-subscribe-powered-by">Powered by Leadin</a>'))},subscribe._open=function(){subscribe.vex.parent().removeClass("vex-closing")},subscribe.close=function(){subscribe.vex&&subscribe.vex.parent().addClass("vex-closing")},subscribe.init(),window.subscribe=subscribe}()}function leadin_subscribe_show(){jQuery.ajax({type:"POST",url:li_ajax.ajax_url,data:{action:"leadin_subscribe_show"},success:function(){},error:function(){}})}function leadin_get_parameter_by_name(name){name=name.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var regex=new RegExp("[\\?&]"+name+"=([^&#]*)"),results=regex.exec(location.search);return null==results?"":decodeURIComponent(results[1].replace(/\+/g," "))}(function(){var vexFactory;vexFactory=function($){var animationEndSupport,vex;return animationEndSupport=!1,$(function(){var s;return s=(document.body||document.documentElement).style,animationEndSupport=void 0!==s.animation||void 0!==s.WebkitAnimation||void 0!==s.MozAnimation||void 0!==s.MsAnimation||void 0!==s.OAnimation,$(window).bind("keyup.vex",function(event){return 27===event.keyCode?vex.closeByEscape():void 0})}),vex={globalID:1,animationEndEvent:"animationend webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend",baseClassNames:{vex:"vex",content:"vex-content",overlay:"vex-overlay",close:"vex-close",closing:"vex-closing",open:"vex-open"},defaultOptions:{content:"",showCloseButton:!0,escapeButtonCloses:!0,overlayClosesOnClick:!0,appendLocation:"body",className:"",css:{},overlayClassName:"",overlayCSS:{},contentClassName:"",contentCSS:{},closeClassName:"",closeCSS:{}},open:function(options){return options=$.extend({},vex.defaultOptions,options),options.id=vex.globalID,vex.globalID+=1,options.$vex=$("<div>").addClass(vex.baseClassNames.vex).addClass(options.className).css(options.css).data({vex:options}),options.$vexOverlay=$("<div>").addClass(vex.baseClassNames.overlay).addClass(options.overlayClassName).css(options.overlayCSS).data({vex:options}),options.overlayClosesOnClick&&options.$vexOverlay.bind("click.vex",function(e){return e.target===this?vex.close($(this).data().vex.id):void 0}),options.$vex.append(options.$vexOverlay),options.$vexContent=$("<div>").addClass(vex.baseClassNames.content).addClass(options.contentClassName).css(options.contentCSS).append(options.content).data({vex:options}),options.$vex.append(options.$vexContent),options.showCloseButton&&(options.$closeButton=$("<div>").addClass(vex.baseClassNames.close).addClass(options.closeClassName).css(options.closeCSS).data({vex:options}).bind("click.vex",function(){return vex.close($(this).data().vex.id)}),options.$vexContent.append(options.$closeButton)),$(options.appendLocation).append(options.$vex),vex.setupBodyClassName(options.$vex),options.afterOpen&&options.afterOpen(options.$vexContent,options),setTimeout(function(){return options.$vexContent.trigger("vexOpen",options)},0),options.$vexContent},getAllVexes:function(){return $("."+vex.baseClassNames.vex+':not(".'+vex.baseClassNames.closing+'") .'+vex.baseClassNames.content)},getVexByID:function(id){return vex.getAllVexes().filter(function(){return $(this).data().vex.id===id})},close:function(id){var $lastVex;if(!id){if($lastVex=vex.getAllVexes().last(),!$lastVex.length)return!1;id=$lastVex.data().vex.id}return vex.closeByID(id)},closeAll:function(){var ids;return ids=vex.getAllVexes().map(function(){return $(this).data().vex.id}).toArray(),(null!=ids?ids.length:void 0)?($.each(ids.reverse(),function(index,id){return vex.closeByID(id)}),!0):!1},closeByID:function(id){var $vex,$vexContent,beforeClose,close,options;return $vexContent=vex.getVexByID(id),$vexContent.length?($vex=$vexContent.data().vex.$vex,options=$.extend({},$vexContent.data().vex),beforeClose=function(){return options.beforeClose?options.beforeClose($vexContent,options):void 0},close=function(){return $vexContent.trigger("vexClose",options),$vex.remove(),options.afterClose?options.afterClose($vexContent,options):void 0},animationEndSupport?(beforeClose(),$vex.unbind(vex.animationEndEvent).bind(vex.animationEndEvent,function(){return close()}).addClass(vex.baseClassNames.closing)):(beforeClose(),close()),!0):void 0},closeByEscape:function(){var $lastVex,id,ids;return ids=vex.getAllVexes().map(function(){return $(this).data().vex.id}).toArray(),(null!=ids?ids.length:void 0)?(id=Math.max.apply(Math,ids),$lastVex=vex.getVexByID(id),$lastVex.data().vex.escapeButtonCloses!==!0?!1:vex.closeByID(id)):!1},setupBodyClassName:function($vex){return $vex.bind("vexOpen.vex",function(){return $("body").addClass(vex.baseClassNames.open)}).bind("vexClose.vex",function(){return vex.getAllVexes().length?void 0:$("body").removeClass(vex.baseClassNames.open)})},hideLoading:function(){return $(".vex-loading-spinner").remove()},showLoading:function(){return vex.hideLoading(),$("body").append('<div class="vex-loading-spinner '+vex.defaultOptions.className+'"></div>')}}},"function"==typeof define&&define.amd?define(["jquery"],vexFactory):"object"==typeof exports?module.exports=vexFactory(require("jquery")):window.vex=vexFactory(jQuery)}).call(this),function(){var vexDialogFactory;vexDialogFactory=function($,vex){var $formToObject,dialog;return null==vex?$.error("Vex is required to use vex.dialog"):($formToObject=function($form){var object;return object={},$.each($form.serializeArray(),function(){return object[this.name]?(object[this.name].push||(object[this.name]=[object[this.name]]),object[this.name].push(this.value||"")):object[this.name]=this.value||""}),object},dialog={},dialog.buttons={YES:{text:"OK",type:"submit",className:"vex-dialog-button-primary"},NO:{text:"Cancel",type:"button",className:"vex-dialog-button-secondary",click:function($vexContent){return $vexContent.data().vex.value=!1,vex.close($vexContent.data().vex.id)}}},dialog.defaultOptions={callback:function(){},afterOpen:function(){},message:"Message",input:'<input name="vex" type="hidden" value="_vex-empty-value" />',value:!1,buttons:[dialog.buttons.YES,dialog.buttons.NO],showCloseButton:!1,onSubmit:function(event){var $form,$vexContent;return $form=$(this),$vexContent=$form.parent(),event.preventDefault(),event.stopPropagation(),$vexContent.data().vex.value=dialog.getFormValueOnSubmit($formToObject($form)),vex.close($vexContent.data().vex.id)},focusFirstInput:!0},dialog.defaultAlertOptions={message:"Alert",buttons:[dialog.buttons.YES]},dialog.defaultConfirmOptions={message:"Confirm"},dialog.open=function(options){var $vexContent;return options=$.extend({},vex.defaultOptions,dialog.defaultOptions,options),options.content=dialog.buildDialogForm(options),options.beforeClose=function($vexContent){return options.callback($vexContent.data().vex.value)},$vexContent=vex.open(options),options.focusFirstInput&&$vexContent.find('input[type="submit"], textarea, input[type="date"], input[type="datetime"], input[type="datetime-local"], input[type="email"], input[type="month"], input[type="number"], input[type="password"], input[type="search"], input[type="tel"], input[type="text"], input[type="time"], input[type="url"], input[type="week"]').first().focus(),$vexContent},dialog.alert=function(options){return"string"==typeof options&&(options={message:options}),options=$.extend({},dialog.defaultAlertOptions,options),dialog.open(options)},dialog.confirm=function(options){return"string"==typeof options?$.error("dialog.confirm(options) requires options.callback."):(options=$.extend({},dialog.defaultConfirmOptions,options),dialog.open(options))},dialog.prompt=function(options){var defaultPromptOptions;return"string"==typeof options?$.error("dialog.prompt(options) requires options.callback."):(defaultPromptOptions={message:'<label for="vex">'+(options.label||"Prompt:")+"</label>",input:'<input name="vex" type="text" class="vex-dialog-prompt-input" placeholder="'+(options.placeholder||"")+'" value="'+(options.value||"")+'" />'},options=$.extend({},defaultPromptOptions,options),dialog.open(options))},dialog.buildDialogForm=function(options){var $form,$input,$message;return $form=$('<form class="vex-dialog-form" />'),$message=$('<div class="vex-dialog-message" />'),$input=$('<div class="vex-dialog-input" />'),$form.append($message.append(options.message)).append($input.append(options.input)).append(dialog.buttonsToDOM(options.buttons)).bind("submit.vex",options.onSubmit),$form},dialog.getFormValueOnSubmit=function(formData){return formData.vex||""===formData.vex?"_vex-empty-value"===formData.vex?!0:formData.vex:formData},dialog.buttonsToDOM=function(buttons){var $buttons;return $buttons=$('<div class="vex-dialog-buttons" />'),$.each(buttons,function(index,button){return $buttons.append($('<input type="'+button.type+'" />').val(button.text).addClass(button.className+" vex-dialog-button "+(0===index?"vex-first ":"")+(index===buttons.length-1?"vex-last ":"")).bind("click.vex",function(e){return button.click?button.click($(this).parents("."+vex.baseClassNames.content),e):void 0}))}),$buttons},dialog)},"function"==typeof define&&define.amd?define(["jquery","vex"],vexDialogFactory):"object"==typeof exports?module.exports=vexDialogFactory(require("jquery"),require("vex")):window.vex.dialog=vexDialogFactory(window.jQuery,window.vex)}.call(this);var ignore_date=new Date;ignore_date.setTime(ignore_date.getTime()+12096e5),jQuery(document).ready(function($){var li_subscribe_flag=$.cookie("li_subscribe");li_subscribe_flag?"show"==li_subscribe_flag&&bind_leadin_subscribe_widget($("#leadin-subscribe-heading").val(),$("#leadin-subscribe-text").val(),$("#leadin-subscribe-name-fields").val(),$("#leadin-subscribe-phone-field").val(),$("#leadin-subscribe-btn-label").val(),$("#leadin-subscribe-btn-color").val(),$("#leadin-subscribe-vex-class").val(),$("#leadin-subscribe-confirmation").val(),$("#leadin-subscribe-mobile-popup").val()):leadin_check_visitor_status($.cookie("li_hash"),function(data){"vex_set"!=data?($.cookie("li_subscribe","show",{path:"/",domain:""}),bind_leadin_subscribe_widget($("#leadin-subscribe-heading").val(),$("#leadin-subscribe-text").val(),$("#leadin-subscribe-name-fields").val(),$("#leadin-subscribe-phone-field").val(),$("#leadin-subscribe-btn-label").val(),$("#leadin-subscribe-btn-color").val(),$("#leadin-subscribe-vex-class").val(),$("#leadin-subscribe-confirmation").val(),$("#leadin-subscribe-mobile-popup").val())):$.cookie("li_subscribe","ignore",{path:"/",domain:"",expires:ignore_date})})});
 
assets/js/build/leadin-tracking.js DELETED
@@ -1,800 +0,0 @@
1
- /*!
2
- * jQuery Cookie Plugin v1.4.0
3
- * https://github.com/carhartl/jquery-cookie
4
- *
5
- * Copyright 2013 Klaus Hartl
6
- * Released under the MIT license
7
- */
8
- (function (factory) {
9
- if (typeof define === 'function' && define.amd) {
10
- // AMD. Register as anonymous module.
11
- define(['jquery'], factory);
12
- } else {
13
- // Browser globals.
14
- factory(jQuery);
15
- }
16
- }(function ($) {
17
-
18
- var pluses = /\+/g;
19
-
20
- function encode(s) {
21
- return config.raw ? s : encodeURIComponent(s);
22
- }
23
-
24
- function decode(s) {
25
- return config.raw ? s : decodeURIComponent(s);
26
- }
27
-
28
- function stringifyCookieValue(value) {
29
- return encode(config.json ? JSON.stringify(value) : String(value));
30
- }
31
-
32
- function parseCookieValue(s) {
33
- if (s.indexOf('"') === 0) {
34
- // This is a quoted cookie as according to RFC2068, unescape...
35
- s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
36
- }
37
-
38
- try {
39
- // Replace server-side written pluses with spaces.
40
- // If we can't decode the cookie, ignore it, it's unusable.
41
- // If we can't parse the cookie, ignore it, it's unusable.
42
- s = decodeURIComponent(s.replace(pluses, ' '));
43
- return config.json ? JSON.parse(s) : s;
44
- } catch(e) {}
45
- }
46
-
47
- function read(s, converter) {
48
- var value = config.raw ? s : parseCookieValue(s);
49
- return $.isFunction(converter) ? converter(value) : value;
50
- }
51
-
52
- var config = $.cookie = function (key, value, options) {
53
-
54
- // Write
55
- if (value !== undefined && !$.isFunction(value)) {
56
- options = $.extend({}, config.defaults, options);
57
-
58
- if (typeof options.expires === 'number') {
59
- var days = options.expires, t = options.expires = new Date();
60
- t.setDate(t.getDate() + days);
61
- }
62
-
63
- return (document.cookie = [
64
- encode(key), '=', stringifyCookieValue(value),
65
- options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
66
- options.path ? '; path=' + options.path : '',
67
- options.domain ? '; domain=' + options.domain : '',
68
- options.secure ? '; secure' : ''
69
- ].join(''));
70
- }
71
-
72
- // Read
73
-
74
- var result = key ? undefined : {};
75
-
76
- // To prevent the for loop in the first place assign an empty array
77
- // in case there are no cookies at all. Also prevents odd result when
78
- // calling $.cookie().
79
- var cookies = document.cookie ? document.cookie.split('; ') : [];
80
-
81
- for (var i = 0, l = cookies.length; i < l; i++) {
82
- var parts = cookies[i].split('=');
83
- var name = decode(parts.shift());
84
- var cookie = parts.join('=');
85
-
86
- if (key && key === name) {
87
- // If second argument (value) is a function it's a converter...
88
- result = read(cookie, value);
89
- break;
90
- }
91
-
92
- // Prevent storing a cookie that we couldn't decode.
93
- if (!key && (cookie = read(cookie)) !== undefined) {
94
- result[name] = cookie;
95
- }
96
- }
97
-
98
- return result;
99
- };
100
-
101
- config.defaults = {};
102
-
103
- $.removeCookie = function (key, options) {
104
- if ($.cookie(key) === undefined) {
105
- return false;
106
- }
107
-
108
- // Must not alter options, thus extending a fresh object...
109
- $.cookie(key, '', $.extend({}, options, { expires: -1 }));
110
- return !$.cookie(key);
111
- };
112
-
113
- }));
114
- var page_title = jQuery(document).find("title").text();
115
- var page_url = window.location.href;
116
- var page_referrer = document.referrer;
117
- var form_saved = false;
118
- var ignore_form = false;
119
- var leadin_debug_mode = false;
120
-
121
- jQuery(document).ready( function ( $ ) {
122
-
123
- var hashkey = $.cookie("li_hash");
124
- var li_submission_cookie = $.cookie("li_submission");
125
-
126
- // The submission didn't officially finish before the page refresh, so try it again
127
- if ( li_submission_cookie )
128
- {
129
- var submission_data = JSON.parse(li_submission_cookie);
130
- leadin_insert_form_submission(
131
- submission_data.submission_hash,
132
- submission_data.hashkey,
133
- submission_data.page_title,
134
- submission_data.page_url,
135
- submission_data.json_form_fields,
136
- submission_data.lead_email,
137
- submission_data.lead_first_name,
138
- submission_data.lead_last_name,
139
- submission_data.lead_phone,
140
- submission_data.form_selector_id,
141
- submission_data.form_selector_classes,
142
- function ( data ) {
143
- // Form was submitted successfully before page reload. Delete cookie for this submission
144
- $.removeCookie('li_submission', {path: "/", domain: ""});
145
- }
146
- );
147
- }
148
-
149
- if ( !hashkey )
150
- {
151
- hashkey = Math.random().toString(36).slice(2);
152
- $.cookie("li_hash", hashkey, {path: "/", domain: ""});
153
- leadin_insert_lead(hashkey, page_referrer);
154
- }
155
-
156
- leadin_log_pageview(hashkey, page_title, page_url, page_referrer, $.cookie('li_last_visit'));
157
-
158
- var date = new Date();
159
- var current_time = date.getTime();
160
- date.setTime(date.getTime() + (60 * 60 * 1000));
161
-
162
- // The li_last_visit has expired, so check to see if this is a stale contact that has been merged
163
- if ( !$.cookie('li_last_visit') )
164
- {
165
- leadin_check_merged_contact(hashkey);
166
- }
167
-
168
- $.cookie("li_last_visit", current_time, {path: "/", domain: "", expires: date});
169
- });
170
-
171
- jQuery(function($){
172
-
173
- // Many WordPress sites run outdated version of jQuery. This is a fix to support jQuery < 1.7.0 and futureproof the plugin when bind, live, etc are deprecated
174
- if ( $.versioncompare($.fn.jquery, '1.7.0') != -1 )
175
- {
176
- $(document).on('submit', 'form', function( e ) {
177
- if ( ! ( $(this).attr('id') == 'loginform' && $(this).attr('action').indexOf('wp-login.php') != -1 ) && ! ( $(this).attr('id') == 'lostpasswordform' && $(this).attr('action').indexOf('wp-login.php') != -1 ) )
178
- {
179
- var $form = $(this).closest('form');
180
- leadin_submit_form($form, $);
181
- }
182
- });
183
- }
184
- else
185
- {
186
- $(document).bind('submit', 'form', function( e ) {
187
- if ( ! ( $(this).attr('id') == 'loginform' && $(this).attr('action').indexOf('wp-login.php') != -1 ) && ! ( $(this).attr('id') == 'lostpasswordform' && $(this).attr('action').indexOf('wp-login.php') != -1 ) )
188
- {
189
- var $form = $(this).closest('form');
190
- leadin_submit_form($form, $);
191
- }
192
- });
193
- }
194
- });
195
-
196
- function leadin_start_debug_mode ()
197
- {
198
- leadin_debug_mode = true;
199
-
200
- jQuery.ajax({
201
- type: 'POST',
202
- url: li_ajax.ajax_url,
203
- data: {
204
- "action": "leadin_print_debug_values"
205
- },
206
- success: function( data ) {
207
- console.log("SERVER CONFIG:\n------------\n");
208
- console.log('jQuery version: ' + jQuery.fn.jquery + "\n");
209
-
210
- console.log(data);
211
-
212
- if ( jQuery.versioncompare('1.7.0', jQuery.fn.jquery) != -1 )
213
- {
214
- console.log('- jQuery version < 1.7.0');
215
- }
216
- },
217
- error: function ( error_data ) {
218
- //alert(error_data);
219
- }
220
- });
221
-
222
- return "Debug started...";
223
- }
224
-
225
- function leadin_submit_form ( $form, $ )
226
- {
227
- if ( leadin_debug_mode )
228
- {
229
- console.log("\nFUNCTION FIRED: leadin_submit_form()");
230
- console.log("FIELDS:\n-----------\n");
231
- }
232
-
233
- var $this = $form;
234
-
235
- var form_fields = [];
236
- var lead_email = '';
237
- var lead_first_name = '';
238
- var lead_last_name = '';
239
- var lead_phone = '';
240
- var form_selector_id = ( $form.attr('id') ? $form.attr('id') : '' );
241
- var form_selector_classes = ( $form.classes() ? $form.classes().join(',') : '' );
242
-
243
- // Excludes hidden input fields + submit inputs
244
- $this.find('input[type!="submit"], textarea').not('input[type="hidden"], input[type="radio"], input[type="password"]').each( function ( index ) {
245
-
246
- var $element = $(this);
247
- var $value = $element.val();
248
-
249
- if ( !$element.is(':visible' ) )
250
- return true;
251
-
252
- // Check if input has an attached lable using for= tag
253
- var $label = $("label[for='" + $element.attr('id') + "']").text();
254
-
255
- // Ninja Forms hack
256
- if ($label.length == 0)
257
- {
258
- if ( $('#' + $element.attr('id') + "_label").length )
259
- $label = $('#' + $element.attr('id') + "_label").text();
260
- }
261
-
262
- // Check for label in same container immediately before input
263
- if ($label.length == 0)
264
- {
265
- $label = $element.prev('label').not('.li_used').addClass('li_used').first().text();
266
-
267
- if ( !$label.length )
268
- {
269
- $label = $element.prevAll('b, strong, span').text(); // Find previous closest string
270
- }
271
- }
272
-
273
- // Check for label in same container immediately after input
274
- if ($label.length == 0)
275
- {
276
- $label = $element.next('label').not('.li_used').addClass('li_used').first().text();
277
-
278
- if ( !$label.length )
279
- {
280
- $label = $element.nextAll('b, strong, span').text(); // Find next closest string
281
- }
282
- }
283
-
284
- // Checks the parent for a label or bold text
285
- if ($label.length == 0)
286
- {
287
- $label = $element.parent().find('label, b, strong').not('.li_used').first().text();
288
- }
289
-
290
- // Checks the parent's parent for a label or bold text
291
- if ($label.length == 0)
292
- {
293
- if ( $.contains($this, $element.parent().parent()) )
294
- {
295
- $label = $element.parent().parent().find('label, b, strong').first().text();
296
- }
297
- }
298
-
299
- // Looks for closests p tag parent, and looks for label inside
300
- if ( $label.length == 0 )
301
- {
302
- $p = $element.closest('p').not('.li_used').addClass('li_used');
303
-
304
- // This gets the text from the p tag parent if it exists
305
- if ( $p.length )
306
- {
307
- $label = $p.text();
308
- $label = $.trim($label.replace($value, "")); // Hack to exclude the textarea text from the label text
309
- }
310
- }
311
-
312
- // Check for placeholder attribute
313
- if ( $label.length == 0 )
314
- {
315
- if ( $element.attr('placeholder') !== undefined )
316
- {
317
- $label = $element.attr('placeholder').toString();
318
- }
319
- }
320
-
321
- if ( $label.length == 0 )
322
- {
323
- if ( $element.attr('name') !== undefined )
324
- {
325
- $label = $element.attr('name').toString();
326
- }
327
- }
328
-
329
- if ( $element.is(':checkbox') )
330
- {
331
- if ( $element.is(':checked'))
332
- {
333
- $value = 'Checked';
334
- }
335
- else
336
- {
337
- $value = 'Not checked';
338
- }
339
- }
340
-
341
- // Remove fakepath from input[type="file"]
342
- $value = $value.replace("C:\\fakepath\\", "");
343
-
344
- var $label_text = $.trim($label.replaceArray(["(", ")", "required", "Required", "*", ":"], [""]));
345
- var lower_label_text = $label_text.toLowerCase();
346
-
347
- if ( ! ignore_field($label_text, $value) )
348
- push_form_field($label_text, $value, form_fields);
349
- else
350
- {
351
- if ( leadin_debug_mode )
352
- console.log(' - Skipping... label: ' + $label + ' value: ' + $value);
353
- }
354
-
355
- // Set email
356
- if ( $value.indexOf('@') != -1 && $value.indexOf('.') != -1 && !lead_email )
357
- lead_email = $value;
358
-
359
- // Set first name
360
- if ( ! lead_first_name )
361
- {
362
- if ( $element.attr('id') == 'leadin-subscribe-fname' )
363
- lead_first_name = $value;
364
- else if ( lower_label_text == 'first' || lower_label_text == 'first name' || lower_label_text == 'name' || lower_label_text == 'your name' )
365
- lead_first_name = $value;
366
- }
367
-
368
- // Set last name
369
- if ( ! lead_last_name )
370
- {
371
- if ( $element.attr('id') == 'leadin-subscribe-lname' )
372
- lead_last_name = $value;
373
- else if ( lower_label_text == 'last' || lower_label_text == 'last name' || lower_label_text == 'your last name' || lower_label_text == 'surname' )
374
- lead_last_name = $value;
375
- }
376
-
377
- // Set phone number
378
- if ( ! lead_phone )
379
- {
380
- if ( $element.attr('id') == 'leadin-subscribe-phone' )
381
- lead_phone = $value;
382
- else if ( lower_label_text == 'phone' || lower_label_text == 'phone number' )
383
- lead_phone = $value;
384
- }
385
- });
386
-
387
- var radio_groups = [];
388
- var rbg_label_values = [];
389
- $this.find(":radio").each(function(){
390
- if ( $.inArray(this.name, radio_groups) == -1 )
391
- radio_groups.push(this.name);
392
- rbg_label_values.push($(this).val());
393
- });
394
-
395
- for ( var i = 0; i < radio_groups.length; i++ )
396
- {
397
- var $rbg = $("input:radio[name='" + radio_groups[i] + "']");
398
- var $rbg_value = $("input:radio[name='" + radio_groups[i] + "']:checked").val();
399
-
400
- if ( $this.find('.gfield').length ) // Hack for gravity forms
401
- $p = $rbg.closest('.gfield').not('.li_used').addClass('li_used');
402
- else if ( $this.find('.frm_form_field').length ) // Hack for Formidable
403
- $p = $rbg.closest('.frm_form_field').not('.li_used').addClass('li_used');
404
- else
405
- $p = $rbg.closest('div, p').not('.li_used').addClass('li_used');
406
-
407
- // This gets the text from the p tag parent if it exists
408
- if ( $p.length )
409
- {
410
- //$p.find('label, strong, span, b').html();
411
- $rbg_label = $p.text();
412
- $rbg_label = $.trim($rbg_label.replaceArray(rbg_label_values, [""]).replace($p.find('.gfield_description').text(), ''));
413
- // Remove .gfield_description from gravity forms
414
- }
415
-
416
- var rgb_selected = ( !$("input:radio[name='" + radio_groups[i] + "']:checked").val() ) ? 'not selected' : $("input:radio[name='" + radio_groups[i] + "']:checked").val();
417
-
418
- if ( ! ignore_field($rbg_label, rgb_selected) )
419
- push_form_field($rbg_label, rgb_selected, form_fields);
420
- else
421
- {
422
- if ( leadin_debug_mode )
423
- console.log('Skipping... label: ' + $label + ' value: ' + $value);
424
- }
425
- }
426
-
427
- $this.find('select').each( function ( ) {
428
- var $select = $(this);
429
- var $select_label = $("label[for='" + $select.attr('id') + "']").text();
430
-
431
- if ( !$select_label.length )
432
- {
433
- var select_values = [];
434
- $select.find("option").each(function(){
435
- if ( $.inArray($(this).val(), select_values) == -1 )
436
- select_values.push($(this).val());
437
- });
438
-
439
- $p = $select.closest('div, p').not('.li_used').addClass('li_used');
440
-
441
- if ( $this.find('.gfield').length ) // Hack for gravity forms
442
- $p = $select.closest('.gfield').not('.li_used').addClass('li_used');
443
- else
444
- {
445
- $p = $select.closest('div, p').addClass('li_used');
446
- }
447
-
448
- if ( $p.length )
449
- {
450
- $select_label = $p.text();
451
- $select_label = $.trim($select_label.replaceArray(select_values, [""]).replace($p.find('.gfield_description').text(), ''));
452
- }
453
- }
454
-
455
- var select_value = '';
456
- if ( $select.val() instanceof Array )
457
- {
458
- var select_vals = $select.val();
459
-
460
- for ( i = 0; i < select_vals.length; i++ )
461
- {
462
- select_value += select_vals[i];
463
- if ( i != select_vals.length - 1 )
464
- select_value += ', ';
465
- }
466
- }
467
- else
468
- {
469
- if ( $select.find('option:selected').text() )
470
- select_value = $select.find('option:selected').text();
471
- else
472
- select_value = $select.val();
473
- }
474
-
475
- if ( ! ignore_field($select_label, select_value) )
476
- push_form_field($select_label, select_value, form_fields);
477
- else
478
- {
479
- if ( leadin_debug_mode )
480
- console.log('Skipping... label: ' + $label + ' value: ' + $value);
481
- }
482
- });
483
-
484
- $this.find('.li_used').removeClass('li_used'); // Clean up added classes
485
-
486
- // Save submission into database if email is present and form is not ignore, send Leadin email, and submit form as usual
487
- if ( lead_email )
488
- {
489
- if ( leadin_debug_mode )
490
- console.log("\nFOUND lead_email: " + lead_email + "\n");
491
-
492
- if ( ignore_form )
493
- {
494
- push_form_field('Credit card form submitted', 'Payment fields not collected for security', form_fields);
495
- }
496
-
497
- var submission_hash = Math.random().toString(36).slice(2);
498
- var hashkey = $.cookie("li_hash");
499
- var json_form_fields = JSON.stringify(form_fields);
500
-
501
- var form_submission = {};
502
- form_submission = {
503
- "submission_hash": submission_hash,
504
- "hashkey": hashkey,
505
- "lead_email": lead_email,
506
- "lead_first_name": lead_first_name,
507
- "lead_last_name": lead_last_name,
508
- "lead_phone": lead_phone,
509
- "page_title": page_title,
510
- "page_url": page_url,
511
- "json_form_fields": json_form_fields,
512
- "form_selector_id": form_selector_id,
513
- "form_selector_classes": form_selector_classes
514
- };
515
-
516
- if ( leadin_debug_mode )
517
- {
518
- console.log("\nFORM SUBMISSION OBJECT:");
519
- console.log(form_submission);
520
- }
521
-
522
- $.cookie("li_submission", JSON.stringify(form_submission), {path: "/", domain: ""});
523
-
524
- leadin_insert_form_submission(
525
- submission_hash,
526
- hashkey,
527
- page_title,
528
- page_url,
529
- json_form_fields,
530
- lead_email,
531
- lead_first_name,
532
- lead_last_name,
533
- lead_phone,
534
- form_selector_id,
535
- form_selector_classes,
536
- function ( data ) {
537
- // Form was executed 100% successfully before page reload. Delete cookie for this submission
538
- $.removeCookie('li_submission', {path: "/", domain: ""});
539
- }
540
- );
541
- }
542
- else // No lead - submit form as usual
543
- {
544
- form_saved = true;
545
-
546
- if ( leadin_debug_mode )
547
- console.log("\ERROR: lead_email not found\n");
548
- }
549
- }
550
-
551
- function leadin_check_merged_contact ( hashkey )
552
- {
553
- jQuery.ajax({
554
- type: 'POST',
555
- url: li_ajax.ajax_url,
556
- data: {
557
- "action": "leadin_check_merged_contact",
558
- "li_id": hashkey
559
- },
560
- success: function(data){
561
- // Force override the current tracking with the merged value
562
- var json_data = jQuery.parseJSON(data);
563
- if ( json_data )
564
- jQuery.cookie("li_hash", json_data, {path: "/", domain: ""});
565
- },
566
- error: function ( error_data ) {
567
- //alert(error_data);
568
- }
569
- });
570
- }
571
-
572
- function leadin_check_visitor_status ( hashkey, callback )
573
- {
574
- jQuery.ajax({
575
- type: 'POST',
576
- url: li_ajax.ajax_url,
577
- data: {
578
- "action": "leadin_check_visitor_status",
579
- "li_id": hashkey
580
- },
581
- success: function(data){
582
- // Force override the current tracking with the merged value
583
- var json_data = jQuery.parseJSON(data);
584
-
585
- if ( callback )
586
- callback(json_data);
587
- },
588
- error: function ( error_data ) {
589
- //alert(error_data);
590
- }
591
- });
592
- }
593
-
594
- function leadin_log_pageview ( hashkey, page_title, page_url, page_referrer, last_visit )
595
- {
596
- jQuery.ajax({
597
- type: 'POST',
598
- url: li_ajax.ajax_url,
599
- data: {
600
- "action": "leadin_log_pageview",
601
- "li_id": hashkey,
602
- "li_title": page_title,
603
- "li_url": page_url,
604
- "li_referrer": page_referrer,
605
- "li_last_visit": last_visit
606
- },
607
- success: function(data){
608
- },
609
- error: function ( error_data ) {
610
- //alert(error_data);
611
- }
612
- });
613
- }
614
-
615
- function leadin_insert_lead ( hashkey, page_referrer ) {
616
- jQuery.ajax({
617
- type: 'POST',
618
- url: li_ajax.ajax_url,
619
- data: {
620
- "action": "leadin_insert_lead",
621
- "li_id": hashkey,
622
- "li_referrer": page_referrer
623
- },
624
- success: function(data){
625
- },
626
- error: function ( error_data ) {
627
- //alert(error_data);
628
- }
629
- });
630
- }
631
-
632
- function leadin_insert_form_submission ( submission_haskey, hashkey, page_title, page_url, json_fields, lead_email, lead_first_name, lead_last_name, lead_phone, form_selector_id, form_selector_classes, Callback )
633
- {
634
- if ( leadin_debug_mode )
635
- console.log("\nFUNCTION FIRED: leadin_insert_form_submission()");
636
-
637
- jQuery.ajax({
638
- type: 'POST',
639
- url: li_ajax.ajax_url,
640
- data: {
641
- "action": "leadin_insert_form_submission",
642
- "li_submission_id": submission_haskey,
643
- "li_id": hashkey,
644
- "li_title": page_title,
645
- "li_url": page_url,
646
- "li_fields": json_fields,
647
- "li_email": lead_email,
648
- "li_first_name": lead_first_name,
649
- "li_last_name": lead_last_name,
650
- "li_phone": lead_phone,
651
- "li_form_selector_id": form_selector_id,
652
- "li_form_selector_classes": form_selector_classes
653
- },
654
- success: function(data){
655
-
656
- if ( leadin_debug_mode )
657
- console.log('RESULT rows updated: ' + data);
658
-
659
- if ( Callback )
660
- Callback(data);
661
- },
662
- error: function ( error_data ) {
663
- //alert(error_data);
664
- }
665
- });
666
-
667
- }
668
-
669
- function push_form_field ( label, value, form_fields )
670
- {
671
- var field = {
672
- label: label,
673
- value: value
674
- };
675
-
676
- form_fields.push(field);
677
-
678
- if ( leadin_debug_mode )
679
- console.log(' + Adding... [label:] ' + label + ' [value:] ' + value);
680
- }
681
-
682
- function ignore_field ( label, value )
683
- {
684
- var bool_ignore_field = false;
685
-
686
- // Ignore any fields with labels that indicate a credit card field
687
- if ( label.toLowerCase().indexOf('credit card') != -1 || label.toLowerCase().indexOf('card number') != -1 )
688
- bool_ignore_field = true;
689
-
690
- if ( label.toLowerCase().indexOf('expiration') != -1 || label.toLowerCase().indexOf('expiry') != -1)
691
- bool_ignore_field = true;
692
-
693
- if ( label.toLowerCase() == 'month' || label.toLowerCase() == 'mm' || label.toLowerCase() == 'yy' || label.toLowerCase() == 'yyyy' || label.toLowerCase() == 'year' )
694
- bool_ignore_field = true;
695
-
696
- if ( label.toLowerCase().indexOf('cvv') != -1 || label.toLowerCase().indexOf('cvc') != -1 || label.toLowerCase().indexOf('secure code') != -1 || label.toLowerCase().indexOf('security code') != -1 )
697
- bool_ignore_field = true;
698
-
699
- if ( value.toLowerCase() == 'visa' || value.toLowerCase() == 'mastercard' || value.toLowerCase() == 'american express' || value.toLowerCase() == 'amex' || value.toLowerCase() == 'discover' )
700
- bool_ignore_field = true;
701
-
702
- // Check if value has integers, strip out spaces, then ignore anything with a credit card length (>16) or an expiration/cvv length (<5)
703
- var int_regex = new RegExp("/^[0-9]+$/");
704
- if ( int_regex.test(value) )
705
- {
706
- var value_no_spaces = value.replace(' ', '');
707
-
708
- if ( isInt(value_no_spaces) && value_no_spaces.length >= 16 )
709
- bool_ignore_field = true;
710
- }
711
-
712
- // Hack for the form parser sometimes rolling up all form fields into one massive label
713
- if ( label.length > 250 )
714
- bool_ignore_field = true;
715
-
716
- if ( bool_ignore_field )
717
- {
718
- if ( ! ignore_form )
719
- ignore_form = true;
720
-
721
- return true;
722
- }
723
- else
724
- return false;
725
- }
726
-
727
- String.prototype.replaceArray = function(find, replace) {
728
- var replaceString = this;
729
- for (var i = 0; i < find.length; i++) {
730
- if ( replace.length != 1 )
731
- replaceString = replaceString.replace(find[i], replace[i]);
732
- else
733
- replaceString = replaceString.replace(find[i], replace[0]);
734
- }
735
- return replaceString;
736
- };
737
-
738
- /**
739
- * Checks the version number of jQuery and compares to string
740
- *
741
- * @param string
742
- * @param string
743
- *
744
- * @return bool
745
- */
746
-
747
- (function($){
748
- $.versioncompare = function(version1, version2){
749
- if ('undefined' === typeof version1) {
750
- throw new Error("$.versioncompare needs at least one parameter.");
751
- }
752
- version2 = version2 || $.fn.jquery;
753
- if (version1 == version2) {
754
- return 0;
755
- }
756
- var v1 = normalize(version1);
757
- var v2 = normalize(version2);
758
- var len = Math.max(v1.length, v2.length);
759
- for (var i = 0; i < len; i++) {
760
- v1[i] = v1[i] || 0;
761
- v2[i] = v2[i] || 0;
762
- if (v1[i] == v2[i]) {
763
- continue;
764
- }
765
- return v1[i] > v2[i] ? 1 : -1;
766
- }
767
- return 0;
768
- };
769
- function normalize(version){
770
- return $.map(version.split('.'), function(value){
771
- return parseInt(value, 10);
772
- });
773
- }
774
- }(jQuery));
775
-
776
-
777
- (function ($) {
778
- $.fn.classes = function (callback) {
779
- var classes = [];
780
- $.each(this, function (i, v) {
781
- var splitClassName = v.className.split(/\s+/);
782
- for (var j in splitClassName) {
783
- var className = splitClassName[j];
784
- if (-1 === classes.indexOf(className)) {
785
- classes.push(className);
786
- }
787
- }
788
- });
789
- if ('function' === typeof callback) {
790
- for (var i in classes) {
791
- callback(classes[i]);
792
- }
793
- }
794
- return classes;
795
- };
796
- })(jQuery);
797
-
798
- function isInt ( n ) {
799
- return typeof n== "number" && isFinite(n) && n%1===0;
800
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/build/leadin-tracking.min.js DELETED
@@ -1 +0,0 @@
1
- function leadin_start_debug_mode(){return leadin_debug_mode=!0,jQuery.ajax({type:"POST",url:li_ajax.ajax_url,data:{action:"leadin_print_debug_values"},success:function(data){console.log("SERVER CONFIG:\n------------\n"),console.log("jQuery version: "+jQuery.fn.jquery+"\n"),console.log(data),-1!=jQuery.versioncompare("1.7.0",jQuery.fn.jquery)&&console.log("- jQuery version < 1.7.0")},error:function(){}}),"Debug started..."}function leadin_submit_form($form,$){leadin_debug_mode&&(console.log("\nFUNCTION FIRED: leadin_submit_form()"),console.log("FIELDS:\n-----------\n"));var $this=$form,form_fields=[],lead_email="",lead_first_name="",lead_last_name="",lead_phone="",form_selector_id=$form.attr("id")?$form.attr("id"):"",form_selector_classes=$form.classes()?$form.classes().join(","):"";$this.find('input[type!="submit"], textarea').not('input[type="hidden"], input[type="radio"], input[type="password"]').each(function(){var $element=$(this),$value=$element.val();if(!$element.is(":visible"))return!0;var $label=$("label[for='"+$element.attr("id")+"']").text();0==$label.length&&$("#"+$element.attr("id")+"_label").length&&($label=$("#"+$element.attr("id")+"_label").text()),0==$label.length&&($label=$element.prev("label").not(".li_used").addClass("li_used").first().text(),$label.length||($label=$element.prevAll("b, strong, span").text())),0==$label.length&&($label=$element.next("label").not(".li_used").addClass("li_used").first().text(),$label.length||($label=$element.nextAll("b, strong, span").text())),0==$label.length&&($label=$element.parent().find("label, b, strong").not(".li_used").first().text()),0==$label.length&&$.contains($this,$element.parent().parent())&&($label=$element.parent().parent().find("label, b, strong").first().text()),0==$label.length&&($p=$element.closest("p").not(".li_used").addClass("li_used"),$p.length&&($label=$p.text(),$label=$.trim($label.replace($value,"")))),0==$label.length&&void 0!==$element.attr("placeholder")&&($label=$element.attr("placeholder").toString()),0==$label.length&&void 0!==$element.attr("name")&&($label=$element.attr("name").toString()),$element.is(":checkbox")&&($value=$element.is(":checked")?"Checked":"Not checked"),$value=$value.replace("C:\\fakepath\\","");var $label_text=$.trim($label.replaceArray(["(",")","required","Required","*",":"],[""])),lower_label_text=$label_text.toLowerCase();ignore_field($label_text,$value)?leadin_debug_mode&&console.log(" - Skipping... label: "+$label+" value: "+$value):push_form_field($label_text,$value,form_fields),-1==$value.indexOf("@")||-1==$value.indexOf(".")||lead_email||(lead_email=$value),lead_first_name||("leadin-subscribe-fname"==$element.attr("id")?lead_first_name=$value:("first"==lower_label_text||"first name"==lower_label_text||"name"==lower_label_text||"your name"==lower_label_text)&&(lead_first_name=$value)),lead_last_name||("leadin-subscribe-lname"==$element.attr("id")?lead_last_name=$value:("last"==lower_label_text||"last name"==lower_label_text||"your last name"==lower_label_text||"surname"==lower_label_text)&&(lead_last_name=$value)),lead_phone||("leadin-subscribe-phone"==$element.attr("id")?lead_phone=$value:("phone"==lower_label_text||"phone number"==lower_label_text)&&(lead_phone=$value))});var radio_groups=[],rbg_label_values=[];$this.find(":radio").each(function(){-1==$.inArray(this.name,radio_groups)&&radio_groups.push(this.name),rbg_label_values.push($(this).val())});for(var i=0;i<radio_groups.length;i++){{var $rbg=$("input:radio[name='"+radio_groups[i]+"']");$("input:radio[name='"+radio_groups[i]+"']:checked").val()}$p=$this.find(".gfield").length?$rbg.closest(".gfield").not(".li_used").addClass("li_used"):$this.find(".frm_form_field").length?$rbg.closest(".frm_form_field").not(".li_used").addClass("li_used"):$rbg.closest("div, p").not(".li_used").addClass("li_used"),$p.length&&($rbg_label=$p.text(),$rbg_label=$.trim($rbg_label.replaceArray(rbg_label_values,[""]).replace($p.find(".gfield_description").text(),"")));var rgb_selected=$("input:radio[name='"+radio_groups[i]+"']:checked").val()?$("input:radio[name='"+radio_groups[i]+"']:checked").val():"not selected";ignore_field($rbg_label,rgb_selected)?leadin_debug_mode&&console.log("Skipping... label: "+$label+" value: "+$value):push_form_field($rbg_label,rgb_selected,form_fields)}if($this.find("select").each(function(){var $select=$(this),$select_label=$("label[for='"+$select.attr("id")+"']").text();if(!$select_label.length){var select_values=[];$select.find("option").each(function(){-1==$.inArray($(this).val(),select_values)&&select_values.push($(this).val())}),$p=$select.closest("div, p").not(".li_used").addClass("li_used"),$p=$this.find(".gfield").length?$select.closest(".gfield").not(".li_used").addClass("li_used"):$select.closest("div, p").addClass("li_used"),$p.length&&($select_label=$p.text(),$select_label=$.trim($select_label.replaceArray(select_values,[""]).replace($p.find(".gfield_description").text(),"")))}var select_value="";if($select.val()instanceof Array){var select_vals=$select.val();for(i=0;i<select_vals.length;i++)select_value+=select_vals[i],i!=select_vals.length-1&&(select_value+=", ")}else select_value=$select.find("option:selected").text()?$select.find("option:selected").text():$select.val();ignore_field($select_label,select_value)?leadin_debug_mode&&console.log("Skipping... label: "+$label+" value: "+$value):push_form_field($select_label,select_value,form_fields)}),$this.find(".li_used").removeClass("li_used"),lead_email){leadin_debug_mode&&console.log("\nFOUND lead_email: "+lead_email+"\n"),ignore_form&&push_form_field("Credit card form submitted","Payment fields not collected for security",form_fields);var submission_hash=Math.random().toString(36).slice(2),hashkey=$.cookie("li_hash"),json_form_fields=JSON.stringify(form_fields),form_submission={};form_submission={submission_hash:submission_hash,hashkey:hashkey,lead_email:lead_email,lead_first_name:lead_first_name,lead_last_name:lead_last_name,lead_phone:lead_phone,page_title:page_title,page_url:page_url,json_form_fields:json_form_fields,form_selector_id:form_selector_id,form_selector_classes:form_selector_classes},leadin_debug_mode&&(console.log("\nFORM SUBMISSION OBJECT:"),console.log(form_submission)),$.cookie("li_submission",JSON.stringify(form_submission),{path:"/",domain:""}),leadin_insert_form_submission(submission_hash,hashkey,page_title,page_url,json_form_fields,lead_email,lead_first_name,lead_last_name,lead_phone,form_selector_id,form_selector_classes,function(){$.removeCookie("li_submission",{path:"/",domain:""})})}else form_saved=!0,leadin_debug_mode&&console.log("ERROR: lead_email not found\n")}function leadin_check_merged_contact(hashkey){jQuery.ajax({type:"POST",url:li_ajax.ajax_url,data:{action:"leadin_check_merged_contact",li_id:hashkey},success:function(data){var json_data=jQuery.parseJSON(data);json_data&&jQuery.cookie("li_hash",json_data,{path:"/",domain:""})},error:function(){}})}function leadin_check_visitor_status(hashkey,callback){jQuery.ajax({type:"POST",url:li_ajax.ajax_url,data:{action:"leadin_check_visitor_status",li_id:hashkey},success:function(data){var json_data=jQuery.parseJSON(data);callback&&callback(json_data)},error:function(){}})}function leadin_log_pageview(hashkey,page_title,page_url,page_referrer,last_visit){jQuery.ajax({type:"POST",url:li_ajax.ajax_url,data:{action:"leadin_log_pageview",li_id:hashkey,li_title:page_title,li_url:page_url,li_referrer:page_referrer,li_last_visit:last_visit},success:function(){},error:function(){}})}function leadin_insert_lead(hashkey,page_referrer){jQuery.ajax({type:"POST",url:li_ajax.ajax_url,data:{action:"leadin_insert_lead",li_id:hashkey,li_referrer:page_referrer},success:function(){},error:function(){}})}function leadin_insert_form_submission(submission_haskey,hashkey,page_title,page_url,json_fields,lead_email,lead_first_name,lead_last_name,lead_phone,form_selector_id,form_selector_classes,Callback){leadin_debug_mode&&console.log("\nFUNCTION FIRED: leadin_insert_form_submission()"),jQuery.ajax({type:"POST",url:li_ajax.ajax_url,data:{action:"leadin_insert_form_submission",li_submission_id:submission_haskey,li_id:hashkey,li_title:page_title,li_url:page_url,li_fields:json_fields,li_email:lead_email,li_first_name:lead_first_name,li_last_name:lead_last_name,li_phone:lead_phone,li_form_selector_id:form_selector_id,li_form_selector_classes:form_selector_classes},success:function(data){leadin_debug_mode&&console.log("RESULT rows updated: "+data),Callback&&Callback(data)},error:function(){}})}function push_form_field(label,value,form_fields){var field={label:label,value:value};form_fields.push(field),leadin_debug_mode&&console.log(" + Adding... [label:] "+label+" [value:] "+value)}function ignore_field(label,value){var bool_ignore_field=!1;(-1!=label.toLowerCase().indexOf("credit card")||-1!=label.toLowerCase().indexOf("card number"))&&(bool_ignore_field=!0),(-1!=label.toLowerCase().indexOf("expiration")||-1!=label.toLowerCase().indexOf("expiry"))&&(bool_ignore_field=!0),("month"==label.toLowerCase()||"mm"==label.toLowerCase()||"yy"==label.toLowerCase()||"yyyy"==label.toLowerCase()||"year"==label.toLowerCase())&&(bool_ignore_field=!0),(-1!=label.toLowerCase().indexOf("cvv")||-1!=label.toLowerCase().indexOf("cvc")||-1!=label.toLowerCase().indexOf("secure code")||-1!=label.toLowerCase().indexOf("security code"))&&(bool_ignore_field=!0),("visa"==value.toLowerCase()||"mastercard"==value.toLowerCase()||"american express"==value.toLowerCase()||"amex"==value.toLowerCase()||"discover"==value.toLowerCase())&&(bool_ignore_field=!0);var int_regex=new RegExp("/^[0-9]+$/");if(int_regex.test(value)){var value_no_spaces=value.replace(" ","");isInt(value_no_spaces)&&value_no_spaces.length>=16&&(bool_ignore_field=!0)}return label.length>250&&(bool_ignore_field=!0),bool_ignore_field?(ignore_form||(ignore_form=!0),!0):!1}function isInt(n){return"number"==typeof n&&isFinite(n)&&n%1===0}!function(factory){"function"==typeof define&&define.amd?define(["jquery"],factory):factory(jQuery)}(function($){function encode(s){return config.raw?s:encodeURIComponent(s)}function decode(s){return config.raw?s:decodeURIComponent(s)}function stringifyCookieValue(value){return encode(config.json?JSON.stringify(value):String(value))}function parseCookieValue(s){0===s.indexOf('"')&&(s=s.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return s=decodeURIComponent(s.replace(pluses," ")),config.json?JSON.parse(s):s}catch(e){}}function read(s,converter){var value=config.raw?s:parseCookieValue(s);return $.isFunction(converter)?converter(value):value}var pluses=/\+/g,config=$.cookie=function(key,value,options){if(void 0!==value&&!$.isFunction(value)){if(options=$.extend({},config.defaults,options),"number"==typeof options.expires){var days=options.expires,t=options.expires=new Date;t.setDate(t.getDate()+days)}return document.cookie=[encode(key),"=",stringifyCookieValue(value),options.expires?"; expires="+options.expires.toUTCString():"",options.path?"; path="+options.path:"",options.domain?"; domain="+options.domain:"",options.secure?"; secure":""].join("")}for(var result=key?void 0:{},cookies=document.cookie?document.cookie.split("; "):[],i=0,l=cookies.length;l>i;i++){var parts=cookies[i].split("="),name=decode(parts.shift()),cookie=parts.join("=");if(key&&key===name){result=read(cookie,value);break}key||void 0===(cookie=read(cookie))||(result[name]=cookie)}return result};config.defaults={},$.removeCookie=function(key,options){return void 0===$.cookie(key)?!1:($.cookie(key,"",$.extend({},options,{expires:-1})),!$.cookie(key))}});var page_title=jQuery(document).find("title").text(),page_url=window.location.href,page_referrer=document.referrer,form_saved=!1,ignore_form=!1,leadin_debug_mode=!1;jQuery(document).ready(function($){var hashkey=$.cookie("li_hash"),li_submission_cookie=$.cookie("li_submission");if(li_submission_cookie){var submission_data=JSON.parse(li_submission_cookie);leadin_insert_form_submission(submission_data.submission_hash,submission_data.hashkey,submission_data.page_title,submission_data.page_url,submission_data.json_form_fields,submission_data.lead_email,submission_data.lead_first_name,submission_data.lead_last_name,submission_data.lead_phone,submission_data.form_selector_id,submission_data.form_selector_classes,function(){$.removeCookie("li_submission",{path:"/",domain:""})})}hashkey||(hashkey=Math.random().toString(36).slice(2),$.cookie("li_hash",hashkey,{path:"/",domain:""}),leadin_insert_lead(hashkey,page_referrer)),leadin_log_pageview(hashkey,page_title,page_url,page_referrer,$.cookie("li_last_visit"));var date=new Date,current_time=date.getTime();date.setTime(date.getTime()+36e5),$.cookie("li_last_visit")||leadin_check_merged_contact(hashkey),$.cookie("li_last_visit",current_time,{path:"/",domain:"",expires:date})}),jQuery(function($){-1!=$.versioncompare($.fn.jquery,"1.7.0")?$(document).on("submit","form",function(){if(!("loginform"==$(this).attr("id")&&-1!=$(this).attr("action").indexOf("wp-login.php")||"lostpasswordform"==$(this).attr("id")&&-1!=$(this).attr("action").indexOf("wp-login.php"))){var $form=$(this).closest("form");leadin_submit_form($form,$)}}):$(document).bind("submit","form",function(){if(!("loginform"==$(this).attr("id")&&-1!=$(this).attr("action").indexOf("wp-login.php")||"lostpasswordform"==$(this).attr("id")&&-1!=$(this).attr("action").indexOf("wp-login.php"))){var $form=$(this).closest("form");leadin_submit_form($form,$)}})}),String.prototype.replaceArray=function(find,replace){for(var replaceString=this,i=0;i<find.length;i++)replaceString=1!=replace.length?replaceString.replace(find[i],replace[i]):replaceString.replace(find[i],replace[0]);return replaceString},function($){function normalize(version){return $.map(version.split("."),function(value){return parseInt(value,10)})}$.versioncompare=function(version1,version2){if("undefined"==typeof version1)throw new Error("$.versioncompare needs at least one parameter.");if(version2=version2||$.fn.jquery,version1==version2)return 0;for(var v1=normalize(version1),v2=normalize(version2),len=Math.max(v1.length,v2.length),i=0;len>i;i++)if(v1[i]=v1[i]||0,v2[i]=v2[i]||0,v1[i]!=v2[i])return v1[i]>v2[i]?1:-1;return 0}}(jQuery),function($){$.fn.classes=function(callback){var classes=[];if($.each(this,function(i,v){var splitClassName=v.className.split(/\s+/);for(var j in splitClassName){var className=splitClassName[j];-1===classes.indexOf(className)&&classes.push(className)}}),"function"==typeof callback)for(var i in classes)callback(classes[i]);return classes}}(jQuery);
 
images/Leadin_logo.png DELETED
Binary file
images/checkmark.png CHANGED
Binary file
images/leadin-icon-16x16-white.png ADDED
Binary file
images/popup-bottom.png CHANGED
Binary file
images/popup-over.png CHANGED
Binary file
images/popup-top.png CHANGED
Binary file
images/power-up-icon-aweber-connect.png DELETED
Binary file
images/power-up-icon-aweber-connect@2x.png DELETED
Binary file
images/power-up-icon-aweber-connect_small.png DELETED
Binary file
images/power-up-icon-aweber-connect_small@2x.png DELETED
Binary file
images/power-up-icon-campaign-monitor-connect.png DELETED
Binary file
images/power-up-icon-campaign-monitor-connect@2x.png DELETED
Binary file
images/power-up-icon-campaign-monitor-connect_small.png DELETED
Binary file
images/power-up-icon-campaign-monitor-connect_small@2x.png DELETED
Binary file
images/power-up-icon-constant-contact-connect.png DELETED
Binary file
images/power-up-icon-constant-contact-connect@2x.png DELETED
Binary file
images/power-up-icon-constant-contact-connect_small.png DELETED
Binary file
images/power-up-icon-constant-contact-connect_small@2x.png DELETED
Binary file
images/power-up-icon-constant-contact-list-sync@2x.png DELETED
Binary file
images/power-up-icon-constant-contact-list-sync_small@2x.png DELETED
Binary file
images/power-up-icon-getresponse-connect.png DELETED
Binary file
images/power-up-icon-getresponse-connect@2x.png DELETED
Binary file
images/power-up-icon-getresponse-connect_small.png DELETED
Binary file
images/power-up-icon-getresponse-connect_small@2x.png DELETED
Binary file
images/power-up-icon-getresponse-list-sync_small.png DELETED
Binary file
images/power-up-icon-getresponse-list-sync_small@2x.png DELETED
Binary file
images/power-up-icon-mailchimp-connect.png DELETED
Binary file
images/power-up-icon-mailchimp-connect@2x.png DELETED
Binary file
images/power-up-icon-mailchimp-connect_small.png DELETED
Binary file
images/power-up-icon-mailchimp-connect_small@2x.png DELETED
Binary file
images/power-up-icon-mailchimp-list-sync@2x.png DELETED
Binary file
images/power-up-icon-mailchimp-list-sync_small@2x.png DELETED
Binary file
images/powerup-icon-analytics.png DELETED
Binary file
images/powerup-icon-analytics@2x.png DELETED
Binary file
images/powerup-icon-ideas.png DELETED
Binary file
images/powerup-icon-ideas@2x.png DELETED
Binary file
images/powerup-icon-leads.png DELETED
Binary file
images/powerup-icon-leads@2x.png DELETED
Binary file
images/powerup-icon-lookups.png DELETED
Binary file
images/powerup-icon-lookups@2x.png DELETED
Binary file
images/powerup-icon-subscribe.png DELETED
Binary file
images/powerup-icon-subscribe@2x.png DELETED
Binary file
images/powerup-icon-vip.png DELETED
Binary file
images/powerup-icon-vip@2x.png DELETED
Binary file
images/powerups.png DELETED
Binary file
images/select2-spinner.gif CHANGED
Binary file
images/triangle.png CHANGED
Binary file
inc/class-emailer.php DELETED
@@ -1,623 +0,0 @@
1
- <?php
2
- //=============================================
3
- // LI_Emailer Class
4
- //=============================================
5
- class LI_Emailer {
6
-
7
- /**
8
- * Class constructor
9
- */
10
- function __construct ()
11
- {
12
-
13
- }
14
-
15
- /**
16
- * Sends the leads history email
17
- *
18
- * @param string
19
- * @return bool $email_sent Whether the email contents were sent successfully. A true return value does not automatically mean that the user received the email successfully. It just only means that the method used was able to process the request without any errors.
20
- */
21
- function send_new_lead_email ( $hashkey )
22
- {
23
- $li_contact = new LI_Contact();
24
- $li_contact->hashkey = $hashkey;
25
- $li_contact->get_contact_history();
26
- $history = $li_contact->history;
27
-
28
- $body = "";
29
-
30
- $body = $this->build_body($li_contact);
31
-
32
- // Each line in an email can only be 998 characters long, so lines need to be broken with a wordwrap
33
- $body = wordwrap($body, 900, "\r\n");
34
-
35
- // Get email from plugin settings, if none set, use admin email
36
- $options = get_option('leadin_options');
37
- $to = ( $options['li_email'] ? $options['li_email'] : get_bloginfo('admin_email') ); // Get email from plugin settings, if none set, use admin email
38
-
39
- $tag_status = '';
40
- if ( count($history->lead->last_submission['form_tags']) )
41
- $tag_status = 'tagged as "' . $history->lead->last_submission['form_tags'][0]['tag_text'] . '" ';
42
-
43
- $return_status = ( $tag_status ? '' : ' ' );
44
- if ( $history->lead->total_visits > 1 )
45
- $return_status = 'by a returning visitor ';
46
-
47
- if ( $history->lead->total_submissions > 1 )
48
- $return_status = 'by a returning contact ';
49
-
50
- $subject = "Form submission " . $tag_status . $return_status . "on " . get_bloginfo('name') . " - " . $history->lead->lead_email;
51
-
52
- $headers = "From: Leadin <notifications@leadin.com>\r\n";
53
- $headers .= "Reply-To: Leadin <notifications@leadin.com>\r\n";
54
- $headers .= "X-Mailer: PHP/" . phpversion() . "\r\n";
55
- $headers .= "MIME-Version: 1.0\r\n";
56
- $headers .= "Content-type: text/html; charset=utf-8\r\n";
57
-
58
- if ( isset($options['pro']) && $options['pro'] )
59
- {
60
- if ( strstr($to, ',') )
61
- $emails = explode(',', $to);
62
- else
63
- $emails = array($to);
64
-
65
- if ( count($emails) )
66
- {
67
- foreach ( $emails as $to_email )
68
- {
69
- $email_sent = $this->send_email_via_sendgrid($to_email, $subject, $body, get_bloginfo('wpurl'));
70
-
71
- if ( $email_sent )
72
- {
73
- leadin_track_plugin_activity('Contact Notification Sent', array('service' => 'sendgrid'));
74
- }
75
- else
76
- {
77
- $email_sent = wp_mail($to_email, $subject, $body, $headers);
78
- leadin_track_plugin_activity('Contact Notification Sent', array('service' => 'php_mail'));
79
- }
80
- }
81
- }
82
- }
83
- else
84
- {
85
- $headers = "From: Leadin <notifications@leadin.com>\r\n";
86
- $headers .= "Reply-To: Leadin <notifications@leadin.com>\r\n";
87
- $headers .= "X-Mailer: PHP/" . phpversion() . "\r\n";
88
- $headers .= "MIME-Version: 1.0\r\n";
89
- $headers .= "Content-type: text/html; charset=utf-8\r\n";
90
-
91
- $email_sent = wp_mail($to, $subject, $body, $headers);
92
- leadin_track_plugin_activity('Contact Notification Sent', array('service' => 'php_mail'));
93
- }
94
-
95
- return $email_sent;
96
- }
97
-
98
- /**
99
- * Creates the contact identity section of the contact notification email
100
- *
101
- * @param stdClass LI_Contact
102
- * @return string concatenated string with HTML body
103
- */
104
- function build_body ( $li_contact )
105
- {
106
- $format = '<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8"/><meta name="viewport" content="width=device-width"/></head><body style="width: 100%%;min-width: 100%%;-webkit-text-size-adjust: 100%%;-ms-text-size-adjust: 100%%;margin: 0;padding: 0;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;text-align: left;line-height: 19px;font-size: 14px;background-color: #f1f1f1;"><table class="body" style="border-spacing: 0;border-collapse: collapse;padding: 0;vertical-align: top;text-align: left;height: 100%%;width: 100%%;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;background-color: #f1f1f1;"><tr style="padding: 0;vertical-align: top;text-align: left;"><td class="center" align="center" valign="top" style="word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;hyphens: auto;border-collapse: collapse;padding: 0;vertical-align: top;text-align: center;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;"><center style="width: 100%%;min-width: 580px;"><table class="container" style="border-spacing: 0;border-collapse: collapse;padding: 0;vertical-align: top;text-align: inherit;width: 580px;margin: 0 auto;"><tr style="padding: 0;vertical-align: top;text-align: left;"><td style="word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;hyphens: auto;border-collapse: collapse;padding: 0;vertical-align: top;text-align: left;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;">%s%s%s%s%s</td></tr></table></center></td></tr></table></body></html>';
107
-
108
- $built_body = sprintf($format, $this->build_submission_details(get_bloginfo('url')), $this->build_contact_identity($li_contact->history->lead->lead_email), $this->build_sessions($li_contact->history), $this->build_enrichment_data($li_contact), $this->build_footer($li_contact));
109
-
110
- return $built_body;
111
- }
112
-
113
- /**
114
- * Creates the contact identity section of the contact notification email
115
- *
116
- * @param string site URL
117
- * @return string concatenated string - New submission on [Site Name](linked to site URL)
118
- */
119
- function build_submission_details ( $url )
120
- {
121
- $format = '<table class="row submission-detail" style="border-spacing: 0;border-collapse: collapse;padding: 0px;vertical-align: top;text-align: left;width: 100%%;position: relative;display: block;"><tr style="padding: 0;vertical-align: top;text-align: left;"><td class="wrapper last" style="word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;hyphens: auto;border-collapse: collapse;padding: 10px 20px 0px 0px;vertical-align: top;text-align: left;position: relative;padding-right: 0px;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;"><table class="twelve columns" style="border-spacing: 0;border-collapse: collapse;padding: 0;vertical-align: top;text-align: left;margin: 0 auto;width: 580px;"><tr style="padding: 0;vertical-align: top;text-align: left;"><td class="text-pad" style="word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;hyphens: auto;border-collapse: collapse;padding: 0px 0px 10px;vertical-align: top;text-align: left;padding-left: 10px;padding-right: 10px;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;"><h3 style="color: #666;font-family: Helvetica, Arial, sans-serif;font-weight: normal;padding: 0;margin: 0;text-align: left;line-height: 1.3;word-break: normal;font-size: 18px;">New submission on <a href="%s" style="color: #2ba6cb;text-decoration: none;">%s</a></h3></td><td class="expander" style="word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;hyphens: auto;border-collapse: collapse;padding: 0;vertical-align: top;text-align: left;visibility: hidden;width: 0px;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;"></td></tr></table></td></tr></table>' . "\r\n";
122
- $built_submission_details = sprintf($format, $url, get_bloginfo('name'));
123
- $built_submission_details .= '<img src="' . $this->create_tracking_pixel() . '"/>';
124
-
125
- return $built_submission_details;
126
- }
127
-
128
- /**
129
- * Creates the contact identity section of the contact notification email
130
- *
131
- * @param string email address from LI_Contact
132
- * @return string concatenated string with avatar + linked email address
133
- */
134
- function build_contact_identity ( $email )
135
- {
136
- $avatar_img = "https://api.hubapi.com/socialintel/v1/avatars?email=" . $email;
137
-
138
- $format = '<table class="row lead-identity" style="border-spacing: 0;border-collapse: collapse;padding: 0px;vertical-align: top;text-align: left;width: 100%%;position: relative;display: block;"><tr style="padding: 0;vertical-align: top;text-align: left;"><td class="wrapper" style="word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;hyphens: auto;border-collapse: collapse;padding: 10px 20px 0px 0px;vertical-align: top;text-align: left;position: relative;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;"><table class="two columns" style="border-spacing: 0;border-collapse: collapse;padding: 0;vertical-align: top;text-align: left;margin: 0 auto;width: 80px;"><tr style="padding: 0;vertical-align: top;text-align: left;"><td class="text-pad" style="word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;hyphens: auto;border-collapse: collapse;padding: 0px 0px 10px;vertical-align: top;text-align: left;padding-left: 10px;padding-right: 10px;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;"><img height="60" width="60" src="%s" style="background-color:#F6601D;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;width: auto;max-width: 100%%;float: left;clear: both;display: block;"/></td><td class="expander" style="word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;hyphens: auto;border-collapse: collapse;padding: 0;vertical-align: top;text-align: left;visibility: hidden;width: 0px;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;"></td></tr></table></td><td class="wrapper last" style="word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;hyphens: auto;border-collapse: collapse;padding: 10px 20px 0px 0px;vertical-align: top;text-align: left;position: relative;padding-right: 0px;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;"><table class="ten columns" style="border-spacing: 0;border-collapse: collapse;padding: 0;vertical-align: top;text-align: left;margin: 0 auto;width: 480px;"><tr style="padding: 0;vertical-align: top;text-align: left;"><td style="word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;hyphens: auto;border-collapse: collapse;padding: 0px 0px 10px;vertical-align: top;text-align: left;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;"><a style="color: #2ba6cb;text-decoration: none;" href="mailto:%s"><h1 style="font-family: Helvetica, Arial, sans-serif;font-weight: normal;padding: 0;margin: 0;text-align: left;line-height: 60px;word-break: normal;font-size: 26px;">%s</h1></a></td><td class="expander" style="word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;hyphens: auto;border-collapse: collapse;padding: 0;vertical-align: top;text-align: left;visibility: hidden;width: 0px;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;"></td></tr></table></td></tr></table>';
139
- $built_identity = sprintf($format, $avatar_img, $email, $email);
140
-
141
- return $built_identity;
142
- }
143
-
144
- /**
145
- * Creates each session section separated by a spacer
146
- *
147
- * @param stdClass LI_contact
148
- * @return string concatenated string of sessions
149
- */
150
- function build_sessions ( $history )
151
- {
152
- $built_sessions = "";
153
-
154
- $sessions = $history->sessions;
155
-
156
- foreach ( $sessions as &$session )
157
- {
158
- $first_event = end($session['events']);
159
- $first_event_date = $first_event['activities'][0]['event_date'];
160
- $session_date = date('F j, Y, g:i a', strtotime($first_event_date));
161
-
162
- $last_event = array_values($session['events']);
163
- $last_event = $last_event[0];
164
- $last_activity = end($last_event['activities']);
165
- $session_end_time = date('g:i a', strtotime($last_activity['event_date']));
166
-
167
- $format = '<table class="row lead-timeline__date" style="border-spacing: 0;border-collapse: collapse;padding: 0px;vertical-align: top;text-align: left;width: 100%%;position: relative;display: block;"><tr style="padding: 0;vertical-align: top;text-align: left;"><td class="wrapper last" style="word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;hyphens: auto;border-collapse: collapse;padding: 10px 20px 0px 0px;vertical-align: top;text-align: left;position: relative;padding-right: 0px;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;"><table class="twelve columns" style="border-spacing: 0;border-collapse: collapse;padding: 0;vertical-align: top;text-align: left;margin: 0 auto;width: 580px;"><tr style="padding: 0;vertical-align: top;text-align: left;"><td class="text-pad" style="word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;hyphens: auto;border-collapse: collapse;padding: 0px 0px 10px;vertical-align: top;text-align: left;padding-left: 10px;padding-right: 10px;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;"><h4 style="color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: bold;padding: 0;margin: 0;text-align: left;line-height: 1.3;word-break: normal;font-size: 14px;">%s - %s</h4></td><td class="expander" style="word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;hyphens: auto;border-collapse: collapse;padding: 0;vertical-align: top;text-align: left;visibility: hidden;width: 0px;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;"></td></tr></table></td></tr></table>';
168
- $built_sessions .= sprintf($format, $session_date, $session_end_time);
169
-
170
- $events = $session['events'];
171
-
172
- foreach ( $events as &$event )
173
- {
174
- if ( $event['event_type'] == 'pageview' )
175
- {
176
- $pageview = $event['activities'][0];
177
- $pageview_time = date('g:ia', strtotime($pageview['event_date']));
178
- $pageview_url = $pageview['pageview_url'];
179
- $pageview_title = $pageview['pageview_title'];
180
- $pageview_source = $pageview['pageview_source'];
181
-
182
- $format = '<table class="row lead-timeline__event pageview" style="border-spacing: 0;border-collapse: collapse;padding: 0px;vertical-align: top;text-align: left;width: 100%%;position: relative;display: block;background-color: #fff;border-top: 1px solid #dedede;border-right: 1px solid #dedede;border-left: 4px solid #28c;"><tr style="padding: 0;vertical-align: top;text-align: left;"><td class="wrapper" style="word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;hyphens: auto;border-collapse: collapse;padding: 10px 20px 0px 0px;vertical-align: top;text-align: left;position: relative;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;"><table class="two columns" style="border-spacing: 0;border-collapse: collapse;padding: 0;vertical-align: top;text-align: left;margin: 0 auto;width: 80px;"><tr style="padding: 0;vertical-align: top;text-align: left;"><td class="text-pad" style="word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;hyphens: auto;border-collapse: collapse;padding: 0px 0px 10px;vertical-align: top;text-align: left;padding-left: 10px;padding-right: 10px;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;"><p class="lead-timeline__event-time" style="margin: 0;color: #1f6696;font-family: Helvetica, Arial, sans-serif;font-weight: normal;padding: 0;text-align: left;line-height: 19px;font-size: 14px;margin-bottom: 10px;">%s</p></td><td class="expander" style="word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;hyphens: auto;border-collapse: collapse;padding: 0;vertical-align: top;text-align: left;visibility: hidden;width: 0px;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;"></td></tr></table></td><td class="wrapper last" style="word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;hyphens: auto;border-collapse: collapse;padding: 10px 20px 0px 0px;vertical-align: top;text-align: left;position: relative;padding-right: 0px;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;"><table class="ten columns" style="border-spacing: 0;border-collapse: collapse;padding: 0;vertical-align: top;text-align: left;margin: 0 auto;width: 480px;"><tr style="padding: 0;vertical-align: top;text-align: left;"><td class="text-pad" style="word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;hyphens: auto;border-collapse: collapse;padding: 0px 0px 10px;vertical-align: top;text-align: left;padding-left: 10px;padding-right: 10px;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;"><p class="lead-timeline__event-title" style="margin: 0;color: #1f6696;font-family: Helvetica, Arial, sans-serif;font-weight: normal;padding: 0;text-align: left;line-height: 19px;font-size: 14px;margin-bottom: 10px;">%s</p><p class="lead-timeline__pageview-url" style="margin: 0;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;padding: 0;text-align: left;line-height: 19px;font-size: 14px;margin-bottom: 10px;"><a href="%s" style="color: #999;text-decoration: none;">%s</a></p></td><td class="expander" style="word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;hyphens: auto;border-collapse: collapse;padding: 0;vertical-align: top;text-align: left;visibility: hidden;width: 0px;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;"></td></tr></table></td></tr></table>';
183
- $built_sessions .= sprintf($format, $pageview_time, $pageview_title, $pageview_url, leadin_strip_params_from_url($pageview_url));
184
-
185
- if ( $pageview['event_date'] == $first_event_date )
186
- {
187
- $format = '<table class="row lead-timeline__event traffic-source" style="margin-bottom: 20px;border-spacing: 0;border-collapse: collapse;padding: 0px;vertical-align: top;text-align: left;width: 100%%;position: relative;display: block;background-color: #fff;border-top: 1px solid #dedede;border-right: 1px solid #dedede;border-left: 4px solid #99aa1f;border-bottom: 1px solid #dedede;"><tr style="padding: 0;vertical-align: top;text-align: left;"><td class="wrapper" style="word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;hyphens: auto;border-collapse: collapse;padding: 10px 20px 0px 0px;vertical-align: top;text-align: left;position: relative;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;"><table class="two columns" style="border-spacing: 0;border-collapse: collapse;padding: 0;vertical-align: top;text-align: left;margin: 0 auto;width: 80px;"><tr style="padding: 0;vertical-align: top;text-align: left;"><td class="text-pad" style="word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;hyphens: auto;border-collapse: collapse;padding: 0px 0px 10px;vertical-align: top;text-align: left;padding-left: 10px;padding-right: 10px;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;"><p class="lead-timeline__event-time" style="margin: 0;color: #727e14;font-family: Helvetica, Arial, sans-serif;font-weight: normal;padding: 0;text-align: left;line-height: 19px;font-size: 14px;margin-bottom: 10px;">%s</p></td><td class="expander" style="word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;hyphens: auto;border-collapse: collapse;padding: 0;vertical-align: top;text-align: left;visibility: hidden;width: 0px;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;"></td></tr></table></td><td class="wrapper last" style="word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;hyphens: auto;border-collapse: collapse;padding: 10px 20px 0px 0px;vertical-align: top;text-align: left;position: relative;padding-right: 0px;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;"><table class="ten columns" style="border-spacing: 0;border-collapse: collapse;padding: 0;vertical-align: top;text-align: left;margin: 0 auto;width: 480px;"><tr style="padding: 0;vertical-align: top;text-align: left;"><td class="text-pad" style="word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;hyphens: auto;border-collapse: collapse;padding: 0px 0px 10px;vertical-align: top;text-align: left;padding-left: 10px;padding-right: 10px;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;"><p class="lead-timeline__event-title" style="margin: 0;color: #727e14;font-family: Helvetica, Arial, sans-serif;font-weight: normal;padding: 0;text-align: left;line-height: 19px;font-size: 14px;margin-bottom: 10px;">Traffic Source: %s</p> %s </td><td class="expander" style="word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;hyphens: auto;border-collapse: collapse;padding: 0;vertical-align: top;text-align: left;visibility: hidden;width: 0px;color: #222222;font-family: Helvetica, Arial, sans-serif;font-weight: normal;margin: 0;line-height: 19px;font-size: 14px;"></td></tr></table></td></tr></table>';
188
- $built_sessions .= sprintf($format, $pageview_time, ( $pageview_source ? '<a href="' . $pageview_source . '">' . leadin_strip_params_from_url($pageview_source) . '</a>' : 'Direct' ), $this->build_source_url_params($pageview_source));
189
- }
190
-