ThirstyAffiliates Affiliate Link Manager - Version 3.1.0

Version Description

  • Feature: Add REST API support
  • Feature: Automatically add link prefix in the robots.txt to prevent indexing
  • Feature: Exclude known search engine bots from stats
  • Feature: Trim stats table on a regular cron
  • Improvement: Make sure the insert buttons in link picker popup stay in place
  • Improvement: Readd the social links on the settings Help tab
  • Improvement: Improve the save click data function
  • Bug Fix: Link picker popup starts searching with only 1 character
  • Bug Fix: Uncloaker should not HTML encode & ampersand characters
  • Bug Fix: Authors and Editors cannot see the ThirstyAffiliates link picker button
  • Bug Fix: Htaccess module removes the wrong .htaccess section
  • Bug Fix: Various error messages for different user roles
Download this release

Release Info

Developer jkohlbach
Plugin Icon 128x128 ThirstyAffiliates Affiliate Link Manager
Version 3.1.0
Comparing to
See all releases

Code changes from version 3.0.3 to 3.1.0

Helpers/Plugin_Constants.php CHANGED
@@ -27,7 +27,7 @@ class Plugin_Constants {
27
  // Plugin configuration constants
28
  const TOKEN = 'ta';
29
  const INSTALLED_VERSION = 'ta_installed_version';
30
- const VERSION = '3.0.3';
31
  const TEXT_DOMAIN = 'thirstyaffiliates';
32
  const THEME_TEMPLATE_PATH = 'thirstyaffiliates';
33
  const META_DATA_PREFIX = '_ta_';
@@ -41,6 +41,7 @@ class Plugin_Constants {
41
  const CRON_REQUEST_REVIEW = 'ta_cron_request_review';
42
  const CRON_MIGRATE_OLD_PLUGIN_DATA = 'ta_cron_migrate_old_plugin_data';
43
  const CRON_TAPRO_NOTICE = 'ta_cron_tapro_notice';
 
44
 
45
  // Options
46
  const SHOW_REQUEST_REVIEW = 'ta_show_request_review';
@@ -154,4 +155,9 @@ class Plugin_Constants {
154
  return $this->_REDIRECT_TYPES;
155
  }
156
 
 
 
 
 
 
157
  }
27
  // Plugin configuration constants
28
  const TOKEN = 'ta';
29
  const INSTALLED_VERSION = 'ta_installed_version';
30
+ const VERSION = '3.1.0';
31
  const TEXT_DOMAIN = 'thirstyaffiliates';
32
  const THEME_TEMPLATE_PATH = 'thirstyaffiliates';
33
  const META_DATA_PREFIX = '_ta_';
41
  const CRON_REQUEST_REVIEW = 'ta_cron_request_review';
42
  const CRON_MIGRATE_OLD_PLUGIN_DATA = 'ta_cron_migrate_old_plugin_data';
43
  const CRON_TAPRO_NOTICE = 'ta_cron_tapro_notice';
44
+ const CRON_STATS_TRIMMER = 'ta_cron_stats_trimmer';
45
 
46
  // Options
47
  const SHOW_REQUEST_REVIEW = 'ta_show_request_review';
155
  return $this->_REDIRECT_TYPES;
156
  }
157
 
158
+ // HTAccess Module
159
+ public function HTACCESS_FILE() {
160
+ return ABSPATH . '/.htaccess';
161
+ }
162
+
163
  }
Interfaces/Deactivatable_Interface.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace ThirstyAffiliates\Interfaces;
3
+
4
+ if ( !defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
5
+
6
+ /**
7
+ * Abstraction that provides contract relating to deactivation.
8
+ * Any model that needs some sort of deactivation must implement this interface.
9
+ *
10
+ * @since 3.1.0
11
+ */
12
+ interface Deactivatable_Interface {
13
+
14
+ /**
15
+ * Contract for deactivation.
16
+ *
17
+ * @since 3.1.0
18
+ * @access public
19
+ */
20
+ public function deactivate();
21
+
22
+ }
Models/Affiliate_Link.php CHANGED
@@ -151,7 +151,7 @@ class Affiliate_Link {
151
  * @param Helper_Functions $helper_functions Helper functions object.
152
  */
153
  public function __construct( $id = null ) {
154
-
155
  $this->_constants = ThirstyAffiliates()->helpers[ 'Plugin_Constants' ];
156
  $this->_helper_functions = ThirstyAffiliates()->helpers[ 'Helper_Functions' ];
157
 
@@ -217,7 +217,7 @@ class Affiliate_Link {
217
 
218
  default :
219
  $value = get_post_meta( $this->id , Plugin_Constants::META_DATA_PREFIX . $prop , true );
220
- $this->data[ $prop ] = apply_filters( 'ta_read_thirstylink_property' , $value , $prop , $this->default_data );
221
  break;
222
 
223
  }
@@ -297,7 +297,7 @@ class Affiliate_Link {
297
  else
298
  $return_value = ( $default ) ? $default : $default_data[ $prop ];
299
 
300
- return $prop === 'destination_url' ? esc_url( $return_value ) : $return_value;
301
 
302
  }
303
 
@@ -578,17 +578,20 @@ class Affiliate_Link {
578
  * Count affiliate link clicks.
579
  *
580
  * @since 3.0.0
 
581
  * @access public
582
  *
 
583
  * @return int Total number of clicks.
584
  */
585
- public function count_clicks() {
586
 
587
  global $wpdb;
588
 
589
  $table_name = $wpdb->prefix . Plugin_Constants::LINK_CLICK_DB;
590
  $link_id = $this->get_id();
591
  $query = "SELECT count(*) from $table_name WHERE link_id = $link_id";
 
592
  $clicks = $wpdb->get_var( $query );
593
 
594
  return (int) $clicks;
151
  * @param Helper_Functions $helper_functions Helper functions object.
152
  */
153
  public function __construct( $id = null ) {
154
+
155
  $this->_constants = ThirstyAffiliates()->helpers[ 'Plugin_Constants' ];
156
  $this->_helper_functions = ThirstyAffiliates()->helpers[ 'Helper_Functions' ];
157
 
217
 
218
  default :
219
  $value = get_post_meta( $this->id , Plugin_Constants::META_DATA_PREFIX . $prop , true );
220
+ $this->data[ $prop ] = apply_filters( 'ta_read_thirstylink_property' , $value , $prop , $this->get_merged_default_extended_data() );
221
  break;
222
 
223
  }
297
  else
298
  $return_value = ( $default ) ? $default : $default_data[ $prop ];
299
 
300
+ return $return_value;
301
 
302
  }
303
 
578
  * Count affiliate link clicks.
579
  *
580
  * @since 3.0.0
581
+ * @since 3.1.0 Add $date_offset parameter to count links only to a certain point.
582
  * @access public
583
  *
584
+ * @param string $date_offset Date before limit to check
585
  * @return int Total number of clicks.
586
  */
587
+ public function count_clicks( $date_offset = '' ) {
588
 
589
  global $wpdb;
590
 
591
  $table_name = $wpdb->prefix . Plugin_Constants::LINK_CLICK_DB;
592
  $link_id = $this->get_id();
593
  $query = "SELECT count(*) from $table_name WHERE link_id = $link_id";
594
+ $query .= ( $date_offset && \DateTime::createFromFormat('Y-m-d H:i:s', $date_offset ) !== false ) ? " AND date_clicked > '$date_offset'" : '';
595
  $clicks = $wpdb->get_var( $query );
596
 
597
  return (int) $clicks;
Models/Affiliate_Links_CPT.php CHANGED
@@ -166,7 +166,7 @@ class Affiliate_Links_CPT implements Model_Interface , Initiable_Interface {
166
  'label' => __( 'Affiliate Links' , 'thirstyaffiliates' ),
167
  'description' => __( 'ThirstyAffiliates affiliate links' , 'thirstyaffiliates' ),
168
  'labels' => $labels,
169
- 'supports' => array( 'title' ),
170
  'taxonomies' => array(),
171
  'hierarchical' => true,
172
  'public' => true,
@@ -190,9 +190,13 @@ class Affiliate_Links_CPT implements Model_Interface , Initiable_Interface {
190
  'has_archive' => false,
191
  'exclude_from_search' => true,
192
  'publicly_queryable' => true,
193
- 'capability_type' => 'post'
 
194
  );
195
 
 
 
 
196
  register_post_type( Plugin_Constants::AFFILIATE_LINKS_CPT , apply_filters( 'ta_affiliate_links_cpt_args' , $args , $labels ) );
197
 
198
  do_action( 'ta_after_register_thirstylink_post_type' , $link_prefix );
@@ -279,8 +283,8 @@ class Affiliate_Links_CPT implements Model_Interface , Initiable_Interface {
279
  add_meta_box( 'ta-link-options-metabox', __( 'Link Options', 'thirstyaffiliates' ), array( $this , 'link_options_metabox' ) , Plugin_Constants::AFFILIATE_LINKS_CPT , 'side' );
280
 
281
  // remove
282
- remove_meta_box( 'submitdiv', Plugin_Constants::AFFILIATE_LINKS_CPT, 'side' );
283
-
284
  }
285
 
286
  /**
166
  'label' => __( 'Affiliate Links' , 'thirstyaffiliates' ),
167
  'description' => __( 'ThirstyAffiliates affiliate links' , 'thirstyaffiliates' ),
168
  'labels' => $labels,
169
+ 'supports' => array( 'title' , 'custom-fields' ),
170
  'taxonomies' => array(),
171
  'hierarchical' => true,
172
  'public' => true,
190
  'has_archive' => false,
191
  'exclude_from_search' => true,
192
  'publicly_queryable' => true,
193
+ 'capability_type' => 'post',
194
+ 'show_in_rest' => true
195
  );
196
 
197
+ if ( ! current_user_can( apply_filters( 'ta_add_affiliate_link_capability' , 'publish_posts' ) ) )
198
+ $args[ 'capabilities' ] = array( 'create_posts' => false , 'delete_posts' => false );
199
+
200
  register_post_type( Plugin_Constants::AFFILIATE_LINKS_CPT , apply_filters( 'ta_affiliate_links_cpt_args' , $args , $labels ) );
201
 
202
  do_action( 'ta_after_register_thirstylink_post_type' , $link_prefix );
283
  add_meta_box( 'ta-link-options-metabox', __( 'Link Options', 'thirstyaffiliates' ), array( $this , 'link_options_metabox' ) , Plugin_Constants::AFFILIATE_LINKS_CPT , 'side' );
284
 
285
  // remove
286
+ remove_meta_box( 'submitdiv', Plugin_Constants::AFFILIATE_LINKS_CPT , 'side' );
287
+ remove_meta_box( 'postcustom' , Plugin_Constants::AFFILIATE_LINKS_CPT , 'normal' );
288
  }
289
 
290
  /**
Models/Bootstrap.php CHANGED
@@ -6,6 +6,7 @@ use ThirstyAffiliates\Abstracts\Abstract_Main_Plugin_Class;
6
  use ThirstyAffiliates\Interfaces\Model_Interface;
7
  use ThirstyAffiliates\Interfaces\Activatable_Interface;
8
  use ThirstyAffiliates\Interfaces\Initiable_Interface;
 
9
 
10
  use ThirstyAffiliates\Helpers\Plugin_Constants;
11
  use ThirstyAffiliates\Helpers\Helper_Functions;
@@ -70,6 +71,15 @@ class Bootstrap implements Model_Interface {
70
  */
71
  private $_initiables;
72
 
 
 
 
 
 
 
 
 
 
73
 
74
 
75
 
@@ -83,6 +93,7 @@ class Bootstrap implements Model_Interface {
83
  * Class constructor.
84
  *
85
  * @since 3.0.0
 
86
  * @access public
87
  *
88
  * @param Abstract_Main_Plugin_Class $main_plugin Main plugin object.
@@ -90,13 +101,15 @@ class Bootstrap implements Model_Interface {
90
  * @param Helper_Functions $helper_functions Helper functions object.
91
  * @param array $activatables Array of models implementing ThirstyAffiliates\Interfaces\Activatable_Interface.
92
  * @param array $initiables Array of models implementing ThirstyAffiliates\Interfaces\Initiable_Interface.
 
93
  */
94
- public function __construct( Abstract_Main_Plugin_Class $main_plugin , Plugin_Constants $constants , Helper_Functions $helper_functions , array $activatables = array() , array $initiables = array() ) {
95
 
96
  $this->_constants = $constants;
97
  $this->_helper_functions = $helper_functions;
98
  $this->_activatables = $activatables;
99
  $this->_initiables = $initiables;
 
100
 
101
  $main_plugin->add_to_all_plugin_models( $this );
102
 
@@ -115,10 +128,10 @@ class Bootstrap implements Model_Interface {
115
  * @param array $initiables Array of models implementing ThirstyAffiliates\Interfaces\Initiable_Interface.
116
  * @return Bootstrap
117
  */
118
- public static function get_instance( Abstract_Main_Plugin_Class $main_plugin , Plugin_Constants $constants , Helper_Functions $helper_functions , array $activatables = array() , array $initiables = array() ) {
119
 
120
  if ( !self::$_instance instanceof self )
121
- self::$_instance = new self( $main_plugin , $constants , $helper_functions , $activatables , $initiables );
122
 
123
  return self::$_instance;
124
 
@@ -159,7 +172,7 @@ class Bootstrap implements Model_Interface {
159
  'thirstyaffiliates-azon-add-on/azon-bootstrap.php',
160
  'thirstyaffiliates-itunes/thirstyaffiliates-itunes.bootstrap.php'
161
  ) , true , null ); // Deactivate on all sites in the network and do not fire deactivation hooks
162
-
163
  global $wpdb;
164
 
165
  if ( is_multisite() ) {
@@ -309,6 +322,11 @@ class Bootstrap implements Model_Interface {
309
  */
310
  private function _deactivate_plugin( $blogid ) {
311
 
 
 
 
 
 
312
  flush_rewrite_rules();
313
 
314
  }
6
  use ThirstyAffiliates\Interfaces\Model_Interface;
7
  use ThirstyAffiliates\Interfaces\Activatable_Interface;
8
  use ThirstyAffiliates\Interfaces\Initiable_Interface;
9
+ use ThirstyAffiliates\Interfaces\Deactivatable_Interface;
10
 
11
  use ThirstyAffiliates\Helpers\Plugin_Constants;
12
  use ThirstyAffiliates\Helpers\Helper_Functions;
71
  */
72
  private $_initiables;
73
 
74
+ /**
75
+ * Array of models implementing the ThirstyAffiliates\Interfaces\Deactivatable_Interface.
76
+ *
77
+ * @since 3.1.0
78
+ * @access private
79
+ * @var array
80
+ */
81
+ private $_deactivatables;
82
+
83
 
84
 
85
 
93
  * Class constructor.
94
  *
95
  * @since 3.0.0
96
+ * @since 3.1.0 Add deactivatables interface.
97
  * @access public
98
  *
99
  * @param Abstract_Main_Plugin_Class $main_plugin Main plugin object.
101
  * @param Helper_Functions $helper_functions Helper functions object.
102
  * @param array $activatables Array of models implementing ThirstyAffiliates\Interfaces\Activatable_Interface.
103
  * @param array $initiables Array of models implementing ThirstyAffiliates\Interfaces\Initiable_Interface.
104
+ * @param array $deactivatables Array of models implementing ThirstyAffiliates\Interfaces\Deactivatable_Interface.
105
  */
106
+ public function __construct( Abstract_Main_Plugin_Class $main_plugin , Plugin_Constants $constants , Helper_Functions $helper_functions , array $activatables = array() , array $initiables = array() , array $deactivatables = array() ) {
107
 
108
  $this->_constants = $constants;
109
  $this->_helper_functions = $helper_functions;
110
  $this->_activatables = $activatables;
111
  $this->_initiables = $initiables;
112
+ $this->_deactivatables = $deactivatables;
113
 
114
  $main_plugin->add_to_all_plugin_models( $this );
115
 
128
  * @param array $initiables Array of models implementing ThirstyAffiliates\Interfaces\Initiable_Interface.
129
  * @return Bootstrap
130
  */
131
+ public static function get_instance( Abstract_Main_Plugin_Class $main_plugin , Plugin_Constants $constants , Helper_Functions $helper_functions , array $activatables = array() , array $initiables = array() , array $deactivatables = array() ) {
132
 
133
  if ( !self::$_instance instanceof self )
134
+ self::$_instance = new self( $main_plugin , $constants , $helper_functions , $activatables , $initiables , $deactivatables );
135
 
136
  return self::$_instance;
137
 
172
  'thirstyaffiliates-azon-add-on/azon-bootstrap.php',
173
  'thirstyaffiliates-itunes/thirstyaffiliates-itunes.bootstrap.php'
174
  ) , true , null ); // Deactivate on all sites in the network and do not fire deactivation hooks
175
+
176
  global $wpdb;
177
 
178
  if ( is_multisite() ) {
322
  */
323
  private function _deactivate_plugin( $blogid ) {
324
 
325
+ // Execute 'deactivate' contract of models implementing ThirstyAffiliates\Interfaces\Deactivatable_Interface
326
+ foreach ( $this->_deactivatables as $deactivatable )
327
+ if ( $deactivatable instanceof Deactivatable_Interface )
328
+ $deactivatable->deactivate();
329
+
330
  flush_rewrite_rules();
331
 
332
  }
Models/Link_Fixer.php CHANGED
@@ -156,7 +156,7 @@ class Link_Fixer implements Model_Interface , Initiable_Interface {
156
  'key' => $key,
157
  'link_id' => $link_id,
158
  'class' => esc_attr( trim( $class ) ),
159
- 'href' => esc_url( $href ),
160
  'rel' => esc_attr( trim( $rel ) ),
161
  'target' => esc_attr( $target ),
162
  'title' => $title
156
  'key' => $key,
157
  'link_id' => $link_id,
158
  'class' => esc_attr( trim( $class ) ),
159
+ 'href' => esc_url_raw( $href ),
160
  'rel' => esc_attr( trim( $rel ) ),
161
  'target' => esc_attr( $target ),
162
  'title' => $title
Models/Link_Picker.php CHANGED
@@ -124,7 +124,7 @@ class Link_Picker implements Model_Interface {
124
  */
125
  public function init_thirsty_editor_buttons() {
126
 
127
- if ( ! is_admin() || ! current_user_can( 'edit_posts' ) || ! current_user_can( 'edit_pages' ) )
128
  return;
129
 
130
  if ( get_option( 'ta_disable_visual_editor_buttons' ) == 'yes' || get_user_option( 'rich_editing' ) != 'true' )
@@ -162,8 +162,11 @@ class Link_Picker implements Model_Interface {
162
  */
163
  public function register_mce_buttons( $buttons ) {
164
 
165
- array_push( $buttons , 'separator' , 'thirstyaffiliates_button' );
166
- array_push( $buttons , 'separator' , 'thirstyaffiliates_quickaddlink_button' );
 
 
 
167
 
168
  return $buttons;
169
  }
@@ -235,8 +238,8 @@ class Link_Picker implements Model_Interface {
235
  data-rel="' . trim( esc_attr( $rel ) ) . '"
236
  data-target="' . esc_attr( $target ) . '"
237
  data-other-atts="' . esc_attr( $other_atts ) . '">
238
- <span class="name">' . $thirstylink->get_prop( 'name' ) . '</span>
239
- <span class="slug">[' . $thirstylink->get_prop( 'slug' ) . ']</span>
240
  <span class="actions">
241
  <button type="button" data-type="normal" class="button insert-link-button dashicons dashicons-admin-links" data-tip="' . __( 'Insert link' , 'thirstyaffiliates' ) . '"></button>
242
  <button type="button" data-type="shortcode" class="button insert-shortcode-button dashicons dashicons-editor-code" data-tip="' . __( 'Insert shortcode' , 'thirstyaffiliates' ) . '"></button>
@@ -303,8 +306,8 @@ class Link_Picker implements Model_Interface {
303
  */
304
  public function ajax_display_advanced_add_affiliate_link() {
305
 
306
- if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || ! current_user_can( apply_filters( 'ta_ajax_access_capability' , 'edit_posts' ) ) )
307
- wp_die();
308
 
309
  $post_id = isset( $_REQUEST[ 'post_id' ] ) ? intval( $_REQUEST[ 'post_id' ] ) : 0;
310
  $affiliate_links = $this->_helper_functions->search_affiliate_links_query();
@@ -367,8 +370,8 @@ class Link_Picker implements Model_Interface {
367
  */
368
  public function ajax_display_quick_add_affiliate_link_thickbox() {
369
 
370
- if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || ! current_user_can( apply_filters( 'ta_ajax_access_capability' , 'edit_posts' ) ) )
371
- wp_die();
372
 
373
  $post_id = isset( $_REQUEST[ 'post_id' ] ) ? intval( $_REQUEST[ 'post_id' ] ) : 0;
374
  $redirect_types = $this->_constants->REDIRECT_TYPES();
124
  */
125
  public function init_thirsty_editor_buttons() {
126
 
127
+ if ( ! is_admin() || ! current_user_can( 'edit_posts' ) )
128
  return;
129
 
130
  if ( get_option( 'ta_disable_visual_editor_buttons' ) == 'yes' || get_user_option( 'rich_editing' ) != 'true' )
162
  */
163
  public function register_mce_buttons( $buttons ) {
164
 
165
+ $enable_link_picker = current_user_can( apply_filters( 'ta_enable_advance_link_picker' , 'edit_posts' ) );
166
+ $enable_quick_add = current_user_can( apply_filters( 'ta_enable_quick_add_affiliate_link' , 'publish_posts' ) );
167
+
168
+ if ( $enable_link_picker ) array_push( $buttons , 'separator' , 'thirstyaffiliates_button' );
169
+ if ( $enable_quick_add ) array_push( $buttons , 'separator' , 'thirstyaffiliates_quickaddlink_button' );
170
 
171
  return $buttons;
172
  }
238
  data-rel="' . trim( esc_attr( $rel ) ) . '"
239
  data-target="' . esc_attr( $target ) . '"
240
  data-other-atts="' . esc_attr( $other_atts ) . '">
241
+ <span class="name">' . mb_strimwidth( $thirstylink->get_prop( 'name' ) , 0 , 44 , "..." ) . '</span>
242
+ <span class="slug">[' . mb_strimwidth( $thirstylink->get_prop( 'slug' ) , 0 , 35 , "..." ) . ']</span>
243
  <span class="actions">
244
  <button type="button" data-type="normal" class="button insert-link-button dashicons dashicons-admin-links" data-tip="' . __( 'Insert link' , 'thirstyaffiliates' ) . '"></button>
245
  <button type="button" data-type="shortcode" class="button insert-shortcode-button dashicons dashicons-editor-code" data-tip="' . __( 'Insert shortcode' , 'thirstyaffiliates' ) . '"></button>
306
  */
307
  public function ajax_display_advanced_add_affiliate_link() {
308
 
309
+ if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || ! current_user_can( apply_filters( 'ta_enable_advance_link_picker' , 'edit_posts' ) ) )
310
+ wp_die( "You're not allowed to do this." );
311
 
312
  $post_id = isset( $_REQUEST[ 'post_id' ] ) ? intval( $_REQUEST[ 'post_id' ] ) : 0;
313
  $affiliate_links = $this->_helper_functions->search_affiliate_links_query();
370
  */
371
  public function ajax_display_quick_add_affiliate_link_thickbox() {
372
 
373
+ if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || ! current_user_can( apply_filters( 'ta_enable_quick_add_affiliate_link' , 'publish_posts' ) ) )
374
+ wp_die( "You're not allowed to do this." );
375
 
376
  $post_id = isset( $_REQUEST[ 'post_id' ] ) ? intval( $_REQUEST[ 'post_id' ] ) : 0;
377
  $redirect_types = $this->_constants->REDIRECT_TYPES();
Models/Marketing.php CHANGED
@@ -317,7 +317,7 @@ class Marketing implements Model_Interface , Activatable_Interface , Initiable_I
317
  */
318
  public function add_pro_features_menu_link() {
319
 
320
- if ( !is_plugin_active( 'thirstyaffiliates-pro/thirstyaffiliates-pro.php' ) ) {
321
 
322
  global $submenu;
323
 
317
  */
318
  public function add_pro_features_menu_link() {
319
 
320
+ if ( !is_plugin_active( 'thirstyaffiliates-pro/thirstyaffiliates-pro.php' ) && current_user_can( 'manage_options' ) ) {
321
 
322
  global $submenu;
323
 
Models/Migration.php CHANGED
@@ -258,7 +258,7 @@ class Migration implements Model_Interface , Activatable_Interface , Initiable_I
258
  * @access public
259
  */
260
  public function migrate_old_plugin_data() {
261
-
262
  update_option( Plugin_Constants::MIGRATION_COMPLETE_FLAG , 'no' );
263
 
264
  $this->initialize_data_key_mappings();
@@ -461,7 +461,7 @@ class Migration implements Model_Interface , Activatable_Interface , Initiable_I
461
 
462
  // Do not esc the destination_url as its already escaped there on meta
463
  // There are cases on TA V2 that & are stored as double amps ( '&amp;amp;' ) we should replace them with single &amp;
464
- $value = str_replace( '&amp;amp;' , '&amp;' , $value );
465
 
466
  } else
467
  $value = esc_sql( $value );
@@ -769,32 +769,36 @@ class Migration implements Model_Interface , Activatable_Interface , Initiable_I
769
  /**
770
  * After migration, urls will have double amps, change this to single amps.
771
  * This is a behavior on TA v2 where it saves & on db as double amps.
772
- *
773
  * @since 3.0.1
774
  * @access public
775
  */
776
  public function fix_double_amps_on_destination_url() {
777
 
778
- global $wpdb;
779
-
780
  $affiliate_link_ids = array();
781
  foreach ( $this->_all_affiliate_links as $affiliate_link )
782
  $affiliate_link_ids[] = $affiliate_link->ID;
783
-
784
- $affiliate_link_ids_str = implode( "," , array_map( 'intval' , $affiliate_link_ids ) );
785
 
786
- $query = "UPDATE $wpdb->postmeta
787
- SET meta_value = REPLACE( meta_value , '&amp;amp;' , '&amp;' )
788
- WHERE meta_key = '_ta_destination_url'
789
- AND post_id IN ( $affiliate_link_ids_str )";
790
 
791
- $wpdb->query( $query );
 
 
 
 
 
 
 
 
 
792
 
793
  }
794
-
795
 
796
 
797
-
 
798
  /*
799
  |--------------------------------------------------------------------------
800
  | Fulfill Implemented Interface Contracts
258
  * @access public
259
  */
260
  public function migrate_old_plugin_data() {
261
+
262
  update_option( Plugin_Constants::MIGRATION_COMPLETE_FLAG , 'no' );
263
 
264
  $this->initialize_data_key_mappings();
461
 
462
  // Do not esc the destination_url as its already escaped there on meta
463
  // There are cases on TA V2 that & are stored as double amps ( '&amp;amp;' ) we should replace them with single &amp;
464
+ $value = esc_url_raw( str_replace( array( '&amp;amp;' , '&amp;' ) , '&' , $value ) );
465
 
466
  } else
467
  $value = esc_sql( $value );
769
  /**
770
  * After migration, urls will have double amps, change this to single amps.
771
  * This is a behavior on TA v2 where it saves & on db as double amps.
772
+ *
773
  * @since 3.0.1
774
  * @access public
775
  */
776
  public function fix_double_amps_on_destination_url() {
777
 
 
 
778
  $affiliate_link_ids = array();
779
  foreach ( $this->_all_affiliate_links as $affiliate_link )
780
  $affiliate_link_ids[] = $affiliate_link->ID;
 
 
781
 
782
+ if ( !empty( $affiliate_link_ids ) && is_array( $affiliate_link_ids ) ) {
783
+
784
+ global $wpdb;
 
785
 
786
+ $affiliate_link_ids_str = implode( "," , array_map( 'intval' , $affiliate_link_ids ) );
787
+
788
+ $query = "UPDATE $wpdb->postmeta
789
+ SET meta_value = REPLACE( REPLACE( meta_value , '&amp;amp;' , '&' ) , '&amp;' , '&' )
790
+ WHERE meta_key = '_ta_destination_url'
791
+ AND post_id IN ( $affiliate_link_ids_str )";
792
+
793
+ $wpdb->query( $query );
794
+
795
+ }
796
 
797
  }
 
798
 
799
 
800
+
801
+
802
  /*
803
  |--------------------------------------------------------------------------
804
  | Fulfill Implemented Interface Contracts
Models/REST_API.php ADDED
@@ -0,0 +1,353 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace ThirstyAffiliates\Models;
4
+
5
+ use ThirstyAffiliates\Abstracts\Abstract_Main_Plugin_Class;
6
+
7
+ use ThirstyAffiliates\Interfaces\Initiable_Interface;
8
+ use ThirstyAffiliates\Interfaces\Model_Interface;
9
+
10
+ use ThirstyAffiliates\Helpers\Plugin_Constants;
11
+ use ThirstyAffiliates\Helpers\Helper_Functions;
12
+
13
+ /**
14
+ * Model that houses the logic for permalink rewrites and affiliate link redirections.
15
+ *
16
+ * @since 3.1.0
17
+ */
18
+ class REST_API implements Model_Interface {
19
+
20
+ /*
21
+ |--------------------------------------------------------------------------
22
+ | Class Properties
23
+ |--------------------------------------------------------------------------
24
+ */
25
+
26
+ /**
27
+ * Property that holds the single main instance of Shortcodes.
28
+ *
29
+ * @since 3.1.0
30
+ * @access private
31
+ * @var Redirection
32
+ */
33
+ private static $_instance;
34
+
35
+ /**
36
+ * Model that houses the main plugin object.
37
+ *
38
+ * @since 3.1.0
39
+ * @access private
40
+ * @var Redirection
41
+ */
42
+ private $_main_plugin;
43
+
44
+ /**
45
+ * Model that houses all the plugin constants.
46
+ *
47
+ * @since 3.1.0
48
+ * @access private
49
+ * @var Plugin_Constants
50
+ */
51
+ private $_constants;
52
+
53
+ /**
54
+ * Property that houses all the helper functions of the plugin.
55
+ *
56
+ * @since 3.1.0
57
+ * @access private
58
+ * @var Helper_Functions
59
+ */
60
+ private $_helper_functions;
61
+
62
+ /**
63
+ * Rest field prefix.
64
+ *
65
+ * @since 3.1.0
66
+ * @access private
67
+ * @var string
68
+ */
69
+ private $_rest_prefix = '_ta_';
70
+
71
+ /**
72
+ * TA custom fields default data.
73
+ *
74
+ * @since 3.1.0
75
+ * @access private
76
+ * @var array
77
+ */
78
+ private $_ta_fields = array(
79
+ 'destination_url' => '',
80
+ 'rel_tags' => '',
81
+ 'redirect_type' => '301',
82
+ 'no_follow' => 'global',
83
+ 'new_window' => 'global',
84
+ 'uncloak_link' => 'global',
85
+ 'pass_query_str' => 'global',
86
+ 'image_ids' => array(),
87
+ 'categories' => array(),
88
+ 'category_slug' => '',
89
+ 'category_slug_id' => 0,
90
+ );
91
+
92
+
93
+
94
+
95
+ /*
96
+ |--------------------------------------------------------------------------
97
+ | Class Methods
98
+ |--------------------------------------------------------------------------
99
+ */
100
+
101
+ /**
102
+ * Class constructor.
103
+ *
104
+ * @since 3.1.0
105
+ * @access public
106
+ *
107
+ * @param Abstract_Main_Plugin_Class $main_plugin Main plugin object.
108
+ * @param Plugin_Constants $constants Plugin constants object.
109
+ * @param Helper_Functions $helper_functions Helper functions object.
110
+ */
111
+ public function __construct( Abstract_Main_Plugin_Class $main_plugin , Plugin_Constants $constants , Helper_Functions $helper_functions ) {
112
+
113
+ $this->_constants = $constants;
114
+ $this->_helper_functions = $helper_functions;
115
+
116
+ $main_plugin->add_to_all_plugin_models( $this );
117
+ }
118
+
119
+ /**
120
+ * Ensure that only one instance of this class is loaded or can be loaded ( Singleton Pattern ).
121
+ *
122
+ * @since 3.1.0
123
+ * @access public
124
+ *
125
+ * @param Abstract_Main_Plugin_Class $main_plugin Main plugin object.
126
+ * @param Plugin_Constants $constants Plugin constants object.
127
+ * @param Helper_Functions $helper_functions Helper functions object.
128
+ * @return Redirection
129
+ */
130
+ public static function get_instance( Abstract_Main_Plugin_Class $main_plugin , Plugin_Constants $constants , Helper_Functions $helper_functions ) {
131
+
132
+ if ( !self::$_instance instanceof self )
133
+ self::$_instance = new self( $main_plugin , $constants , $helper_functions );
134
+
135
+ return self::$_instance;
136
+
137
+ }
138
+
139
+ /**
140
+ * Register ThirstyAffiliates custom fields so they can be accessible on REST.
141
+ *
142
+ * @since 3.1.0
143
+ * @access public
144
+ */
145
+ public function register_ta_custom_fields_on_rest() {
146
+
147
+ $fields = apply_filters( 'ta_register_rest_api_fields' , $this->_ta_fields );
148
+
149
+ foreach ( $fields as $meta_key => $default_value )
150
+ $this->register_rest_field( $meta_key , $default_value );
151
+
152
+
153
+ }
154
+
155
+ /**
156
+ * Register single field in the REST API.
157
+ *
158
+ * @since 3.1.0
159
+ * @access private
160
+ *
161
+ * @param string $meta_key Custom field meta key.
162
+ * @param mixed $default_value Custom field default value.
163
+ */
164
+ private function register_rest_field( $meta_key , $default_value ) {
165
+
166
+ $field_type = gettype( $default_value );
167
+
168
+ register_rest_field( Plugin_Constants::AFFILIATE_LINKS_CPT , $this->_rest_prefix . $meta_key , array(
169
+
170
+ // REST field get callback.
171
+ 'get_callback' => function( $post_data ) use ( $meta_key , $field_type , $default_value ) {
172
+
173
+ if ( $meta_key == 'categories' )
174
+ return wp_get_post_terms( $post_data[ 'id' ] , Plugin_Constants::AFFILIATE_LINKS_TAX , array( 'fields' => 'ids' ) );
175
+ else {
176
+
177
+ $meta_value = get_post_meta( $post_data[ 'id' ] , Plugin_Constants::META_DATA_PREFIX . $meta_key , true );
178
+ $meta_value = $this->esc_meta_value( $meta_value , $meta_key , $field_type );
179
+ return ( $meta_value && $field_type === gettype( $meta_value ) ) ? $meta_value : $default_value;
180
+ }
181
+ },
182
+
183
+ // REST field update callback.
184
+ 'update_callback' => function( $new_value , $post_obj ) use ( $meta_key , $field_type , $default_value ) {
185
+
186
+ // Filter to determine if field allows to be updated or not.
187
+ if ( apply_filters( 'ta_restapi_field_update_cb' , false , $meta_key , $new_value , $field_type , $default_value ) )
188
+ return;
189
+
190
+ if ( $meta_key == 'categories' ) {
191
+
192
+ if ( ! is_array( $new_value ) || empty( $new_value ) )
193
+ return;
194
+
195
+ $categories = array_unique( array_map( 'intval' , $new_value ) );
196
+ wp_set_post_terms( $post_obj->ID , $categories , Plugin_Constants::AFFILIATE_LINKS_TAX );
197
+
198
+ } else
199
+ update_post_meta( $post_obj->ID , Plugin_Constants::META_DATA_PREFIX . $meta_key , $this->sanitize_field( $new_value , $meta_key , $field_type , $default_value ) );
200
+ },
201
+
202
+ // REST field schema.
203
+ 'schema' => array(
204
+ 'type' => $field_type,
205
+ 'context' => array( 'view' , 'edit' )
206
+ )
207
+
208
+ ) );
209
+ }
210
+
211
+ /**
212
+ * Escape meta value before displaying.
213
+ *
214
+ * @since 3.1.0
215
+ * @access private
216
+ *
217
+ * @param mixed $meta_value Custom field value.
218
+ * @param string $meta_key Custom field meta key.
219
+ * @param string $field_type Custom field type.
220
+ * @return mixed Escaped custom field value.
221
+ */
222
+ private function esc_meta_value( $meta_value , $meta_key , $field_type ) {
223
+
224
+ // allow TA pro and other third party plugins to escape value while not running the default function.
225
+ $escaped_value = apply_filters( 'ta_rest_api_esc_meta_value' , false , $meta_value , $meta_key , $field_type );
226
+ if ( $escaped_value !== false ) return $escaped_value;
227
+
228
+ switch ( $field_type ) {
229
+
230
+ case 'array' :
231
+ $sanitize_func = ( $meta_key == 'image_ids' ) ? 'intval' : 'esc_attr';
232
+ $escaped_value = is_array( $meta_value ) ? array_map( $sanitize_func , $meta_value ) : $meta_value;
233
+ break;
234
+
235
+ case 'integer' :
236
+ $escaped_value = intval( $meta_value );
237
+ break;
238
+
239
+ case 'string' :
240
+ default :
241
+ $escaped_value = ( $meta_key == 'destination_url' ) ? esc_url_raw( $meta_value ) : esc_attr( $meta_value );
242
+ break;
243
+ }
244
+
245
+ return $escaped_value;
246
+ }
247
+
248
+ /**
249
+ * Sanitize updated meta value before saving.
250
+ *
251
+ * @since 3.1.0
252
+ * @access private
253
+ *
254
+ * @param mixed $field_value Custom field value.
255
+ * @param string $meta_key Custom field meta key.
256
+ * @param string $field_type Custom field type.
257
+ * @param mixed $default_value Custom field default value.
258
+ * @return mixed Sanitized custom field value.
259
+ */
260
+ private function sanitize_field( $field_value , $meta_key , $field_type , $default_value ) {
261
+
262
+ // allow TA pro and other third party plugins to sanitize value while not running the default function.
263
+ $sanitized_value = apply_filters( 'ta_rest_api_sanitize_field' , false , $field_value , $meta_key , $field_type , $default_value );
264
+ if ( $sanitized_value !== false ) return $sanitized_value;
265
+
266
+ switch ( $field_type ) {
267
+
268
+ case 'array' :
269
+ $sanitize_func = ( $meta_key == 'image_ids' ) ? 'intval' : 'sanitize_text_field';
270
+ $sanitized_value = ( is_array( $field_value ) && ! empty( $field_value ) ) ? array_unique( array_map( $sanitize_func , $field_value ) ) : $default_value;
271
+
272
+ // validate if provided ids are already saved attachments for image_ids field.
273
+ if ( $meta_key == 'image_ids' ) {
274
+
275
+ $valid_images = array();
276
+ foreach ( $sanitized_value as $image_id )
277
+ if ( get_post_type( $image_id ) === 'attachment' ) $valid_images[] = $image_id;
278
+
279
+ $sanitized_value = $valid_images;
280
+ }
281
+
282
+ break;
283
+
284
+ case 'integer' :
285
+ $sanitized_value = ( $field_value ) ? intval( $field_value ) : $default_value;
286
+ break;
287
+
288
+ case 'string' :
289
+ default :
290
+ $sanitized_value = ( $field_value ) ? $field_value : $default_value;
291
+ $sanitized_value = ( $meta_key == 'destination_url' ) ? esc_url_raw( $field_value ) : sanitize_text_field( $field_value );
292
+ break;
293
+ }
294
+
295
+ return $sanitized_value;
296
+ }
297
+
298
+ /**
299
+ * Sanitize special TA fields.
300
+ *
301
+ * @since 3.1.0
302
+ * @access public
303
+ *
304
+ * @param mixed $sanitized_value Value after sanitized. Defaults to boolean false.
305
+ * @param mixed $field_value Raw field value.
306
+ * @param string $meta_key TA field meta key.
307
+ * @param string $field_type TA field variable type.
308
+ * @param mixed $default_value TA field default value.
309
+ * @return mixed Filtered sanitized field value.
310
+ */
311
+ public function sanitize_special_fields( $sanitized_value , $field_value , $meta_key , $field_type , $default_value ) {
312
+
313
+ $toggle_fields = apply_filters( 'ta_rest_api_sanitize_toggle_fields' , array(
314
+ 'no_follow',
315
+ 'new_window',
316
+ 'uncloak_link',
317
+ 'pass_query_str',
318
+ ) );
319
+
320
+ if ( in_array( $meta_key , $toggle_fields ) )
321
+ $allowed_values = array( 'global' , 'yes' , 'no' );
322
+ elseif( $meta_key == 'redirect_type' )
323
+ $allowed_values = array( '301' , '302' , '307' );
324
+
325
+ if ( isset( $allowed_values ) && is_array( $allowed_values ) )
326
+ $sanitized_value = in_array( $field_value , $allowed_values ) ? sanitize_text_field( $field_value ) : $default_value;
327
+
328
+ return $sanitized_value;
329
+ }
330
+
331
+
332
+
333
+
334
+ /*
335
+ |--------------------------------------------------------------------------
336
+ | Implemented Interface Methods
337
+ |--------------------------------------------------------------------------
338
+ */
339
+
340
+ /**
341
+ * Execute model.
342
+ *
343
+ * @implements ThirstyAffiliates\Interfaces\Model_Interface
344
+ *
345
+ * @since 3.1.0
346
+ * @access public
347
+ */
348
+ public function run() {
349
+
350
+ add_action( 'rest_api_init' , array( $this , 'register_ta_custom_fields_on_rest' ) , 10 );
351
+ add_filter( 'ta_rest_api_sanitize_field' , array( $this , 'sanitize_special_fields' ) , 10 , 5 );
352
+ }
353
+ }
Models/Rewrites_Redirection.php CHANGED
@@ -5,6 +5,7 @@ namespace ThirstyAffiliates\Models;
5
  use ThirstyAffiliates\Abstracts\Abstract_Main_Plugin_Class;
6
 
7
  use ThirstyAffiliates\Interfaces\Model_Interface;
 
8
 
9
  use ThirstyAffiliates\Helpers\Plugin_Constants;
10
  use ThirstyAffiliates\Helpers\Helper_Functions;
@@ -14,7 +15,7 @@ use ThirstyAffiliates\Helpers\Helper_Functions;
14
  *
15
  * @since 3.0.0
16
  */
17
- class Rewrites_Redirection implements Model_Interface {
18
 
19
  /*
20
  |--------------------------------------------------------------------------
@@ -193,6 +194,9 @@ class Rewrites_Redirection implements Model_Interface {
193
 
194
  flush_rewrite_rules( false );
195
  delete_transient( 'ta_flush_rewrite_rules' );
 
 
 
196
  }
197
 
198
 
@@ -257,6 +261,55 @@ class Rewrites_Redirection implements Model_Interface {
257
  return $redirect_url . $connector . $query_string;
258
  }
259
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
260
 
261
 
262
 
@@ -266,6 +319,18 @@ class Rewrites_Redirection implements Model_Interface {
266
  |--------------------------------------------------------------------------
267
  */
268
 
 
 
 
 
 
 
 
 
 
 
 
 
269
  /**
270
  * Execute ajax handler.
271
  *
5
  use ThirstyAffiliates\Abstracts\Abstract_Main_Plugin_Class;
6
 
7
  use ThirstyAffiliates\Interfaces\Model_Interface;
8
+ use ThirstyAffiliates\Interfaces\Deactivatable_Interface;
9
 
10
  use ThirstyAffiliates\Helpers\Plugin_Constants;
11
  use ThirstyAffiliates\Helpers\Helper_Functions;
15
  *
16
  * @since 3.0.0
17
  */
18
+ class Rewrites_Redirection implements Model_Interface , Deactivatable_Interface {
19
 
20
  /*
21
  |--------------------------------------------------------------------------
194
 
195
  flush_rewrite_rules( false );
196
  delete_transient( 'ta_flush_rewrite_rules' );
197
+
198
+ // block bots on accessing/indexing affiliate links on htaccess
199
+ $this->block_bots_to_access_affiliate_links_on_htaccess();
200
  }
201
 
202
 
261
  return $redirect_url . $connector . $query_string;
262
  }
263
 
264
+ /**
265
+ * Add/Recreate htaccess rule to block bots access to affiliate links.
266
+ *
267
+ * @since 3.1.0
268
+ * @access public
269
+ */
270
+ public function block_bots_to_access_affiliate_links_on_htaccess() {
271
+
272
+ $htaccess = $this->remove_block_bots_htaccess_rules();
273
+ $link_prefix = $this->_helper_functions->get_thirstylink_link_prefix();
274
+ $bots_list = apply_filters( 'ta_block_bots_on_htaccess' , array( 'googlebot' , 'bingbot' , 'Slurp' , 'DuckDuckBot' , 'Baiduspider' , 'YandexBot' , 'Sogou' , 'Exabot' , 'facebo' , 'ia_archiver' ) );
275
+
276
+ // prepare new TA block bots htaccess content.
277
+ $bots_list_str = implode( $bots_list , '|' );
278
+ $block_bots = "\n#BEGIN Block-Bots-ThirstyAffiliates\n";
279
+ $block_bots .= "<IfModule mod_rewrite.c>\n";
280
+ $block_bots .= "RewriteEngine On\n";
281
+ $block_bots .= "RewriteCond %{HTTP_USER_AGENT} (" . $bots_list_str . ") [NC]\n";
282
+ $block_bots .= "RewriteRule ^" . $link_prefix . "/ - [L,F]\n";
283
+ $block_bots .= "</IfModule>\n";
284
+ $block_bots .= "#END Block-Bots-ThirstyAffiliates\n\n";
285
+
286
+ // prepend block bots rules in the htaccess content.
287
+ $htaccess = $block_bots . $htaccess;
288
+
289
+ file_put_contents( $this->_constants->HTACCESS_FILE() , $htaccess );
290
+ }
291
+
292
+ /**
293
+ * Remove ThirstyAffiliates block bots htaccess rules.
294
+ *
295
+ * @since 3.1.0
296
+ * @access public
297
+ *
298
+ * @param boolean $put_contents Toggle to check if function needs to save htaccess file or not.
299
+ * @return string Htaccess content after removing TA block bots rules.
300
+ */
301
+ public function remove_block_bots_htaccess_rules( $put_contents = false ) {
302
+
303
+ $htaccess = file_get_contents( $this->_constants->HTACCESS_FILE() );
304
+ $pattern = "/[\n]*#[\s]*BEGIN Block-Bots-ThirstyAffiliates.*?#[\s]*END Block-Bots-ThirstyAffiliates[\n][\n]/is";
305
+ $htaccess = preg_replace( $pattern , "" , $htaccess );
306
+
307
+ if ( $put_contents )
308
+ file_put_contents( $this->_constants->HTACCESS_FILE() , $htaccess );
309
+
310
+ return $htaccess;
311
+ }
312
+
313
 
314
 
315
 
319
  |--------------------------------------------------------------------------
320
  */
321
 
322
+ /**
323
+ * Execute codes that needs to run plugin deactivation.
324
+ *
325
+ * @since 1.0.0
326
+ * @access public
327
+ * @implements ThirstyAffiliates\Interfaces\Deactivatable_Interface
328
+ */
329
+ public function deactivate() {
330
+
331
+ $this->remove_block_bots_htaccess_rules( true );
332
+ }
333
+
334
  /**
335
  * Execute ajax handler.
336
  *
Models/Script_Loader.php CHANGED
@@ -132,20 +132,22 @@ class Script_Loader implements Model_Interface {
132
  }
133
 
134
  // Link picker styles and scripts.
135
- if ( is_admin() && current_user_can( 'manage_options' ) && ! in_array( $screen->base , array( 'widgets' , 'customize' ) ) ) {
136
 
137
  wp_enqueue_style( 'thirstyaffiliates-tinymce' , $this->_constants->CSS_ROOT_URL() . 'admin/tinymce/editor.css' , array( 'thickbox' ) , Plugin_Constants::VERSION , 'screen' );
138
 
139
  wp_enqueue_script( 'ta_editor_js', $this->_constants->JS_ROOT_URL() . 'app/ta-editor.js', array( 'jquery' , 'thickbox' ), Plugin_Constants::VERSION , true );
140
- wp_localize_script( 'ta_editor_js' , 'ta_editor_var' , array(
141
  'insertion_type' => get_option( 'ta_link_insertion_type' , 'link' ),
142
  'disable_qtag_buttons' => get_option( 'ta_disable_text_editor_buttons' , 'no' ),
 
 
143
  'html_editor_affiliate_link_btn' => __( 'affiliate link' , 'thirstyaffiliates' ),
144
- 'html_editor_quick_add_btn' => __( 'affiliate link' , 'thirstyaffiliates' ),
145
  'html_editor_affiliate_link_title' => __( 'Open the ThirstyAffiliates link picker' , 'thirstyaffiliates' ),
146
  'html_editor_quick_add_title' => __( 'Open quick add affiliate link dialog' , 'thirstyaffiliates' ),
147
  'simple_search_placeholder' => __( 'Type to search affiliate link' , 'thirstyaffiliates' )
148
- ) );
149
  }
150
 
151
 
132
  }
133
 
134
  // Link picker styles and scripts.
135
+ if ( is_admin() && current_user_can( 'edit_posts' ) && ! in_array( $screen->base , array( 'widgets' , 'customize' ) ) ) {
136
 
137
  wp_enqueue_style( 'thirstyaffiliates-tinymce' , $this->_constants->CSS_ROOT_URL() . 'admin/tinymce/editor.css' , array( 'thickbox' ) , Plugin_Constants::VERSION , 'screen' );
138
 
139
  wp_enqueue_script( 'ta_editor_js', $this->_constants->JS_ROOT_URL() . 'app/ta-editor.js', array( 'jquery' , 'thickbox' ), Plugin_Constants::VERSION , true );
140
+ wp_localize_script( 'ta_editor_js' , 'ta_editor_var' , apply_filters( 'ta_editor_linkpicker_jsvars' , array(
141
  'insertion_type' => get_option( 'ta_link_insertion_type' , 'link' ),
142
  'disable_qtag_buttons' => get_option( 'ta_disable_text_editor_buttons' , 'no' ),
143
+ 'html_editor_enable_aff_link_btn' => current_user_can( apply_filters( 'ta_enable_advance_link_picker' , 'edit_posts' ) ),
144
+ 'html_editor_enable_quick_add_btn' => current_user_can( apply_filters( 'ta_enable_quick_add_affiliate_link' , 'publish_posts' ) ),
145
  'html_editor_affiliate_link_btn' => __( 'affiliate link' , 'thirstyaffiliates' ),
146
+ 'html_editor_quick_add_btn' => __( 'quick add affiliate link' , 'thirstyaffiliates' ),
147
  'html_editor_affiliate_link_title' => __( 'Open the ThirstyAffiliates link picker' , 'thirstyaffiliates' ),
148
  'html_editor_quick_add_title' => __( 'Open quick add affiliate link dialog' , 'thirstyaffiliates' ),
149
  'simple_search_placeholder' => __( 'Type to search affiliate link' , 'thirstyaffiliates' )
150
+ ) ) );
151
  }
152
 
153
 
Models/Settings.php CHANGED
@@ -209,6 +209,7 @@ class Settings implements Model_Interface , Activatable_Interface , Initiable_In
209
  'link' => array( $this , 'render_link_option_field' ),
210
  'option_divider' => array( $this , 'render_option_divider_option_field' ),
211
  'migration_controls' => array( $this , 'render_migration_controls_option_field' ),
 
212
  'export_global_settings' => array( $this , 'render_export_global_settings_option_field' ),
213
  'import_global_settings' => array( $this , 'render_import_global_settings_option_field' )
214
  ) );
@@ -278,8 +279,18 @@ class Settings implements Model_Interface , Activatable_Interface , Initiable_In
278
  'title' => __( 'Disable buttons on the Text/Quicktags editor?' , 'thirstyaffiliates' ),
279
  'desc' => __( "Hide the ThirstyAffiliates buttons on the Text editor." , 'thirstyaffiliates' ),
280
  'type' => 'toggle'
281
- )
282
-
 
 
 
 
 
 
 
 
 
 
283
  ) ),
284
  'ta_links_settings' => apply_filters( 'ta_links_settings_options' , array(
285
 
@@ -461,6 +472,12 @@ class Settings implements Model_Interface , Activatable_Interface , Initiable_In
461
  'id' => 'ta_blog_link',
462
  ),
463
 
 
 
 
 
 
 
464
  array(
465
  'id' => 'ta_other_utilities_divider', // Even though no option is really saved, we still add id, for the purpose of later when extending this section options, they can search for this specific section divider during array loop
466
  'title' => __( 'Other Utilities' , 'thirstyaffiliates' ),
@@ -1372,6 +1389,42 @@ class Settings implements Model_Interface , Activatable_Interface , Initiable_In
1372
 
1373
  }
1374
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1375
  /**
1376
  * Render custom "export_global_settings" field. Do not need to be registered to WP Settings API.
1377
  *
209
  'link' => array( $this , 'render_link_option_field' ),
210
  'option_divider' => array( $this , 'render_option_divider_option_field' ),
211
  'migration_controls' => array( $this , 'render_migration_controls_option_field' ),
212
+ 'social_links' => array( $this , 'render_social_links_option_field' ),
213
  'export_global_settings' => array( $this , 'render_export_global_settings_option_field' ),
214
  'import_global_settings' => array( $this , 'render_import_global_settings_option_field' )
215
  ) );
279
  'title' => __( 'Disable buttons on the Text/Quicktags editor?' , 'thirstyaffiliates' ),
280
  'desc' => __( "Hide the ThirstyAffiliates buttons on the Text editor." , 'thirstyaffiliates' ),
281
  'type' => 'toggle'
282
+ ),
283
+
284
+ array(
285
+ 'id' => 'ta_stats_trimer_set_point',
286
+ 'title' => __( 'Trim stats older than:' , 'thirstyaffiliates' ),
287
+ 'desc' => __( "months (Automatically clean the statistics database records older than a set point. Setting this to 0 will disable it)." , 'thirstyaffiliates' ),
288
+ 'type' => 'number',
289
+ 'min' => 0,
290
+ 'default' => 0,
291
+ 'condition_cb' => function() { return get_option( 'ta_enable_stats_reporting_module' ) === 'yes'; }
292
+ )
293
+
294
  ) ),
295
  'ta_links_settings' => apply_filters( 'ta_links_settings_options' , array(
296
 
472
  'id' => 'ta_blog_link',
473
  ),
474
 
475
+ array(
476
+ 'title' => __( 'Join the Community' , 'thirstyaffiliates' ),
477
+ 'type' => 'social_links',
478
+ 'id' => 'ta_social_links'
479
+ ),
480
+
481
  array(
482
  'id' => 'ta_other_utilities_divider', // Even though no option is really saved, we still add id, for the purpose of later when extending this section options, they can search for this specific section divider during array loop
483
  'title' => __( 'Other Utilities' , 'thirstyaffiliates' ),
1389
 
1390
  }
1391
 
1392
+ /**
1393
+ * Render custom "social_links" field. Do not need to be registered to WP Settings API.
1394
+ *
1395
+ * @since 3.1.0
1396
+ * @access public
1397
+ *
1398
+ * @param array $option Array of options data. May vary depending on option type.
1399
+ */
1400
+ public function render_social_links_option_field( $option ) {
1401
+
1402
+ ?>
1403
+ <tr valign="top" class="<?php echo esc_attr( $option[ 'id' ] ) . '-row'; ?>">
1404
+ <th scope="row"><?php echo sanitize_text_field( $option[ 'title' ] ); ?></th>
1405
+ <td>
1406
+ <ul>
1407
+ <li>
1408
+ <a href="https://www.facebook.com/thirstyaffiliates/"><?php _e( 'Like us on Facebook' , 'thirstyaffiliates' ); ?></a>
1409
+ <iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fthirstyaffiliates&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=false&amp;font=arial&amp;colorscheme=light&amp;action=like&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px; vertical-align: bottom;" allowTransparency="true"></iframe>
1410
+ </li>
1411
+ <li>
1412
+ <a href="http://twitter.com/thirstyaff"><?php _e( 'Follow us on Twitter' , 'thirstyaffiliates' ); ?></a>
1413
+ <a href="https://twitter.com/thirstyaff" class="twitter-follow-button" data-show-count="true" style="vertical-align: bottom;">Follow @thirstyaff</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?"http":"https";if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document, "script", "twitter-wjs");</script>
1414
+ </li>
1415
+ <li>
1416
+ <a href="https://www.linkedin.com/company-beta/2928598/"><?php _e( 'Follow us on Linkedin' , 'thirstyaffiliates' ); ?></a>
1417
+ </li>
1418
+ <li>
1419
+ <a href="https://thirstyaffiliates.com/affiliates?utm_source=Free%20Plugin&utm_medium=Help&utm_campaign=Affiliates%20Link" target="_blank"><?php _e( 'Join Our Affiliate Program' , 'thirstyaffiliates' ); ?></a>
1420
+ <?php _e( '(up to 30% commisions)' , 'thirstyaffiliates' ); ?>
1421
+ </li>
1422
+ </ul>
1423
+ </td>
1424
+ </tr>
1425
+ <?php
1426
+ }
1427
+
1428
  /**
1429
  * Render custom "export_global_settings" field. Do not need to be registered to WP Settings API.
1430
  *
Models/Shortcodes.php CHANGED
@@ -189,6 +189,7 @@ class Shortcodes implements Model_Interface {
189
 
190
  // get the link URL
191
  $link_attributes[ 'href' ] = ( $uncloak_link ) ? apply_filters( 'ta_uncloak_link_url' , $thirstylink->get_prop( 'destination_url' ) , $thirstylink ) : $thirstylink->get_prop( 'permalink' );
 
192
 
193
  // get link text content default if no value is set
194
  if ( empty( $content ) && $atts[ 'linktext' ] )
189
 
190
  // get the link URL
191
  $link_attributes[ 'href' ] = ( $uncloak_link ) ? apply_filters( 'ta_uncloak_link_url' , $thirstylink->get_prop( 'destination_url' ) , $thirstylink ) : $thirstylink->get_prop( 'permalink' );
192
+ $link_attributes[ 'href' ] = esc_url( $link_attributes[ 'href' ] );
193
 
194
  // get link text content default if no value is set
195
  if ( empty( $content ) && $atts[ 'linktext' ] )
Models/Stats_Reporting.php CHANGED
@@ -6,6 +6,7 @@ use ThirstyAffiliates\Abstracts\Abstract_Main_Plugin_Class;
6
 
7
  use ThirstyAffiliates\Interfaces\Model_Interface;
8
  use ThirstyAffiliates\Interfaces\Initiable_Interface;
 
9
 
10
  use ThirstyAffiliates\Helpers\Plugin_Constants;
11
  use ThirstyAffiliates\Helpers\Helper_Functions;
@@ -17,7 +18,7 @@ use ThirstyAffiliates\Models\Affiliate_Link;
17
  *
18
  * @since 3.0.0
19
  */
20
- class Stats_Reporting implements Model_Interface , Initiable_Interface {
21
 
22
  /*
23
  |--------------------------------------------------------------------------
@@ -123,15 +124,24 @@ class Stats_Reporting implements Model_Interface , Initiable_Interface {
123
  * Save link click data to the database.
124
  *
125
  * @since 3.0.0
 
126
  * @access private
127
  *
128
- * @param int $link_id Affiliate link ID.
129
- * @param string $http_referer HTTP Referrer value.
 
 
 
 
 
130
  */
131
- private function save_click_data( $link_id , $http_referer = '' ) {
132
 
133
  global $wpdb;
134
 
 
 
 
135
  $link_click_db = $wpdb->prefix . Plugin_Constants::LINK_CLICK_DB;
136
  $link_click_meta_db = $wpdb->prefix . Plugin_Constants::LINK_CLICK_META_DB;
137
 
@@ -139,7 +149,7 @@ class Stats_Reporting implements Model_Interface , Initiable_Interface {
139
  $wpdb->insert(
140
  $link_click_db,
141
  array(
142
- 'link_id' => $link_id,
143
  'date_clicked' => current_time( 'mysql' , true )
144
  )
145
  );
@@ -149,8 +159,11 @@ class Stats_Reporting implements Model_Interface , Initiable_Interface {
149
 
150
  $meta_data = apply_filters( 'ta_save_click_data' , array(
151
  'user_ip_address' => $this->_helper_functions->get_user_ip_address(),
152
- 'http_referer' => $http_referer
153
- ) );
 
 
 
154
 
155
  foreach ( $meta_data as $key => $value ) {
156
 
@@ -171,24 +184,30 @@ class Stats_Reporting implements Model_Interface , Initiable_Interface {
171
  * Save click data on redirect
172
  *
173
  * @since 3.0.0
 
174
  * @access public
175
  *
176
- * @param Affiliate_Link $thirstylink Affiliate link object.
 
 
177
  */
178
- public function save_click_data_on_redirect( $thirstylink ) {
179
 
180
  $link_id = $thirstylink->get_id();
181
  $http_referer = isset( $_SERVER[ 'HTTP_REFERER' ] ) ? $_SERVER[ 'HTTP_REFERER' ] : '';
182
-
 
 
183
  // if the refferer is from an external site, then record stat.
184
  if ( ! $http_referer || ! strrpos( 'x' . $http_referer , home_url() ) )
185
- $this->save_click_data( $link_id , $http_referer );
186
  }
187
 
188
  /**
189
  * AJAX save click data on redirect
190
  *
191
  * @since 3.0.0
 
192
  * @access public
193
  */
194
  public function ajax_save_click_data_on_redirect() {
@@ -197,16 +216,20 @@ class Stats_Reporting implements Model_Interface , Initiable_Interface {
197
  wp_die();
198
 
199
  $link_id = isset( $_REQUEST[ 'link_id' ] ) ? (int) sanitize_text_field( $_REQUEST[ 'link_id' ] ) : 0;
200
- $http_referer = isset( $_REQUEST[ 'page' ] ) ? sanitize_text_field( $_REQUEST[ 'page' ] ) : '';
 
201
 
202
- if ( ! $link_id ) {
 
203
 
204
- $link_href = sanitize_text_field( $_REQUEST[ 'href' ] );
205
- $link_id = url_to_postid( $link_href );
206
- }
 
 
207
 
208
- if ( $link_id )
209
- $this->save_click_data( $link_id , $http_referer );
210
 
211
  wp_die();
212
  }
@@ -694,6 +717,82 @@ class Stats_Reporting implements Model_Interface , Initiable_Interface {
694
  return new \DateTime( 'First day of ' . $month . ' ' . date( 'Y' ) , $timezone );
695
  }
696
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
697
  /**
698
  * Delete stats data when an affiliate link is deleted permanently.
699
  *
@@ -729,13 +828,24 @@ class Stats_Reporting implements Model_Interface , Initiable_Interface {
729
 
730
 
731
 
732
-
733
  /*
734
  |--------------------------------------------------------------------------
735
  | Fulfill implemented interface contracts
736
  |--------------------------------------------------------------------------
737
  */
738
 
 
 
 
 
 
 
 
 
 
 
 
 
739
  /**
740
  * Method that houses codes to be executed on init hook.
741
  *
@@ -767,9 +877,11 @@ class Stats_Reporting implements Model_Interface , Initiable_Interface {
767
  if ( get_option( 'ta_enable_stats_reporting_module' , 'yes' ) !== 'yes' )
768
  return;
769
 
770
- add_action( 'ta_before_link_redirect' , array( $this , 'save_click_data_on_redirect' ) , 10 , 1 );
 
771
  add_action( 'admin_menu' , array( $this , 'add_reports_submenu' ) , 10 );
772
  add_action( 'ta_register_reports' , array( $this , 'register_link_performance_report' ) , 10 );
 
773
  add_action( 'before_delete_post' , array( $this , 'delete_stats_data_on_affiliate_link_deletion' ) , 10 );
774
  }
775
  }
6
 
7
  use ThirstyAffiliates\Interfaces\Model_Interface;
8
  use ThirstyAffiliates\Interfaces\Initiable_Interface;
9
+ use ThirstyAffiliates\Interfaces\Activatable_Interface;
10
 
11
  use ThirstyAffiliates\Helpers\Plugin_Constants;
12
  use ThirstyAffiliates\Helpers\Helper_Functions;
18
  *
19
  * @since 3.0.0
20
  */
21
+ class Stats_Reporting implements Model_Interface , Initiable_Interface , Activatable_Interface {
22
 
23
  /*
24
  |--------------------------------------------------------------------------
124
  * Save link click data to the database.
125
  *
126
  * @since 3.0.0
127
+ * @since 3.1.0 Set to save additional information: $cloaked_url , $redirect_url and $redirect_type.
128
  * @access private
129
  *
130
+ * @global wpdb $wpdb Object that contains a set of functions used to interact with a database.
131
+ *
132
+ * @param Affiliate_Link $thirstylink Affiliate link object.
133
+ * @param string $http_referer HTTP Referrer value.
134
+ * @param string cloaked_url Affiliate link cloaked url.
135
+ * @param string $redirect_url Link to where user is redirected to.
136
+ * @param string $redirect_type Redirect type (301,302, etc.)
137
  */
138
+ private function save_click_data( $thirstylink , $http_referer , $cloaked_url , $redirect_url , $redirect_type ) {
139
 
140
  global $wpdb;
141
 
142
+ if ( apply_filters( 'ta_filter_before_save_click' , false , $thirstylink , $http_referer ) )
143
+ return;
144
+
145
  $link_click_db = $wpdb->prefix . Plugin_Constants::LINK_CLICK_DB;
146
  $link_click_meta_db = $wpdb->prefix . Plugin_Constants::LINK_CLICK_META_DB;
147
 
149
  $wpdb->insert(
150
  $link_click_db,
151
  array(
152
+ 'link_id' => $thirstylink->get_id(),
153
  'date_clicked' => current_time( 'mysql' , true )
154
  )
155
  );
159
 
160
  $meta_data = apply_filters( 'ta_save_click_data' , array(
161
  'user_ip_address' => $this->_helper_functions->get_user_ip_address(),
162
+ 'http_referer' => $http_referer,
163
+ 'cloaked_url' => $cloaked_url,
164
+ 'redirect_url' => $redirect_url,
165
+ 'redirect_type' => $redirect_type
166
+ ), $thirstylink );
167
 
168
  foreach ( $meta_data as $key => $value ) {
169
 
184
  * Save click data on redirect
185
  *
186
  * @since 3.0.0
187
+ * @since 3.1.0 Passed additional 2 parameters: $redirect_url and $redirect type. Updated save_click_data function call to include new required arguments.
188
  * @access public
189
  *
190
+ * @param Affiliate_Link $thirstylink Affiliate link object.
191
+ * @param string $redirect_url Link to where user is redirected to.
192
+ * @param string $redirect_type Redirect type (301,302, etc.)
193
  */
194
+ public function save_click_data_on_redirect( $thirstylink , $redirect_url , $redirect_type ) {
195
 
196
  $link_id = $thirstylink->get_id();
197
  $http_referer = isset( $_SERVER[ 'HTTP_REFERER' ] ) ? $_SERVER[ 'HTTP_REFERER' ] : '';
198
+ $query_string = isset( $_SERVER[ 'QUERY_STRING' ] ) ? $_SERVER[ 'QUERY_STRING' ] : '';
199
+ $cloaked_url = $query_string ? $thirstylink->get_prop( 'permalink' ) . '?' . $query_string : $thirstylink->get_prop( 'permalink' );
200
+
201
  // if the refferer is from an external site, then record stat.
202
  if ( ! $http_referer || ! strrpos( 'x' . $http_referer , home_url() ) )
203
+ $this->save_click_data( $thirstylink , $http_referer , $cloaked_url , $redirect_url , $redirect_type );
204
  }
205
 
206
  /**
207
  * AJAX save click data on redirect
208
  *
209
  * @since 3.0.0
210
+ * @since 3.1.0 Updated save_click_data function call to include new required arguments.
211
  * @access public
212
  */
213
  public function ajax_save_click_data_on_redirect() {
216
  wp_die();
217
 
218
  $link_id = isset( $_REQUEST[ 'link_id' ] ) ? (int) sanitize_text_field( $_REQUEST[ 'link_id' ] ) : 0;
219
+ $http_referer = isset( $_REQUEST[ 'page' ] ) ? esc_url_raw( $_REQUEST[ 'page' ] ) : '';
220
+ $cloaked_url = isset( $_REQUEST[ 'href' ] ) ? esc_url_raw( $_REQUEST[ 'href' ] ) : '';
221
 
222
+ if ( ! $link_id )
223
+ $link_id = url_to_postid( $cloaked_url );
224
 
225
+ if ( $link_id ) {
226
+
227
+ $thirstylink = new Affiliate_Link( $link_id );
228
+ $redirect_url = apply_filters( 'ta_filter_redirect_url' , $thirstylink->get_prop( 'destination_url' ) , $thirstylink );
229
+ $redirect_type = $thirstylink->get_prop( 'redirect_type' );
230
 
231
+ $this->save_click_data( $thirstylink , $http_referer , $cloaked_url , $redirect_url , $redirect_type );
232
+ }
233
 
234
  wp_die();
235
  }
717
  return new \DateTime( 'First day of ' . $month . ' ' . date( 'Y' ) , $timezone );
718
  }
719
 
720
+ /**
721
+ * Schedule stats trimmer cron job.
722
+ *
723
+ * @since 3.1.0
724
+ * @access private
725
+ */
726
+ private function schedule_stats_trimmer_cron() {
727
+
728
+ $zone_str = $this->_helper_functions->get_site_current_timezone();
729
+ $timezone = new \DateTimeZone( $zone_str );
730
+ $time = new \DateTime( 'first day of next month' , $timezone );
731
+
732
+ // clear all scheduled crons so there will always only be one.
733
+ wp_clear_scheduled_hook( Plugin_Constants::CRON_STATS_TRIMMER );
734
+
735
+ // schedule cron job
736
+ wp_schedule_single_event( $time->format( 'U' ) , Plugin_Constants::CRON_STATS_TRIMMER );
737
+ }
738
+
739
+ /**
740
+ * Implement stats trimmer
741
+ *
742
+ * @since 3.1.0
743
+ * @access public
744
+ *
745
+ * @global wpdb $wpdb Object that contains a set of functions used to interact with a database.
746
+ */
747
+ public function implement_stats_trimmer() {
748
+
749
+ global $wpdb;
750
+
751
+ $trim_point = (int) get_option( 'ta_stats_trimer_set_point' , 0 );
752
+
753
+ if ( $trim_point > 0 ) {
754
+
755
+ $clicks_db = $wpdb->prefix . Plugin_Constants::LINK_CLICK_DB;
756
+ $clicks_meta_db = $wpdb->prefix . Plugin_Constants::LINK_CLICK_META_DB;
757
+
758
+ // get click ids based on set range.
759
+ $query = "SELECT id FROM $clicks_db WHERE date_clicked < DATE_ADD( NOW() , INTERVAL -" . $trim_point . " MONTH )";
760
+ $click_ids = $wpdb->get_col( $query );
761
+
762
+ // Proceed on deleting data when $click_ids are present
763
+ if ( is_array( $click_ids ) && ! empty( $click_ids ) ) {
764
+
765
+ $click_ids_string = implode( $click_ids , ',' );
766
+
767
+ // delete click data
768
+ $wpdb->query( "DELETE FROM $clicks_meta_db WHERE click_id IN ( $click_ids_string )" );
769
+ $wpdb->query( "DELETE FROM $clicks_db WHERE id IN ( $click_ids_string )" );
770
+ }
771
+ }
772
+
773
+ // reschedule the cron job
774
+ $this->schedule_stats_trimmer_cron();
775
+ }
776
+
777
+ /**
778
+ * Prevent saving click data if useragent is a bot.
779
+ *
780
+ * @since 3.1.0
781
+ * @access public
782
+ *
783
+ * @param boolean $response Default response of filter.
784
+ * @return boolean True if needs to be prevented, false otherwise.
785
+ */
786
+ public function prevent_save_click_if_useragent_is_bot( $response ) {
787
+
788
+ $user_agent = isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) ? strtolower( $_SERVER[ 'HTTP_USER_AGENT' ] ) : '';
789
+ $bots = apply_filters( 'ta_useragent_bots_phrase_list' , array( 'bot' , 'crawl' , 'slurp' , 'spider' , 'mediapartners' ) );
790
+ $bots_str = implode( $bots , '|' );
791
+ $pattern = '/' . $bots_str . '/i';
792
+
793
+ return preg_match( $pattern , $user_agent );
794
+ }
795
+
796
  /**
797
  * Delete stats data when an affiliate link is deleted permanently.
798
  *
828
 
829
 
830
 
 
831
  /*
832
  |--------------------------------------------------------------------------
833
  | Fulfill implemented interface contracts
834
  |--------------------------------------------------------------------------
835
  */
836
 
837
+ /**
838
+ * Execute codes that needs to run plugin activation.
839
+ *
840
+ * @since 3.0.0
841
+ * @access public
842
+ * @implements ThirstyAffiliates\Interfaces\Activatable_Interface
843
+ */
844
+ public function activate() {
845
+
846
+ $this->schedule_stats_trimmer_cron();
847
+ }
848
+
849
  /**
850
  * Method that houses codes to be executed on init hook.
851
  *
877
  if ( get_option( 'ta_enable_stats_reporting_module' , 'yes' ) !== 'yes' )
878
  return;
879
 
880
+ add_filter( 'ta_filter_before_save_click' , array( $this , 'prevent_save_click_if_useragent_is_bot' ) , 10 , 1 );
881
+ add_action( 'ta_before_link_redirect' , array( $this , 'save_click_data_on_redirect' ) , 10 , 3 );
882
  add_action( 'admin_menu' , array( $this , 'add_reports_submenu' ) , 10 );
883
  add_action( 'ta_register_reports' , array( $this , 'register_link_performance_report' ) , 10 );
884
+ add_action( Plugin_Constants::CRON_STATS_TRIMMER , array( $this , 'implement_stats_trimmer' ) );
885
  add_action( 'before_delete_post' , array( $this , 'delete_stats_data_on_affiliate_link_deletion' ) , 10 );
886
  }
887
  }
css/admin/ta-settings.css CHANGED
@@ -26,4 +26,18 @@ tr.ta_link_prefix_custom-row {
26
  .ta-settings .uncloak-links-select2 , .ta-settings .select2 {
27
  width: 100%;
28
  }
29
- .ta_category_to_uncloak-row span.select2-selection__clear { display: none; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  .ta-settings .uncloak-links-select2 , .ta-settings .select2 {
27
  width: 100%;
28
  }
29
+ .ta_category_to_uncloak-row span.select2-selection__clear {
30
+ display: none;
31
+ }
32
+ tr.ta_social_links-row ul {
33
+ margin: 0;
34
+ }
35
+ tr.ta_social_links-row ul li {
36
+ margin-bottom: 15px;
37
+ }
38
+ tr.ta_social_links-row ul li:nth-child(1) a {
39
+ margin-right: 8px;
40
+ }
41
+ tr.ta_social_links-row ul li:nth-child(2) a {
42
+ margin-right: 10px;
43
+ }
js/app/advance_link_picker/dist/advance-link-picker.js CHANGED
@@ -21,4 +21,4 @@
21
  *
22
  * Date: 2016-08-08
23
  */
24
- function(e){function t(e,t,n,r){var i,o,a,s,u,c,d,p=t&&t.ownerDocument,h=t?t.nodeType:9;if(n=n||[],"string"!=typeof e||!e||1!==h&&9!==h&&11!==h)return n;if(!r&&((t?t.ownerDocument||t:R)!==L&&A(t),t=t||L,P)){if(11!==h&&(u=ge.exec(e)))if(i=u[1]){if(9===h){if(!(a=t.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(p&&(a=p.getElementById(i))&&F(t,a)&&a.id===i)return n.push(a),n}else{if(u[2])return Q.apply(n,t.getElementsByTagName(e)),n;if((i=u[3])&&b.getElementsByClassName&&t.getElementsByClassName)return Q.apply(n,t.getElementsByClassName(i)),n}if(b.qsa&&!z[e+" "]&&(!H||!H.test(e))){if(1!==h)p=t,d=e;else if("object"!==t.nodeName.toLowerCase()){for((s=t.getAttribute("id"))?s=s.replace(xe,be):t.setAttribute("id",s=M),c=C(e),o=c.length;o--;)c[o]="#"+s+" "+f(c[o]);d=c.join(","),p=ve.test(e)&&l(t.parentNode)||t}if(d)try{return Q.apply(n,p.querySelectorAll(d)),n}catch(e){}finally{s===M&&t.removeAttribute("id")}}}return E(e.replace(oe,"$1"),t,n,r)}function n(){function e(n,r){return t.push(n+" ")>w.cacheLength&&delete e[t.shift()],e[n+" "]=r}var t=[];return e}function r(e){return e[M]=!0,e}function i(e){var t=L.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function o(e,t){for(var n=e.split("|"),r=n.length;r--;)w.attrHandle[n[r]]=t}function a(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function s(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&Te(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function u(e){return r(function(t){return t=+t,r(function(n,r){for(var i,o=e([],n.length,t),a=o.length;a--;)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function l(e){return e&&void 0!==e.getElementsByTagName&&e}function c(){}function f(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function d(e,t,n){var r=t.dir,i=t.next,o=i||r,a=n&&"parentNode"===o,s=W++;return t.first?function(t,n,i){for(;t=t[r];)if(1===t.nodeType||a)return e(t,n,i);return!1}:function(t,n,u){var l,c,f,d=[I,s];if(u){for(;t=t[r];)if((1===t.nodeType||a)&&e(t,n,u))return!0}else for(;t=t[r];)if(1===t.nodeType||a)if(f=t[M]||(t[M]={}),c=f[t.uniqueID]||(f[t.uniqueID]={}),i&&i===t.nodeName.toLowerCase())t=t[r]||t;else{if((l=c[o])&&l[0]===I&&l[1]===s)return d[2]=l[2];if(c[o]=d,d[2]=e(t,n,u))return!0}return!1}}function p(e){return e.length>1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function h(e,n,r){for(var i=0,o=n.length;i<o;i++)t(e,n[i],r);return r}function g(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function v(e,t,n,i,o,a){return i&&!i[M]&&(i=v(i)),o&&!o[M]&&(o=v(o,a)),r(function(r,a,s,u){var l,c,f,d=[],p=[],v=a.length,m=r||h(t||"*",s.nodeType?[s]:s,[]),y=!e||!r&&t?m:g(m,d,e,s,u),x=n?o||(r?e:v||i)?[]:a:y;if(n&&n(y,x,s,u),i)for(l=g(x,p),i(l,[],s,u),c=l.length;c--;)(f=l[c])&&(x[p[c]]=!(y[p[c]]=f));if(r){if(o||e){if(o){for(l=[],c=x.length;c--;)(f=x[c])&&l.push(y[c]=f);o(null,x=[],l,u)}for(c=x.length;c--;)(f=x[c])&&(l=o?K(r,f):d[c])>-1&&(r[l]=!(a[l]=f))}}else x=g(x===a?x.splice(v,x.length):x),o?o(null,a,x,u):Q.apply(a,x)})}function m(e){for(var t,n,r,i=e.length,o=w.relative[e[0].type],a=o||w.relative[" "],s=o?1:0,u=d(function(e){return e===t},a,!0),l=d(function(e){return K(t,e)>-1},a,!0),c=[function(e,n,r){var i=!o&&(r||n!==j)||((t=n).nodeType?u(e,n,r):l(e,n,r));return t=null,i}];s<i;s++)if(n=w.relative[e[s].type])c=[d(p(c),n)];else{if(n=w.filter[e[s].type].apply(null,e[s].matches),n[M]){for(r=++s;r<i&&!w.relative[e[r].type];r++);return v(s>1&&p(c),s>1&&f(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(oe,"$1"),n,s<r&&m(e.slice(s,r)),r<i&&m(e=e.slice(r)),r<i&&f(e))}c.push(n)}return p(c)}function y(e,n){var i=n.length>0,o=e.length>0,a=function(r,a,s,u,l){var c,f,d,p=0,h="0",v=r&&[],m=[],y=j,x=r||o&&w.find.TAG("*",l),b=I+=null==y?1:Math.random()||.1,T=x.length;for(l&&(j=a===L||a||l);h!==T&&null!=(c=x[h]);h++){if(o&&c){for(f=0,a||c.ownerDocument===L||(A(c),s=!P);d=e[f++];)if(d(c,a||L,s)){u.push(c);break}l&&(I=b)}i&&((c=!d&&c)&&p--,r&&v.push(c))}if(p+=h,i&&h!==p){for(f=0;d=n[f++];)d(v,m,a,s);if(r){if(p>0)for(;h--;)v[h]||m[h]||(m[h]=G.call(u));m=g(m)}Q.apply(u,m),l&&!r&&m.length>0&&p+n.length>1&&t.uniqueSort(u)}return l&&(I=b,j=y),v};return i?r(a):a}var x,b,w,T,k,C,S,E,j,N,D,A,L,q,P,H,O,_,F,M="sizzle"+1*new Date,R=e.document,I=0,W=0,$=n(),B=n(),z=n(),X=function(e,t){return e===t&&(D=!0),0},U={}.hasOwnProperty,V=[],G=V.pop,Y=V.push,Q=V.push,J=V.slice,K=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},Z="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",ee="[\\x20\\t\\r\\n\\f]",te="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",ne="\\["+ee+"*("+te+")(?:"+ee+"*([*^$|!~]?=)"+ee+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+te+"))|)"+ee+"*\\]",re=":("+te+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+ne+")*)|.*)\\)|)",ie=new RegExp(ee+"+","g"),oe=new RegExp("^"+ee+"+|((?:^|[^\\\\])(?:\\\\.)*)"+ee+"+$","g"),ae=new RegExp("^"+ee+"*,"+ee+"*"),se=new RegExp("^"+ee+"*([>+~]|"+ee+")"+ee+"*"),ue=new RegExp("="+ee+"*([^\\]'\"]*?)"+ee+"*\\]","g"),le=new RegExp(re),ce=new RegExp("^"+te+"$"),fe={ID:new RegExp("^#("+te+")"),CLASS:new RegExp("^\\.("+te+")"),TAG:new RegExp("^("+te+"|[*])"),ATTR:new RegExp("^"+ne),PSEUDO:new RegExp("^"+re),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ee+"*(even|odd|(([+-]|)(\\d*)n|)"+ee+"*(?:([+-]|)"+ee+"*(\\d+)|))"+ee+"*\\)|)","i"),bool:new RegExp("^(?:"+Z+")$","i"),needsContext:new RegExp("^"+ee+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ee+"*((?:-\\d)?\\d*)"+ee+"*\\)|)(?=[^-]|$)","i")},de=/^(?:input|select|textarea|button)$/i,pe=/^h\d$/i,he=/^[^{]+\{\s*\[native \w/,ge=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ve=/[+~]/,me=new RegExp("\\\\([\\da-f]{1,6}"+ee+"?|("+ee+")|.)","ig"),ye=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},xe=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,be=function(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},we=function(){A()},Te=d(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{Q.apply(V=J.call(R.childNodes),R.childNodes),V[R.childNodes.length].nodeType}catch(e){Q={apply:V.length?function(e,t){Y.apply(e,J.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}b=t.support={},k=t.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},A=t.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:R;return r!==L&&9===r.nodeType&&r.documentElement?(L=r,q=L.documentElement,P=!k(L),R!==L&&(n=L.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",we,!1):n.attachEvent&&n.attachEvent("onunload",we)),b.attributes=i(function(e){return e.className="i",!e.getAttribute("className")}),b.getElementsByTagName=i(function(e){return e.appendChild(L.createComment("")),!e.getElementsByTagName("*").length}),b.getElementsByClassName=he.test(L.getElementsByClassName),b.getById=i(function(e){return q.appendChild(e).id=M,!L.getElementsByName||!L.getElementsByName(M).length}),b.getById?(w.filter.ID=function(e){var t=e.replace(me,ye);return function(e){return e.getAttribute("id")===t}},w.find.ID=function(e,t){if(void 0!==t.getElementById&&P){var n=t.getElementById(e);return n?[n]:[]}}):(w.filter.ID=function(e){var t=e.replace(me,ye);return function(e){var n=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},w.find.ID=function(e,t){if(void 0!==t.getElementById&&P){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];for(i=t.getElementsByName(e),r=0;o=i[r++];)if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),w.find.TAG=b.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):b.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},w.find.CLASS=b.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&P)return t.getElementsByClassName(e)},O=[],H=[],(b.qsa=he.test(L.querySelectorAll))&&(i(function(e){q.appendChild(e).innerHTML="<a id='"+M+"'></a><select id='"+M+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&H.push("[*^$]="+ee+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||H.push("\\["+ee+"*(?:value|"+Z+")"),e.querySelectorAll("[id~="+M+"-]").length||H.push("~="),e.querySelectorAll(":checked").length||H.push(":checked"),e.querySelectorAll("a#"+M+"+*").length||H.push(".#.+[+~]")}),i(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=L.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&H.push("name"+ee+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&H.push(":enabled",":disabled"),q.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&H.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),H.push(",.*:")})),(b.matchesSelector=he.test(_=q.matches||q.webkitMatchesSelector||q.mozMatchesSelector||q.oMatchesSelector||q.msMatchesSelector))&&i(function(e){b.disconnectedMatch=_.call(e,"*"),_.call(e,"[s!='']:x"),O.push("!=",re)}),H=H.length&&new RegExp(H.join("|")),O=O.length&&new RegExp(O.join("|")),t=he.test(q.compareDocumentPosition),F=t||he.test(q.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},X=t?function(e,t){if(e===t)return D=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&n||!b.sortDetached&&t.compareDocumentPosition(e)===n?e===L||e.ownerDocument===R&&F(R,e)?-1:t===L||t.ownerDocument===R&&F(R,t)?1:N?K(N,e)-K(N,t):0:4&n?-1:1)}:function(e,t){if(e===t)return D=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,s=[e],u=[t];if(!i||!o)return e===L?-1:t===L?1:i?-1:o?1:N?K(N,e)-K(N,t):0;if(i===o)return a(e,t);for(n=e;n=n.parentNode;)s.unshift(n);for(n=t;n=n.parentNode;)u.unshift(n);for(;s[r]===u[r];)r++;return r?a(s[r],u[r]):s[r]===R?-1:u[r]===R?1:0},L):L},t.matches=function(e,n){return t(e,null,null,n)},t.matchesSelector=function(e,n){if((e.ownerDocument||e)!==L&&A(e),n=n.replace(ue,"='$1']"),b.matchesSelector&&P&&!z[n+" "]&&(!O||!O.test(n))&&(!H||!H.test(n)))try{var r=_.call(e,n);if(r||b.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return t(n,L,null,[e]).length>0},t.contains=function(e,t){return(e.ownerDocument||e)!==L&&A(e),F(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!==L&&A(e);var n=w.attrHandle[t.toLowerCase()],r=n&&U.call(w.attrHandle,t.toLowerCase())?n(e,t,!P):void 0;return void 0!==r?r:b.attributes||!P?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},t.escape=function(e){return(e+"").replace(xe,be)},t.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,n=[],r=0,i=0;if(D=!b.detectDuplicates,N=!b.sortStable&&e.slice(0),e.sort(X),D){for(;t=e[i++];)t===e[i]&&(r=n.push(i));for(;r--;)e.splice(n[r],1)}return N=null,e},T=t.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=T(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r++];)n+=T(t);return n},w=t.selectors={cacheLength:50,createPseudo:r,match:fe,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(me,ye),e[3]=(e[3]||e[4]||e[5]||"").replace(me,ye),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||t.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&t.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return fe.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&le.test(n)&&(t=C(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(me,ye).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=$[e+" "];return t||(t=new RegExp("(^|"+ee+")"+e+"("+ee+"|$)"))&&$(e,function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,n,r){return function(i){var o=t.attr(i,e);return null==o?"!="===n:!n||(o+="","="===n?o===r:"!="===n?o!==r:"^="===n?r&&0===o.indexOf(r):"*="===n?r&&o.indexOf(r)>-1:"$="===n?r&&o.slice(-r.length)===r:"~="===n?(" "+o.replace(ie," ")+" ").indexOf(r)>-1:"|="===n&&(o===r||o.slice(0,r.length+1)===r+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,d,p,h,g=o!==a?"nextSibling":"previousSibling",v=t.parentNode,m=s&&t.nodeName.toLowerCase(),y=!u&&!s,x=!1;if(v){if(o){for(;g;){for(d=t;d=d[g];)if(s?d.nodeName.toLowerCase()===m:1===d.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?v.firstChild:v.lastChild],a&&y){for(d=v,f=d[M]||(d[M]={}),c=f[d.uniqueID]||(f[d.uniqueID]={}),l=c[e]||[],p=l[0]===I&&l[1],x=p&&l[2],d=p&&v.childNodes[p];d=++p&&d&&d[g]||(x=p=0)||h.pop();)if(1===d.nodeType&&++x&&d===t){c[e]=[I,p,x];break}}else if(y&&(d=t,f=d[M]||(d[M]={}),c=f[d.uniqueID]||(f[d.uniqueID]={}),l=c[e]||[],p=l[0]===I&&l[1],x=p),!1===x)for(;(d=++p&&d&&d[g]||(x=p=0)||h.pop())&&((s?d.nodeName.toLowerCase()!==m:1!==d.nodeType)||!++x||(y&&(f=d[M]||(d[M]={}),c=f[d.uniqueID]||(f[d.uniqueID]={}),c[e]=[I,x]),d!==t)););return(x-=i)===r||x%r==0&&x/r>=0}}},PSEUDO:function(e,n){var i,o=w.pseudos[e]||w.setFilters[e.toLowerCase()]||t.error("unsupported pseudo: "+e);return o[M]?o(n):o.length>1?(i=[e,e,"",n],w.setFilters.hasOwnProperty(e.toLowerCase())?r(function(e,t){for(var r,i=o(e,n),a=i.length;a--;)r=K(e,i[a]),e[r]=!(t[r]=i[a])}):function(e){return o(e,0,i)}):o}},pseudos:{not:r(function(e){var t=[],n=[],i=S(e.replace(oe,"$1"));return i[M]?r(function(e,t,n,r){for(var o,a=i(e,null,r,[]),s=e.length;s--;)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,r,o){return t[0]=e,i(t,null,o,n),t[0]=null,!n.pop()}}),has:r(function(e){return function(n){return t(e,n).length>0}}),contains:r(function(e){return e=e.replace(me,ye),function(t){return(t.textContent||t.innerText||T(t)).indexOf(e)>-1}}),lang:r(function(e){return ce.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(me,ye).toLowerCase(),function(t){var n;do{if(n=P?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===q},focus:function(e){return e===L.activeElement&&(!L.hasFocus||L.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:s(!1),disabled:s(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!w.pseudos.empty(e)},header:function(e){return pe.test(e.nodeName)},input:function(e){return de.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:u(function(){return[0]}),last:u(function(e,t){return[t-1]}),eq:u(function(e,t,n){return[n<0?n+t:n]}),even:u(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:u(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:u(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:u(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}},w.pseudos.nth=w.pseudos.eq;for(x in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})w.pseudos[x]=function(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}(x);for(x in{submit:!0,reset:!0})w.pseudos[x]=function(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}(x);return c.prototype=w.filters=w.pseudos,w.setFilters=new c,C=t.tokenize=function(e,n){var r,i,o,a,s,u,l,c=B[e+" "];if(c)return n?0:c.slice(0);for(s=e,u=[],l=w.preFilter;s;){r&&!(i=ae.exec(s))||(i&&(s=s.slice(i[0].length)||s),u.push(o=[])),r=!1,(i=se.exec(s))&&(r=i.shift(),o.push({value:r,type:i[0].replace(oe," ")}),s=s.slice(r.length));for(a in w.filter)!(i=fe[a].exec(s))||l[a]&&!(i=l[a](i))||(r=i.shift(),o.push({value:r,type:a,matches:i}),s=s.slice(r.length));if(!r)break}return n?s.length:s?t.error(e):B(e,u).slice(0)},S=t.compile=function(e,t){var n,r=[],i=[],o=z[e+" "];if(!o){for(t||(t=C(e)),n=t.length;n--;)o=m(t[n]),o[M]?r.push(o):i.push(o);o=z(e,y(i,r)),o.selector=e}return o},E=t.select=function(e,t,n,r){var i,o,a,s,u,c="function"==typeof e&&e,d=!r&&C(e=c.selector||e);if(n=n||[],1===d.length){if(o=d[0]=d[0].slice(0),o.length>2&&"ID"===(a=o[0]).type&&9===t.nodeType&&P&&w.relative[o[1].type]){if(!(t=(w.find.ID(a.matches[0].replace(me,ye),t)||[])[0]))return n;c&&(t=t.parentNode),e=e.slice(o.shift().value.length)}for(i=fe.needsContext.test(e)?0:o.length;i--&&(a=o[i],!w.relative[s=a.type]);)if((u=w.find[s])&&(r=u(a.matches[0].replace(me,ye),ve.test(o[0].type)&&l(t.parentNode)||t))){if(o.splice(i,1),!(e=r.length&&f(o)))return Q.apply(n,r),n;break}}return(c||S(e,d))(r,t,!P,n,!t||ve.test(e)&&l(t.parentNode)||t),n},b.sortStable=M.split("").sort(X).join("")===M,b.detectDuplicates=!!D,A(),b.sortDetached=i(function(e){return 1&e.compareDocumentPosition(L.createElement("fieldset"))}),i(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||o("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),b.attributes&&i(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||o("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),i(function(e){return null==e.getAttribute("disabled")})||o(Z,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),t}(o);xe.find=we,xe.expr=we.selectors,xe.expr[":"]=xe.expr.pseudos,xe.uniqueSort=xe.unique=we.uniqueSort,xe.text=we.getText,xe.isXMLDoc=we.isXML,xe.contains=we.contains,xe.escapeSelector=we.escape;var Te=function(e,t,n){for(var r=[],i=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(i&&xe(e).is(n))break;r.push(e)}return r},ke=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},Ce=xe.expr.match.needsContext,Se=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,Ee=/^.[^:#\[\.,]*$/;xe.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?xe.find.matchesSelector(r,e)?[r]:[]:xe.find.matches(e,xe.grep(t,function(e){return 1===e.nodeType}))},xe.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(xe(e).filter(function(){for(t=0;t<r;t++)if(xe.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)xe.find(e,i[t],n);return r>1?xe.uniqueSort(n):n},filter:function(e){return this.pushStack(c(this,e||[],!1))},not:function(e){return this.pushStack(c(this,e||[],!0))},is:function(e){return!!c(this,"string"==typeof e&&Ce.test(e)?xe(e):e||[],!1).length}});var je,Ne=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(xe.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||je,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:Ne.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof xe?t[0]:t,xe.merge(this,xe.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:se,!0)),Se.test(r[1])&&xe.isPlainObject(t))for(r in t)xe.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return i=se.getElementById(r[2]),i&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):xe.isFunction(e)?void 0!==n.ready?n.ready(e):e(xe):xe.makeArray(e,this)}).prototype=xe.fn,je=xe(se);var De=/^(?:parents|prev(?:Until|All))/,Ae={children:!0,contents:!0,next:!0,prev:!0};xe.fn.extend({has:function(e){var t=xe(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(xe.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&xe(e);if(!Ce.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&xe.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?xe.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?de.call(xe(e),this[0]):de.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(xe.uniqueSort(xe.merge(this.get(),xe(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),xe.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return Te(e,"parentNode")},parentsUntil:function(e,t,n){return Te(e,"parentNode",n)},next:function(e){return f(e,"nextSibling")},prev:function(e){return f(e,"previousSibling")},nextAll:function(e){return Te(e,"nextSibling")},prevAll:function(e){return Te(e,"previousSibling")},nextUntil:function(e,t,n){return Te(e,"nextSibling",n)},prevUntil:function(e,t,n){return Te(e,"previousSibling",n)},siblings:function(e){return ke((e.parentNode||{}).firstChild,e)},children:function(e){return ke(e.firstChild)},contents:function(e){return l(e,"iframe")?e.contentDocument:(l(e,"template")&&(e=e.content||e),xe.merge([],e.childNodes))}},function(e,t){xe.fn[e]=function(n,r){var i=xe.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=xe.filter(r,i)),this.length>1&&(Ae[e]||xe.uniqueSort(i),De.test(e)&&i.reverse()),this.pushStack(i)}});var Le=/[^\x20\t\r\n\f]+/g;xe.Callbacks=function(e){e="string"==typeof e?d(e):xe.extend({},e);var t,n,r,i,o=[],a=[],s=-1,u=function(){for(i=i||e.once,r=t=!0;a.length;s=-1)for(n=a.shift();++s<o.length;)!1===o[s].apply(n[0],n[1])&&e.stopOnFalse&&(s=o.length,n=!1);e.memory||(n=!1),t=!1,i&&(o=n?[]:"")},l={add:function(){return o&&(n&&!t&&(s=o.length-1,a.push(n)),function t(n){xe.each(n,function(n,r){xe.isFunction(r)?e.unique&&l.has(r)||o.push(r):r&&r.length&&"string"!==xe.type(r)&&t(r)})}(arguments),n&&!t&&u()),this},remove:function(){return xe.each(arguments,function(e,t){for(var n;(n=xe.inArray(t,o,n))>-1;)o.splice(n,1),n<=s&&s--}),this},has:function(e){return e?xe.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=n||[],n=[e,n.slice?n.slice():n],a.push(n),t||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l},xe.extend({Deferred:function(e){var t=[["notify","progress",xe.Callbacks("memory"),xe.Callbacks("memory"),2],["resolve","done",xe.Callbacks("once memory"),xe.Callbacks("once memory"),0,"resolved"],["reject","fail",xe.Callbacks("once memory"),xe.Callbacks("once memory"),1,"rejected"]],n="pending",r={state:function(){return n},always:function(){return a.done(arguments).fail(arguments),this},catch:function(e){return r.then(null,e)},pipe:function(){var e=arguments;return xe.Deferred(function(n){xe.each(t,function(t,r){var i=xe.isFunction(e[r[4]])&&e[r[4]];a[r[1]](function(){var e=i&&i.apply(this,arguments);e&&xe.isFunction(e.promise)?e.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[r[0]+"With"](this,i?[e]:arguments)})}),e=null}).promise()},then:function(e,n,r){function a(e,t,n,r){return function(){var u=this,l=arguments,c=function(){var o,c;if(!(e<s)){if((o=n.apply(u,l))===t.promise())throw new TypeError("Thenable self-resolution");c=o&&("object"===(void 0===o?"undefined":i(o))||"function"==typeof o)&&o.then,xe.isFunction(c)?r?c.call(o,a(s,t,p,r),a(s,t,h,r)):(s++,c.call(o,a(s,t,p,r),a(s,t,h,r),a(s,t,p,t.notifyWith))):(n!==p&&(u=void 0,l=[o]),(r||t.resolveWith)(u,l))}},f=r?c:function(){try{c()}catch(r){xe.Deferred.exceptionHook&&xe.Deferred.exceptionHook(r,f.stackTrace),e+1>=s&&(n!==h&&(u=void 0,l=[r]),t.rejectWith(u,l))}};e?f():(xe.Deferred.getStackHook&&(f.stackTrace=xe.Deferred.getStackHook()),o.setTimeout(f))}}var s=0;return xe.Deferred(function(i){t[0][3].add(a(0,i,xe.isFunction(r)?r:p,i.notifyWith)),t[1][3].add(a(0,i,xe.isFunction(e)?e:p)),t[2][3].add(a(0,i,xe.isFunction(n)?n:h))}).promise()},promise:function(e){return null!=e?xe.extend(e,r):r}},a={};return xe.each(t,function(e,i){var o=i[2],s=i[5];r[i[1]]=o.add,s&&o.add(function(){n=s},t[3-e][2].disable,t[0][2].lock),o.add(i[3].fire),a[i[0]]=function(){return a[i[0]+"With"](this===a?void 0:this,arguments),this},a[i[0]+"With"]=o.fireWith}),r.promise(a),e&&e.call(a,a),a},when:function(e){var t=arguments.length,n=t,r=Array(n),i=le.call(arguments),o=xe.Deferred(),a=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?le.call(arguments):n,--t||o.resolveWith(r,i)}};if(t<=1&&(g(e,o.done(a(n)).resolve,o.reject,!t),"pending"===o.state()||xe.isFunction(i[n]&&i[n].then)))return o.then();for(;n--;)g(i[n],a(n),o.reject);return o.promise()}});var qe=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;xe.Deferred.exceptionHook=function(e,t){o.console&&o.console.warn&&e&&qe.test(e.name)&&o.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},xe.readyException=function(e){o.setTimeout(function(){throw e})};var Pe=xe.Deferred();xe.fn.ready=function(e){return Pe.then(e).catch(function(e){xe.readyException(e)}),this},xe.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--xe.readyWait:xe.isReady)||(xe.isReady=!0,!0!==e&&--xe.readyWait>0||Pe.resolveWith(se,[xe]))}}),xe.ready.then=Pe.then,"complete"===se.readyState||"loading"!==se.readyState&&!se.documentElement.doScroll?o.setTimeout(xe.ready):(se.addEventListener("DOMContentLoaded",v),o.addEventListener("load",v));var He=function e(t,n,r,i,o,a,s){var u=0,l=t.length,c=null==r;if("object"===xe.type(r)){o=!0;for(u in r)e(t,n,u,r[u],!0,a,s)}else if(void 0!==i&&(o=!0,xe.isFunction(i)||(s=!0),c&&(s?(n.call(t,i),n=null):(c=n,n=function(e,t,n){return c.call(xe(e),n)})),n))for(;u<l;u++)n(t[u],r,s?i:i.call(t[u],u,n(t[u],r)));return o?t:c?n.call(t):l?n(t[0],r):a},Oe=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};m.uid=1,m.prototype={cache:function(e){var t=e[this.expando];return t||(t={},Oe(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[xe.camelCase(t)]=n;else for(r in t)i[xe.camelCase(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][xe.camelCase(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){Array.isArray(t)?t=t.map(xe.camelCase):(t=xe.camelCase(t),t=t in r?[t]:t.match(Le)||[]),n=t.length;for(;n--;)delete r[t[n]]}(void 0===t||xe.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!xe.isEmptyObject(t)}};var _e=new m,Fe=new m,Me=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Re=/[A-Z]/g;xe.extend({hasData:function(e){return Fe.hasData(e)||_e.hasData(e)},data:function(e,t,n){return Fe.access(e,t,n)},removeData:function(e,t){Fe.remove(e,t)},_data:function(e,t,n){return _e.access(e,t,n)},_removeData:function(e,t){_e.remove(e,t)}}),xe.fn.extend({data:function(e,t){var n,r,o,a=this[0],s=a&&a.attributes;if(void 0===e){if(this.length&&(o=Fe.get(a),1===a.nodeType&&!_e.get(a,"hasDataAttrs"))){for(n=s.length;n--;)s[n]&&(r=s[n].name,0===r.indexOf("data-")&&(r=xe.camelCase(r.slice(5)),x(a,r,o[r])));_e.set(a,"hasDataAttrs",!0)}return o}return"object"===(void 0===e?"undefined":i(e))?this.each(function(){Fe.set(this,e)}):He(this,function(t){var n;if(a&&void 0===t){if(void 0!==(n=Fe.get(a,e)))return n;if(void 0!==(n=x(a,e)))return n}else this.each(function(){Fe.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){Fe.remove(this,e)})}}),xe.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=_e.get(e,t),n&&(!r||Array.isArray(n)?r=_e.access(e,t,xe.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=xe.queue(e,t),r=n.length,i=n.shift(),o=xe._queueHooks(e,t),a=function(){xe.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return _e.get(e,n)||_e.access(e,n,{empty:xe.Callbacks("once memory").add(function(){_e.remove(e,[t+"queue",n])})})}}),xe.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length<n?xe.queue(this[0],e):void 0===t?this:this.each(function(){var n=xe.queue(this,e,t);xe._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&xe.dequeue(this,e)})},dequeue:function(e){return this.each(function(){xe.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=xe.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};for("string"!=typeof e&&(t=e,e=void 0),e=e||"fx";a--;)(n=_e.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var Ie=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,We=new RegExp("^(?:([+-])=|)("+Ie+")([a-z%]*)$","i"),$e=["Top","Right","Bottom","Left"],Be=function(e,t){return e=t||e,"none"===e.style.display||""===e.style.display&&xe.contains(e.ownerDocument,e)&&"none"===xe.css(e,"display")},ze=function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i},Xe={};xe.fn.extend({show:function(){return T(this,!0)},hide:function(){return T(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){Be(this)?xe(this).show():xe(this).hide()})}});var Ue=/^(?:checkbox|radio)$/i,Ve=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,Ge=/^$|\/(?:java|ecma)script/i,Ye={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};Ye.optgroup=Ye.option,Ye.tbody=Ye.tfoot=Ye.colgroup=Ye.caption=Ye.thead,Ye.th=Ye.td;var Qe=/<|&#?\w+;/;!function(){var e=se.createDocumentFragment(),t=e.appendChild(se.createElement("div")),n=se.createElement("input");n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),t.appendChild(n),ye.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,t.innerHTML="<textarea>x</textarea>",ye.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue}();var Je=se.documentElement,Ke=/^key/,Ze=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,et=/^([^.]*)(?:\.(.+)|)/;xe.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,l,c,f,d,p,h,g,v=_e.get(e);if(v)for(n.handler&&(o=n,n=o.handler,i=o.selector),i&&xe.find.matchesSelector(Je,i),n.guid||(n.guid=xe.guid++),(u=v.events)||(u=v.events={}),(a=v.handle)||(a=v.handle=function(t){return void 0!==xe&&xe.event.triggered!==t.type?xe.event.dispatch.apply(e,arguments):void 0}),t=(t||"").match(Le)||[""],l=t.length;l--;)s=et.exec(t[l])||[],p=g=s[1],h=(s[2]||"").split(".").sort(),p&&(f=xe.event.special[p]||{},p=(i?f.delegateType:f.bindType)||p,f=xe.event.special[p]||{},c=xe.extend({type:p,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&xe.expr.match.needsContext.test(i),namespace:h.join(".")},o),(d=u[p])||(d=u[p]=[],d.delegateCount=0,f.setup&&!1!==f.setup.call(e,r,h,a)||e.addEventListener&&e.addEventListener(p,a)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?d.splice(d.delegateCount++,0,c):d.push(c),xe.event.global[p]=!0)},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,d,p,h,g,v=_e.hasData(e)&&_e.get(e);if(v&&(u=v.events)){for(t=(t||"").match(Le)||[""],l=t.length;l--;)if(s=et.exec(t[l])||[],p=g=s[1],h=(s[2]||"").split(".").sort(),p){for(f=xe.event.special[p]||{},p=(r?f.delegateType:f.bindType)||p,d=u[p]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=d.length;o--;)c=d[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(d.splice(o,1),c.selector&&d.delegateCount--,f.remove&&f.remove.call(e,c));a&&!d.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||xe.removeEvent(e,p,v.handle),delete u[p])}else for(p in u)xe.event.remove(e,p+t[l],n,r,!0);xe.isEmptyObject(u)&&_e.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=xe.event.fix(e),u=new Array(arguments.length),l=(_e.get(this,"events")||{})[s.type]||[],c=xe.event.special[s.type]||{};for(u[0]=s,t=1;t<arguments.length;t++)u[t]=arguments[t];if(s.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,s)){for(a=xe.event.handlers.call(this,s,l),t=0;(i=a[t++])&&!s.isPropagationStopped();)for(s.currentTarget=i.elem,n=0;(o=i.handlers[n++])&&!s.isImmediatePropagationStopped();)s.rnamespace&&!s.rnamespace.test(o.namespace)||(s.handleObj=o,s.data=o.data,void 0!==(r=((xe.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,u))&&!1===(s.result=r)&&(s.preventDefault(),s.stopPropagation()));return c.postDispatch&&c.postDispatch.call(this,s),s.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&e.button>=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)r=t[n],i=r.selector+" ",void 0===a[i]&&(a[i]=r.needsContext?xe(i,this).index(l)>-1:xe.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(e,t){Object.defineProperty(xe.Event.prototype,e,{enumerable:!0,configurable:!0,get:xe.isFunction(t)?function(){if(this.originalEvent)return t(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set:function(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})},fix:function(e){return e[xe.expando]?e:new xe.Event(e)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==N()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===N()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&l(this,"input"))return this.click(),!1},_default:function(e){return l(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},xe.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},xe.Event=function(e,t){if(!(this instanceof xe.Event))return new xe.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?E:j,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&xe.extend(this,t),this.timeStamp=e&&e.timeStamp||xe.now(),this[xe.expando]=!0},xe.Event.prototype={constructor:xe.Event,isDefaultPrevented:j,isPropagationStopped:j,isImmediatePropagationStopped:j,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=E,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=E,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=E,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},xe.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,char:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&Ke.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&Ze.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},xe.event.addProp),xe.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){xe.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return i&&(i===r||xe.contains(r,i))||(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),xe.fn.extend({on:function(e,t,n,r){return D(this,e,t,n,r)},one:function(e,t,n,r){return D(this,e,t,n,r,1)},off:function(e,t,n){var r,o;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,xe(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"===(void 0===e?"undefined":i(e))){for(o in e)this.off(o,t,e[o]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=j),this.each(function(){xe.event.remove(this,e,n,t)})}});var tt=/<script|<style|<link/i,nt=/checked\s*(?:[^=]|=\s*.checked.)/i,rt=/^true\/(.*)/,it=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;xe.extend({htmlPrefilter:function(e){return e.replace(/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,"<$1></$2>")},clone:function(e,t,n){var r,i,o,a,s=e.cloneNode(!0),u=xe.contains(e.ownerDocument,e);if(!(ye.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||xe.isXMLDoc(e)))for(a=k(s),o=k(e),r=0,i=o.length;r<i;r++)H(o[r],a[r]);if(t)if(n)for(o=o||k(e),a=a||k(s),r=0,i=o.length;r<i;r++)P(o[r],a[r]);else P(e,s);return a=k(s,"script"),a.length>0&&C(a,!u&&k(e,"script")),s},cleanData:function(e){for(var t,n,r,i=xe.event.special,o=0;void 0!==(n=e[o]);o++)if(Oe(n)){if(t=n[_e.expando]){if(t.events)for(r in t.events)i[r]?xe.event.remove(n,r):xe.removeEvent(n,r,t.handle);n[_e.expando]=void 0}n[Fe.expando]&&(n[Fe.expando]=void 0)}}}),xe.fn.extend({detach:function(e){return _(this,e,!0)},remove:function(e){return _(this,e)},text:function(e){return He(this,function(e){return void 0===e?xe.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return O(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){A(this,e).appendChild(e)}})},prepend:function(){return O(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=A(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return O(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return O(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(xe.cleanData(k(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return xe.clone(this,e,t)})},html:function(e){return He(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!tt.test(e)&&!Ye[(Ve.exec(e)||["",""])[1].toLowerCase()]){e=xe.htmlPrefilter(e);try{for(;n<r;n++)t=this[n]||{},1===t.nodeType&&(xe.cleanData(k(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return O(this,arguments,function(t){var n=this.parentNode;xe.inArray(this,e)<0&&(xe.cleanData(k(this)),n&&n.replaceChild(t,this))},e)}}),xe.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){xe.fn[e]=function(e){for(var n,r=[],i=xe(e),o=i.length-1,a=0;a<=o;a++)n=a===o?this:this.clone(!0),xe(i[a])[t](n),fe.apply(r,n.get());return this.pushStack(r)}});var ot=/^margin/,at=new RegExp("^("+Ie+")(?!px)[a-z%]+$","i"),st=function(e){var t=e.ownerDocument.defaultView;return t&&t.opener||(t=o),t.getComputedStyle(e)};!function(){function e(){if(s){s.style.cssText="box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",s.innerHTML="",Je.appendChild(a);var e=o.getComputedStyle(s);t="1%"!==e.top,i="2px"===e.marginLeft,n="4px"===e.width,s.style.marginRight="50%",r="4px"===e.marginRight,Je.removeChild(a),s=null}}var t,n,r,i,a=se.createElement("div"),s=se.createElement("div");s.style&&(s.style.backgroundClip="content-box",s.cloneNode(!0).style.backgroundClip="",ye.clearCloneStyle="content-box"===s.style.backgroundClip,a.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",a.appendChild(s),xe.extend(ye,{pixelPosition:function(){return e(),t},boxSizingReliable:function(){return e(),n},pixelMarginRight:function(){return e(),r},reliableMarginLeft:function(){return e(),i}}))}();var ut=/^(none|table(?!-c[ea]).+)/,lt=/^--/,ct={position:"absolute",visibility:"hidden",display:"block"},ft={letterSpacing:"0",fontWeight:"400"},dt=["Webkit","Moz","ms"],pt=se.createElement("div").style;xe.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=F(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{float:"cssFloat"},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,u=xe.camelCase(t),l=lt.test(t),c=e.style;if(l||(t=I(u)),s=xe.cssHooks[t]||xe.cssHooks[u],void 0===n)return s&&"get"in s&&void 0!==(o=s.get(e,!1,r))?o:c[t];a=void 0===n?"undefined":i(n),"string"===a&&(o=We.exec(n))&&o[1]&&(n=b(e,t,o),a="number"),null!=n&&n===n&&("number"===a&&(n+=o&&o[3]||(xe.cssNumber[u]?"":"px")),ye.clearCloneStyle||""!==n||0!==t.indexOf("background")||(c[t]="inherit"),s&&"set"in s&&void 0===(n=s.set(e,n,r))||(l?c.setProperty(t,n):c[t]=n))}},css:function(e,t,n,r){var i,o,a,s=xe.camelCase(t);return lt.test(t)||(t=I(s)),a=xe.cssHooks[t]||xe.cssHooks[s],a&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=F(e,t,r)),"normal"===i&&t in ft&&(i=ft[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),xe.each(["height","width"],function(e,t){xe.cssHooks[t]={get:function(e,n,r){if(n)return!ut.test(xe.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?B(e,t,r):ze(e,ct,function(){return B(e,t,r)})},set:function(e,n,r){var i,o=r&&st(e),a=r&&$(e,t,r,"border-box"===xe.css(e,"boxSizing",!1,o),o);return a&&(i=We.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=xe.css(e,t)),W(e,n,a)}}}),xe.cssHooks.marginLeft=M(ye.reliableMarginLeft,function(e,t){if(t)return(parseFloat(F(e,"marginLeft"))||e.getBoundingClientRect().left-ze(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),xe.each({margin:"",padding:"",border:"Width"},function(e,t){xe.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+$e[r]+t]=o[r]||o[r-2]||o[0];return i}},ot.test(e)||(xe.cssHooks[e+t].set=W)}),xe.fn.extend({css:function(e,t){return He(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=st(e),i=t.length;a<i;a++)o[t[a]]=xe.css(e,t[a],!1,r);return o}return void 0!==n?xe.style(e,t,n):xe.css(e,t)},e,t,arguments.length>1)}}),xe.Tween=z,z.prototype={constructor:z,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||xe.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(xe.cssNumber[n]?"":"px")},cur:function(){var e=z.propHooks[this.prop];return e&&e.get?e.get(this):z.propHooks._default.get(this)},run:function(e){var t,n=z.propHooks[this.prop];return this.options.duration?this.pos=t=xe.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):z.propHooks._default.set(this),this}},z.prototype.init.prototype=z.prototype,z.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=xe.css(e.elem,e.prop,""),t&&"auto"!==t?t:0)},set:function(e){xe.fx.step[e.prop]?xe.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[xe.cssProps[e.prop]]&&!xe.cssHooks[e.prop]?e.elem[e.prop]=e.now:xe.style(e.elem,e.prop,e.now+e.unit)}}},z.propHooks.scrollTop=z.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},xe.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},xe.fx=z.prototype.init,xe.fx.step={};var ht,gt,vt=/^(?:toggle|show|hide)$/,mt=/queueHooks$/;xe.Animation=xe.extend(J,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return b(n.elem,e,We.exec(t),n),n}]},tweener:function(e,t){xe.isFunction(e)?(t=e,e=["*"]):e=e.match(Le);for(var n,r=0,i=e.length;r<i;r++)n=e[r],J.tweeners[n]=J.tweeners[n]||[],J.tweeners[n].unshift(t)},prefilters:[Y],prefilter:function(e,t){t?J.prefilters.unshift(e):J.prefilters.push(e)}}),xe.speed=function(e,t,n){var r=e&&"object"===(void 0===e?"undefined":i(e))?xe.extend({},e):{complete:n||!n&&t||xe.isFunction(e)&&e,duration:e,easing:n&&t||t&&!xe.isFunction(t)&&t};return xe.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in xe.fx.speeds?r.duration=xe.fx.speeds[r.duration]:r.duration=xe.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){xe.isFunction(r.old)&&r.old.call(this),r.queue&&xe.dequeue(this,r.queue)},r},xe.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Be).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=xe.isEmptyObject(e),o=xe.speed(t,n,r),a=function(){var t=J(this,xe.extend({},e),o);(i||_e.get(this,"finish"))&&t.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&!1!==e&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",o=xe.timers,a=_e.get(this);if(i)a[i]&&a[i].stop&&r(a[i]);else for(i in a)a[i]&&a[i].stop&&mt.test(i)&&r(a[i]);for(i=o.length;i--;)o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1));!t&&n||xe.dequeue(this,e)})},finish:function(e){return!1!==e&&(e=e||"fx"),this.each(function(){var t,n=_e.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=xe.timers,a=r?r.length:0;for(n.finish=!0,xe.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;t<a;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),xe.each(["toggle","show","hide"],function(e,t){var n=xe.fn[t];xe.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(V(t,!0),e,r,i)}}),xe.each({slideDown:V("show"),slideUp:V("hide"),slideToggle:V("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){xe.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),xe.timers=[],xe.fx.tick=function(){var e,t=0,n=xe.timers;for(ht=xe.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||xe.fx.stop(),ht=void 0},xe.fx.timer=function(e){xe.timers.push(e),xe.fx.start()},xe.fx.interval=13,xe.fx.start=function(){gt||(gt=!0,X())},xe.fx.stop=function(){gt=null},xe.fx.speeds={slow:600,fast:200,_default:400},xe.fn.delay=function(e,t){return e=xe.fx?xe.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=o.setTimeout(t,e);n.stop=function(){o.clearTimeout(r)}})},function(){var e=se.createElement("input"),t=se.createElement("select"),n=t.appendChild(se.createElement("option"));e.type="checkbox",ye.checkOn=""!==e.value,ye.optSelected=n.selected,e=se.createElement("input"),e.value="t",e.type="radio",ye.radioValue="t"===e.value}();var yt,xt=xe.expr.attrHandle;xe.fn.extend({attr:function(e,t){return He(this,xe.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){xe.removeAttr(this,e)})}}),xe.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return void 0===e.getAttribute?xe.prop(e,t,n):(1===o&&xe.isXMLDoc(e)||(i=xe.attrHooks[t.toLowerCase()]||(xe.expr.match.bool.test(t)?yt:void 0)),void 0!==n?null===n?void xe.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:(r=xe.find.attr(e,t),null==r?void 0:r))},attrHooks:{type:{set:function(e,t){if(!ye.radioValue&&"radio"===t&&l(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(Le);if(i&&1===e.nodeType)for(;n=i[r++];)e.removeAttribute(n)}}),yt={set:function(e,t,n){return!1===t?xe.removeAttr(e,n):e.setAttribute(n,n),n}},xe.each(xe.expr.match.bool.source.match(/\w+/g),function(e,t){var n=xt[t]||xe.find.attr;xt[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=xt[a],xt[a]=i,i=null!=n(e,t,r)?a:null,xt[a]=o),i}});var bt=/^(?:input|select|textarea|button)$/i,wt=/^(?:a|area)$/i;xe.fn.extend({prop:function(e,t){return He(this,xe.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[xe.propFix[e]||e]})}}),xe.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&xe.isXMLDoc(e)||(t=xe.propFix[t]||t,i=xe.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=xe.find.attr(e,"tabindex");return t?parseInt(t,10):bt.test(e.nodeName)||wt.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),ye.optSelected||(xe.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),xe.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){xe.propFix[this.toLowerCase()]=this}),xe.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(xe.isFunction(e))return this.each(function(t){xe(this).addClass(e.call(this,t,Z(this)))});if("string"==typeof e&&e)for(t=e.match(Le)||[];n=this[u++];)if(i=Z(n),r=1===n.nodeType&&" "+K(i)+" "){for(a=0;o=t[a++];)r.indexOf(" "+o+" ")<0&&(r+=o+" ");s=K(r),i!==s&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(xe.isFunction(e))return this.each(function(t){xe(this).removeClass(e.call(this,t,Z(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof e&&e)for(t=e.match(Le)||[];n=this[u++];)if(i=Z(n),r=1===n.nodeType&&" "+K(i)+" "){for(a=0;o=t[a++];)for(;r.indexOf(" "+o+" ")>-1;)r=r.replace(" "+o+" "," ");s=K(r),i!==s&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=void 0===e?"undefined":i(e);return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):xe.isFunction(e)?this.each(function(n){xe(this).toggleClass(e.call(this,n,Z(this),t),t)}):this.each(function(){var t,r,i,o;if("string"===n)for(r=0,i=xe(this),o=e.match(Le)||[];t=o[r++];)i.hasClass(t)?i.removeClass(t):i.addClass(t);else void 0!==e&&"boolean"!==n||(t=Z(this),t&&_e.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":_e.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;for(t=" "+e+" ";n=this[r++];)if(1===n.nodeType&&(" "+K(Z(n))+" ").indexOf(t)>-1)return!0;return!1}});xe.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=xe.isFunction(e),this.each(function(n){var i;1===this.nodeType&&(i=r?e.call(this,n,xe(this).val()):e,null==i?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=xe.map(i,function(e){return null==e?"":e+""})),(t=xe.valHooks[this.type]||xe.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return(t=xe.valHooks[i.type]||xe.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:(n=i.value,"string"==typeof n?n.replace(/\r/g,""):null==n?"":n)}}}),xe.extend({valHooks:{option:{get:function(e){var t=xe.find.attr(e,"value");return null!=t?t:K(xe.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(n=i[r],(n.selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!l(n.parentNode,"optgroup"))){if(t=xe(n).val(),a)return t;s.push(t)}return s},set:function(e,t){for(var n,r,i=e.options,o=xe.makeArray(t),a=i.length;a--;)r=i[a],(r.selected=xe.inArray(xe.valHooks.option.get(r),o)>-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),xe.each(["radio","checkbox"],function(){xe.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=xe.inArray(xe(e).val(),t)>-1}},ye.checkOn||(xe.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Tt=/^(?:focusinfocus|focusoutblur)$/;xe.extend(xe.event,{trigger:function(e,t,n,r){var a,s,u,l,c,f,d,p=[n||se],h=ge.call(e,"type")?e.type:e,g=ge.call(e,"namespace")?e.namespace.split("."):[];if(s=u=n=n||se,3!==n.nodeType&&8!==n.nodeType&&!Tt.test(h+xe.event.triggered)&&(h.indexOf(".")>-1&&(g=h.split("."),h=g.shift(),g.sort()),c=h.indexOf(":")<0&&"on"+h,e=e[xe.expando]?e:new xe.Event(h,"object"===(void 0===e?"undefined":i(e))&&e),e.isTrigger=r?2:3,e.namespace=g.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+g.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:xe.makeArray(t,[e]),d=xe.event.special[h]||{},r||!d.trigger||!1!==d.trigger.apply(n,t))){if(!r&&!d.noBubble&&!xe.isWindow(n)){for(l=d.delegateType||h,Tt.test(l+h)||(s=s.parentNode);s;s=s.parentNode)p.push(s),u=s;u===(n.ownerDocument||se)&&p.push(u.defaultView||u.parentWindow||o)}for(a=0;(s=p[a++])&&!e.isPropagationStopped();)e.type=a>1?l:d.bindType||h,f=(_e.get(s,"events")||{})[e.type]&&_e.get(s,"handle"),f&&f.apply(s,t),(f=c&&s[c])&&f.apply&&Oe(s)&&(e.result=f.apply(s,t),!1===e.result&&e.preventDefault());return e.type=h,r||e.isDefaultPrevented()||d._default&&!1!==d._default.apply(p.pop(),t)||!Oe(n)||c&&xe.isFunction(n[h])&&!xe.isWindow(n)&&(u=n[c],u&&(n[c]=null),xe.event.triggered=h,n[h](),xe.event.triggered=void 0,u&&(n[c]=u)),e.result}},simulate:function(e,t,n){var r=xe.extend(new xe.Event,n,{type:e,isSimulated:!0});xe.event.trigger(r,null,t)}}),xe.fn.extend({trigger:function(e,t){return this.each(function(){xe.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return xe.event.trigger(e,t,n,!0)}}),xe.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,t){xe.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),xe.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),ye.focusin="onfocusin"in o,ye.focusin||xe.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){xe.event.simulate(t,e.target,xe.event.fix(e))};xe.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=_e.access(r,t);i||r.addEventListener(e,n,!0),_e.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=_e.access(r,t)-1;i?_e.access(r,t,i):(r.removeEventListener(e,n,!0),_e.remove(r,t))}}});var kt=o.location,Ct=xe.now(),St=/\?/;xe.parseXML=function(e){var t;if(!e||"string"!=typeof e)return null;try{t=(new o.DOMParser).parseFromString(e,"text/xml")}catch(e){t=void 0}return t&&!t.getElementsByTagName("parsererror").length||xe.error("Invalid XML: "+e),t};var Et=/\[\]$/,jt=/^(?:submit|button|image|reset|file)$/i,Nt=/^(?:input|select|textarea|keygen)/i;xe.param=function(e,t){var n,r=[],i=function(e,t){var n=xe.isFunction(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(e)||e.jquery&&!xe.isPlainObject(e))xe.each(e,function(){i(this.name,this.value)});else for(n in e)ee(n,e[n],t,i);return r.join("&")},xe.fn.extend({serialize:function(){return xe.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=xe.prop(this,"elements");return e?xe.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!xe(this).is(":disabled")&&Nt.test(this.nodeName)&&!jt.test(e)&&(this.checked||!Ue.test(e))}).map(function(e,t){var n=xe(this).val();return null==n?null:Array.isArray(n)?xe.map(n,function(e){return{name:t.name,value:e.replace(/\r?\n/g,"\r\n")}}):{name:t.name,value:n.replace(/\r?\n/g,"\r\n")}}).get()}});var Dt=/^(.*?):[ \t]*([^\r\n]*)$/gm,At=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Lt=/^(?:GET|HEAD)$/,qt={},Pt={},Ht="*/".concat("*"),Ot=se.createElement("a");Ot.href=kt.href,xe.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:kt.href,type:"GET",isLocal:At.test(kt.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Ht,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":xe.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?re(re(e,xe.ajaxSettings),t):re(xe.ajaxSettings,e)},ajaxPrefilter:te(qt),ajaxTransport:te(Pt),ajax:function(e,t){function n(e,t,n,i){var u,c,p,h,w,T=t;f||(f=!0,l&&o.clearTimeout(l),r=void 0,s=i||"",C.readyState=e>0?4:0,u=e>=200&&e<300||304===e,n&&(h=ie(g,C,n)),h=oe(g,h,C,u),u?(g.ifModified&&(w=C.getResponseHeader("Last-Modified"),w&&(xe.lastModified[a]=w),(w=C.getResponseHeader("etag"))&&(xe.etag[a]=w)),204===e||"HEAD"===g.type?T="nocontent":304===e?T="notmodified":(T=h.state,c=h.data,p=h.error,u=!p)):(p=T,!e&&T||(T="error",e<0&&(e=0))),C.status=e,C.statusText=(t||T)+"",u?y.resolveWith(v,[c,T,C]):y.rejectWith(v,[C,T,p]),C.statusCode(b),b=void 0,d&&m.trigger(u?"ajaxSuccess":"ajaxError",[C,g,u?c:p]),x.fireWith(v,[C,T]),d&&(m.trigger("ajaxComplete",[C,g]),--xe.active||xe.event.trigger("ajaxStop")))}"object"===(void 0===e?"undefined":i(e))&&(t=e,e=void 0),t=t||{};var r,a,s,u,l,c,f,d,p,h,g=xe.ajaxSetup({},t),v=g.context||g,m=g.context&&(v.nodeType||v.jquery)?xe(v):xe.event,y=xe.Deferred(),x=xe.Callbacks("once memory"),b=g.statusCode||{},w={},T={},k="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(f){if(!u)for(u={};t=Dt.exec(s);)u[t[1].toLowerCase()]=t[2];t=u[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return f?s:null},setRequestHeader:function(e,t){return null==f&&(e=T[e.toLowerCase()]=T[e.toLowerCase()]||e,w[e]=t),this},overrideMimeType:function(e){return null==f&&(g.mimeType=e),this},statusCode:function(e){var t;if(e)if(f)C.always(e[C.status]);else for(t in e)b[t]=[b[t],e[t]];return this},abort:function(e){var t=e||k;return r&&r.abort(t),n(0,t),this}};if(y.promise(C),g.url=((e||g.url||kt.href)+"").replace(/^\/\//,kt.protocol+"//"),g.type=t.method||t.type||g.method||g.type,g.dataTypes=(g.dataType||"*").toLowerCase().match(Le)||[""],null==g.crossDomain){c=se.createElement("a");try{c.href=g.url,c.href=c.href,g.crossDomain=Ot.protocol+"//"+Ot.host!=c.protocol+"//"+c.host}catch(e){g.crossDomain=!0}}if(g.data&&g.processData&&"string"!=typeof g.data&&(g.data=xe.param(g.data,g.traditional)),ne(qt,g,t,C),f)return C;d=xe.event&&g.global,d&&0==xe.active++&&xe.event.trigger("ajaxStart"),g.type=g.type.toUpperCase(),g.hasContent=!Lt.test(g.type),a=g.url.replace(/#.*$/,""),g.hasContent?g.data&&g.processData&&0===(g.contentType||"").indexOf("application/x-www-form-urlencoded")&&(g.data=g.data.replace(/%20/g,"+")):(h=g.url.slice(a.length),g.data&&(a+=(St.test(a)?"&":"?")+g.data,delete g.data),!1===g.cache&&(a=a.replace(/([?&])_=[^&]*/,"$1"),h=(St.test(a)?"&":"?")+"_="+Ct+++h),g.url=a+h),g.ifModified&&(xe.lastModified[a]&&C.setRequestHeader("If-Modified-Since",xe.lastModified[a]),xe.etag[a]&&C.setRequestHeader("If-None-Match",xe.etag[a])),(g.data&&g.hasContent&&!1!==g.contentType||t.contentType)&&C.setRequestHeader("Content-Type",g.contentType),C.setRequestHeader("Accept",g.dataTypes[0]&&g.accepts[g.dataTypes[0]]?g.accepts[g.dataTypes[0]]+("*"!==g.dataTypes[0]?", "+Ht+"; q=0.01":""):g.accepts["*"]);for(p in g.headers)C.setRequestHeader(p,g.headers[p]);if(g.beforeSend&&(!1===g.beforeSend.call(v,C,g)||f))return C.abort();if(k="abort",x.add(g.complete),C.done(g.success),C.fail(g.error),r=ne(Pt,g,t,C)){if(C.readyState=1,d&&m.trigger("ajaxSend",[C,g]),f)return C;g.async&&g.timeout>0&&(l=o.setTimeout(function(){C.abort("timeout")},g.timeout));try{f=!1,r.send(w,n)}catch(e){if(f)throw e;n(-1,e)}}else n(-1,"No Transport");return C},getJSON:function(e,t,n){return xe.get(e,t,n,"json")},getScript:function(e,t){return xe.get(e,void 0,t,"script")}}),xe.each(["get","post"],function(e,t){xe[t]=function(e,n,r,i){return xe.isFunction(n)&&(i=i||r,r=n,n=void 0),xe.ajax(xe.extend({url:e,type:t,dataType:i,data:n,success:r},xe.isPlainObject(e)&&e))}}),xe._evalUrl=function(e){return xe.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,throws:!0})},xe.fn.extend({wrapAll:function(e){var t;return this[0]&&(xe.isFunction(e)&&(e=e.call(this[0])),t=xe(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return xe.isFunction(e)?this.each(function(t){xe(this).wrapInner(e.call(this,t))}):this.each(function(){var t=xe(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=xe.isFunction(e);return this.each(function(n){xe(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){xe(this).replaceWith(this.childNodes)}),this}}),xe.expr.pseudos.hidden=function(e){return!xe.expr.pseudos.visible(e)},xe.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},xe.ajaxSettings.xhr=function(){try{return new o.XMLHttpRequest}catch(e){}};var _t={0:200,1223:204},Ft=xe.ajaxSettings.xhr();ye.cors=!!Ft&&"withCredentials"in Ft,ye.ajax=Ft=!!Ft,xe.ajaxTransport(function(e){var t,n;if(ye.cors||Ft&&!e.crossDomain)return{send:function(r,i){var a,s=e.xhr();if(s.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(a in e.xhrFields)s[a]=e.xhrFields[a];e.mimeType&&s.overrideMimeType&&s.overrideMimeType(e.mimeType),e.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest");for(a in r)s.setRequestHeader(a,r[a]);t=function(e){return function(){t&&(t=n=s.onload=s.onerror=s.onabort=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?i(0,"error"):i(s.status,s.statusText):i(_t[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=t(),n=s.onerror=t("error"),void 0!==s.onabort?s.onabort=n:s.onreadystatechange=function(){4===s.readyState&&o.setTimeout(function(){t&&n()})},t=t("abort");try{s.send(e.hasContent&&e.data||null)}catch(e){if(t)throw e}},abort:function(){t&&t()}}}),xe.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),xe.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return xe.globalEval(e),e}}}),xe.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),xe.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(r,i){t=xe("<script>").prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&i("error"===e.type?404:200,e.type)}),se.head.appendChild(t[0])},abort:function(){n&&n()}}}});var Mt=[],Rt=/(=)\?(?=&|$)|\?\?/;xe.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Mt.pop()||xe.expando+"_"+Ct++;return this[e]=!0,e}}),xe.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,a,s=!1!==e.jsonp&&(Rt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Rt.test(e.data)&&"data");if(s||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=xe.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,s?e[s]=e[s].replace(Rt,"$1"+r):!1!==e.jsonp&&(e.url+=(St.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return a||xe.error(r+" was not called"),a[0]},e.dataTypes[0]="json",i=o[r],o[r]=function(){a=arguments},n.always(function(){void 0===i?xe(o).removeProp(r):o[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Mt.push(r)),a&&xe.isFunction(i)&&i(a[0]),a=i=void 0}),"script"}),ye.createHTMLDocument=function(){var e=se.implementation.createHTMLDocument("").body;return e.innerHTML="<form></form><form></form>",2===e.childNodes.length}(),xe.parseHTML=function(e,t,n){if("string"!=typeof e)return[];"boolean"==typeof t&&(n=t,t=!1);var r,i,o;return t||(ye.createHTMLDocument?(t=se.implementation.createHTMLDocument(""),r=t.createElement("base"),r.href=se.location.href,t.head.appendChild(r)):t=se),i=Se.exec(e),o=!n&&[],i?[t.createElement(i[1])]:(i=S([e],t,o),o&&o.length&&xe(o).remove(),xe.merge([],i.childNodes))},xe.fn.load=function(e,t,n){var r,o,a,s=this,u=e.indexOf(" ");return u>-1&&(r=K(e.slice(u)),e=e.slice(0,u)),xe.isFunction(t)?(n=t,t=void 0):t&&"object"===(void 0===t?"undefined":i(t))&&(o="POST"),s.length>0&&xe.ajax({url:e,type:o||"GET",dataType:"html",data:t}).done(function(e){a=arguments,s.html(r?xe("<div>").append(xe.parseHTML(e)).find(r):e)}).always(n&&function(e,t){s.each(function(){n.apply(this,a||[e.responseText,t,e])})}),this},xe.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){xe.fn[t]=function(e){return this.on(t,e)}}),xe.expr.pseudos.animated=function(e){return xe.grep(xe.timers,function(t){return e===t.elem}).length},xe.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l,c=xe.css(e,"position"),f=xe(e),d={};"static"===c&&(e.style.position="relative"),s=f.offset(),o=xe.css(e,"top"),u=xe.css(e,"left"),l=("absolute"===c||"fixed"===c)&&(o+u).indexOf("auto")>-1,l?(r=f.position(),a=r.top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),xe.isFunction(t)&&(t=t.call(e,n,xe.extend({},s))),null!=t.top&&(d.top=t.top-s.top+a),null!=t.left&&(d.left=t.left-s.left+i),"using"in t?t.using.call(e,d):f.css(d)}},xe.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){xe.offset.setOffset(this,e,t)});var t,n,r,i,o=this[0];if(o)return o.getClientRects().length?(r=o.getBoundingClientRect(),t=o.ownerDocument,n=t.documentElement,i=t.defaultView,{top:r.top+i.pageYOffset-n.clientTop,left:r.left+i.pageXOffset-n.clientLeft}):{top:0,left:0}},position:function(){if(this[0]){var e,t,n=this[0],r={top:0,left:0};return"fixed"===xe.css(n,"position")?t=n.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),l(e[0],"html")||(r=e.offset()),r={top:r.top+xe.css(e[0],"borderTopWidth",!0),left:r.left+xe.css(e[0],"borderLeftWidth",!0)}),{top:t.top-r.top-xe.css(n,"marginTop",!0),left:t.left-r.left-xe.css(n,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent;e&&"static"===xe.css(e,"position");)e=e.offsetParent;return e||Je})}}),xe.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n="pageYOffset"===t;xe.fn[e]=function(r){return He(this,function(e,r,i){var o;if(xe.isWindow(e)?o=e:9===e.nodeType&&(o=e.defaultView),void 0===i)return o?o[t]:e[r];o?o.scrollTo(n?o.pageXOffset:i,n?i:o.pageYOffset):e[r]=i},e,r,arguments.length)}}),xe.each(["top","left"],function(e,t){xe.cssHooks[t]=M(ye.pixelPosition,function(e,n){if(n)return n=F(e,t),at.test(n)?xe(e).position()[t]+"px":n})}),xe.each({Height:"height",Width:"width"},function(e,t){xe.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){xe.fn[r]=function(i,o){var a=arguments.length&&(n||"boolean"!=typeof i),s=n||(!0===i||!0===o?"margin":"border");return He(this,function(t,n,i){var o;return xe.isWindow(t)?0===r.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(o=t.documentElement,Math.max(t.body["scroll"+e],o["scroll"+e],t.body["offset"+e],o["offset"+e],o["client"+e])):void 0===i?xe.css(t,n,s):xe.style(t,n,i,s)},t,a?i:void 0,a)}})}),xe.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}}),xe.holdReady=function(e){e?xe.readyWait++:xe.ready(!0)},xe.isArray=Array.isArray,xe.parseJSON=JSON.parse,xe.nodeName=l,n=[],void 0!==(r=function(){return xe}.apply(t,n))&&(e.exports=r);var It=o.jQuery,Wt=o.$;return xe.noConflict=function(e){return o.$===xe&&(o.$=Wt),e&&o.jQuery===xe&&(o.jQuery=It),xe},a||(o.jQuery=o.$=xe),xe})}).call(t,n(4)(e))},function(e,t,n){"use strict";function r(){var e,t,n,r=(0,o.default)("#advanced_add_affiliate_link"),i=r.find(".search-panel"),a=r.find(".results-panel"),s=a.find("ul.results-list"),u=2,l=!0,c=void 0;i.on("keyup","#thirstylink-search",function(){var r=(0,o.default)(this),i=a.find(".load-more-results");return c&&n!==r.val()&&(c.abort(),c=null),e||(e=s.html()),s.html("<li class='spinner'><i style='background-image: url("+Options.spinner_image+");'></i><span>"+Options.searching_text+"</span></li>"),(""==r.val()||r.val().length<3)&&!l?(u=2,s.html(e).show(),void i.show()):n===r.val()?(u=2,s.html(t).show(),void i.show()):(u=1,i.hide(),void(c=o.default.post(parent.ajaxurl,{action:"search_affiliate_links_query",keyword:r.val(),paged:u,advance:!0,post_id:Options.post_id},function(e){n=r.val(),l=!1,"success"==e.status&&(t=e.search_query_markup,s.html(e.search_query_markup).show(),u++,e.count<1?i.hide():i.show())},"json")))}),a.on("click",".load-more-results",function(){var e=(0,o.default)(this),t=i.find("#thirstylink-search");e.hasClass("fetching")||(e.addClass("fetching").css("padding-top","4px").find(".spinner").show(),e.find(".button-text").hide(),c=o.default.post(parent.ajaxurl,{action:"search_affiliate_links_query",keyword:t.val(),paged:u,advance:!0},function(t){if(e.removeClass("fetching").find(".spinner").hide(),e.find(".button-text").show(),"success"==t.status){if(u++,t.count<1)return void e.hide();s.append(t.search_query_markup)}},"json"))})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var i=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(i)},function(e,t,n){"use strict";function r(){function e(){var e,t,r,o,s,u,l,c,f,d,p,h,g,v,m,y=(0,a.default)(this).closest("li.thirstylink"),x=(0,a.default)(this).data("type"),b=n.data("htmleditor"),w="";if(parent.ThirstyLinkPicker.linkNode||b){if(e=b?parent.ThirstyLinkPicker.get_html_editor_selection().text:parent.ThirstyLinkPicker.editor.selection.getContent(),t=y.data("linkid"),r=y.data("class"),o=r?' class="'+r+'"':"",s=y.data("href"),u=y.data("title"),l=u?' title="'+u+'"':"",c=y.find("span.name").text(),f=y.data("rel"),d=y.data("target"),v=y.data("other-atts"),!/^(?:[a-z]+:|#|\?|\.|\/)/.test(s))return;if("object"==(void 0===v?"undefined":i(v))&&Object.keys(v).length>0)for(var T in v)w+=T+'="'+v[T]+'" ';if("shortcode"==x)c=e.trim()?e:c,p='[thirstylink ids="'+t+'"]'+c+"[/thirstylink]",b?parent.ThirstyLinkPicker.replace_html_editor_selected_text(p):(parent.ThirstyLinkPicker.editor.execCommand("Unlink",!1,!1),parent.ThirstyLinkPicker.editor.selection.setContent(p),parent.ThirstyLinkPicker.inputInstance.reset());else if("image"==x)""!=r&&(o=' class="thirstylinkimg"'),g=(0,a.default)(this).data("imgid"),a.default.post(parent.ajaxurl,{action:"ta_get_image_markup_by_id",imgid:g},function(e){"success"==e.status&&(h="<a"+o+l+' href="'+s+'" rel="'+f+'" target="'+d+'" '+w+">"+e.image_markup+"</a>",b?parent.ThirstyLinkPicker.replace_html_editor_selected_text(h):(parent.ThirstyLinkPicker.editor.selection.setContent(h),parent.ThirstyLinkPicker.inputInstance.reset())),parent.ThirstyLinkPicker.close_thickbox()},"json");else if(c=e.trim()?e:c,b)h="<a"+o+l+' href="'+s+'" rel="'+f+'" target="'+d+'" '+w+">"+e+"</a>",parent.ThirstyLinkPicker.replace_html_editor_selected_text(h);else{if(m={class:r,title:u,href:s,rel:f,target:d,"data-wplink-edit":null,"data-thirstylink-edit":null},"object"==(void 0===v?"undefined":i(v))&&Object.keys(v).length>0)for(T in v)m[T]=v[T];parent.ThirstyLinkPicker.editor.execCommand("Unlink",!1,!1),parent.ThirstyLinkPicker.editor.execCommand("mceInsertLink",!1,m),e.trim()||parent.ThirstyLinkPicker.editor.selection.setContent(c),parent.ThirstyLinkPicker.inputInstance.reset()}g||parent.ThirstyLinkPicker.close_thickbox()}}var t=(0,a.default)("#advanced_add_affiliate_link"),n=t.find(".results-panel ul.results-list");n.on("click",".actions .insert-link-button",e),n.on("click",".actions .insert-shortcode-button",e),n.on("click",".images-block .images img",e),n.on("click",".actions .insert-image-button",function(){var e=(0,a.default)(this).closest(".thirstylink"),t=e.find(".images-block"),n=e.hasClass("show");(0,a.default)(".results-panel").find(".images-block").removeClass("show").hide(),n||t.slideDown("fast").addClass("show")})}Object.defineProperty(t,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=r;var o=n(0),a=function(e){return e&&e.__esModule?e:{default:e}}(o)},function(e,t){},function(e,t,n){"use strict";e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(0),o=r(i),a=n(1),s=r(a),u=n(2),l=r(u);n(3),(0,o.default)(document).ready(function(){(0,s.default)(),(0,l.default)()})}]);
21
  *
22
  * Date: 2016-08-08
23
  */
24
+ function(e){function t(e,t,n,r){var i,o,a,s,u,c,d,p=t&&t.ownerDocument,h=t?t.nodeType:9;if(n=n||[],"string"!=typeof e||!e||1!==h&&9!==h&&11!==h)return n;if(!r&&((t?t.ownerDocument||t:R)!==L&&A(t),t=t||L,P)){if(11!==h&&(u=ge.exec(e)))if(i=u[1]){if(9===h){if(!(a=t.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(p&&(a=p.getElementById(i))&&F(t,a)&&a.id===i)return n.push(a),n}else{if(u[2])return Q.apply(n,t.getElementsByTagName(e)),n;if((i=u[3])&&b.getElementsByClassName&&t.getElementsByClassName)return Q.apply(n,t.getElementsByClassName(i)),n}if(b.qsa&&!z[e+" "]&&(!H||!H.test(e))){if(1!==h)p=t,d=e;else if("object"!==t.nodeName.toLowerCase()){for((s=t.getAttribute("id"))?s=s.replace(xe,be):t.setAttribute("id",s=M),c=C(e),o=c.length;o--;)c[o]="#"+s+" "+f(c[o]);d=c.join(","),p=ve.test(e)&&l(t.parentNode)||t}if(d)try{return Q.apply(n,p.querySelectorAll(d)),n}catch(e){}finally{s===M&&t.removeAttribute("id")}}}return E(e.replace(oe,"$1"),t,n,r)}function n(){function e(n,r){return t.push(n+" ")>w.cacheLength&&delete e[t.shift()],e[n+" "]=r}var t=[];return e}function r(e){return e[M]=!0,e}function i(e){var t=L.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function o(e,t){for(var n=e.split("|"),r=n.length;r--;)w.attrHandle[n[r]]=t}function a(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function s(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&Te(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function u(e){return r(function(t){return t=+t,r(function(n,r){for(var i,o=e([],n.length,t),a=o.length;a--;)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function l(e){return e&&void 0!==e.getElementsByTagName&&e}function c(){}function f(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function d(e,t,n){var r=t.dir,i=t.next,o=i||r,a=n&&"parentNode"===o,s=W++;return t.first?function(t,n,i){for(;t=t[r];)if(1===t.nodeType||a)return e(t,n,i);return!1}:function(t,n,u){var l,c,f,d=[I,s];if(u){for(;t=t[r];)if((1===t.nodeType||a)&&e(t,n,u))return!0}else for(;t=t[r];)if(1===t.nodeType||a)if(f=t[M]||(t[M]={}),c=f[t.uniqueID]||(f[t.uniqueID]={}),i&&i===t.nodeName.toLowerCase())t=t[r]||t;else{if((l=c[o])&&l[0]===I&&l[1]===s)return d[2]=l[2];if(c[o]=d,d[2]=e(t,n,u))return!0}return!1}}function p(e){return e.length>1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function h(e,n,r){for(var i=0,o=n.length;i<o;i++)t(e,n[i],r);return r}function g(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function v(e,t,n,i,o,a){return i&&!i[M]&&(i=v(i)),o&&!o[M]&&(o=v(o,a)),r(function(r,a,s,u){var l,c,f,d=[],p=[],v=a.length,m=r||h(t||"*",s.nodeType?[s]:s,[]),y=!e||!r&&t?m:g(m,d,e,s,u),x=n?o||(r?e:v||i)?[]:a:y;if(n&&n(y,x,s,u),i)for(l=g(x,p),i(l,[],s,u),c=l.length;c--;)(f=l[c])&&(x[p[c]]=!(y[p[c]]=f));if(r){if(o||e){if(o){for(l=[],c=x.length;c--;)(f=x[c])&&l.push(y[c]=f);o(null,x=[],l,u)}for(c=x.length;c--;)(f=x[c])&&(l=o?K(r,f):d[c])>-1&&(r[l]=!(a[l]=f))}}else x=g(x===a?x.splice(v,x.length):x),o?o(null,a,x,u):Q.apply(a,x)})}function m(e){for(var t,n,r,i=e.length,o=w.relative[e[0].type],a=o||w.relative[" "],s=o?1:0,u=d(function(e){return e===t},a,!0),l=d(function(e){return K(t,e)>-1},a,!0),c=[function(e,n,r){var i=!o&&(r||n!==j)||((t=n).nodeType?u(e,n,r):l(e,n,r));return t=null,i}];s<i;s++)if(n=w.relative[e[s].type])c=[d(p(c),n)];else{if(n=w.filter[e[s].type].apply(null,e[s].matches),n[M]){for(r=++s;r<i&&!w.relative[e[r].type];r++);return v(s>1&&p(c),s>1&&f(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(oe,"$1"),n,s<r&&m(e.slice(s,r)),r<i&&m(e=e.slice(r)),r<i&&f(e))}c.push(n)}return p(c)}function y(e,n){var i=n.length>0,o=e.length>0,a=function(r,a,s,u,l){var c,f,d,p=0,h="0",v=r&&[],m=[],y=j,x=r||o&&w.find.TAG("*",l),b=I+=null==y?1:Math.random()||.1,T=x.length;for(l&&(j=a===L||a||l);h!==T&&null!=(c=x[h]);h++){if(o&&c){for(f=0,a||c.ownerDocument===L||(A(c),s=!P);d=e[f++];)if(d(c,a||L,s)){u.push(c);break}l&&(I=b)}i&&((c=!d&&c)&&p--,r&&v.push(c))}if(p+=h,i&&h!==p){for(f=0;d=n[f++];)d(v,m,a,s);if(r){if(p>0)for(;h--;)v[h]||m[h]||(m[h]=G.call(u));m=g(m)}Q.apply(u,m),l&&!r&&m.length>0&&p+n.length>1&&t.uniqueSort(u)}return l&&(I=b,j=y),v};return i?r(a):a}var x,b,w,T,k,C,S,E,j,N,D,A,L,q,P,H,O,_,F,M="sizzle"+1*new Date,R=e.document,I=0,W=0,$=n(),B=n(),z=n(),X=function(e,t){return e===t&&(D=!0),0},U={}.hasOwnProperty,V=[],G=V.pop,Y=V.push,Q=V.push,J=V.slice,K=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},Z="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",ee="[\\x20\\t\\r\\n\\f]",te="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",ne="\\["+ee+"*("+te+")(?:"+ee+"*([*^$|!~]?=)"+ee+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+te+"))|)"+ee+"*\\]",re=":("+te+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+ne+")*)|.*)\\)|)",ie=new RegExp(ee+"+","g"),oe=new RegExp("^"+ee+"+|((?:^|[^\\\\])(?:\\\\.)*)"+ee+"+$","g"),ae=new RegExp("^"+ee+"*,"+ee+"*"),se=new RegExp("^"+ee+"*([>+~]|"+ee+")"+ee+"*"),ue=new RegExp("="+ee+"*([^\\]'\"]*?)"+ee+"*\\]","g"),le=new RegExp(re),ce=new RegExp("^"+te+"$"),fe={ID:new RegExp("^#("+te+")"),CLASS:new RegExp("^\\.("+te+")"),TAG:new RegExp("^("+te+"|[*])"),ATTR:new RegExp("^"+ne),PSEUDO:new RegExp("^"+re),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ee+"*(even|odd|(([+-]|)(\\d*)n|)"+ee+"*(?:([+-]|)"+ee+"*(\\d+)|))"+ee+"*\\)|)","i"),bool:new RegExp("^(?:"+Z+")$","i"),needsContext:new RegExp("^"+ee+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ee+"*((?:-\\d)?\\d*)"+ee+"*\\)|)(?=[^-]|$)","i")},de=/^(?:input|select|textarea|button)$/i,pe=/^h\d$/i,he=/^[^{]+\{\s*\[native \w/,ge=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ve=/[+~]/,me=new RegExp("\\\\([\\da-f]{1,6}"+ee+"?|("+ee+")|.)","ig"),ye=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},xe=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,be=function(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},we=function(){A()},Te=d(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{Q.apply(V=J.call(R.childNodes),R.childNodes),V[R.childNodes.length].nodeType}catch(e){Q={apply:V.length?function(e,t){Y.apply(e,J.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}b=t.support={},k=t.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},A=t.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:R;return r!==L&&9===r.nodeType&&r.documentElement?(L=r,q=L.documentElement,P=!k(L),R!==L&&(n=L.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",we,!1):n.attachEvent&&n.attachEvent("onunload",we)),b.attributes=i(function(e){return e.className="i",!e.getAttribute("className")}),b.getElementsByTagName=i(function(e){return e.appendChild(L.createComment("")),!e.getElementsByTagName("*").length}),b.getElementsByClassName=he.test(L.getElementsByClassName),b.getById=i(function(e){return q.appendChild(e).id=M,!L.getElementsByName||!L.getElementsByName(M).length}),b.getById?(w.filter.ID=function(e){var t=e.replace(me,ye);return function(e){return e.getAttribute("id")===t}},w.find.ID=function(e,t){if(void 0!==t.getElementById&&P){var n=t.getElementById(e);return n?[n]:[]}}):(w.filter.ID=function(e){var t=e.replace(me,ye);return function(e){var n=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},w.find.ID=function(e,t){if(void 0!==t.getElementById&&P){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];for(i=t.getElementsByName(e),r=0;o=i[r++];)if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),w.find.TAG=b.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):b.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},w.find.CLASS=b.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&P)return t.getElementsByClassName(e)},O=[],H=[],(b.qsa=he.test(L.querySelectorAll))&&(i(function(e){q.appendChild(e).innerHTML="<a id='"+M+"'></a><select id='"+M+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&H.push("[*^$]="+ee+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||H.push("\\["+ee+"*(?:value|"+Z+")"),e.querySelectorAll("[id~="+M+"-]").length||H.push("~="),e.querySelectorAll(":checked").length||H.push(":checked"),e.querySelectorAll("a#"+M+"+*").length||H.push(".#.+[+~]")}),i(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=L.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&H.push("name"+ee+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&H.push(":enabled",":disabled"),q.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&H.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),H.push(",.*:")})),(b.matchesSelector=he.test(_=q.matches||q.webkitMatchesSelector||q.mozMatchesSelector||q.oMatchesSelector||q.msMatchesSelector))&&i(function(e){b.disconnectedMatch=_.call(e,"*"),_.call(e,"[s!='']:x"),O.push("!=",re)}),H=H.length&&new RegExp(H.join("|")),O=O.length&&new RegExp(O.join("|")),t=he.test(q.compareDocumentPosition),F=t||he.test(q.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},X=t?function(e,t){if(e===t)return D=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&n||!b.sortDetached&&t.compareDocumentPosition(e)===n?e===L||e.ownerDocument===R&&F(R,e)?-1:t===L||t.ownerDocument===R&&F(R,t)?1:N?K(N,e)-K(N,t):0:4&n?-1:1)}:function(e,t){if(e===t)return D=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,s=[e],u=[t];if(!i||!o)return e===L?-1:t===L?1:i?-1:o?1:N?K(N,e)-K(N,t):0;if(i===o)return a(e,t);for(n=e;n=n.parentNode;)s.unshift(n);for(n=t;n=n.parentNode;)u.unshift(n);for(;s[r]===u[r];)r++;return r?a(s[r],u[r]):s[r]===R?-1:u[r]===R?1:0},L):L},t.matches=function(e,n){return t(e,null,null,n)},t.matchesSelector=function(e,n){if((e.ownerDocument||e)!==L&&A(e),n=n.replace(ue,"='$1']"),b.matchesSelector&&P&&!z[n+" "]&&(!O||!O.test(n))&&(!H||!H.test(n)))try{var r=_.call(e,n);if(r||b.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return t(n,L,null,[e]).length>0},t.contains=function(e,t){return(e.ownerDocument||e)!==L&&A(e),F(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!==L&&A(e);var n=w.attrHandle[t.toLowerCase()],r=n&&U.call(w.attrHandle,t.toLowerCase())?n(e,t,!P):void 0;return void 0!==r?r:b.attributes||!P?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},t.escape=function(e){return(e+"").replace(xe,be)},t.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,n=[],r=0,i=0;if(D=!b.detectDuplicates,N=!b.sortStable&&e.slice(0),e.sort(X),D){for(;t=e[i++];)t===e[i]&&(r=n.push(i));for(;r--;)e.splice(n[r],1)}return N=null,e},T=t.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=T(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r++];)n+=T(t);return n},w=t.selectors={cacheLength:50,createPseudo:r,match:fe,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(me,ye),e[3]=(e[3]||e[4]||e[5]||"").replace(me,ye),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||t.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&t.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return fe.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&le.test(n)&&(t=C(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(me,ye).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=$[e+" "];return t||(t=new RegExp("(^|"+ee+")"+e+"("+ee+"|$)"))&&$(e,function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,n,r){return function(i){var o=t.attr(i,e);return null==o?"!="===n:!n||(o+="","="===n?o===r:"!="===n?o!==r:"^="===n?r&&0===o.indexOf(r):"*="===n?r&&o.indexOf(r)>-1:"$="===n?r&&o.slice(-r.length)===r:"~="===n?(" "+o.replace(ie," ")+" ").indexOf(r)>-1:"|="===n&&(o===r||o.slice(0,r.length+1)===r+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,d,p,h,g=o!==a?"nextSibling":"previousSibling",v=t.parentNode,m=s&&t.nodeName.toLowerCase(),y=!u&&!s,x=!1;if(v){if(o){for(;g;){for(d=t;d=d[g];)if(s?d.nodeName.toLowerCase()===m:1===d.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?v.firstChild:v.lastChild],a&&y){for(d=v,f=d[M]||(d[M]={}),c=f[d.uniqueID]||(f[d.uniqueID]={}),l=c[e]||[],p=l[0]===I&&l[1],x=p&&l[2],d=p&&v.childNodes[p];d=++p&&d&&d[g]||(x=p=0)||h.pop();)if(1===d.nodeType&&++x&&d===t){c[e]=[I,p,x];break}}else if(y&&(d=t,f=d[M]||(d[M]={}),c=f[d.uniqueID]||(f[d.uniqueID]={}),l=c[e]||[],p=l[0]===I&&l[1],x=p),!1===x)for(;(d=++p&&d&&d[g]||(x=p=0)||h.pop())&&((s?d.nodeName.toLowerCase()!==m:1!==d.nodeType)||!++x||(y&&(f=d[M]||(d[M]={}),c=f[d.uniqueID]||(f[d.uniqueID]={}),c[e]=[I,x]),d!==t)););return(x-=i)===r||x%r==0&&x/r>=0}}},PSEUDO:function(e,n){var i,o=w.pseudos[e]||w.setFilters[e.toLowerCase()]||t.error("unsupported pseudo: "+e);return o[M]?o(n):o.length>1?(i=[e,e,"",n],w.setFilters.hasOwnProperty(e.toLowerCase())?r(function(e,t){for(var r,i=o(e,n),a=i.length;a--;)r=K(e,i[a]),e[r]=!(t[r]=i[a])}):function(e){return o(e,0,i)}):o}},pseudos:{not:r(function(e){var t=[],n=[],i=S(e.replace(oe,"$1"));return i[M]?r(function(e,t,n,r){for(var o,a=i(e,null,r,[]),s=e.length;s--;)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,r,o){return t[0]=e,i(t,null,o,n),t[0]=null,!n.pop()}}),has:r(function(e){return function(n){return t(e,n).length>0}}),contains:r(function(e){return e=e.replace(me,ye),function(t){return(t.textContent||t.innerText||T(t)).indexOf(e)>-1}}),lang:r(function(e){return ce.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(me,ye).toLowerCase(),function(t){var n;do{if(n=P?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===q},focus:function(e){return e===L.activeElement&&(!L.hasFocus||L.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:s(!1),disabled:s(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!w.pseudos.empty(e)},header:function(e){return pe.test(e.nodeName)},input:function(e){return de.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:u(function(){return[0]}),last:u(function(e,t){return[t-1]}),eq:u(function(e,t,n){return[n<0?n+t:n]}),even:u(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:u(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:u(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:u(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}},w.pseudos.nth=w.pseudos.eq;for(x in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})w.pseudos[x]=function(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}(x);for(x in{submit:!0,reset:!0})w.pseudos[x]=function(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}(x);return c.prototype=w.filters=w.pseudos,w.setFilters=new c,C=t.tokenize=function(e,n){var r,i,o,a,s,u,l,c=B[e+" "];if(c)return n?0:c.slice(0);for(s=e,u=[],l=w.preFilter;s;){r&&!(i=ae.exec(s))||(i&&(s=s.slice(i[0].length)||s),u.push(o=[])),r=!1,(i=se.exec(s))&&(r=i.shift(),o.push({value:r,type:i[0].replace(oe," ")}),s=s.slice(r.length));for(a in w.filter)!(i=fe[a].exec(s))||l[a]&&!(i=l[a](i))||(r=i.shift(),o.push({value:r,type:a,matches:i}),s=s.slice(r.length));if(!r)break}return n?s.length:s?t.error(e):B(e,u).slice(0)},S=t.compile=function(e,t){var n,r=[],i=[],o=z[e+" "];if(!o){for(t||(t=C(e)),n=t.length;n--;)o=m(t[n]),o[M]?r.push(o):i.push(o);o=z(e,y(i,r)),o.selector=e}return o},E=t.select=function(e,t,n,r){var i,o,a,s,u,c="function"==typeof e&&e,d=!r&&C(e=c.selector||e);if(n=n||[],1===d.length){if(o=d[0]=d[0].slice(0),o.length>2&&"ID"===(a=o[0]).type&&9===t.nodeType&&P&&w.relative[o[1].type]){if(!(t=(w.find.ID(a.matches[0].replace(me,ye),t)||[])[0]))return n;c&&(t=t.parentNode),e=e.slice(o.shift().value.length)}for(i=fe.needsContext.test(e)?0:o.length;i--&&(a=o[i],!w.relative[s=a.type]);)if((u=w.find[s])&&(r=u(a.matches[0].replace(me,ye),ve.test(o[0].type)&&l(t.parentNode)||t))){if(o.splice(i,1),!(e=r.length&&f(o)))return Q.apply(n,r),n;break}}return(c||S(e,d))(r,t,!P,n,!t||ve.test(e)&&l(t.parentNode)||t),n},b.sortStable=M.split("").sort(X).join("")===M,b.detectDuplicates=!!D,A(),b.sortDetached=i(function(e){return 1&e.compareDocumentPosition(L.createElement("fieldset"))}),i(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||o("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),b.attributes&&i(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||o("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),i(function(e){return null==e.getAttribute("disabled")})||o(Z,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),t}(o);xe.find=we,xe.expr=we.selectors,xe.expr[":"]=xe.expr.pseudos,xe.uniqueSort=xe.unique=we.uniqueSort,xe.text=we.getText,xe.isXMLDoc=we.isXML,xe.contains=we.contains,xe.escapeSelector=we.escape;var Te=function(e,t,n){for(var r=[],i=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(i&&xe(e).is(n))break;r.push(e)}return r},ke=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},Ce=xe.expr.match.needsContext,Se=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,Ee=/^.[^:#\[\.,]*$/;xe.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?xe.find.matchesSelector(r,e)?[r]:[]:xe.find.matches(e,xe.grep(t,function(e){return 1===e.nodeType}))},xe.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(xe(e).filter(function(){for(t=0;t<r;t++)if(xe.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)xe.find(e,i[t],n);return r>1?xe.uniqueSort(n):n},filter:function(e){return this.pushStack(c(this,e||[],!1))},not:function(e){return this.pushStack(c(this,e||[],!0))},is:function(e){return!!c(this,"string"==typeof e&&Ce.test(e)?xe(e):e||[],!1).length}});var je,Ne=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(xe.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||je,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:Ne.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof xe?t[0]:t,xe.merge(this,xe.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:se,!0)),Se.test(r[1])&&xe.isPlainObject(t))for(r in t)xe.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return i=se.getElementById(r[2]),i&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):xe.isFunction(e)?void 0!==n.ready?n.ready(e):e(xe):xe.makeArray(e,this)}).prototype=xe.fn,je=xe(se);var De=/^(?:parents|prev(?:Until|All))/,Ae={children:!0,contents:!0,next:!0,prev:!0};xe.fn.extend({has:function(e){var t=xe(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(xe.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&xe(e);if(!Ce.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&xe.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?xe.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?de.call(xe(e),this[0]):de.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(xe.uniqueSort(xe.merge(this.get(),xe(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),xe.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return Te(e,"parentNode")},parentsUntil:function(e,t,n){return Te(e,"parentNode",n)},next:function(e){return f(e,"nextSibling")},prev:function(e){return f(e,"previousSibling")},nextAll:function(e){return Te(e,"nextSibling")},prevAll:function(e){return Te(e,"previousSibling")},nextUntil:function(e,t,n){return Te(e,"nextSibling",n)},prevUntil:function(e,t,n){return Te(e,"previousSibling",n)},siblings:function(e){return ke((e.parentNode||{}).firstChild,e)},children:function(e){return ke(e.firstChild)},contents:function(e){return l(e,"iframe")?e.contentDocument:(l(e,"template")&&(e=e.content||e),xe.merge([],e.childNodes))}},function(e,t){xe.fn[e]=function(n,r){var i=xe.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=xe.filter(r,i)),this.length>1&&(Ae[e]||xe.uniqueSort(i),De.test(e)&&i.reverse()),this.pushStack(i)}});var Le=/[^\x20\t\r\n\f]+/g;xe.Callbacks=function(e){e="string"==typeof e?d(e):xe.extend({},e);var t,n,r,i,o=[],a=[],s=-1,u=function(){for(i=i||e.once,r=t=!0;a.length;s=-1)for(n=a.shift();++s<o.length;)!1===o[s].apply(n[0],n[1])&&e.stopOnFalse&&(s=o.length,n=!1);e.memory||(n=!1),t=!1,i&&(o=n?[]:"")},l={add:function(){return o&&(n&&!t&&(s=o.length-1,a.push(n)),function t(n){xe.each(n,function(n,r){xe.isFunction(r)?e.unique&&l.has(r)||o.push(r):r&&r.length&&"string"!==xe.type(r)&&t(r)})}(arguments),n&&!t&&u()),this},remove:function(){return xe.each(arguments,function(e,t){for(var n;(n=xe.inArray(t,o,n))>-1;)o.splice(n,1),n<=s&&s--}),this},has:function(e){return e?xe.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=n||[],n=[e,n.slice?n.slice():n],a.push(n),t||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l},xe.extend({Deferred:function(e){var t=[["notify","progress",xe.Callbacks("memory"),xe.Callbacks("memory"),2],["resolve","done",xe.Callbacks("once memory"),xe.Callbacks("once memory"),0,"resolved"],["reject","fail",xe.Callbacks("once memory"),xe.Callbacks("once memory"),1,"rejected"]],n="pending",r={state:function(){return n},always:function(){return a.done(arguments).fail(arguments),this},catch:function(e){return r.then(null,e)},pipe:function(){var e=arguments;return xe.Deferred(function(n){xe.each(t,function(t,r){var i=xe.isFunction(e[r[4]])&&e[r[4]];a[r[1]](function(){var e=i&&i.apply(this,arguments);e&&xe.isFunction(e.promise)?e.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[r[0]+"With"](this,i?[e]:arguments)})}),e=null}).promise()},then:function(e,n,r){function a(e,t,n,r){return function(){var u=this,l=arguments,c=function(){var o,c;if(!(e<s)){if((o=n.apply(u,l))===t.promise())throw new TypeError("Thenable self-resolution");c=o&&("object"===(void 0===o?"undefined":i(o))||"function"==typeof o)&&o.then,xe.isFunction(c)?r?c.call(o,a(s,t,p,r),a(s,t,h,r)):(s++,c.call(o,a(s,t,p,r),a(s,t,h,r),a(s,t,p,t.notifyWith))):(n!==p&&(u=void 0,l=[o]),(r||t.resolveWith)(u,l))}},f=r?c:function(){try{c()}catch(r){xe.Deferred.exceptionHook&&xe.Deferred.exceptionHook(r,f.stackTrace),e+1>=s&&(n!==h&&(u=void 0,l=[r]),t.rejectWith(u,l))}};e?f():(xe.Deferred.getStackHook&&(f.stackTrace=xe.Deferred.getStackHook()),o.setTimeout(f))}}var s=0;return xe.Deferred(function(i){t[0][3].add(a(0,i,xe.isFunction(r)?r:p,i.notifyWith)),t[1][3].add(a(0,i,xe.isFunction(e)?e:p)),t[2][3].add(a(0,i,xe.isFunction(n)?n:h))}).promise()},promise:function(e){return null!=e?xe.extend(e,r):r}},a={};return xe.each(t,function(e,i){var o=i[2],s=i[5];r[i[1]]=o.add,s&&o.add(function(){n=s},t[3-e][2].disable,t[0][2].lock),o.add(i[3].fire),a[i[0]]=function(){return a[i[0]+"With"](this===a?void 0:this,arguments),this},a[i[0]+"With"]=o.fireWith}),r.promise(a),e&&e.call(a,a),a},when:function(e){var t=arguments.length,n=t,r=Array(n),i=le.call(arguments),o=xe.Deferred(),a=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?le.call(arguments):n,--t||o.resolveWith(r,i)}};if(t<=1&&(g(e,o.done(a(n)).resolve,o.reject,!t),"pending"===o.state()||xe.isFunction(i[n]&&i[n].then)))return o.then();for(;n--;)g(i[n],a(n),o.reject);return o.promise()}});var qe=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;xe.Deferred.exceptionHook=function(e,t){o.console&&o.console.warn&&e&&qe.test(e.name)&&o.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},xe.readyException=function(e){o.setTimeout(function(){throw e})};var Pe=xe.Deferred();xe.fn.ready=function(e){return Pe.then(e).catch(function(e){xe.readyException(e)}),this},xe.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--xe.readyWait:xe.isReady)||(xe.isReady=!0,!0!==e&&--xe.readyWait>0||Pe.resolveWith(se,[xe]))}}),xe.ready.then=Pe.then,"complete"===se.readyState||"loading"!==se.readyState&&!se.documentElement.doScroll?o.setTimeout(xe.ready):(se.addEventListener("DOMContentLoaded",v),o.addEventListener("load",v));var He=function e(t,n,r,i,o,a,s){var u=0,l=t.length,c=null==r;if("object"===xe.type(r)){o=!0;for(u in r)e(t,n,u,r[u],!0,a,s)}else if(void 0!==i&&(o=!0,xe.isFunction(i)||(s=!0),c&&(s?(n.call(t,i),n=null):(c=n,n=function(e,t,n){return c.call(xe(e),n)})),n))for(;u<l;u++)n(t[u],r,s?i:i.call(t[u],u,n(t[u],r)));return o?t:c?n.call(t):l?n(t[0],r):a},Oe=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};m.uid=1,m.prototype={cache:function(e){var t=e[this.expando];return t||(t={},Oe(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[xe.camelCase(t)]=n;else for(r in t)i[xe.camelCase(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][xe.camelCase(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){Array.isArray(t)?t=t.map(xe.camelCase):(t=xe.camelCase(t),t=t in r?[t]:t.match(Le)||[]),n=t.length;for(;n--;)delete r[t[n]]}(void 0===t||xe.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!xe.isEmptyObject(t)}};var _e=new m,Fe=new m,Me=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Re=/[A-Z]/g;xe.extend({hasData:function(e){return Fe.hasData(e)||_e.hasData(e)},data:function(e,t,n){return Fe.access(e,t,n)},removeData:function(e,t){Fe.remove(e,t)},_data:function(e,t,n){return _e.access(e,t,n)},_removeData:function(e,t){_e.remove(e,t)}}),xe.fn.extend({data:function(e,t){var n,r,o,a=this[0],s=a&&a.attributes;if(void 0===e){if(this.length&&(o=Fe.get(a),1===a.nodeType&&!_e.get(a,"hasDataAttrs"))){for(n=s.length;n--;)s[n]&&(r=s[n].name,0===r.indexOf("data-")&&(r=xe.camelCase(r.slice(5)),x(a,r,o[r])));_e.set(a,"hasDataAttrs",!0)}return o}return"object"===(void 0===e?"undefined":i(e))?this.each(function(){Fe.set(this,e)}):He(this,function(t){var n;if(a&&void 0===t){if(void 0!==(n=Fe.get(a,e)))return n;if(void 0!==(n=x(a,e)))return n}else this.each(function(){Fe.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){Fe.remove(this,e)})}}),xe.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=_e.get(e,t),n&&(!r||Array.isArray(n)?r=_e.access(e,t,xe.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=xe.queue(e,t),r=n.length,i=n.shift(),o=xe._queueHooks(e,t),a=function(){xe.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return _e.get(e,n)||_e.access(e,n,{empty:xe.Callbacks("once memory").add(function(){_e.remove(e,[t+"queue",n])})})}}),xe.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length<n?xe.queue(this[0],e):void 0===t?this:this.each(function(){var n=xe.queue(this,e,t);xe._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&xe.dequeue(this,e)})},dequeue:function(e){return this.each(function(){xe.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=xe.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};for("string"!=typeof e&&(t=e,e=void 0),e=e||"fx";a--;)(n=_e.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var Ie=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,We=new RegExp("^(?:([+-])=|)("+Ie+")([a-z%]*)$","i"),$e=["Top","Right","Bottom","Left"],Be=function(e,t){return e=t||e,"none"===e.style.display||""===e.style.display&&xe.contains(e.ownerDocument,e)&&"none"===xe.css(e,"display")},ze=function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i},Xe={};xe.fn.extend({show:function(){return T(this,!0)},hide:function(){return T(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){Be(this)?xe(this).show():xe(this).hide()})}});var Ue=/^(?:checkbox|radio)$/i,Ve=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,Ge=/^$|\/(?:java|ecma)script/i,Ye={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};Ye.optgroup=Ye.option,Ye.tbody=Ye.tfoot=Ye.colgroup=Ye.caption=Ye.thead,Ye.th=Ye.td;var Qe=/<|&#?\w+;/;!function(){var e=se.createDocumentFragment(),t=e.appendChild(se.createElement("div")),n=se.createElement("input");n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),t.appendChild(n),ye.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,t.innerHTML="<textarea>x</textarea>",ye.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue}();var Je=se.documentElement,Ke=/^key/,Ze=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,et=/^([^.]*)(?:\.(.+)|)/;xe.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,l,c,f,d,p,h,g,v=_e.get(e);if(v)for(n.handler&&(o=n,n=o.handler,i=o.selector),i&&xe.find.matchesSelector(Je,i),n.guid||(n.guid=xe.guid++),(u=v.events)||(u=v.events={}),(a=v.handle)||(a=v.handle=function(t){return void 0!==xe&&xe.event.triggered!==t.type?xe.event.dispatch.apply(e,arguments):void 0}),t=(t||"").match(Le)||[""],l=t.length;l--;)s=et.exec(t[l])||[],p=g=s[1],h=(s[2]||"").split(".").sort(),p&&(f=xe.event.special[p]||{},p=(i?f.delegateType:f.bindType)||p,f=xe.event.special[p]||{},c=xe.extend({type:p,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&xe.expr.match.needsContext.test(i),namespace:h.join(".")},o),(d=u[p])||(d=u[p]=[],d.delegateCount=0,f.setup&&!1!==f.setup.call(e,r,h,a)||e.addEventListener&&e.addEventListener(p,a)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?d.splice(d.delegateCount++,0,c):d.push(c),xe.event.global[p]=!0)},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,d,p,h,g,v=_e.hasData(e)&&_e.get(e);if(v&&(u=v.events)){for(t=(t||"").match(Le)||[""],l=t.length;l--;)if(s=et.exec(t[l])||[],p=g=s[1],h=(s[2]||"").split(".").sort(),p){for(f=xe.event.special[p]||{},p=(r?f.delegateType:f.bindType)||p,d=u[p]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=d.length;o--;)c=d[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(d.splice(o,1),c.selector&&d.delegateCount--,f.remove&&f.remove.call(e,c));a&&!d.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||xe.removeEvent(e,p,v.handle),delete u[p])}else for(p in u)xe.event.remove(e,p+t[l],n,r,!0);xe.isEmptyObject(u)&&_e.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=xe.event.fix(e),u=new Array(arguments.length),l=(_e.get(this,"events")||{})[s.type]||[],c=xe.event.special[s.type]||{};for(u[0]=s,t=1;t<arguments.length;t++)u[t]=arguments[t];if(s.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,s)){for(a=xe.event.handlers.call(this,s,l),t=0;(i=a[t++])&&!s.isPropagationStopped();)for(s.currentTarget=i.elem,n=0;(o=i.handlers[n++])&&!s.isImmediatePropagationStopped();)s.rnamespace&&!s.rnamespace.test(o.namespace)||(s.handleObj=o,s.data=o.data,void 0!==(r=((xe.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,u))&&!1===(s.result=r)&&(s.preventDefault(),s.stopPropagation()));return c.postDispatch&&c.postDispatch.call(this,s),s.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&e.button>=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)r=t[n],i=r.selector+" ",void 0===a[i]&&(a[i]=r.needsContext?xe(i,this).index(l)>-1:xe.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(e,t){Object.defineProperty(xe.Event.prototype,e,{enumerable:!0,configurable:!0,get:xe.isFunction(t)?function(){if(this.originalEvent)return t(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set:function(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})},fix:function(e){return e[xe.expando]?e:new xe.Event(e)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==N()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===N()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&l(this,"input"))return this.click(),!1},_default:function(e){return l(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},xe.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},xe.Event=function(e,t){if(!(this instanceof xe.Event))return new xe.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?E:j,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&xe.extend(this,t),this.timeStamp=e&&e.timeStamp||xe.now(),this[xe.expando]=!0},xe.Event.prototype={constructor:xe.Event,isDefaultPrevented:j,isPropagationStopped:j,isImmediatePropagationStopped:j,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=E,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=E,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=E,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},xe.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,char:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&Ke.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&Ze.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},xe.event.addProp),xe.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){xe.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return i&&(i===r||xe.contains(r,i))||(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),xe.fn.extend({on:function(e,t,n,r){return D(this,e,t,n,r)},one:function(e,t,n,r){return D(this,e,t,n,r,1)},off:function(e,t,n){var r,o;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,xe(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"===(void 0===e?"undefined":i(e))){for(o in e)this.off(o,t,e[o]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=j),this.each(function(){xe.event.remove(this,e,n,t)})}});var tt=/<script|<style|<link/i,nt=/checked\s*(?:[^=]|=\s*.checked.)/i,rt=/^true\/(.*)/,it=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;xe.extend({htmlPrefilter:function(e){return e.replace(/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,"<$1></$2>")},clone:function(e,t,n){var r,i,o,a,s=e.cloneNode(!0),u=xe.contains(e.ownerDocument,e);if(!(ye.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||xe.isXMLDoc(e)))for(a=k(s),o=k(e),r=0,i=o.length;r<i;r++)H(o[r],a[r]);if(t)if(n)for(o=o||k(e),a=a||k(s),r=0,i=o.length;r<i;r++)P(o[r],a[r]);else P(e,s);return a=k(s,"script"),a.length>0&&C(a,!u&&k(e,"script")),s},cleanData:function(e){for(var t,n,r,i=xe.event.special,o=0;void 0!==(n=e[o]);o++)if(Oe(n)){if(t=n[_e.expando]){if(t.events)for(r in t.events)i[r]?xe.event.remove(n,r):xe.removeEvent(n,r,t.handle);n[_e.expando]=void 0}n[Fe.expando]&&(n[Fe.expando]=void 0)}}}),xe.fn.extend({detach:function(e){return _(this,e,!0)},remove:function(e){return _(this,e)},text:function(e){return He(this,function(e){return void 0===e?xe.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return O(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){A(this,e).appendChild(e)}})},prepend:function(){return O(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=A(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return O(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return O(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(xe.cleanData(k(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return xe.clone(this,e,t)})},html:function(e){return He(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!tt.test(e)&&!Ye[(Ve.exec(e)||["",""])[1].toLowerCase()]){e=xe.htmlPrefilter(e);try{for(;n<r;n++)t=this[n]||{},1===t.nodeType&&(xe.cleanData(k(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return O(this,arguments,function(t){var n=this.parentNode;xe.inArray(this,e)<0&&(xe.cleanData(k(this)),n&&n.replaceChild(t,this))},e)}}),xe.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){xe.fn[e]=function(e){for(var n,r=[],i=xe(e),o=i.length-1,a=0;a<=o;a++)n=a===o?this:this.clone(!0),xe(i[a])[t](n),fe.apply(r,n.get());return this.pushStack(r)}});var ot=/^margin/,at=new RegExp("^("+Ie+")(?!px)[a-z%]+$","i"),st=function(e){var t=e.ownerDocument.defaultView;return t&&t.opener||(t=o),t.getComputedStyle(e)};!function(){function e(){if(s){s.style.cssText="box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",s.innerHTML="",Je.appendChild(a);var e=o.getComputedStyle(s);t="1%"!==e.top,i="2px"===e.marginLeft,n="4px"===e.width,s.style.marginRight="50%",r="4px"===e.marginRight,Je.removeChild(a),s=null}}var t,n,r,i,a=se.createElement("div"),s=se.createElement("div");s.style&&(s.style.backgroundClip="content-box",s.cloneNode(!0).style.backgroundClip="",ye.clearCloneStyle="content-box"===s.style.backgroundClip,a.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",a.appendChild(s),xe.extend(ye,{pixelPosition:function(){return e(),t},boxSizingReliable:function(){return e(),n},pixelMarginRight:function(){return e(),r},reliableMarginLeft:function(){return e(),i}}))}();var ut=/^(none|table(?!-c[ea]).+)/,lt=/^--/,ct={position:"absolute",visibility:"hidden",display:"block"},ft={letterSpacing:"0",fontWeight:"400"},dt=["Webkit","Moz","ms"],pt=se.createElement("div").style;xe.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=F(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{float:"cssFloat"},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,u=xe.camelCase(t),l=lt.test(t),c=e.style;if(l||(t=I(u)),s=xe.cssHooks[t]||xe.cssHooks[u],void 0===n)return s&&"get"in s&&void 0!==(o=s.get(e,!1,r))?o:c[t];a=void 0===n?"undefined":i(n),"string"===a&&(o=We.exec(n))&&o[1]&&(n=b(e,t,o),a="number"),null!=n&&n===n&&("number"===a&&(n+=o&&o[3]||(xe.cssNumber[u]?"":"px")),ye.clearCloneStyle||""!==n||0!==t.indexOf("background")||(c[t]="inherit"),s&&"set"in s&&void 0===(n=s.set(e,n,r))||(l?c.setProperty(t,n):c[t]=n))}},css:function(e,t,n,r){var i,o,a,s=xe.camelCase(t);return lt.test(t)||(t=I(s)),a=xe.cssHooks[t]||xe.cssHooks[s],a&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=F(e,t,r)),"normal"===i&&t in ft&&(i=ft[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),xe.each(["height","width"],function(e,t){xe.cssHooks[t]={get:function(e,n,r){if(n)return!ut.test(xe.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?B(e,t,r):ze(e,ct,function(){return B(e,t,r)})},set:function(e,n,r){var i,o=r&&st(e),a=r&&$(e,t,r,"border-box"===xe.css(e,"boxSizing",!1,o),o);return a&&(i=We.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=xe.css(e,t)),W(e,n,a)}}}),xe.cssHooks.marginLeft=M(ye.reliableMarginLeft,function(e,t){if(t)return(parseFloat(F(e,"marginLeft"))||e.getBoundingClientRect().left-ze(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),xe.each({margin:"",padding:"",border:"Width"},function(e,t){xe.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+$e[r]+t]=o[r]||o[r-2]||o[0];return i}},ot.test(e)||(xe.cssHooks[e+t].set=W)}),xe.fn.extend({css:function(e,t){return He(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=st(e),i=t.length;a<i;a++)o[t[a]]=xe.css(e,t[a],!1,r);return o}return void 0!==n?xe.style(e,t,n):xe.css(e,t)},e,t,arguments.length>1)}}),xe.Tween=z,z.prototype={constructor:z,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||xe.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(xe.cssNumber[n]?"":"px")},cur:function(){var e=z.propHooks[this.prop];return e&&e.get?e.get(this):z.propHooks._default.get(this)},run:function(e){var t,n=z.propHooks[this.prop];return this.options.duration?this.pos=t=xe.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):z.propHooks._default.set(this),this}},z.prototype.init.prototype=z.prototype,z.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=xe.css(e.elem,e.prop,""),t&&"auto"!==t?t:0)},set:function(e){xe.fx.step[e.prop]?xe.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[xe.cssProps[e.prop]]&&!xe.cssHooks[e.prop]?e.elem[e.prop]=e.now:xe.style(e.elem,e.prop,e.now+e.unit)}}},z.propHooks.scrollTop=z.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},xe.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},xe.fx=z.prototype.init,xe.fx.step={};var ht,gt,vt=/^(?:toggle|show|hide)$/,mt=/queueHooks$/;xe.Animation=xe.extend(J,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return b(n.elem,e,We.exec(t),n),n}]},tweener:function(e,t){xe.isFunction(e)?(t=e,e=["*"]):e=e.match(Le);for(var n,r=0,i=e.length;r<i;r++)n=e[r],J.tweeners[n]=J.tweeners[n]||[],J.tweeners[n].unshift(t)},prefilters:[Y],prefilter:function(e,t){t?J.prefilters.unshift(e):J.prefilters.push(e)}}),xe.speed=function(e,t,n){var r=e&&"object"===(void 0===e?"undefined":i(e))?xe.extend({},e):{complete:n||!n&&t||xe.isFunction(e)&&e,duration:e,easing:n&&t||t&&!xe.isFunction(t)&&t};return xe.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in xe.fx.speeds?r.duration=xe.fx.speeds[r.duration]:r.duration=xe.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){xe.isFunction(r.old)&&r.old.call(this),r.queue&&xe.dequeue(this,r.queue)},r},xe.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Be).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=xe.isEmptyObject(e),o=xe.speed(t,n,r),a=function(){var t=J(this,xe.extend({},e),o);(i||_e.get(this,"finish"))&&t.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&!1!==e&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",o=xe.timers,a=_e.get(this);if(i)a[i]&&a[i].stop&&r(a[i]);else for(i in a)a[i]&&a[i].stop&&mt.test(i)&&r(a[i]);for(i=o.length;i--;)o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1));!t&&n||xe.dequeue(this,e)})},finish:function(e){return!1!==e&&(e=e||"fx"),this.each(function(){var t,n=_e.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=xe.timers,a=r?r.length:0;for(n.finish=!0,xe.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;t<a;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),xe.each(["toggle","show","hide"],function(e,t){var n=xe.fn[t];xe.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(V(t,!0),e,r,i)}}),xe.each({slideDown:V("show"),slideUp:V("hide"),slideToggle:V("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){xe.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),xe.timers=[],xe.fx.tick=function(){var e,t=0,n=xe.timers;for(ht=xe.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||xe.fx.stop(),ht=void 0},xe.fx.timer=function(e){xe.timers.push(e),xe.fx.start()},xe.fx.interval=13,xe.fx.start=function(){gt||(gt=!0,X())},xe.fx.stop=function(){gt=null},xe.fx.speeds={slow:600,fast:200,_default:400},xe.fn.delay=function(e,t){return e=xe.fx?xe.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=o.setTimeout(t,e);n.stop=function(){o.clearTimeout(r)}})},function(){var e=se.createElement("input"),t=se.createElement("select"),n=t.appendChild(se.createElement("option"));e.type="checkbox",ye.checkOn=""!==e.value,ye.optSelected=n.selected,e=se.createElement("input"),e.value="t",e.type="radio",ye.radioValue="t"===e.value}();var yt,xt=xe.expr.attrHandle;xe.fn.extend({attr:function(e,t){return He(this,xe.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){xe.removeAttr(this,e)})}}),xe.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return void 0===e.getAttribute?xe.prop(e,t,n):(1===o&&xe.isXMLDoc(e)||(i=xe.attrHooks[t.toLowerCase()]||(xe.expr.match.bool.test(t)?yt:void 0)),void 0!==n?null===n?void xe.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:(r=xe.find.attr(e,t),null==r?void 0:r))},attrHooks:{type:{set:function(e,t){if(!ye.radioValue&&"radio"===t&&l(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(Le);if(i&&1===e.nodeType)for(;n=i[r++];)e.removeAttribute(n)}}),yt={set:function(e,t,n){return!1===t?xe.removeAttr(e,n):e.setAttribute(n,n),n}},xe.each(xe.expr.match.bool.source.match(/\w+/g),function(e,t){var n=xt[t]||xe.find.attr;xt[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=xt[a],xt[a]=i,i=null!=n(e,t,r)?a:null,xt[a]=o),i}});var bt=/^(?:input|select|textarea|button)$/i,wt=/^(?:a|area)$/i;xe.fn.extend({prop:function(e,t){return He(this,xe.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[xe.propFix[e]||e]})}}),xe.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&xe.isXMLDoc(e)||(t=xe.propFix[t]||t,i=xe.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=xe.find.attr(e,"tabindex");return t?parseInt(t,10):bt.test(e.nodeName)||wt.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),ye.optSelected||(xe.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),xe.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){xe.propFix[this.toLowerCase()]=this}),xe.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(xe.isFunction(e))return this.each(function(t){xe(this).addClass(e.call(this,t,Z(this)))});if("string"==typeof e&&e)for(t=e.match(Le)||[];n=this[u++];)if(i=Z(n),r=1===n.nodeType&&" "+K(i)+" "){for(a=0;o=t[a++];)r.indexOf(" "+o+" ")<0&&(r+=o+" ");s=K(r),i!==s&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(xe.isFunction(e))return this.each(function(t){xe(this).removeClass(e.call(this,t,Z(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof e&&e)for(t=e.match(Le)||[];n=this[u++];)if(i=Z(n),r=1===n.nodeType&&" "+K(i)+" "){for(a=0;o=t[a++];)for(;r.indexOf(" "+o+" ")>-1;)r=r.replace(" "+o+" "," ");s=K(r),i!==s&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=void 0===e?"undefined":i(e);return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):xe.isFunction(e)?this.each(function(n){xe(this).toggleClass(e.call(this,n,Z(this),t),t)}):this.each(function(){var t,r,i,o;if("string"===n)for(r=0,i=xe(this),o=e.match(Le)||[];t=o[r++];)i.hasClass(t)?i.removeClass(t):i.addClass(t);else void 0!==e&&"boolean"!==n||(t=Z(this),t&&_e.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":_e.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;for(t=" "+e+" ";n=this[r++];)if(1===n.nodeType&&(" "+K(Z(n))+" ").indexOf(t)>-1)return!0;return!1}});xe.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=xe.isFunction(e),this.each(function(n){var i;1===this.nodeType&&(i=r?e.call(this,n,xe(this).val()):e,null==i?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=xe.map(i,function(e){return null==e?"":e+""})),(t=xe.valHooks[this.type]||xe.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return(t=xe.valHooks[i.type]||xe.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:(n=i.value,"string"==typeof n?n.replace(/\r/g,""):null==n?"":n)}}}),xe.extend({valHooks:{option:{get:function(e){var t=xe.find.attr(e,"value");return null!=t?t:K(xe.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(n=i[r],(n.selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!l(n.parentNode,"optgroup"))){if(t=xe(n).val(),a)return t;s.push(t)}return s},set:function(e,t){for(var n,r,i=e.options,o=xe.makeArray(t),a=i.length;a--;)r=i[a],(r.selected=xe.inArray(xe.valHooks.option.get(r),o)>-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),xe.each(["radio","checkbox"],function(){xe.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=xe.inArray(xe(e).val(),t)>-1}},ye.checkOn||(xe.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Tt=/^(?:focusinfocus|focusoutblur)$/;xe.extend(xe.event,{trigger:function(e,t,n,r){var a,s,u,l,c,f,d,p=[n||se],h=ge.call(e,"type")?e.type:e,g=ge.call(e,"namespace")?e.namespace.split("."):[];if(s=u=n=n||se,3!==n.nodeType&&8!==n.nodeType&&!Tt.test(h+xe.event.triggered)&&(h.indexOf(".")>-1&&(g=h.split("."),h=g.shift(),g.sort()),c=h.indexOf(":")<0&&"on"+h,e=e[xe.expando]?e:new xe.Event(h,"object"===(void 0===e?"undefined":i(e))&&e),e.isTrigger=r?2:3,e.namespace=g.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+g.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:xe.makeArray(t,[e]),d=xe.event.special[h]||{},r||!d.trigger||!1!==d.trigger.apply(n,t))){if(!r&&!d.noBubble&&!xe.isWindow(n)){for(l=d.delegateType||h,Tt.test(l+h)||(s=s.parentNode);s;s=s.parentNode)p.push(s),u=s;u===(n.ownerDocument||se)&&p.push(u.defaultView||u.parentWindow||o)}for(a=0;(s=p[a++])&&!e.isPropagationStopped();)e.type=a>1?l:d.bindType||h,f=(_e.get(s,"events")||{})[e.type]&&_e.get(s,"handle"),f&&f.apply(s,t),(f=c&&s[c])&&f.apply&&Oe(s)&&(e.result=f.apply(s,t),!1===e.result&&e.preventDefault());return e.type=h,r||e.isDefaultPrevented()||d._default&&!1!==d._default.apply(p.pop(),t)||!Oe(n)||c&&xe.isFunction(n[h])&&!xe.isWindow(n)&&(u=n[c],u&&(n[c]=null),xe.event.triggered=h,n[h](),xe.event.triggered=void 0,u&&(n[c]=u)),e.result}},simulate:function(e,t,n){var r=xe.extend(new xe.Event,n,{type:e,isSimulated:!0});xe.event.trigger(r,null,t)}}),xe.fn.extend({trigger:function(e,t){return this.each(function(){xe.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return xe.event.trigger(e,t,n,!0)}}),xe.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,t){xe.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),xe.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),ye.focusin="onfocusin"in o,ye.focusin||xe.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){xe.event.simulate(t,e.target,xe.event.fix(e))};xe.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=_e.access(r,t);i||r.addEventListener(e,n,!0),_e.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=_e.access(r,t)-1;i?_e.access(r,t,i):(r.removeEventListener(e,n,!0),_e.remove(r,t))}}});var kt=o.location,Ct=xe.now(),St=/\?/;xe.parseXML=function(e){var t;if(!e||"string"!=typeof e)return null;try{t=(new o.DOMParser).parseFromString(e,"text/xml")}catch(e){t=void 0}return t&&!t.getElementsByTagName("parsererror").length||xe.error("Invalid XML: "+e),t};var Et=/\[\]$/,jt=/^(?:submit|button|image|reset|file)$/i,Nt=/^(?:input|select|textarea|keygen)/i;xe.param=function(e,t){var n,r=[],i=function(e,t){var n=xe.isFunction(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(e)||e.jquery&&!xe.isPlainObject(e))xe.each(e,function(){i(this.name,this.value)});else for(n in e)ee(n,e[n],t,i);return r.join("&")},xe.fn.extend({serialize:function(){return xe.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=xe.prop(this,"elements");return e?xe.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!xe(this).is(":disabled")&&Nt.test(this.nodeName)&&!jt.test(e)&&(this.checked||!Ue.test(e))}).map(function(e,t){var n=xe(this).val();return null==n?null:Array.isArray(n)?xe.map(n,function(e){return{name:t.name,value:e.replace(/\r?\n/g,"\r\n")}}):{name:t.name,value:n.replace(/\r?\n/g,"\r\n")}}).get()}});var Dt=/^(.*?):[ \t]*([^\r\n]*)$/gm,At=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Lt=/^(?:GET|HEAD)$/,qt={},Pt={},Ht="*/".concat("*"),Ot=se.createElement("a");Ot.href=kt.href,xe.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:kt.href,type:"GET",isLocal:At.test(kt.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Ht,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":xe.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?re(re(e,xe.ajaxSettings),t):re(xe.ajaxSettings,e)},ajaxPrefilter:te(qt),ajaxTransport:te(Pt),ajax:function(e,t){function n(e,t,n,i){var u,c,p,h,w,T=t;f||(f=!0,l&&o.clearTimeout(l),r=void 0,s=i||"",C.readyState=e>0?4:0,u=e>=200&&e<300||304===e,n&&(h=ie(g,C,n)),h=oe(g,h,C,u),u?(g.ifModified&&(w=C.getResponseHeader("Last-Modified"),w&&(xe.lastModified[a]=w),(w=C.getResponseHeader("etag"))&&(xe.etag[a]=w)),204===e||"HEAD"===g.type?T="nocontent":304===e?T="notmodified":(T=h.state,c=h.data,p=h.error,u=!p)):(p=T,!e&&T||(T="error",e<0&&(e=0))),C.status=e,C.statusText=(t||T)+"",u?y.resolveWith(v,[c,T,C]):y.rejectWith(v,[C,T,p]),C.statusCode(b),b=void 0,d&&m.trigger(u?"ajaxSuccess":"ajaxError",[C,g,u?c:p]),x.fireWith(v,[C,T]),d&&(m.trigger("ajaxComplete",[C,g]),--xe.active||xe.event.trigger("ajaxStop")))}"object"===(void 0===e?"undefined":i(e))&&(t=e,e=void 0),t=t||{};var r,a,s,u,l,c,f,d,p,h,g=xe.ajaxSetup({},t),v=g.context||g,m=g.context&&(v.nodeType||v.jquery)?xe(v):xe.event,y=xe.Deferred(),x=xe.Callbacks("once memory"),b=g.statusCode||{},w={},T={},k="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(f){if(!u)for(u={};t=Dt.exec(s);)u[t[1].toLowerCase()]=t[2];t=u[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return f?s:null},setRequestHeader:function(e,t){return null==f&&(e=T[e.toLowerCase()]=T[e.toLowerCase()]||e,w[e]=t),this},overrideMimeType:function(e){return null==f&&(g.mimeType=e),this},statusCode:function(e){var t;if(e)if(f)C.always(e[C.status]);else for(t in e)b[t]=[b[t],e[t]];return this},abort:function(e){var t=e||k;return r&&r.abort(t),n(0,t),this}};if(y.promise(C),g.url=((e||g.url||kt.href)+"").replace(/^\/\//,kt.protocol+"//"),g.type=t.method||t.type||g.method||g.type,g.dataTypes=(g.dataType||"*").toLowerCase().match(Le)||[""],null==g.crossDomain){c=se.createElement("a");try{c.href=g.url,c.href=c.href,g.crossDomain=Ot.protocol+"//"+Ot.host!=c.protocol+"//"+c.host}catch(e){g.crossDomain=!0}}if(g.data&&g.processData&&"string"!=typeof g.data&&(g.data=xe.param(g.data,g.traditional)),ne(qt,g,t,C),f)return C;d=xe.event&&g.global,d&&0==xe.active++&&xe.event.trigger("ajaxStart"),g.type=g.type.toUpperCase(),g.hasContent=!Lt.test(g.type),a=g.url.replace(/#.*$/,""),g.hasContent?g.data&&g.processData&&0===(g.contentType||"").indexOf("application/x-www-form-urlencoded")&&(g.data=g.data.replace(/%20/g,"+")):(h=g.url.slice(a.length),g.data&&(a+=(St.test(a)?"&":"?")+g.data,delete g.data),!1===g.cache&&(a=a.replace(/([?&])_=[^&]*/,"$1"),h=(St.test(a)?"&":"?")+"_="+Ct+++h),g.url=a+h),g.ifModified&&(xe.lastModified[a]&&C.setRequestHeader("If-Modified-Since",xe.lastModified[a]),xe.etag[a]&&C.setRequestHeader("If-None-Match",xe.etag[a])),(g.data&&g.hasContent&&!1!==g.contentType||t.contentType)&&C.setRequestHeader("Content-Type",g.contentType),C.setRequestHeader("Accept",g.dataTypes[0]&&g.accepts[g.dataTypes[0]]?g.accepts[g.dataTypes[0]]+("*"!==g.dataTypes[0]?", "+Ht+"; q=0.01":""):g.accepts["*"]);for(p in g.headers)C.setRequestHeader(p,g.headers[p]);if(g.beforeSend&&(!1===g.beforeSend.call(v,C,g)||f))return C.abort();if(k="abort",x.add(g.complete),C.done(g.success),C.fail(g.error),r=ne(Pt,g,t,C)){if(C.readyState=1,d&&m.trigger("ajaxSend",[C,g]),f)return C;g.async&&g.timeout>0&&(l=o.setTimeout(function(){C.abort("timeout")},g.timeout));try{f=!1,r.send(w,n)}catch(e){if(f)throw e;n(-1,e)}}else n(-1,"No Transport");return C},getJSON:function(e,t,n){return xe.get(e,t,n,"json")},getScript:function(e,t){return xe.get(e,void 0,t,"script")}}),xe.each(["get","post"],function(e,t){xe[t]=function(e,n,r,i){return xe.isFunction(n)&&(i=i||r,r=n,n=void 0),xe.ajax(xe.extend({url:e,type:t,dataType:i,data:n,success:r},xe.isPlainObject(e)&&e))}}),xe._evalUrl=function(e){return xe.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,throws:!0})},xe.fn.extend({wrapAll:function(e){var t;return this[0]&&(xe.isFunction(e)&&(e=e.call(this[0])),t=xe(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return xe.isFunction(e)?this.each(function(t){xe(this).wrapInner(e.call(this,t))}):this.each(function(){var t=xe(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=xe.isFunction(e);return this.each(function(n){xe(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){xe(this).replaceWith(this.childNodes)}),this}}),xe.expr.pseudos.hidden=function(e){return!xe.expr.pseudos.visible(e)},xe.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},xe.ajaxSettings.xhr=function(){try{return new o.XMLHttpRequest}catch(e){}};var _t={0:200,1223:204},Ft=xe.ajaxSettings.xhr();ye.cors=!!Ft&&"withCredentials"in Ft,ye.ajax=Ft=!!Ft,xe.ajaxTransport(function(e){var t,n;if(ye.cors||Ft&&!e.crossDomain)return{send:function(r,i){var a,s=e.xhr();if(s.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(a in e.xhrFields)s[a]=e.xhrFields[a];e.mimeType&&s.overrideMimeType&&s.overrideMimeType(e.mimeType),e.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest");for(a in r)s.setRequestHeader(a,r[a]);t=function(e){return function(){t&&(t=n=s.onload=s.onerror=s.onabort=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?i(0,"error"):i(s.status,s.statusText):i(_t[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=t(),n=s.onerror=t("error"),void 0!==s.onabort?s.onabort=n:s.onreadystatechange=function(){4===s.readyState&&o.setTimeout(function(){t&&n()})},t=t("abort");try{s.send(e.hasContent&&e.data||null)}catch(e){if(t)throw e}},abort:function(){t&&t()}}}),xe.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),xe.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return xe.globalEval(e),e}}}),xe.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),xe.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(r,i){t=xe("<script>").prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&i("error"===e.type?404:200,e.type)}),se.head.appendChild(t[0])},abort:function(){n&&n()}}}});var Mt=[],Rt=/(=)\?(?=&|$)|\?\?/;xe.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Mt.pop()||xe.expando+"_"+Ct++;return this[e]=!0,e}}),xe.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,a,s=!1!==e.jsonp&&(Rt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Rt.test(e.data)&&"data");if(s||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=xe.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,s?e[s]=e[s].replace(Rt,"$1"+r):!1!==e.jsonp&&(e.url+=(St.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return a||xe.error(r+" was not called"),a[0]},e.dataTypes[0]="json",i=o[r],o[r]=function(){a=arguments},n.always(function(){void 0===i?xe(o).removeProp(r):o[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Mt.push(r)),a&&xe.isFunction(i)&&i(a[0]),a=i=void 0}),"script"}),ye.createHTMLDocument=function(){var e=se.implementation.createHTMLDocument("").body;return e.innerHTML="<form></form><form></form>",2===e.childNodes.length}(),xe.parseHTML=function(e,t,n){if("string"!=typeof e)return[];"boolean"==typeof t&&(n=t,t=!1);var r,i,o;return t||(ye.createHTMLDocument?(t=se.implementation.createHTMLDocument(""),r=t.createElement("base"),r.href=se.location.href,t.head.appendChild(r)):t=se),i=Se.exec(e),o=!n&&[],i?[t.createElement(i[1])]:(i=S([e],t,o),o&&o.length&&xe(o).remove(),xe.merge([],i.childNodes))},xe.fn.load=function(e,t,n){var r,o,a,s=this,u=e.indexOf(" ");return u>-1&&(r=K(e.slice(u)),e=e.slice(0,u)),xe.isFunction(t)?(n=t,t=void 0):t&&"object"===(void 0===t?"undefined":i(t))&&(o="POST"),s.length>0&&xe.ajax({url:e,type:o||"GET",dataType:"html",data:t}).done(function(e){a=arguments,s.html(r?xe("<div>").append(xe.parseHTML(e)).find(r):e)}).always(n&&function(e,t){s.each(function(){n.apply(this,a||[e.responseText,t,e])})}),this},xe.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){xe.fn[t]=function(e){return this.on(t,e)}}),xe.expr.pseudos.animated=function(e){return xe.grep(xe.timers,function(t){return e===t.elem}).length},xe.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l,c=xe.css(e,"position"),f=xe(e),d={};"static"===c&&(e.style.position="relative"),s=f.offset(),o=xe.css(e,"top"),u=xe.css(e,"left"),l=("absolute"===c||"fixed"===c)&&(o+u).indexOf("auto")>-1,l?(r=f.position(),a=r.top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),xe.isFunction(t)&&(t=t.call(e,n,xe.extend({},s))),null!=t.top&&(d.top=t.top-s.top+a),null!=t.left&&(d.left=t.left-s.left+i),"using"in t?t.using.call(e,d):f.css(d)}},xe.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){xe.offset.setOffset(this,e,t)});var t,n,r,i,o=this[0];if(o)return o.getClientRects().length?(r=o.getBoundingClientRect(),t=o.ownerDocument,n=t.documentElement,i=t.defaultView,{top:r.top+i.pageYOffset-n.clientTop,left:r.left+i.pageXOffset-n.clientLeft}):{top:0,left:0}},position:function(){if(this[0]){var e,t,n=this[0],r={top:0,left:0};return"fixed"===xe.css(n,"position")?t=n.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),l(e[0],"html")||(r=e.offset()),r={top:r.top+xe.css(e[0],"borderTopWidth",!0),left:r.left+xe.css(e[0],"borderLeftWidth",!0)}),{top:t.top-r.top-xe.css(n,"marginTop",!0),left:t.left-r.left-xe.css(n,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent;e&&"static"===xe.css(e,"position");)e=e.offsetParent;return e||Je})}}),xe.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n="pageYOffset"===t;xe.fn[e]=function(r){return He(this,function(e,r,i){var o;if(xe.isWindow(e)?o=e:9===e.nodeType&&(o=e.defaultView),void 0===i)return o?o[t]:e[r];o?o.scrollTo(n?o.pageXOffset:i,n?i:o.pageYOffset):e[r]=i},e,r,arguments.length)}}),xe.each(["top","left"],function(e,t){xe.cssHooks[t]=M(ye.pixelPosition,function(e,n){if(n)return n=F(e,t),at.test(n)?xe(e).position()[t]+"px":n})}),xe.each({Height:"height",Width:"width"},function(e,t){xe.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){xe.fn[r]=function(i,o){var a=arguments.length&&(n||"boolean"!=typeof i),s=n||(!0===i||!0===o?"margin":"border");return He(this,function(t,n,i){var o;return xe.isWindow(t)?0===r.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(o=t.documentElement,Math.max(t.body["scroll"+e],o["scroll"+e],t.body["offset"+e],o["offset"+e],o["client"+e])):void 0===i?xe.css(t,n,s):xe.style(t,n,i,s)},t,a?i:void 0,a)}})}),xe.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}}),xe.holdReady=function(e){e?xe.readyWait++:xe.ready(!0)},xe.isArray=Array.isArray,xe.parseJSON=JSON.parse,xe.nodeName=l,n=[],void 0!==(r=function(){return xe}.apply(t,n))&&(e.exports=r);var It=o.jQuery,Wt=o.$;return xe.noConflict=function(e){return o.$===xe&&(o.$=Wt),e&&o.jQuery===xe&&(o.jQuery=It),xe},a||(o.jQuery=o.$=xe),xe})}).call(t,n(4)(e))},function(e,t,n){"use strict";function r(){var e,t,n,r=(0,o.default)("#advanced_add_affiliate_link"),i=r.find(".search-panel"),a=r.find(".results-panel"),s=a.find("ul.results-list"),u=2,l=!0,c=void 0;i.on("keyup","#thirstylink-search",function(){var r=(0,o.default)(this),i=a.find(".load-more-results");if(!(l&&r.val().length<3)){if(c&&n!==r.val()&&(c.abort(),c=null),e||(e=s.html()),s.html("<li class='spinner'><i style='background-image: url("+Options.spinner_image+");'></i><span>"+Options.searching_text+"</span></li>"),(""==r.val()||r.val().length<3)&&!l)return u=2,s.html(e).show(),void i.show();if(n===r.val())return u=2,s.html(t).show(),void i.show();u=1,i.hide(),c=o.default.post(parent.ajaxurl,{action:"search_affiliate_links_query",keyword:r.val(),paged:u,advance:!0,post_id:Options.post_id},function(e){n=r.val(),l=!1,"success"==e.status&&(t=e.search_query_markup,s.html(e.search_query_markup).show(),u++,e.count<1?i.hide():i.show())},"json")}}),a.on("click",".load-more-results",function(){var e=(0,o.default)(this),t=i.find("#thirstylink-search");e.hasClass("fetching")||(e.addClass("fetching").css("padding-top","4px").find(".spinner").show(),e.find(".button-text").hide(),c=o.default.post(parent.ajaxurl,{action:"search_affiliate_links_query",keyword:t.val(),paged:u,advance:!0},function(t){if(e.removeClass("fetching").find(".spinner").hide(),e.find(".button-text").show(),"success"==t.status){if(u++,t.count<1)return void e.hide();s.append(t.search_query_markup)}},"json"))})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var i=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(i)},function(e,t,n){"use strict";function r(){function e(){var e,t,r,o,s,u,l,c,f,d,p,h,g,v,m,y=(0,a.default)(this).closest("li.thirstylink"),x=(0,a.default)(this).data("type"),b=n.data("htmleditor"),w="";if(parent.ThirstyLinkPicker.linkNode||b){if(e=b?parent.ThirstyLinkPicker.get_html_editor_selection().text:parent.ThirstyLinkPicker.editor.selection.getContent(),t=y.data("linkid"),r=y.data("class"),o=r?' class="'+r+'"':"",s=y.data("href"),u=y.data("title"),l=u?' title="'+u+'"':"",c=y.find("span.name").text(),f=y.data("rel"),d=y.data("target"),v=y.data("other-atts"),!/^(?:[a-z]+:|#|\?|\.|\/)/.test(s))return;if("object"==(void 0===v?"undefined":i(v))&&Object.keys(v).length>0)for(var T in v)w+=T+'="'+v[T]+'" ';if("shortcode"==x)c=e.trim()?e:c,p='[thirstylink ids="'+t+'"]'+c+"[/thirstylink]",b?parent.ThirstyLinkPicker.replace_html_editor_selected_text(p):(parent.ThirstyLinkPicker.editor.execCommand("Unlink",!1,!1),parent.ThirstyLinkPicker.editor.selection.setContent(p),parent.ThirstyLinkPicker.inputInstance.reset());else if("image"==x)""!=r&&(o=' class="thirstylinkimg"'),g=(0,a.default)(this).data("imgid"),a.default.post(parent.ajaxurl,{action:"ta_get_image_markup_by_id",imgid:g},function(e){"success"==e.status&&(h="<a"+o+l+' href="'+s+'" rel="'+f+'" target="'+d+'" '+w+">"+e.image_markup+"</a>",b?parent.ThirstyLinkPicker.replace_html_editor_selected_text(h):(parent.ThirstyLinkPicker.editor.selection.setContent(h),parent.ThirstyLinkPicker.inputInstance.reset())),parent.ThirstyLinkPicker.close_thickbox()},"json");else if(c=e.trim()?e:c,b)h="<a"+o+l+' href="'+s+'" rel="'+f+'" target="'+d+'" '+w+">"+e+"</a>",parent.ThirstyLinkPicker.replace_html_editor_selected_text(h);else{if(m={class:r,title:u,href:s,rel:f,target:d,"data-wplink-edit":null,"data-thirstylink-edit":null},"object"==(void 0===v?"undefined":i(v))&&Object.keys(v).length>0)for(T in v)m[T]=v[T];parent.ThirstyLinkPicker.editor.execCommand("Unlink",!1,!1),parent.ThirstyLinkPicker.editor.execCommand("mceInsertLink",!1,m),e.trim()||parent.ThirstyLinkPicker.editor.selection.setContent(c),parent.ThirstyLinkPicker.inputInstance.reset()}g||parent.ThirstyLinkPicker.close_thickbox()}}var t=(0,a.default)("#advanced_add_affiliate_link"),n=t.find(".results-panel ul.results-list");n.on("click",".actions .insert-link-button",e),n.on("click",".actions .insert-shortcode-button",e),n.on("click",".images-block .images img",e),n.on("click",".actions .insert-image-button",function(){var e=(0,a.default)(this).closest(".thirstylink"),t=e.find(".images-block"),n=e.hasClass("show");(0,a.default)(".results-panel").find(".images-block").removeClass("show").hide(),n||t.slideDown("fast").addClass("show")})}Object.defineProperty(t,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=r;var o=n(0),a=function(e){return e&&e.__esModule?e:{default:e}}(o)},function(e,t){},function(e,t,n){"use strict";e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(0),o=r(i),a=n(1),s=r(a),u=n(2),l=r(u);n(3),(0,o.default)(document).ready(function(){(0,s.default)(),(0,l.default)()})}]);
js/app/ta-editor.js CHANGED
@@ -12,6 +12,20 @@ jQuery( document ).ready( function($) {
12
  tb_remove();
13
  },
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  /**
16
  * Get selected text on the HTML editor
17
  *