TypeSquare Webfonts SAKURA for SAKURA Rental Server - Version 3.0.0

Version Description

Download this release

Release Info

Developer sakurainternet
Plugin Icon 128x128 TypeSquare Webfonts SAKURA for SAKURA Rental Server
Version 3.0.0
Comparing to
See all releases

Code changes from version 2.0.1 to 3.0.0

Files changed (5) hide show
  1. inc/admin-base.php +0 -1
  2. inc/admin-dashboard.php +121 -0
  3. inc/admin-fonttheme.php +0 -184
  4. inc/admin-root.php +435 -182
  5. inc/app.js +582 -29797
inc/admin-base.php CHANGED
@@ -9,7 +9,6 @@ class TypeSquare_Admin_Base {
9
  const MESSAGE_KEY = 'typesquare-admin-errors';
10
  const MENU_FONTTHEME = 'typesquare-admin-fonttheme';
11
  const MENU_FONTGEN = 'typesquare-admin-fontgen';
12
- const FONT_THEME_MAX = 10;
13
  private function __construct(){}
14
 
15
  public static function get_instance() {
9
  const MESSAGE_KEY = 'typesquare-admin-errors';
10
  const MENU_FONTTHEME = 'typesquare-admin-fonttheme';
11
  const MENU_FONTGEN = 'typesquare-admin-fontgen';
 
12
  private function __construct(){}
13
 
14
  public static function get_instance() {
inc/admin-dashboard.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! class_exists( 'typesquare_dashboard_widget' ) ) {
4
+
5
+ /**
6
+ * Class typesquare_dashboard_widget
7
+ *
8
+ * @since 2.3.10
9
+ */
10
+ class typesquare_dashboard_widget {
11
+
12
+ /**
13
+ * Add the action to the constructor.
14
+ */
15
+ function __construct() {
16
+ add_action( 'wp_dashboard_setup', array( $this, 'add_dashboard_widget' ) );
17
+ }
18
+
19
+ /**
20
+ * @since 2.3.10
21
+ */
22
+ function add_dashboard_widget() {
23
+ if ( current_user_can( 'install_plugins' ) && false !== $this->show_widget() ) {
24
+ wp_add_dashboard_widget(
25
+ 'slug','TypeSquareニュース', array(
26
+ $this,
27
+ 'display_rss_dashboard_widget',
28
+ )
29
+ );
30
+ }
31
+
32
+ }
33
+
34
+ /**
35
+ * @since 2.3.10.2
36
+ */
37
+ function show_widget() {
38
+
39
+ $show = true;
40
+
41
+
42
+ global $typesquarep_options;
43
+
44
+ return $show;
45
+ }
46
+
47
+ /**
48
+ * @since 2.3.10
49
+ */
50
+ function display_rss_dashboard_widget() {
51
+ // check if the user has chosen not to display this widget through screen options.
52
+ $current_screen = get_current_screen();
53
+ $hidden_widgets = get_user_meta( get_current_user_id(), 'metaboxhidden_' . $current_screen->id );
54
+ if ( $hidden_widgets && count( $hidden_widgets ) > 0 && is_array( $hidden_widgets[0] ) && in_array( 'slug', $hidden_widgets[0], true ) ) {
55
+ return;
56
+ }
57
+
58
+ include_once( ABSPATH . WPINC . '/feed.php' );
59
+
60
+ $rss = fetch_feed( 'https://typesquare.com/ja/news/newslist.rss' );
61
+ if ( is_wp_error( $rss ) ) {
62
+ echo 'エラー';
63
+
64
+ return;
65
+ }
66
+
67
+ $rss_items = $rss->get_items( 0, 5 );
68
+
69
+ $cached = array();
70
+ foreach ( $rss_items as $item ) {
71
+ $cached[] = array(
72
+ // 以下はxmlファイルのitemタグ内の要素
73
+ // <link>
74
+ 'url' => $item->get_permalink(),
75
+ // <title>
76
+ 'title' => $item->get_title(),
77
+ // <pubDate>
78
+ 'date' => $item->get_date( 'M jS Y' ),
79
+ // <description>
80
+ 'content' => substr( strip_tags( $item->get_content() ), 0, 216 ) . '...',
81
+ );
82
+ }
83
+ $rss_items = $cached;
84
+
85
+ ?>
86
+
87
+ <ul>
88
+ <?php
89
+ if ( false === $rss_items ) {
90
+ echo '<li>No items</li>';
91
+
92
+ return;
93
+ }
94
+
95
+ foreach ( $rss_items as $item ) {
96
+ ?>
97
+ <li>
98
+ <a target="_blank" href="<?php echo esc_url( $item['url'] ); ?>" style="font-size:14px;">
99
+ <?php echo esc_html( $item['title'] ); ?>
100
+ </a>
101
+ <span class="typesquarep-rss-date" style="display:block; margin: 4px 0;"><?php echo $item['date']; ?></span>
102
+ <div class="typesquarep_news" style="color:#777;">
103
+ <?php echo strip_tags( $item['content'] ) . '...'; ?>
104
+ </div>
105
+ </li>
106
+ <hr>
107
+ <?php
108
+ }
109
+
110
+ ?>
111
+ </ul>
112
+
113
+ <?php
114
+
115
+ }
116
+ }
117
+
118
+ new typesquare_dashboard_widget();
119
+ }
120
+
121
+
inc/admin-fonttheme.php CHANGED
@@ -13,188 +13,4 @@ class TypeSquare_Admin_Fonttheme extends TypeSquare_Admin_Base {
13
  return self::$instance;
14
  }
15
 
16
- public function fonttheme_setting() {
17
- $option_name = 'typesquare_auth';
18
- $nonce_key = TypeSquare_ST::OPTION_NAME;
19
- echo "<div class='wrap'>";
20
- echo '<h2>'. __( 'カスタムフォントテーマ' , self::$text_domain ). '</h2>';
21
- echo '<p>'. __( 'オリジナルのフォントテーマの作成や編集が行えます。' , self::$text_domain ). '</p>';
22
- do_action( 'typesquare_add_setting_before' );
23
- $auth_param = $this->get_auth_params();
24
- if ( false !== $auth_param['typesquare_auth']['auth_status'] ) {
25
- echo $this->_get_custome_font_theme_list_form();
26
- }
27
- do_action( 'typesquare_add_setting_after' );
28
- }
29
-
30
- /**
31
- * @TODO: to use font theme generator
32
- **/
33
- public function get_font_select_form() {
34
- $options = get_option( 'typesquare_custom_theme' );
35
- $edit_theme = false;
36
- if ( isset( $_POST['edit_theme'] ) ) {
37
- $edit_theme = esc_attr( $_POST['edit_theme'] );
38
- }
39
- $fonts = TypeSquare_ST_Fonts::get_instance();
40
- /* @TODO Debug Code
41
- $option_name = 'typesquare_fonttheme';
42
- $param = get_option( $option_name );
43
- unset($param['fonts']);
44
- update_option( $option_name, $param );
45
- $param = $fonts->get_fonttheme_options();
46
- */
47
- $font_list = $theme_id = $theme_name = '';
48
- if ( $edit_theme && $options['theme'][ $edit_theme ] ) {
49
- $theme_name = $options['theme'][ $edit_theme ]['name'];
50
- $theme_id = $options['theme'][ $edit_theme ]['id'];
51
- $font_list = $options['fonts'][ $edit_theme ];
52
- }
53
-
54
- $html = '';
55
- $html .= '<hr/>';
56
- $query = './admin.php?page='. self::MENU_FONTTHEME;
57
- $html .= "<form method='post' action='{$query}' id='". self::MENU_FONTTHEME. "'>";
58
- $html .= wp_nonce_field( 'ts_update_font_name_setting', 'ts_update_font_name_setting', true , false );
59
- if ( $theme_id ) {
60
- $theme_input = "<input type='hidden' name='typesquare_custom_theme[id]' value='{$theme_id}' />";
61
- $html .= "<input type='hidden' name='ts_edit_mode' value='update' />";
62
- $html .= $theme_input;
63
- } else {
64
- $theme_id = uniqid();
65
- $theme_input = false;
66
- $html .= "<input type='hidden' name='ts_edit_mode' value='new' />";
67
- $html .= "<input type='hidden' name='typesquare_custom_theme[id]' value='{$theme_id}' maxlength='16' style='width:100%;' pattern='^[0-9A-Za-z]+$' required/>";
68
- }
69
- $html .= '<h4>■'. __( 'フォントテーマ名' , self::$text_domain ). '</h4>';
70
- $html .= '<p>'. __( 'フォントテーマの名称を設定します。(最大16文字まで)' , self::$text_domain ). '</p>';
71
- $html .= "<input type='text' name='typesquare_custom_theme[name]' value='{$theme_name}' maxlength='16' style='width:100%;' required/>";
72
- $html .= '<h4>■'. __( 'フォントテーマの設定' , self::$text_domain ). '</h4>';
73
- $html .= '<p>'. __( '各クラスに設定するフォントを選択します。' , self::$text_domain ). '</p>';
74
- $html .= "<div id='ts-react-search-font'></div>";
75
- $html .= get_submit_button( __( 'フォントテーマを設定する', self::$text_domain ) );
76
- $html .= '</form>';
77
- $html .= $this->_get_delete_fonttheme_form( $theme_input );
78
- $html .= $this->_get_script( $font_list );
79
- return $html;
80
- }
81
-
82
- private function _get_script( $font_list ) {
83
- $vars = "var form_id = '#". self::MENU_FONTTHEME. "';";
84
- $vars .= "var notify_text = '". __( 'フォントを1種類以上選択してください。', self::$text_domain ). "';";
85
- $script = <<<EOM
86
- {$vars}
87
- jQuery( document ).ready(function() {
88
- jQuery( form_id ).submit(function() {
89
- var title = jQuery( 'select[name="typesquare_custom_theme[fonts][title][font]"]' ).val();
90
- var lead = jQuery( 'select[name="typesquare_custom_theme[fonts][lead][font]"]' ).val();
91
- var text = jQuery( 'select[name="typesquare_custom_theme[fonts][text][font]"]' ).val();
92
- var bold = jQuery( 'select[name="typesquare_custom_theme[fonts][bold][font]"]' ).val();
93
- if (
94
- title === 'false' &&
95
- lead === 'false' &&
96
- text === 'false' &&
97
- bold === 'false'
98
- ) {
99
- alert( notify_text );
100
- return false;
101
- }
102
- });
103
- });
104
- EOM;
105
- $html = '<script>';
106
- $endpoint = path_join( TS_PLUGIN_URL , 'inc/font.json' );
107
- $html .= "var json_endpoint = '{$endpoint}';";
108
- if ( $font_list ) {
109
- $html .= "var current_font = ". json_encode( $font_list ) .';';
110
- } else {
111
- $html .= "var current_font = false;";
112
- }
113
- $html .= $script;
114
- $html .= '</script>';
115
- return $html;
116
- }
117
-
118
- private function _get_delete_fonttheme_form( $theme_input ) {
119
- $html = '';
120
- $query = './admin.php?page='. self::MENU_FONTTHEME;
121
- if ( $theme_input ) {
122
- $html .= "<form method='post' action='{$query}'>";
123
- $html .= "<input type='hidden' name='ts_edit_mode' value='delete' />";
124
- $html .= $theme_input;
125
- $html .= wp_nonce_field( 'ts_update_font_name_setting', 'ts_update_font_name_setting', true , false );
126
- $html .= get_submit_button( __( 'フォントテーマを削除する', self::$text_domain ) );
127
- $html .= '</form>';
128
- }
129
- return $html;
130
- }
131
-
132
- private function _get_custome_font_theme_list_form() {
133
- $options = get_option( 'typesquare_custom_theme' );
134
- $query = './admin.php?page='. self::MENU_FONTGEN;
135
- $html = '';
136
- if ( is_array( $options['theme'] ) && ! empty( $options['theme'] ) ) {
137
- $html .= '<h3>■'. __( 'カスタムフォントテーマ一覧' , self::$text_domain ). '</h3>';
138
- $html .= "<table class='widefat form-table'>";
139
- $html .= '<tbody>';
140
- $html .= '<tr><td>';
141
- $html .= "<form method='POST' action='{$query}'>";
142
- $html .= "<select name='edit_theme'>";
143
- foreach ( $options['theme'] as $option ) {
144
- $name = $option['name'];
145
- $id = $option['id'];
146
- $fonts = $this->_get_font_data( $option['fonts'] );
147
- $fonts = "( {$fonts} )";
148
- $html .= "<option value='{$id}'>{$name}{$fonts}</option>";
149
- }
150
- $html .= '</select>';
151
- $html .= "<input type='hidden' name='ts_edit_mode' value='update' />";
152
- $html .= get_submit_button( __( '編集する', self::$text_domain ) );
153
- $html .= wp_nonce_field( 'ts_update_font_list' , 'ts_update_font_list' , true , false );
154
- $html .= '</form>';
155
- $html .= '</td></tr>';
156
- $html .= '</tbody>';
157
- $html .= '</table>';
158
- }
159
- if (count($options['theme']) < self::FONT_THEME_MAX) {
160
- $html .= "<form method='POST' action='{$query}'>";
161
- $html .= "<input type='hidden' name='ts_edit_mode' value='new' />";
162
- $html .= get_submit_button( __( '新しいカスタムフォントテーマを作成する', self::$text_domain ) );
163
- $html .= wp_nonce_field( 'ts_update_font_list' , 'ts_update_font_list' , true , false );
164
- $html .= '</form>';
165
- }
166
- return $html;
167
- }
168
-
169
- private function _get_font_data( $fonts ) {
170
- $text = '';
171
- if ( isset( $fonts['title'] ) ) {
172
- $text .= __( '見出し:', self::$text_domain ). $fonts['title']. ',';
173
- }
174
- if ( isset( $fonts['lead'] ) ) {
175
- $text .= __( 'リード:', self::$text_domain ). $fonts['lead']. ',';
176
- }
177
- if ( isset( $fonts['text'] ) ) {
178
- $text .= __( '本文:', self::$text_domain ). $fonts['text']. ',';
179
- }
180
- if ( isset( $fonts['bold'] ) ) {
181
- $text .= __( '太字:', self::$text_domain ). $fonts['bold']. ',';
182
- }
183
- $text = rtrim( $text, ',' );
184
- $text = str_replace( ",", " / ", $text );
185
- return $text;
186
- }
187
-
188
- public function fonttheme_generator() {
189
- $option_name = 'typesquare_auth';
190
- $nonce_key = TypeSquare_ST::OPTION_NAME;
191
- echo "<div class='wrap'>";
192
- echo '<h2>'. __( 'フォントテーマエディタ' , self::$text_domain ). '</h2>';
193
- do_action( 'typesquare_add_setting_before' );
194
- $auth_param = $this->get_auth_params();
195
- if ( false !== $auth_param['typesquare_auth']['auth_status'] ) {
196
- echo $this->get_font_select_form();
197
- }
198
- echo '</div>';
199
- }
200
  }
13
  return self::$instance;
14
  }
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  }
inc/admin-root.php CHANGED
@@ -4,6 +4,7 @@ class TypeSquare_Admin_Root extends TypeSquare_Admin_Base {
4
  private static $text_domain;
5
  private function __construct(){}
6
 
 
7
  public static function get_instance() {
8
  if ( ! isset( self::$instance ) ) {
9
  $c = __CLASS__;
@@ -20,7 +21,7 @@ class TypeSquare_Admin_Root extends TypeSquare_Admin_Base {
20
  }
21
  $post_type = array( 'post', 'page' );
22
  foreach ( $post_type as $type ) {
23
- add_meta_box( 'typesquare_post_metabox', __( 'TypeSquare Webfonts for SAKURA RS', self::$text_domain ), array( $this, 'typesquare_post_metabox_inside' ), $type, 'advanced', 'low' );
24
  }
25
  }
26
 
@@ -52,7 +53,64 @@ class TypeSquare_Admin_Root extends TypeSquare_Admin_Base {
52
  $option .= '</option>';
53
  }
54
  $html .= '<h3>'. __( 'フォントテーマから選ぶ', self::$text_domain ) . '</h3>';
55
- $html .= "<select name='typesquare_fonttheme[theme]'>{$option}</select>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  return $html;
57
  }
58
 
@@ -113,110 +171,207 @@ class TypeSquare_Admin_Root extends TypeSquare_Admin_Base {
113
  $param = $this->get_auth_params();
114
  $option_name = 'typesquare_auth';
115
  $nonce_key = TypeSquare_ST::OPTION_NAME;
 
 
 
116
  echo "<div class='wrap'>";
117
- echo '<h2>'. __( 'TypeSquare Webfonts Plugin for さくらのレンタルサーバ' , self::$text_domain ). '</h2>';
118
  do_action( 'typesquare_add_setting_before' );
119
- $autho_param = $this->get_auth_params();
120
- if ( false !== $autho_param['typesquare_auth']['auth_status'] ) {
121
- echo $this->get_font_theme_form();
122
- echo '<hr/>';
123
- echo "<div class='ts-custome_form_row'>";
124
- echo '<span><h3 class="toggleText toggleAdvanced mTop20">'. __( '上級者向けのカスタマイズ', self::$text_domain ). '<span class="advancedTriangle">▼</span></h3></span>';
125
- echo "<div class='ts-custome_form hidden'>";
126
- echo $this->get_font_target_form();
127
- echo $this->update_font_list_form();
128
- echo $this->_get_post_font_form();
129
- echo '</div>';
130
- echo '</div>';
131
- }
 
 
 
 
 
 
132
  do_action( 'typesquare_add_setting_after' );
133
  }
134
 
135
- private function _get_post_font_form() {
136
- $option_name = 'typesquare_fonttheme';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  $fonts = TypeSquare_ST_Fonts::get_instance();
138
- $param = $fonts->get_fonttheme_params();
139
- $keys = $param['typesquare_themes_keys'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  $html = '';
141
- $html .= '<hr/>';
142
- $html .= "<form method='post' action=''>";
143
- $html .= '<h3>'. __( '個別記事フォント設定' , self::$text_domain ). '</h3>';
144
- $html .= '<p>'. __( '個別記事作成画面にフォント設定を表示します。' , self::$text_domain ). '</p>';
145
- $html .= wp_nonce_field( 'ts_update_font_settings' , 'ts_update_font_settings' , true , false );
146
  $html .= "<table class='widefat form-table'>";
147
  $html .= '<tbody>';
148
- $html .= "<tr><th> {$keys['show_post_form']}</th><td>";
149
- $value = esc_attr( $param['typesquare_themes']['show_post_form'] );
150
- $html .= '<label>';
151
- $html .= "<input name='{$option_name}[show_post_form]' type='hidden' id='show_post_form' value='false' class='code'/>";
152
- $html .= "<input name='{$option_name}[show_post_form]' value='true' id='show_post_form' type='checkbox' class='code' ".checked( $value, 'true', true )."/>";
153
- $html .= __( '有効化する' , self::$text_domain );
154
- $html .= '</label>';
155
- $html .= '<p>'. __( 'デフォルトではフォントテーマ設定が無効化されています。' , self::$text_domain ). '</p>';
156
- $html .= '</td></tr>';
157
- $html .= '<tr><th></th><td style="position: relative; left: -208px;">' . get_submit_button( __( '個別記事フォント設定を更新する', self::$text_domain ) ) . '</td></tr>';
 
 
 
 
 
 
 
 
 
 
158
  $html .= '</tbody>';
 
159
  $html .= '</table>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  $html .= '</form>';
161
  return $html;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
 
 
163
  }
164
 
165
- public function get_font_theme_form() {
166
- $current = get_option('typesquare_fonttheme');
167
- $options = get_option( 'typesquare_custom_theme' );
168
- $edit_theme = false;
169
- $display = 'display:none';
170
- if ( isset( $_POST['typesquare_fonttheme'] ) ) {
171
- $edit_theme = esc_attr( $_POST['typesquare_fonttheme']['font_theme'] );
172
- $display = "";
173
- }
174
- $edit_theme = '';
175
- if( isset($_POST['ts_change_edit_theme']) ){
176
- $edit_theme = 'change';
177
- }
178
- $edit_mode = '';
179
- if( isset( $_POST['ts_edit_mode'] ) ) {
180
- $edit_mode = $_POST['ts_edit_mode'];
181
- }
182
- if($edit_theme === 'change'){$display = 'display:none';}
183
- if($edit_mode === 'delete' || $edit_mode === 'new' || $edit_theme === 'false' || !$edit_theme || !$edit_theme){ $display = 'display:none'; }
184
- else{$display = "";}
185
  $option_name = 'typesquare_fonttheme';
186
  $fonts = TypeSquare_ST_Fonts::get_instance();
187
  $param = $fonts->get_fonttheme_params();
188
- $all_font_theme = $fonts->load_all_font_data( );
189
- $font_theme = TypeSquare_ST_Fonttheme::get_instance();
190
- $custom_theme_json = $font_theme->get_custom_theme_json();
191
- if ( $current['font_theme'] && $options['theme'][ $current['font_theme'] ] && $edit_mode !== 'new' ) { $display = ""; }
192
- if( isset($_POST['typesquare_fonttheme']['font_theme']) && $_POST['typesquare_fonttheme']['font_theme'] !== 'new'){
193
- $param['typesquare_themes']['font_theme'] = $_POST['typesquare_fonttheme']['font_theme'];
194
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
  $html = '';
196
- $html .= '<hr/>';
197
- $html .= "<form method='post' action='' id='custmeFontForm'>";
198
- $html .= '<h3>'. __( 'フォントテーマ設定' , self::$text_domain ). '</h3>';
199
- $html .= '<p>'. __( 'フォントテーマを選択してください。' , self::$text_domain ). '<br/>';
200
- $html .= '<strong>'. __( '※「新しくテーマを作成する」から、自由にフォントテーマを作成できます。' , self::$text_domain ). '</strong></p>';
201
  $html .= wp_nonce_field( 'ts_update_font_settings' , 'ts_update_font_settings' , true , false );
202
- $html .= "<table class='widefat form-table'>";
203
- $html .= '<thead>';
204
- $html .= "<tr><th> {$param['typesquare_themes_keys']['font_theme']}</th></tr>";
205
- $html .= '</thead>';
206
- $html .= '<tbody>';
207
- $html .= '<tr><td>';
208
- $html .= "<select id='fontThemeSelect' name='{$option_name}[font_theme]'>";
209
- $html .= "<option value='false'>テーマを設定しない</option>";
210
- $newSelect = '';
211
- if($edit_mode === 'new'){
212
- $newSelect = 'selected';
213
- }
214
- $html .= "<option value='new' {$newSelect}>新しくテーマを作成する</option>";
215
  foreach ( $all_font_theme as $fonttheme_key => $fonttheme ) {
216
  $fonttheme_name = esc_attr( $fonttheme['name'] );
217
  $font_text = $this->_get_fonttheme_text( $fonttheme );
218
  $selected = '';
219
- if ( $fonttheme_key == $param['typesquare_themes']['font_theme'] && $fonttheme_key !== 'false' && !$newSelect ) {
220
  $selected = 'selected';
221
  }
222
  $html .= "<option value='{$fonttheme_key}' {$selected}>";
@@ -224,103 +379,126 @@ class TypeSquare_Admin_Root extends TypeSquare_Admin_Base {
224
  $html .= '</option>';
225
  }
226
  $html .= '</select>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
  $html .= $this->_get_custome_font_theme_list_form();
228
  $html .= "<table>";
229
  $html .= "<th>";
230
- $html .= get_submit_button( __( 'フォントテーマを更新する', self::$text_domain ), 'primary', 'fontThemeUpdateButton');
231
  $html .= "</th>";
232
  $html .= "<th>";
233
- $style = array("style"=>"margin-top:15px;".$display);
234
- $html .= get_submit_button( __( 'フォントテーマを削除する', self::$text_domain ), 'delete', 'fontThemeDeleteButton', null, $style);
235
  $html .= "</th>";
236
  $html .= "</table>";
237
  $html .= '<input type="hidden" name="typesquare_nonce_postmeta" id="typesquare_nonce_postmeta" value="' . wp_create_nonce( plugin_basename( __FILE__ ) ) . '" />';
238
- $html .= '</td></tr>';
239
- $html .= '</tbody>';
240
- $html .= '</table>';
241
  $html .= '</form>';
242
  return $html;
243
  }
244
 
245
- public function _get_custome_font_theme_list_form() {
246
- $options = get_option( 'typesquare_custom_theme' );
247
- $current = get_option('typesquare_fonttheme');
248
- $edit_theme = false;
249
- $hidden = ' hidden';
250
- $require = '';
251
- if ( isset( $_POST['typesquare_fonttheme'] ) && isset( $_POST['ts_change_edit_theme'] ) ) {
252
- $edit_theme = esc_attr( $_POST['typesquare_fonttheme']['font_theme'] );
253
- $hidden = ' hidden';
254
- }else if($current['font_theme'] && $current['font_theme'] !== 'false'){
255
- $edit_theme = $current['font_theme'];
256
- }
257
- $fonts = TypeSquare_ST_Fonts::get_instance();
258
- /* @TODO Debug Code
259
- $option_name = 'typesquare_fonttheme';
260
- $param = get_option( $option_name );
261
- unset($param['fonts']);
262
- update_option( $option_name, $param );
263
- $param = $fonts->get_fonttheme_options();
264
- */
265
- $edit_mode = '';
266
- if( isset( $_POST['ts_edit_mode'] ) ) {
267
- $edit_mode = $_POST['ts_edit_mode'];
268
- }
269
- $font_list = $theme_id = $theme_name = '';
270
- if ( $edit_theme && $options['theme'][ $edit_theme ] ) {
271
- $theme_name = $options['theme'][ $edit_theme ]['name'];
272
- $theme_id = $options['theme'][ $edit_theme ]['id'];
273
- $font_list = $options['fonts'][ $edit_theme ];
274
- $hidden = ' ';
275
- $edit_mode = 'update';
276
- }
277
  $html = '';
278
- if ( $theme_id ) {
279
- $theme_input = "<input type='hidden' id='ts_custome_theme_id' name='typesquare_custom_theme[id]' value='{$theme_id}' />";
280
- $html .= "<input type='hidden' name='ts_edit_mode' value='update' />";
281
- $html .= $theme_input;
282
- } else {
283
- $theme_id = uniqid();
284
- $theme_input = false;
285
- $html .= "<input type='hidden' name='ts_edit_mode' value='update' />";
286
- if(!$edit_theme || !$edit_mode || $edit_theme === 'false' || $edit_mode === 'delete' || $edit_mode === 'update'){
287
- $theme_id = '';
288
- }
289
- if($theme_id !== ''){
290
- $html .= "<input type='hidden' id='ts_custome_theme_id' name='typesquare_custom_theme[id]' value='{$theme_id}' maxlength='16' style='width:100%;' pattern='^[0-9A-Za-z]+$' required/>";
291
- }else {
292
- $html .= '<input type="hidden" name="ts_custome_theme_id" id="typesquare_custom_theme[id]" value="' . wp_create_nonce( plugin_basename( __FILE__ ) ) . '" />';
293
- }
294
- }
295
- if($edit_mode === 'new'){
296
- $hidden = ' ';
297
- }
298
- if($edit_theme === 'new'){
299
- $hidden = ' ';
300
- }
301
- if(!$edit_theme || !$edit_mode || $edit_theme === 'false' || $edit_mode === 'delete'){
302
- $hidden = ' hidden';
303
- }
304
- if($hidden === ' '){
305
- $require = 'required';
306
- }
307
- $html .= '<hr/>';
308
- $html .= "<div id='customeFontThemeForm'{$hidden}>";
309
  $html .= wp_nonce_field( 'ts_update_font_name_setting', 'ts_update_font_name_setting', true , false );
310
  $html .= "<table class='widefat' style='border: 0px'>";
311
  $html .= '<tbody>';
312
- $html .= "<tr><th width='20%''>テーマタイトル</th><td>";
313
- $html .= "<input type='hidden' id='current_custome_font_name' value='{$theme_name}'/>";
314
- $html .= "<input type='text' id='custome_font_name' name='typesquare_custom_theme[name]' value='{$theme_name}' maxlength='16' style='width:30%;' {$require}/>";
315
  $html .= '</td></tr>';
 
 
 
 
316
  $html .= '</tbody>';
317
  $html .= '</table>';
318
  $html .= "<div id='ts-react-search-font'></div>";
319
  $html .= "</div>";
 
320
  $html .= $this->_get_script( $font_list );
321
  return $html;
322
  }
323
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
324
  private function _get_script( $font_list ) {
325
  $vars = "var form_id = '#". self::MENU_FONTTHEME. "';";
326
  $vars .= "var notify_text = '". __( 'フォントを1種類以上選択してください。', self::$text_domain ). "';";
@@ -395,58 +573,133 @@ EOM;
395
  return $font_text;
396
  }
397
 
398
- public function get_font_target_form() {
399
  $fonts = TypeSquare_ST_Fonts::get_instance();
400
- $param = $fonts->get_fonttheme_params();
401
- $html = '';
402
- $html .= "<form method='post' action=''>";
403
- $html .= '<h3>'. __( 'フォント設定クラス' , self::$text_domain ). '</h3>';
404
- $html .= '<p>'. __( 'フォントを適用するクラスを指定します。' , self::$text_domain ). '</p>';
405
  $html .= "<table class='widefat form-table'>";
406
  $html .= '<thead>';
407
- $key = $param['typesquare_themes_keys'];
408
- $html .= "<tr><th> {$key['title_target']}</th><th> {$key['lead_target']}</th><th> {$key['text_target']}</th><th> {$key['bold_target']}</th></tr>";
409
  $html .= '</thead>';
410
- $html .= '<tbody>';
411
- $data = $param['typesquare_themes'];
412
- $html .= "<tr><td><input type='text' name='typesquare_fonttheme[title_target]' value='{$data['title_target']}' required/></td>";
413
- $html .= "<td><input type='text' name='typesquare_fonttheme[lead_target]' value='{$data['lead_target']}' required/></td>";
414
- $html .= "<td><input type='text' name='typesquare_fonttheme[text_target]' value='{$data['text_target']}' required/></td>";
415
- $html .= "<td><input type='text' name='typesquare_fonttheme[bold_target]' value='{$data['bold_target']}' required/></td></tr>";
416
- $html .= "<tr><td>";
417
- $html .= get_submit_button( __( '設定クラスを更新する', self::$text_domain ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
418
  $html .= "</td></tr>";
419
  $html .= '</tbody>';
420
  $html .= '</table>';
421
- $html .= wp_nonce_field( 'ts_update_font_settings' , 'ts_update_font_settings' , true , false );
422
- $html .= '</form>';
423
  return $html;
424
  }
425
 
426
- public function update_font_list_form() {
 
 
427
  $fonts = TypeSquare_ST_Fonts::get_instance();
428
- $auth_param = $this->get_auth_params();
429
- if ( false == $auth_param['typesquare_auth']['api_status'] ) {
430
- return;
 
 
 
431
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
432
  $font_file_path = path_join( TS_PLUGIN_PATH , 'inc/font.json' );
433
- $param = date("y/m/d", filemtime($font_file_path));
 
 
434
  $html = '';
435
- $html .= "<form method='post' action=''>";
436
- $html .= '<h3>'. __( 'フォント一覧の更新' , self::$text_domain ). '</h3>';
437
- $html .= '<p>'. __( '利用可能フォントの一覧を最新版に更新します。' , self::$text_domain ). '</p>';
 
438
  $html .= "<table class='widefat form-table'>";
439
  $html .= '<thead>';
440
  $html .= "<tr></tr>";
441
  $html .= '</thead>';
442
  $html .= "<tbody>";
443
- $html .= "<tr><td style='width: 1%;'>".get_submit_button( __( 'フォント一覧を更新する', self::$text_domain ) )."</td>";
444
- $html .= "<td>最終更新日: ".$param."</td></tr>";
445
  $html .= '</tbody>';
446
  $html .= '</table>';
 
447
  $html .= wp_nonce_field( 'ts_update_font_list' , 'ts_update_font_list' , true , false );
448
- $html .= '</form>';
449
  return $html;
450
  }
451
-
452
  }
4
  private static $text_domain;
5
  private function __construct(){}
6
 
7
+
8
  public static function get_instance() {
9
  if ( ! isset( self::$instance ) ) {
10
  $c = __CLASS__;
21
  }
22
  $post_type = array( 'post', 'page' );
23
  foreach ( $post_type as $type ) {
24
+ add_meta_box( 'typesquare_post_metabox', __( 'TS Webfonts for SAKURA RS', self::$text_domain ), array( $this, 'typesquare_post_metabox_inside' ), $type, 'advanced', 'low' );
25
  }
26
  }
27
 
53
  $option .= '</option>';
54
  }
55
  $html .= '<h3>'. __( 'フォントテーマから選ぶ', self::$text_domain ) . '</h3>';
56
+ $preview = <<<EOM
57
+ jQuery( document ).ready(function() {
58
+ window.onload = function () {
59
+ theme_preview_new();
60
+ };
61
+
62
+ jQuery('#choiceThemeNew').change(function() {
63
+ theme_preview_new();
64
+ });
65
+
66
+ function theme_preview_new() {
67
+ var select_val = jQuery('.font_theme_select_pre_new option:selected').val();
68
+ if( select_val === "false") {
69
+ jQuery('.pre_title').text("");
70
+ jQuery('.pre_lead').text("");
71
+ jQuery('.pre_body').text("");
72
+ jQuery('.pre_bold').text("");
73
+ } else {
74
+ var val = document.getElementById("selected-get-" + select_val);
75
+ var theme_data = JSON.parse(val.value);
76
+
77
+ jQuery('#theme_preview').val(val);
78
+
79
+ jQuery('.pre_title').text(theme_data.fonts.title);
80
+ jQuery('.pre_title').css("font-family", `'\${theme_data.fonts.title}'`);
81
+
82
+ jQuery('.pre_lead').text(theme_data.fonts.lead);
83
+ jQuery('.pre_lead').css("font-family", `'\${theme_data.fonts.lead}'`);
84
+
85
+ if (theme_data.fonts.content) {
86
+ jQuery('.pre_body').text(theme_data.fonts.content);
87
+ jQuery('.pre_body').css("font-family", `'\${theme_data.fonts.content}'`);
88
+ } else {
89
+ jQuery('.pre_body').text(theme_data.fonts.text);
90
+ jQuery('.pre_body').css("font-family", `'\${theme_data.fonts.text}'`);
91
+ }
92
+
93
+ jQuery('.pre_bold').text(theme_data.fonts.bold);
94
+ jQuery('.pre_bold').css("font-family", `'\${theme_data.fonts.bold}'`);
95
+ }
96
+ }
97
+ });
98
+ EOM;
99
+ $html = '<script>';
100
+ $html .= $preview;
101
+ $html .= '</script>';
102
+ $html .= '<div id="choiceThemeNew">';
103
+ $html .= "<select name='typesquare_fonttheme[theme]' class='font_theme_select_pre_new'>{$option}</select>";
104
+ $html .= '<h3>プレビュー</h3>';
105
+ $html .= '<div><p class="title">見出し:<p class="pre_title"></p></p></div>';
106
+ $html .= '<div><p class="title">リード:<p class="pre_lead"></p></p></div>';
107
+ $html .= '<div><p class="title">本文:<p class="pre_body"></p></p></div>';
108
+ $html .= '<div><p class="title">太字:<p class="pre_bold"></p></p></div>';
109
+ $html .= '<input type="hidden" id="theme_preview" />';
110
+ foreach ($all_font_theme as $fonttheme_key => $fonttheme) {
111
+ $html .= "<input type='hidden' id='selected-get-{$fonttheme_key}' value='" . json_encode($fonttheme) . "'>";
112
+ }
113
+ $html .= '</div>';
114
  return $html;
115
  }
116
 
171
  $param = $this->get_auth_params();
172
  $option_name = 'typesquare_auth';
173
  $nonce_key = TypeSquare_ST::OPTION_NAME;
174
+ $auth_param = $this->get_auth_params();
175
+ echo "<style type='text/css' rel='stylesheet'>";
176
+ echo "</style>";
177
  echo "<div class='wrap'>";
178
+ echo '<h2>'. __( 'TS Webfonts for SAKURA RS' , self::$text_domain ). '</h2>';
179
  do_action( 'typesquare_add_setting_before' );
180
+ echo '<hr />';
181
+ echo '<span><h3 class="toggleText toggleAdvanced_font mTop20">'. __( '投稿記事フォント設定', self::$text_domain ). '<span class="advancedTriangle advancedTriangle_font">▼</span></h3></span>';
182
+ echo "<div class='ts-custome_form_font hidden'>";
183
+ echo $this->_get_post_font_form($auth_param);
184
+ echo '</div>';
185
+ echo '</div>';
186
+
187
+ echo '<hr/>';
188
+ echo '<span><h3 class="toggleText toggleAdvanced_site mTop20">'. __('サイトフォント設定', self::$text_domain). '<span class="advancedTriangle advancedTriangle_site">▼</span></h3></span>';
189
+ echo "<div class='ts-custome_form_site hidden'>";
190
+ echo $this->_get_site_font_form();
191
+ echo '</div>';
192
+ echo '<hr/>';
193
+ echo '<span><h3 class="toggleText toggleAdvanced_article mTop20">'. __('カスタムテーマ編集', self::$text_domain). '<span class="advancedTriangle advancedTriangle_article">▼</span></h3></span>';
194
+ echo "<div class='ts-custome_form_article hidden'>";
195
+ echo '<div class="ts-custum_block">';
196
+ echo $this->_get_font_theme_custom_form();
197
+ echo '</div>';
198
+ echo '</div>';
199
  do_action( 'typesquare_add_setting_after' );
200
  }
201
 
202
+ private function _get_post_font_form($auth_param) {
203
+ $html = "<form method='post' action=''>";
204
+ $html .= '<p>投稿記事に対するWebフォント適用方法を設定します。</p>';
205
+ $html .= '<div class="block_wrap">';
206
+ $html .= '<p class="block_title">'. __('投稿記事に適用するフォント設定', self::$text_domain). '</p>';
207
+ $html .= '<div class="label_wrapper">';
208
+ $html .= '<label class="custum_form_ladio"><input name="fontThemeUseType" type="radio" value="1">指定しない';
209
+ $html .= '<p class="setting_read">フォントテーマを適用しません。</p>';
210
+ $html .= '</label>';
211
+ $html .= '<label class="custum_form_ladio"><input name="fontThemeUseType" type="radio" value="2" class="radio_custum_font_theme">共通テーマ指定';
212
+ $html .= '<p class="setting_read">全ての投稿に設定したフォントテーマが適用されます。</p>';
213
+ $html .= '</label>';
214
+ $html .= $this->_get_font_theme_form();
215
+ $html .= '<label class="custum_form_ladio"><input name="fontThemeUseType" type="radio" value="3">個別テーマ指定';
216
+ $html .= '<p class="setting_read">投稿ごとに設定したフォントテーマが適用されます。</p>';
217
+ $html .= '</label>';
218
+ $html .= '<label class="custum_form_ladio"><input name="fontThemeUseType" type="radio" value="4">直接指定(上級者向け)';
219
+ $html .= '<p class="setting_read">CSSセレクターを指定して適用するウェブフォントを選べます。</p>';
220
+ $html .= '</label>';
221
+ $html .= $this->_get_font_target_form();
222
+
223
  $fonts = TypeSquare_ST_Fonts::get_instance();
224
+ $fonttheme_params = $fonts->get_fonttheme_params();
225
+
226
+ if (empty($auth_param['typesquare_auth']['fontThemeUseType'])) {
227
+ if (empty($fonttheme_params['typesquare_themes']['font_theme']) || $fonttheme_params['typesquare_themes']['font_theme'] === "false") {
228
+ $html .= '<input type="hidden" id="activeAdvanced_theme" value="1">';
229
+ } else {
230
+ $html .= '<input type="hidden" id="activeAdvanced_theme" value="2">';
231
+ }
232
+ } else {
233
+ if (!empty($fonttheme_params['typesquare_themes']['font_theme']) && $auth_param['typesquare_auth']['fontThemeUseType'] === "1") {
234
+ $html .= '<input type="hidden" id="activeAdvanced_theme" value="2">';
235
+ } else {
236
+ $html .= '<input type="hidden" id="activeAdvanced_theme" value="' . $auth_param['typesquare_auth']['fontThemeUseType'] . '">';
237
+ }
238
+ }
239
+
240
+ $html .= '</div>';
241
+ $html .= '</div>';
242
+ $html .= get_submit_button( __( '投稿フォント設定を保存する', self::$text_domain ) );
243
+ $html .= '</form>';
244
+ return $html;
245
+ }
246
+
247
+ private function _get_auth_form($auth_param) {
248
  $html = '';
249
+ $nonce_key = TypeSquare_ST::OPTION_NAME;
250
+ $html .= "<form method='post' action='' id='authForm'>";
251
+ $html .= wp_nonce_field( $nonce_key, self::MENU_ID , true , false );
 
 
252
  $html .= "<table class='widefat form-table'>";
253
  $html .= '<tbody>';
254
+ $param = $this->get_auth_params();
255
+ $option_name = 'typesquare_auth';
256
+ foreach ( $param['typesquare_auth_keys'] as $key => $title ) {
257
+ $html .= "<tr><td>";
258
+ $name = "{$option_name}[{$key}]";
259
+ $type = 'hidden';
260
+ $name = esc_attr( $name );
261
+ $id = esc_attr( $key );
262
+ $value = "SAKURA";
263
+ $html .= "<input
264
+ name='{$name}'
265
+ id='{$id}'
266
+ value='{$value}'
267
+ required
268
+ type='{$type}'
269
+ data-parsley-trigger='change'
270
+ class='regular-text code'
271
+ />";
272
+ $html .= '</td></tr>';
273
+ }
274
  $html .= '</tbody>';
275
+ $html .= '</div>';
276
  $html .= '</table>';
277
+ if ( '' !== $auth_param['typesquare_auth']['typesquare_id'] ) {
278
+ $html .= '<div class="block_wrap">';
279
+ $html .= "<table class='widefat form-table'>";
280
+ $html .= '<tbody>';
281
+ $html .= $this->_get_font_fade_form();
282
+ $html .= $this->_get_auto_load_font_form();
283
+ $html .= $this->_get_apply_to_hidden_form();
284
+ $html .= $this->_get_apply_to_pseudo_form();
285
+ $html .= '</tbody>';
286
+ $html .= "</table>";
287
+ $html .= '</div>';
288
+ }
289
+
290
+ $html .= $this->_update_font_list_form();
291
+ $html .= get_submit_button( __( 'TypeSquare設定を保存する', self::$text_domain ) );
292
+
293
  $html .= '</form>';
294
  return $html;
295
+ }
296
+
297
+ private function _get_ad_area() {
298
+ $html = '<script>';
299
+ $endpoint = path_join( TS_PLUGIN_URL , 'inc/font.json' );
300
+ $html .= "var json_endpoint = '{$endpoint}';";
301
+ if ( $font_list ) {
302
+ $html .= "var current_font = ". json_encode( $font_list ) .';';
303
+ } else {
304
+ $html .= "var current_font = false;";
305
+ }
306
+ $html .= $script;
307
+ $html .= '</script>';
308
+ $html .= "<div class='ts-ad-area'>";
309
+ $messages[] = __( '・ご利用にはTypeSquareの会員登録が必要です (<a href="https://typesquare.com">https://typesquare.com</a>)', self::$text_domain );
310
+ $messages[] = __( '・利用プランによっては利用可能な書体数に上限がありますので、上限を超えて設定したフォントは配信されません。', self::$text_domain );
311
+ $messages[] = ' '. __( '・無料プラン:1書体', self::$text_domain );
312
+ $messages[] = ' '. __( '', self::$text_domain );
313
+ $messages[] = ' '. __( '・スタンダードIプラン:3書体', self::$text_domain );
314
+ $html .= '<ul>';
315
+ $html .= '<li style="padding-bottom: 5px;"><span href="#" class="toggleLimit toggleText">' . __( 'ご利用上の注意', self::$text_domain ). '</span><span class="textMute elimitTriangl" style="float: right;">▼</span></li>';
316
+ $html .= '<div id="ts-ad-area-messages" class="ts-hidden">';
317
+ foreach ( $messages as $message ) {
318
+ $html .= "<li>{$message}</li>";
319
+ }
320
+ $html .= "<p><a href='https://typesquare.com/ja/service/plan' target='_blank' class='button button-hero'>". __( '→プランを見てみる', self::$text_domain ) . '</a></p>';
321
+ $html .= '</div>';
322
+ $html .= '</ul>';
323
+ $html .= '</div>';
324
+ $html .= '<div class="mTop30">';
325
+ $html .= '<h3 class="mBottom10">'. __( 'ご利用方法' , self::$text_domain ). '</h3>';
326
+ $html .= '<div>'. __( 'TypeSquare Webfontsについての内容を説明しています' , self::$text_domain ). '</div>';
327
+ $html .= '<div>'. __( '詳しくは' , self::$text_domain ). "<a href='https://blog.typesquare.com/archives/55354' target='_blank'>". __( 'こちら' , self::$text_domain ). '</a></div>';
328
+ $html .= '</div>';
329
 
330
+ return $html;
331
  }
332
 
333
+ private function _get_font_fade_form() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
  $option_name = 'typesquare_fonttheme';
335
  $fonts = TypeSquare_ST_Fonts::get_instance();
336
  $param = $fonts->get_fonttheme_params();
337
+ $keys = $param['typesquare_themes_keys'];
338
+ $html .= "<tr><th>{$keys['fade_in']}</th><td>";
339
+ $value = esc_attr( $param['typesquare_themes']['fade_in'] );
340
+ if ( $value ) {
341
+ $optional = 'checked';
 
342
  }
343
+
344
+ $html .="<label class='switch__label' ><input name='{$option_name}[fade_in]'type='checkbox' class='switch__input' id='fade_in' value='1' ". checked( $value, true, false ). "/><span class='switch__content'></span><span class='switch__circle'></span></label><span>有効化する</span>";
345
+ $html .= '</td></tr>';
346
+ if ( $value ) {
347
+ $state = 'ts-table-low';
348
+ } else {
349
+ $state = 'hidden';
350
+ }
351
+ $html .= "<tr id='hidden_time' class='{$state}'><th>{$keys['fade_time']}</th><td>";
352
+ $value = esc_attr( $param['typesquare_themes']['fade_time'] );
353
+ $optional = "size='5' maxlength='5'";
354
+ $html .= "<input name='{$option_name}[fade_time]' type='text' id='fade_time' value='{$value}' class='code' {$optional}/>";
355
+ $html .= __( 'ミリ秒(0〜10000の整数)', self::$text_domain );
356
+ $html .= '</td></tr>';
357
+
358
+ return $html;
359
+ }
360
+
361
+ private function _get_font_theme_form() {
362
+ $option_name = 'typesquare_fonttheme';
363
+ $fonts = TypeSquare_ST_Fonts::get_instance();
364
+ $param = $fonts->get_fonttheme_params();
365
  $html = '';
 
 
 
 
 
366
  $html .= wp_nonce_field( 'ts_update_font_settings' , 'ts_update_font_settings' , true , false );
367
+ $html .= '<div id="choiceTheme" class="font_custum_select">';
368
+ $html .= "<select name='{$option_name}[font_theme]' class='font_theme_select_pre'>";
369
+ $all_font_theme = $fonts->load_all_font_data();
 
 
 
 
 
 
 
 
 
 
370
  foreach ( $all_font_theme as $fonttheme_key => $fonttheme ) {
371
  $fonttheme_name = esc_attr( $fonttheme['name'] );
372
  $font_text = $this->_get_fonttheme_text( $fonttheme );
373
  $selected = '';
374
+ if ( $fonttheme_key == $param['typesquare_themes']['font_theme']) {
375
  $selected = 'selected';
376
  }
377
  $html .= "<option value='{$fonttheme_key}' {$selected}>";
379
  $html .= '</option>';
380
  }
381
  $html .= '</select>';
382
+ $html .= '<h3>プレビュー</h3>';
383
+ $html .= '<div><p class="title">見出し:<p class="pre_title"></p></p></div>';
384
+ $html .= '<div><p class="title">リード:<p class="pre_lead"></p></p></div>';
385
+ $html .= '<div><p class="title">本文:<p class="pre_body"></p></p></div>';
386
+ $html .= '<div><p class="title">太字:<p class="pre_bold"></p></p></div>';
387
+ $html .= '<input type="hidden" id="theme_preview" />';
388
+ foreach ($all_font_theme as $fonttheme_key => $fonttheme) {
389
+ $html .= "<input type='hidden' id='selected-get-{$fonttheme_key}' value='" . json_encode($fonttheme) . "'>";
390
+ }
391
+ $html .= wp_nonce_field( 'ts_update_font_settings' , 'ts_update_font_settings' , true , false );
392
+
393
+ $value = esc_attr( $param['typesquare_themes']['show_post_form'] ) == "true" ? true : false;
394
+ $html .= '</div>';
395
+ $html .= '<input type="hidden" name="typesquare_nonce_postmeta" id="typesquare_nonce_postmeta" value="' . wp_create_nonce( plugin_basename( __FILE__ ) ) . '" />';
396
+ return $html;
397
+ }
398
+
399
+ private function _get_font_theme_custom_form() {
400
+ $option_name = 'typesquare_fonttheme';
401
+ $fonts = TypeSquare_ST_Fonts::get_instance();
402
+ $param = $fonts->get_fonttheme_params();
403
+ if( isset($_POST['typesquare_fonttheme']['font_theme']) && $_POST['typesquare_fonttheme']['font_theme'] !== 'new'){
404
+ $param['typesquare_themes']['font_theme'] = $_POST['typesquare_fonttheme']['font_theme'];
405
+ }
406
+ $html = '';
407
+ $html .= "<form method='post' action='' id='custmeFontForm' class='b__font_theme_form'>";
408
+ $html .= '<p>お好きなフォントを組み合わせてテーマを作成できます。また、作成したテーマの編集ができます。</p>';
409
+ $html .= wp_nonce_field( 'ts_update_font_settings' , 'ts_update_font_settings' , true , false );
410
+ $html .= '<div class="font_custum_select">';
411
+ $html .= "<select id='fontThemeSelect' name='{$option_name}[font_theme]'>";
412
+ $html .= "<option value='new' selected>新しくテーマを作成する</option>";
413
+ $coustam_font_theme = $fonts->load_coustam_font_data();
414
+ if (!empty($coustam_font_theme)) {
415
+ foreach ( $coustam_font_theme as $fonttheme_key => $fonttheme ) {
416
+ $fonttheme_name = esc_attr( $fonttheme['name'] );
417
+ $font_text = $this->_get_fonttheme_text( $fonttheme );
418
+ $selected = '';
419
+ $html .= "<option value='{$fonttheme_key}' {$selected}>";
420
+ $html .= "{$fonttheme_name} ( {$font_text} )";
421
+ $html .= '</option>';
422
+ }
423
+ }
424
+ $html .= '</select>';
425
+ if (!empty($coustam_font_theme)) {
426
+ foreach ($coustam_font_theme as $fonttheme_key => $fonttheme) {
427
+ $html .= "<input type='hidden' id='{$fonttheme_key}' value='" . json_encode($fonttheme) . "'>";
428
+ }
429
+ }
430
+ $html .= '</div>';
431
+
432
  $html .= $this->_get_custome_font_theme_list_form();
433
  $html .= "<table>";
434
  $html .= "<th>";
435
+ $html .= get_submit_button( __( 'テーマを保存する', self::$text_domain ), 'primary', 'fontThemeUpdateButton');
436
  $html .= "</th>";
437
  $html .= "<th>";
438
+ $style = array("style"=>"margin-top:15px; display:none;");
439
+ $html .= get_submit_button( __( 'テーマを削除する', self::$text_domain ), 'delete', 'fontThemeDeleteButton', null, $style);
440
  $html .= "</th>";
441
  $html .= "</table>";
442
  $html .= '<input type="hidden" name="typesquare_nonce_postmeta" id="typesquare_nonce_postmeta" value="' . wp_create_nonce( plugin_basename( __FILE__ ) ) . '" />';
 
 
 
443
  $html .= '</form>';
444
  return $html;
445
  }
446
 
447
+ private function _get_custome_font_theme_list_form() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
448
  $html = '';
449
+ $html .= "<input type='hidden' name='ts_edit_mode' value='new' />";
450
+ $html .= '<input type="hidden" id="ts_custome_theme_id" name="typesquare_custom_theme[id]" value="' . uniqid() . '" />';
451
+ $html .= "<div id='customeFontThemeForm'>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
452
  $html .= wp_nonce_field( 'ts_update_font_name_setting', 'ts_update_font_name_setting', true , false );
453
  $html .= "<table class='widefat' style='border: 0px'>";
454
  $html .= '<tbody>';
455
+ $html .= "<tr><th width='240px' style='padding-left:0;'>テーマタイトル</th><td>";
456
+ $html .= "<input type='hidden' id='current_custome_font_name' name='typesquare_custom_theme[name]' value=''/>";
457
+ $html .= "<input type='text' id='custome_font_name' name='typesquare_custom_theme[name]' value='' maxlength='16' style='width:50%;' required/>";
458
  $html .= '</td></tr>';
459
+ $html .= $this->_get_site_font_form_tr("見出し", "", "typesquare_custom_theme[fonts][title][type]");
460
+ $html .= $this->_get_site_font_form_tr("リード", "", "typesquare_custom_theme[fonts][lead][type]");
461
+ $html .= $this->_get_site_font_form_tr("本文", "", "typesquare_custom_theme[fonts][text][type]");
462
+ $html .= $this->_get_site_font_form_tr("太字", "", "typesquare_custom_theme[fonts][bold][type]");
463
  $html .= '</tbody>';
464
  $html .= '</table>';
465
  $html .= "<div id='ts-react-search-font'></div>";
466
  $html .= "</div>";
467
+ $font_list = array();
468
  $html .= $this->_get_script( $font_list );
469
  return $html;
470
  }
471
 
472
+ private function _get_site_font_form() {
473
+ $fonts = TypeSquare_ST_Fonts::get_instance();
474
+ $value = $fonts->get_site_font_setting();
475
+ $html = "<form method='post' action='' id='siteFontForm'>";
476
+ $html .= '<p>タイトルなど、ウェブサイト共通部分のフォント設定です</p>';
477
+ $html .= '<table class="widefat form-table">';
478
+ $html .= '<tbody>';
479
+ $html .= $this->_get_site_font_form_tr("サイトタイトル", $value['title_fontname'], "title_fontname");
480
+ $html .= $this->_get_site_font_form_tr("サイトキャッチコピー", $value['catchcopy_fontname'], "catchcopy_fontname");
481
+ $html .= $this->_get_site_font_form_tr("ウィジェットタイトル", $value['widget_title_fontname'], "widget_title_fontname");
482
+ $html .= $this->_get_site_font_form_tr("ウィジェット", $value['widget_fontname'], "widget_fontname");
483
+ $html .= '</tbody>';
484
+ $html .= "</table>";
485
+ $html .= get_submit_button( __( 'サイトフォント設定を保存する', self::$text_domain ) );
486
+ $html .= wp_nonce_field( 'ts_update_site_font_settings' , 'ts_update_site_font_settings' , true , false );
487
+ $html .= '</form>';
488
+ return $html;
489
+ }
490
+
491
+ private function _get_site_font_form_tr ($title, $value, $input_name) {
492
+ $html = "<tr><th style='padding-left:0;'><span>{$title}</span></th>";
493
+ $html .= '<td class="font_table_td">';
494
+ $html .= '<div class="w_font_select">';
495
+ $html .= "<input class='fontlist_input' autocomplete='off' value='{$value}' style='font-family: {$value}' placeholder='未設定'/>";
496
+ $html .= "<div class='w_fontlist b_def_fontlist'></div>";
497
+ $html .= "</div>";
498
+ $html .= "</td><input value='{$value}' type='hidden' name='{$input_name}' id='fontlist_select' class='fontlist_select'/></tr>";
499
+ return $html;
500
+ }
501
+
502
  private function _get_script( $font_list ) {
503
  $vars = "var form_id = '#". self::MENU_FONTTHEME. "';";
504
  $vars .= "var notify_text = '". __( 'フォントを1種類以上選択してください。', self::$text_domain ). "';";
573
  return $font_text;
574
  }
575
 
576
+ private function _get_font_target_form() {
577
  $fonts = TypeSquare_ST_Fonts::get_instance();
578
+ $array_input = $fonts->get_font_pro_setting();
579
+ $html = "<div class='b__font_target_form'>";
 
 
 
580
  $html .= "<table class='widefat form-table'>";
581
  $html .= '<thead>';
582
+ $html .= "<tr><th style='width: 25%; padding-left: 45px;'>フォント選択</th><th style='width: 75%; padding-left: 14px;'>適用箇所(CSSセレクターで指定)</th></tr>";
 
583
  $html .= '</thead>';
584
+ $html .= "<tbody class='cls_tb'>";
585
+
586
+ if( !empty( $array_input )) {
587
+ $i = 0;
588
+ foreach($array_input as $key => $value){
589
+ $i++;
590
+ $html .= "<tr id='font_setting'><td>";
591
+ $html .= "<div class='cls_delete_btn cls_delete_btn_selected'>×</div>";
592
+ $html .= "<input id='fontlist_input' class='fontlist_input' autocomplete='off' value='{$value['fontlist_fontname']}' style='font-family: {$value['fontlist_fontname']}'/>";
593
+ $html .= "<div class='w_fontlist b_def_fontlist'></div>";
594
+ $html .= "</td>";
595
+ $html .= "<td class='add_class_td'><input type='text' class='class_input' value=''/><button type='button' id='add_box' class='add_box'>追加</button>";
596
+
597
+ $cls_name = $value['fontlist_cls'];
598
+ foreach($cls_name as $cls_value){
599
+ $html .= "<p class='add_class_label'>{$cls_value} ×";
600
+ $html .= "<input name='fontlist_cls{$i}[]' type='hidden' value='{$cls_value}' />";
601
+ $html .= "</p>";
602
+ };
603
+
604
+ $html .= "</td>";
605
+ $html .= "<input value='{$value['fontlist_fontname']}' type='hidden' name='fontlist_fontname{$i}' id='fontlist_select' class='fontlist_select'/>";
606
+ $html .= "</tr>";
607
+ };
608
+ } else {
609
+ $html .= "<tr id='font_setting'><td>";
610
+ $html .= "<div class='cls_delete_btn cls_delete_btn_selected'>×</div>";
611
+ $html .= "<input id='fontlist_input' class='fontlist_input' autocomplete='off' placeholder='未設定'>";
612
+ $html .= "<div class='w_fontlist'><ul class='font_select_menu'></ul></div>";
613
+ $html .= "</td>";
614
+ $html .= "<td class='add_class_td'><input type='text' class='class_input' value=''/><button type='button' id='add_box' class='add_box'>追加</button></td>";
615
+ $html .= "<input value='' type='hidden' name='fontlist_fontname1' id='fontlist_select' class='fontlist_select'/>";
616
+ $html .= "</tr>";
617
+ };
618
+
619
+ $html .= "<tr id='addbtn_tr'><td>";
620
+ $html .= "<button type='button' id='input_add_btn'>+</button>";
621
  $html .= "</td></tr>";
622
  $html .= '</tbody>';
623
  $html .= '</table>';
624
+ $html .= '</div>';
625
+ $html .= wp_nonce_field( 'ts_update_font_pro_settings' , 'ts_update_font_pro_settings' , true , false );
626
  return $html;
627
  }
628
 
629
+ //フォント自動読み込み設定
630
+ private function _get_auto_load_font_form(){
631
+ $option_name = 'typesquare_fonttheme';
632
  $fonts = TypeSquare_ST_Fonts::get_instance();
633
+ $param = $fonts->get_fonttheme_params();
634
+ $keys = $param['typesquare_themes_keys'];
635
+ $html .= "<tr><th>{$keys['auto_load_font']}</th><td>";
636
+ $value = esc_attr( $param['typesquare_themes']['auto_load_font'] );
637
+ if ( $value ) {
638
+ $optional = 'checked';
639
  }
640
+ $html .="<label class='switch__label'><input name='{$option_name}[auto_load_font]'type='checkbox' class='switch__input' id='auto_load_font' value='1' ". checked( $value, true, false ). "/><span class='switch__content'></span><span class='switch__circle'></span></label><span>有効化する</span>";
641
+ $html .= '</td></tr>';
642
+
643
+ return $html;
644
+ }
645
+
646
+ // 疑似要素フォント読込
647
+ private function _get_apply_to_pseudo_form() {
648
+ $option_name = 'typesquare_fonttheme';
649
+ $fonts = TypeSquare_ST_Fonts::get_instance();
650
+ $param = $fonts->get_fonttheme_params();
651
+ $keys = $param['typesquare_themes_keys'];
652
+ $html .= "<tr><th>{$keys['apply_to_pseudo']}</th><td>";
653
+ $value = esc_attr( $param['typesquare_themes']['apply_to_pseudo'] );
654
+ if ( $value ) {
655
+ $optional = 'checked';
656
+ }
657
+ $html .="<label class='switch__label'><input name='{$option_name}[apply_to_pseudo]'type='checkbox' class='switch__input' id='apply_to_pseudo' value='1' ". checked( $value, true, false ). "/><span class='switch__content'></span><span class='switch__circle'></span></label><span>有効化する</span>";
658
+ $html .= '</td></tr>';
659
+
660
+ return $html;
661
+ }
662
+
663
+ // 非表示要素フォント読込
664
+ private function _get_apply_to_hidden_form() {
665
+ $option_name = 'typesquare_fonttheme';
666
+ $fonts = TypeSquare_ST_Fonts::get_instance();
667
+ $param = $fonts->get_fonttheme_params();
668
+ $keys = $param['typesquare_themes_keys'];
669
+ $html .= "<tr><th>{$keys['apply_to_hidden']}</th><td>";
670
+ $value = esc_attr( $param['typesquare_themes']['apply_to_hidden'] );
671
+ if ( $value ) {
672
+ $optional = 'checked';
673
+ }
674
+ $html .="<label class='switch__label'><input name='{$option_name}[apply_to_hidden]'type='checkbox' class='switch__input' id='apply_to_hidden' value='1' ". checked( $value, true, false ). "/><span class='switch__content'></span><span class='switch__circle'></span></label><span>有効化する</span>";
675
+ $html .= '</td></tr>';
676
+
677
+ return $html;
678
+ }
679
+
680
+ private function _update_font_list_form() {
681
+ $fonts = TypeSquare_ST_Fonts::get_instance();
682
  $font_file_path = path_join( TS_PLUGIN_PATH , 'inc/font.json' );
683
+ $settings_timezone = get_option('timezone_string');
684
+ date_default_timezone_set($settings_timezone);
685
+ $param = date("y/m/d H:i:s", filemtime($font_file_path));
686
  $html = '';
687
+ $html .= '<div class="block_wrap">';
688
+ $html .= '<div>';
689
+ $html .= '<h3 class="block_title">'. __( 'フォントリストの更新' , self::$text_domain ). '</h3>';
690
+ $html .= '</div>';
691
  $html .= "<table class='widefat form-table'>";
692
  $html .= '<thead>';
693
  $html .= "<tr></tr>";
694
  $html .= '</thead>';
695
  $html .= "<tbody>";
696
+ $html .= "<tr><td style='width: 1%;' class='fontlist_update'>".get_submit_button( __( 'フォントリスト更新', self::$text_domain ), null, 'updateFontListButton', null)."</td>";
697
+ $html .= "<td class='update_msg'>最終更新日: ".$param."</td></tr>";
698
  $html .= '</tbody>';
699
  $html .= '</table>';
700
+ $html .= '<input type="hidden" name="update_font_list" id="update_font_list" value="off" />';
701
  $html .= wp_nonce_field( 'ts_update_font_list' , 'ts_update_font_list' , true , false );
702
+ $html .= '</div>';
703
  return $html;
704
  }
 
705
  }
inc/app.js CHANGED
@@ -1,30072 +1,657 @@
1
- (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
- // Load Library
3
- 'use strict';
4
 
5
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
6
-
7
- var _react = require('react');
8
-
9
- var _react2 = _interopRequireDefault(_react);
10
-
11
- var _reactDom = require('react-dom');
12
-
13
- require('./functions/events.jsx');
14
-
15
- var Thead = _react2['default'].createClass({
16
- displayName: 'Thead',
17
-
18
- render: function render() {
19
- return _react2['default'].createElement(
20
- 'thead',
21
- null,
22
- _react2['default'].createElement(
23
- 'tr',
24
- null,
25
- _react2['default'].createElement(
26
- 'th',
27
- null,
28
- ' 適用箇所'
29
- ),
30
- _react2['default'].createElement(
31
- 'th',
32
- null,
33
- ' 書体分類'
34
- ),
35
- _react2['default'].createElement(
36
- 'th',
37
- null,
38
- ' フォントファミリー名'
39
- ),
40
- _react2['default'].createElement(
41
- 'th',
42
- null,
43
- ' フォント名'
44
- )
45
- )
46
- );
47
- }
48
- });
49
-
50
- var SelectFont = _react2['default'].createClass({
51
- displayName: 'SelectFont',
52
-
53
- getInitialState: function getInitialState() {
54
- return {
55
- checked: ['unselect']
56
- };
57
- },
58
- handleChange: function handleChange(event) {
59
- var checked = [];
60
- var sel = event.target;
61
- for (var i = 0; i < sel.length; i++) {
62
- var option = sel.options[i];
63
- if (option.selected) {
64
- checked.push(option.value);
65
- }
66
- }
67
- this.setState({
68
- checked: checked
69
- });
70
- },
71
- getOptions: function getOptions() {
72
- var i = 0;
73
- var selectedValue = 'false';
74
- var optionNodes = [];
75
- var selected = current_font[this.props.type];
76
-
77
- if (!this.props.selectedFamily[0]) {
78
- if (!selected || this.props.selectedType[0]) {
79
- optionNodes.push(_react2['default'].createElement(
80
- 'option',
81
- { key: i, value: 'false' },
82
- '書体分類・フォントファミリー名を選択してください'
83
- ));
84
- var options = {
85
- selected: selectedValue,
86
- nodes: optionNodes
87
- };
88
- return options;
89
- }
90
- }
91
-
92
- if (selected) {
93
- var key1 = selected.type;
94
- var key2 = selected.family;
95
- var selectedValue = selected.font;
96
- }
97
-
98
- if ('unselect' !== this.state.checked[0]) {
99
- var selectedValue = this.state.checked[0];
100
- }
101
-
102
- if (this.props.selectedType[0] || this.props.selectedFamily[0]) {
103
- if (this.props.selectedType[0]) {
104
- var key1 = this.props.selectedType[0];
105
- }
106
- if (this.props.selectedFamily[0]) {
107
- var key2 = this.props.selectedFamily[0];
108
- }
109
- }
110
-
111
- var dataCount = Object.keys(this.props.data).length;
112
- if (0 !== dataCount) {
113
- console.log();
114
- if (!this.props.data[key1] || !this.props.data[key1][key2]) {
115
- i++;
116
- optionNodes.push(_react2['default'].createElement(
117
- 'option',
118
- { key: i, value: 'false' },
119
- '書体分類・フォントファミリー名を選択してください'
120
- ));
121
- } else {
122
- var font = this.props.data[key1][key2];
123
- optionNodes.push(_react2['default'].createElement(
124
- 'option',
125
- { key: i, value: 'false' },
126
- '設定しない'
127
- ));
128
- Object.keys(font).forEach(function (key) {
129
- i++;
130
- var value = this[key];
131
- optionNodes.push(_react2['default'].createElement(
132
- 'option',
133
- { key: i, value: value },
134
- value
135
- ));
136
- }, font);
137
- }
138
- }
139
-
140
- var options = {
141
- selected: selectedValue,
142
- nodes: optionNodes
143
- };
144
- return options;
145
- },
146
- render: function render() {
147
- var name = 'typesquare_custom_theme[fonts][' + this.props.type + '][font]';
148
- var options = this.getOptions();
149
- var selectedValue = options.selected;
150
- var optionNodes = options.nodes;
151
- return _react2['default'].createElement(
152
- 'select',
153
- { name: name, onChange: this.handleChange, value: selectedValue },
154
- optionNodes
155
- );
156
- }
157
- });
158
-
159
- var SelectFamily = _react2['default'].createClass({
160
- displayName: 'SelectFamily',
161
-
162
- getInitialState: function getInitialState() {
163
- return {
164
- checked: ['unselect']
165
- };
166
- },
167
- handleChange: function handleChange(event) {
168
- var checked = [];
169
- var sel = event.target;
170
- for (var i = 0; i < sel.length; i++) {
171
- var option = sel.options[i];
172
- if (option.selected) {
173
- checked.push(option.value);
174
- }
175
- }
176
- this.props.onChangeFamily(checked);
177
- this.setState({
178
- checked: checked
179
- });
180
- },
181
- getOptions: function getOptions() {
182
- var optionNodes = [];
183
- var i = 0;
184
- var selectedValue = 'false';
185
- var selected = current_font[this.props.type];
186
- if (!this.props.selected && !selected) {
187
- optionNodes.push(_react2['default'].createElement(
188
- 'option',
189
- { key: i, value: 'false' },
190
- '設定なし'
191
- ));
192
- var options = {
193
- selected: selectedValue,
194
- nodes: optionNodes
195
- };
196
- return options;
197
- }
198
-
199
- if (this.props.selected) {
200
- var key = this.props.selected[0];
201
- } else {
202
- var key = selected.type;
203
- }
204
-
205
- if ('unselect' !== this.state.checked[0]) {
206
- var selectedValue = this.state.checked[0];
207
- } else if (selected) {
208
- var selectedValue = selected.family;
209
- }
210
-
211
- var dataCount = Object.keys(this.props.data).length;
212
- if (0 === dataCount) {
213
- optionNodes.push(_react2['default'].createElement(
214
- 'option',
215
- { key: i, value: 'false' },
216
- 'Loading...'
217
- ));
218
- } else {
219
- var family = this.props.data[key];
220
- if (!family) {
221
- optionNodes.push(_react2['default'].createElement(
222
- 'option',
223
- { key: i, value: 'false' },
224
- '設定なし'
225
- ));
226
- } else {
227
- optionNodes.push(_react2['default'].createElement(
228
- 'option',
229
- { key: i, value: 'false' },
230
- 'フォントファミリー名を選択してください'
231
- ));
232
- if (!family[selectedValue]) {
233
- var selectedValue = 'false';
234
- }
235
- Object.keys(family).forEach(function (key) {
236
- i++;
237
- var value = this[key];
238
- optionNodes.push(_react2['default'].createElement(
239
- 'option',
240
- { key: i, value: key },
241
- key
242
- ));
243
- }, family);
244
- }
245
- }
246
-
247
- var options = {
248
- selected: selectedValue,
249
- nodes: optionNodes
250
- };
251
- return options;
252
- },
253
- render: function render() {
254
- var name = 'typesquare_custom_theme[fonts][' + this.props.type + '][family]';
255
- var options = this.getOptions();
256
- var selectedValue = options.selected;
257
- var optionNodes = options.nodes;
258
- return _react2['default'].createElement(
259
- 'select',
260
- { name: name, onChange: this.handleChange, value: selectedValue },
261
- optionNodes
262
- );
263
- }
264
- });
265
-
266
- var SelectType = _react2['default'].createClass({
267
- displayName: 'SelectType',
268
-
269
- getInitialState: function getInitialState() {
270
- return {
271
- checked: ['unselect']
272
- };
273
- },
274
- handleChange: function handleChange(event) {
275
- var checked = [];
276
- var sel = event.target;
277
- for (var i = 0; i < sel.length; i++) {
278
- var option = sel.options[i];
279
- if (option.selected) {
280
- checked.push(option.value);
281
- }
282
- }
283
- this.props.onChangeType(checked);
284
- this.setState({
285
- checked: checked
286
- });
287
- },
288
- render: function render() {
289
- var optionNodes = [];
290
- var i = 0;
291
- var name = 'typesquare_custom_theme[fonts][' + this.props.type + '][type]';
292
- var selected = current_font[this.props.type];
293
- var selectedValue = 'false';
294
- if (selected) {
295
- if ('unselect' == this.state.checked[0]) {
296
- selectedValue = selected.type;
297
- }
298
- }
299
- if ('unselect' != this.state.checked[0]) {
300
- selectedValue = this.state.checked[0];
301
- }
302
-
303
- optionNodes.push(_react2['default'].createElement(
304
- 'option',
305
- { key: i, value: 'false' },
306
- '設定なし'
307
- ));
308
- Object.keys(this.props.data).forEach(function (key) {
309
- i++;
310
- var value = this[key];
311
- optionNodes.push(_react2['default'].createElement(
312
- 'option',
313
- { key: i, value: key },
314
- key
315
- ));
316
- }, this.props.data);
317
- return _react2['default'].createElement(
318
- 'select',
319
- { name: name, onChange: this.handleChange, value: selectedValue },
320
- optionNodes
321
- );
322
- }
323
- });
324
-
325
- var Row = _react2['default'].createClass({
326
- displayName: 'Row',
327
-
328
- getInitialState: function getInitialState() {
329
- return {
330
- type: '',
331
- family: '',
332
- name: ''
333
- };
334
- },
335
- changeType: function changeType(selected) {
336
- this.setState({
337
- type: selected
338
- });
339
- },
340
- changeFamily: function changeFamily(selected) {
341
- this.setState({
342
- family: selected
343
- });
344
- },
345
- getTotalRow: function getTotalRow() {
346
- return _react2['default'].createElement(
347
- 'tr',
348
- null,
349
- _react2['default'].createElement(
350
- 'th',
351
- null,
352
- ' ',
353
- this.props.title
354
- ),
355
- _react2['default'].createElement(
356
- 'td',
357
- null,
358
- _react2['default'].createElement(SelectType, {
359
- onChangeType: this.changeType,
360
- data: this.props.data,
361
- type: this.props.type })
362
- ),
363
- _react2['default'].createElement(
364
- 'td',
365
- null,
366
- _react2['default'].createElement(SelectFamily, {
367
- onChangeFamily: this.changeFamily,
368
- data: this.props.data,
369
- selected: this.state.type,
370
- type: this.props.type })
371
- ),
372
- _react2['default'].createElement(
373
- 'td',
374
- null,
375
- _react2['default'].createElement(SelectFont, {
376
- data: this.props.data,
377
- selectedType: this.state.type,
378
- selectedFamily: this.state.family,
379
- selectedName: this.state.name,
380
- type: this.props.type })
381
- )
382
- );
383
- },
384
- getPostRow: function getPostRow() {
385
- return _react2['default'].createElement(
386
- 'tr',
387
- null,
388
- _react2['default'].createElement(
389
- 'th',
390
- null,
391
- ' ',
392
- this.props.title
393
- ),
394
- _react2['default'].createElement(
395
- 'td',
396
- null,
397
- _react2['default'].createElement(
398
- 'p',
399
- null,
400
- _react2['default'].createElement(
401
- 'label',
402
- null,
403
- '書体分類:'
404
- ),
405
- _react2['default'].createElement(SelectType, {
406
- onChangeType: this.changeType,
407
- data: this.props.data,
408
- type: this.props.type })
409
- ),
410
- _react2['default'].createElement(
411
- 'p',
412
- null,
413
- _react2['default'].createElement(
414
- 'label',
415
- null,
416
- 'フォントファミリー名:'
417
- ),
418
- _react2['default'].createElement(SelectFamily, {
419
- onChangeFamily: this.changeFamily,
420
- data: this.props.data,
421
- selected: this.state.type,
422
- type: this.props.type })
423
- ),
424
- _react2['default'].createElement(
425
- 'p',
426
- null,
427
- _react2['default'].createElement(
428
- 'label',
429
- null,
430
- 'フォント名:'
431
- ),
432
- _react2['default'].createElement(SelectFont, {
433
- data: this.props.data,
434
- selectedType: this.state.type,
435
- selectedFamily: this.state.family,
436
- selectedName: this.state.name,
437
- type: this.props.type })
438
- )
439
- )
440
- );
441
- },
442
- render: function render() {
443
- if ('total' == this.props.pageType) {
444
- var rowNode = this.getTotalRow();
445
- } else if ('post' == this.props.pageType) {
446
- var rowNode = this.getPostRow();
447
- } else {
448
- var rowNode = _react2['default'].createElement(
449
- 'tr',
450
- null,
451
- _react2['default'].createElement(
452
- 'td',
453
- null,
454
- 'NoData'
455
- )
456
- );
457
- }
458
- return rowNode;
459
- }
460
-
461
- });
462
-
463
- var Tbody = _react2['default'].createClass({
464
- displayName: 'Tbody',
465
-
466
- loadPostsFromServer: function loadPostsFromServer() {
467
- jQuery.ajax({
468
- type: "GET",
469
- url: json_endpoint,
470
- dataType: 'json',
471
- cache: false,
472
- success: (function (data) {
473
- this.setState({ data: data });
474
- }).bind(this),
475
- error: (function (xhr, status, err) {
476
- console.error(this.props.url, status, err.toString());
477
- }).bind(this)
478
- });
479
- },
480
- getInitialState: function getInitialState() {
481
- return {
482
- data: []
483
- };
484
- },
485
- componentDidMount: function componentDidMount() {
486
- this.loadPostsFromServer();
487
- },
488
- render: function render() {
489
- return _react2['default'].createElement(
490
- 'tbody',
491
- null,
492
- _react2['default'].createElement(Row, { title: 'タイトル', type: 'title', data: this.state.data, pageType: this.props.pageType }),
493
- _react2['default'].createElement(Row, { title: 'リード', type: 'lead', data: this.state.data, pageType: this.props.pageType }),
494
- _react2['default'].createElement(Row, { title: '本文', type: 'text', data: this.state.data, pageType: this.props.pageType }),
495
- _react2['default'].createElement(Row, { title: '太字', type: 'bold', data: this.state.data, pageType: this.props.pageType })
496
- );
497
- }
498
- });
499
-
500
- var App = _react2['default'].createClass({
501
- displayName: 'App',
502
-
503
- render: function render() {
504
- if ('total' == this.props.pageType) {
505
- var headNode = _react2['default'].createElement(Thead, null);
506
- }
507
- return _react2['default'].createElement(
508
- 'table',
509
- { className: 'widefat form-table' },
510
- headNode,
511
- _react2['default'].createElement(Tbody, { pageType: this.props.pageType })
512
- );
513
- }
514
- });
515
-
516
- if (document.getElementById("ts-react-search-font") != null) {
517
- (0, _reactDom.render)(_react2['default'].createElement(App, { pageType: 'total' }), document.getElementById('ts-react-search-font'));
518
- } else if (document.getElementById("ts-react-post-search-font") != null) {
519
- (0, _reactDom.render)(_react2['default'].createElement(App, { pageType: 'post' }), document.getElementById('ts-react-post-search-font'));
520
- }
521
-
522
- },{"./functions/events.jsx":2,"react":161,"react-dom":32}],2:[function(require,module,exports){
523
- 'use strict';
524
-
525
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
526
-
527
- var _jquery = require('jquery');
528
-
529
- var _jquery2 = _interopRequireDefault(_jquery);
530
-
531
- (0, _jquery2['default'])(function ($) {
532
-
533
- // フォントテーマ設定
534
- $('#fontThemeSelect').change(function () {
535
- var selectTheme = $(this).val();
536
- // 初期非表示
537
- $('#customeFontThemeForm').hide();
538
- $('#fontThemeDeleteButton').hide();
539
- // 新しくテーマを作成する。表示
540
- if (selectTheme === 'new') {
541
- $('input[name=ts_edit_mode]').val('new');
542
- $('#ts_custome_theme_id').val(unique_id);
543
- $("<input>", {
544
- type: "hidden",
545
- name: "ts_change_edit_theme",
546
- value: "change"
547
- }).appendTo("#custmeFontForm");
548
- $('#custmeFontForm').submit();
549
- // カスタムテーマ選択。表示
550
- } else if (selectTheme !== 'false') {
551
- $('#custome_font_name').removeAttr('required');
552
- $('input[name=ts_edit_mode]').val('update');
553
- $('#ts_custome_theme_id').val('');
554
- var custome_fonts = option_font_list.theme;
555
- $.each(custome_fonts, function (i, cs_font) {
556
- if (cs_font.id === selectTheme) {
557
- $('input[name=ts_edit_mode]').val('update');
558
- $('#ts_custome_theme_id').val(cs_font.id);
559
- $("<input>", {
560
- type: "hidden",
561
- name: "ts_change_edit_theme",
562
- value: "change"
563
- }).appendTo("#custmeFontForm");
564
- $('#custmeFontForm').submit();
565
- }
566
- });
567
- } else {
568
- $('#custome_font_name').removeAttr('required');
569
- $('input[name=ts_edit_mode]').val('update');
570
- $('#ts_custome_theme_id').val('');
571
- $('#fontThemeDeleteButton').hide();
572
- }
573
- });
574
-
575
- // フォントテーマ更新ボタン押下処理
576
- $('#fontThemeUpdateButton').click(function () {
577
- var nameDuplicateMessage = "同一名のカスタムフォントテーマは作成できません";
578
- var countOverMessage = "カスタムフォントテーマは10個を超えて作成できません";
579
-
580
- var warningFlg = 0;
581
-
582
- // カスタムテーマ以外の選択
583
- if ($('#customeFontThemeForm').is(':hidden')) {
584
- return true;
585
- }
586
-
587
- // 同一名チェック
588
- var all_font_theme = all_font_list;
589
- var custome_font_name = $('#custome_font_name').val();
590
- if (custome_font_name !== $('#current_custome_font_name').val()) {
591
- $.each(all_font_theme, function (i, af_font) {
592
- if (af_font.name === custome_font_name) {
593
- warningFlg = 1;
594
- return false;
595
- }
596
- });
597
- }
598
- // 個数チェック
599
- var custome_fonts = option_font_list.theme;
600
- var custome_font_count = Object.keys(custome_fonts).length;
601
- if (custome_font_count >= 10 && !$('#current_custome_font_name').val()) {
602
- warningFlg = 2;
603
- }
604
-
605
- // エラー切り分け
606
- switch (warningFlg) {
607
- case 1:
608
- // 同一名警告
609
- alert(nameDuplicateMessage);
610
- return false;
611
- break;
612
- case 2:
613
- // 11個以上警告
614
- alert(countOverMessage);
615
- return false;
616
- break;
617
- default:
618
- if ($('#custome_font_name').val()) {
619
- $('#custmeFontForm').submit();
620
- }
621
- }
622
- });
623
-
624
- // フォントテーマ削除ボタン押下処理
625
- $('#fontThemeDeleteButton').click(function () {
626
- var dialogMessage = $('#current_custome_font_name').val() + 'を削除します。よろしいですか?';
627
- var fontDeleteConfirmDialog = window.confirm(dialogMessage);
628
-
629
- if (fontDeleteConfirmDialog) {
630
- $('input[name=ts_edit_mode]').val('delete');
631
- $('#custmeFontForm').submit();
632
- } else {
633
- return false;
634
- }
635
- });
636
-
637
- // localStorageのactiveAdvancedを取得
638
- var activeAdvanced = localStorage.getItem('activeAdvanced');
639
- if (activeAdvanced === 'true') {
640
- $('.ts-custome_form').css('display', 'block');
641
- $('.ts-custome_form').addClass('ts-active');
642
- $('.advancedTriangle').addClass('open');
643
- }
644
-
645
- // 「上級者向けのカスタマイズ」クリック時イベント
646
- $(".toggleAdvanced").on('click', function () {
647
- $('.ts-custome_form').slideToggle('normal', function () {
648
- if ($('.ts-custome_form').hasClass('ts-active')) {
649
- $('.ts-custome_form').removeClass('ts-active');
650
- $('.advancedTriangle').removeClass('open');
651
- localStorage.setItem('activeAdvanced', false);
652
- } else {
653
- $('.ts-custome_form').addClass('ts-active');
654
- $('.advancedTriangle').addClass('open');
655
- localStorage.setItem('activeAdvanced', true);
656
- }
657
- });
658
- });
659
- });
660
-
661
- },{"jquery":30}],3:[function(require,module,exports){
662
- (function (process){
663
- /**
664
- * Copyright 2013-2015, Facebook, Inc.
665
- *
666
- * Licensed under the Apache License, Version 2.0 (the "License");
667
- * you may not use this file except in compliance with the License.
668
- * You may obtain a copy of the License at
669
- *
670
- * http://www.apache.org/licenses/LICENSE-2.0
671
- *
672
- * Unless required by applicable law or agreed to in writing, software
673
- * distributed under the License is distributed on an "AS IS" BASIS,
674
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
675
- * See the License for the specific language governing permissions and
676
- * limitations under the License.
677
- *
678
- * @providesModule EventListener
679
- * @typechecks
680
- */
681
-
682
- 'use strict';
683
-
684
- var emptyFunction = require('./emptyFunction');
685
-
686
- /**
687
- * Upstream version of event listener. Does not take into account specific
688
- * nature of platform.
689
- */
690
- var EventListener = {
691
- /**
692
- * Listen to DOM events during the bubble phase.
693
- *
694
- * @param {DOMEventTarget} target DOM element to register listener on.
695
- * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
696
- * @param {function} callback Callback function.
697
- * @return {object} Object with a `remove` method.
698
- */
699
- listen: function (target, eventType, callback) {
700
- if (target.addEventListener) {
701
- target.addEventListener(eventType, callback, false);
702
- return {
703
- remove: function () {
704
- target.removeEventListener(eventType, callback, false);
705
- }
706
- };
707
- } else if (target.attachEvent) {
708
- target.attachEvent('on' + eventType, callback);
709
- return {
710
- remove: function () {
711
- target.detachEvent('on' + eventType, callback);
712
- }
713
- };
714
- }
715
- },
716
-
717
- /**
718
- * Listen to DOM events during the capture phase.
719
- *
720
- * @param {DOMEventTarget} target DOM element to register listener on.
721
- * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
722
- * @param {function} callback Callback function.
723
- * @return {object} Object with a `remove` method.
724
- */
725
- capture: function (target, eventType, callback) {
726
- if (target.addEventListener) {
727
- target.addEventListener(eventType, callback, true);
728
- return {
729
- remove: function () {
730
- target.removeEventListener(eventType, callback, true);
731
- }
732
- };
733
- } else {
734
- if (process.env.NODE_ENV !== 'production') {
735
- console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.');
736
- }
737
- return {
738
- remove: emptyFunction
739
- };
740
- }
741
- },
742
-
743
- registerDefault: function () {}
744
- };
745
-
746
- module.exports = EventListener;
747
- }).call(this,require('_process'))
748
-
749
- },{"./emptyFunction":10,"_process":31}],4:[function(require,module,exports){
750
- /**
751
- * Copyright 2013-2015, Facebook, Inc.
752
- * All rights reserved.
753
- *
754
- * This source code is licensed under the BSD-style license found in the
755
- * LICENSE file in the root directory of this source tree. An additional grant
756
- * of patent rights can be found in the PATENTS file in the same directory.
757
- *
758
- * @providesModule ExecutionEnvironment
759
- */
760
-
761
- 'use strict';
762
-
763
- var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
764
-
765
- /**
766
- * Simple, lightweight module assisting with the detection and context of
767
- * Worker. Helps avoid circular dependencies and allows code to reason about
768
- * whether or not they are in a Worker, even if they never include the main
769
- * `ReactWorker` dependency.
770
- */
771
- var ExecutionEnvironment = {
772
-
773
- canUseDOM: canUseDOM,
774
-
775
- canUseWorkers: typeof Worker !== 'undefined',
776
-
777
- canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
778
-
779
- canUseViewport: canUseDOM && !!window.screen,
780
-
781
- isInWorker: !canUseDOM // For now, this is true - might change in the future.
782
-
783
- };
784
-
785
- module.exports = ExecutionEnvironment;
786
- },{}],5:[function(require,module,exports){
787
- /**
788
- * Copyright 2013-2015, Facebook, Inc.
789
- * All rights reserved.
790
- *
791
- * This source code is licensed under the BSD-style license found in the
792
- * LICENSE file in the root directory of this source tree. An additional grant
793
- * of patent rights can be found in the PATENTS file in the same directory.
794
- *
795
- * @providesModule camelize
796
- * @typechecks
797
- */
798
-
799
- "use strict";
800
-
801
- var _hyphenPattern = /-(.)/g;
802
-
803
- /**
804
- * Camelcases a hyphenated string, for example:
805
- *
806
- * > camelize('background-color')
807
- * < "backgroundColor"
808
- *
809
- * @param {string} string
810
- * @return {string}
811
- */
812
- function camelize(string) {
813
- return string.replace(_hyphenPattern, function (_, character) {
814
- return character.toUpperCase();
815
- });
816
- }
817
-
818
- module.exports = camelize;
819
- },{}],6:[function(require,module,exports){
820
- /**
821
- * Copyright 2013-2015, Facebook, Inc.
822
- * All rights reserved.
823
- *
824
- * This source code is licensed under the BSD-style license found in the
825
- * LICENSE file in the root directory of this source tree. An additional grant
826
- * of patent rights can be found in the PATENTS file in the same directory.
827
- *
828
- * @providesModule camelizeStyleName
829
- * @typechecks
830
- */
831
-
832
- 'use strict';
833
-
834
- var camelize = require('./camelize');
835
-
836
- var msPattern = /^-ms-/;
837
-
838
- /**
839
- * Camelcases a hyphenated CSS property name, for example:
840
- *
841
- * > camelizeStyleName('background-color')
842
- * < "backgroundColor"
843
- * > camelizeStyleName('-moz-transition')
844
- * < "MozTransition"
845
- * > camelizeStyleName('-ms-transition')
846
- * < "msTransition"
847
- *
848
- * As Andi Smith suggests
849
- * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
850
- * is converted to lowercase `ms`.
851
- *
852
- * @param {string} string
853
- * @return {string}
854
- */
855
- function camelizeStyleName(string) {
856
- return camelize(string.replace(msPattern, 'ms-'));
857
- }
858
-
859
- module.exports = camelizeStyleName;
860
- },{"./camelize":5}],7:[function(require,module,exports){
861
- /**
862
- * Copyright 2013-2015, Facebook, Inc.
863
- * All rights reserved.
864
- *
865
- * This source code is licensed under the BSD-style license found in the
866
- * LICENSE file in the root directory of this source tree. An additional grant
867
- * of patent rights can be found in the PATENTS file in the same directory.
868
- *
869
- * @providesModule containsNode
870
- * @typechecks
871
- */
872
-
873
- 'use strict';
874
-
875
- var isTextNode = require('./isTextNode');
876
-
877
- /*eslint-disable no-bitwise */
878
-
879
- /**
880
- * Checks if a given DOM node contains or is another DOM node.
881
- *
882
- * @param {?DOMNode} outerNode Outer DOM node.
883
- * @param {?DOMNode} innerNode Inner DOM node.
884
- * @return {boolean} True if `outerNode` contains or is `innerNode`.
885
- */
886
- function containsNode(_x, _x2) {
887
- var _again = true;
888
-
889
- _function: while (_again) {
890
- var outerNode = _x,
891
- innerNode = _x2;
892
- _again = false;
893
-
894
- if (!outerNode || !innerNode) {
895
- return false;
896
- } else if (outerNode === innerNode) {
897
- return true;
898
- } else if (isTextNode(outerNode)) {
899
- return false;
900
- } else if (isTextNode(innerNode)) {
901
- _x = outerNode;
902
- _x2 = innerNode.parentNode;
903
- _again = true;
904
- continue _function;
905
- } else if (outerNode.contains) {
906
- return outerNode.contains(innerNode);
907
- } else if (outerNode.compareDocumentPosition) {
908
- return !!(outerNode.compareDocumentPosition(innerNode) & 16);
909
- } else {
910
- return false;
911
- }
912
- }
913
- }
914
-
915
- module.exports = containsNode;
916
- },{"./isTextNode":20}],8:[function(require,module,exports){
917
- /**
918
- * Copyright 2013-2015, Facebook, Inc.
919
- * All rights reserved.
920
- *
921
- * This source code is licensed under the BSD-style license found in the
922
- * LICENSE file in the root directory of this source tree. An additional grant
923
- * of patent rights can be found in the PATENTS file in the same directory.
924
- *
925
- * @providesModule createArrayFromMixed
926
- * @typechecks
927
- */
928
-
929
- 'use strict';
930
-
931
- var toArray = require('./toArray');
932
-
933
- /**
934
- * Perform a heuristic test to determine if an object is "array-like".
935
- *
936
- * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
937
- * Joshu replied: "Mu."
938
- *
939
- * This function determines if its argument has "array nature": it returns
940
- * true if the argument is an actual array, an `arguments' object, or an
941
- * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
942
- *
943
- * It will return false for other array-like objects like Filelist.
944
- *
945
- * @param {*} obj
946
- * @return {boolean}
947
- */
948
- function hasArrayNature(obj) {
949
- return(
950
- // not null/false
951
- !!obj && (
952
- // arrays are objects, NodeLists are functions in Safari
953
- typeof obj == 'object' || typeof obj == 'function') &&
954
- // quacks like an array
955
- 'length' in obj &&
956
- // not window
957
- !('setInterval' in obj) &&
958
- // no DOM node should be considered an array-like
959
- // a 'select' element has 'length' and 'item' properties on IE8
960
- typeof obj.nodeType != 'number' && (
961
- // a real array
962
- Array.isArray(obj) ||
963
- // arguments
964
- 'callee' in obj ||
965
- // HTMLCollection/NodeList
966
- 'item' in obj)
967
- );
968
- }
969
-
970
- /**
971
- * Ensure that the argument is an array by wrapping it in an array if it is not.
972
- * Creates a copy of the argument if it is already an array.
973
- *
974
- * This is mostly useful idiomatically:
975
- *
976
- * var createArrayFromMixed = require('createArrayFromMixed');
977
- *
978
- * function takesOneOrMoreThings(things) {
979
- * things = createArrayFromMixed(things);
980
- * ...
981
- * }
982
- *
983
- * This allows you to treat `things' as an array, but accept scalars in the API.
984
- *
985
- * If you need to convert an array-like object, like `arguments`, into an array
986
- * use toArray instead.
987
- *
988
- * @param {*} obj
989
- * @return {array}
990
- */
991
- function createArrayFromMixed(obj) {
992
- if (!hasArrayNature(obj)) {
993
- return [obj];
994
- } else if (Array.isArray(obj)) {
995
- return obj.slice();
996
- } else {
997
- return toArray(obj);
998
- }
999
- }
1000
-
1001
- module.exports = createArrayFromMixed;
1002
- },{"./toArray":28}],9:[function(require,module,exports){
1003
- (function (process){
1004
- /**
1005
- * Copyright 2013-2015, Facebook, Inc.
1006
- * All rights reserved.
1007
- *
1008
- * This source code is licensed under the BSD-style license found in the
1009
- * LICENSE file in the root directory of this source tree. An additional grant
1010
- * of patent rights can be found in the PATENTS file in the same directory.
1011
- *
1012
- * @providesModule createNodesFromMarkup
1013
- * @typechecks
1014
- */
1015
-
1016
- /*eslint-disable fb-www/unsafe-html*/
1017
-
1018
- 'use strict';
1019
-
1020
- var ExecutionEnvironment = require('./ExecutionEnvironment');
1021
-
1022
- var createArrayFromMixed = require('./createArrayFromMixed');
1023
- var getMarkupWrap = require('./getMarkupWrap');
1024
- var invariant = require('./invariant');
1025
-
1026
- /**
1027
- * Dummy container used to render all markup.
1028
- */
1029
- var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
1030
-
1031
- /**
1032
- * Pattern used by `getNodeName`.
1033
- */
1034
- var nodeNamePattern = /^\s*<(\w+)/;
1035
-
1036
- /**
1037
- * Extracts the `nodeName` of the first element in a string of markup.
1038
- *
1039
- * @param {string} markup String of markup.
1040
- * @return {?string} Node name of the supplied markup.
1041
- */
1042
- function getNodeName(markup) {
1043
- var nodeNameMatch = markup.match(nodeNamePattern);
1044
- return nodeNameMatch && nodeNameMatch[1].toLowerCase();
1045
- }
1046
-
1047
- /**
1048
- * Creates an array containing the nodes rendered from the supplied markup. The
1049
- * optionally supplied `handleScript` function will be invoked once for each
1050
- * <script> element that is rendered. If no `handleScript` function is supplied,
1051
- * an exception is thrown if any <script> elements are rendered.
1052
- *
1053
- * @param {string} markup A string of valid HTML markup.
1054
- * @param {?function} handleScript Invoked once for each rendered <script>.
1055
- * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
1056
- */
1057
- function createNodesFromMarkup(markup, handleScript) {
1058
- var node = dummyNode;
1059
- !!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : undefined;
1060
- var nodeName = getNodeName(markup);
1061
-
1062
- var wrap = nodeName && getMarkupWrap(nodeName);
1063
- if (wrap) {
1064
- node.innerHTML = wrap[1] + markup + wrap[2];
1065
-
1066
- var wrapDepth = wrap[0];
1067
- while (wrapDepth--) {
1068
- node = node.lastChild;
1069
- }
1070
- } else {
1071
- node.innerHTML = markup;
1072
- }
1073
-
1074
- var scripts = node.getElementsByTagName('script');
1075
- if (scripts.length) {
1076
- !handleScript ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : undefined;
1077
- createArrayFromMixed(scripts).forEach(handleScript);
1078
- }
1079
-
1080
- var nodes = createArrayFromMixed(node.childNodes);
1081
- while (node.lastChild) {
1082
- node.removeChild(node.lastChild);
1083
- }
1084
- return nodes;
1085
- }
1086
-
1087
- module.exports = createNodesFromMarkup;
1088
- }).call(this,require('_process'))
1089
-
1090
- },{"./ExecutionEnvironment":4,"./createArrayFromMixed":8,"./getMarkupWrap":14,"./invariant":18,"_process":31}],10:[function(require,module,exports){
1091
- /**
1092
- * Copyright 2013-2015, Facebook, Inc.
1093
- * All rights reserved.
1094
- *
1095
- * This source code is licensed under the BSD-style license found in the
1096
- * LICENSE file in the root directory of this source tree. An additional grant
1097
- * of patent rights can be found in the PATENTS file in the same directory.
1098
- *
1099
- * @providesModule emptyFunction
1100
- */
1101
-
1102
- "use strict";
1103
-
1104
- function makeEmptyFunction(arg) {
1105
- return function () {
1106
- return arg;
1107
- };
1108
- }
1109
-
1110
- /**
1111
- * This function accepts and discards inputs; it has no side effects. This is
1112
- * primarily useful idiomatically for overridable function endpoints which
1113
- * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
1114
- */
1115
- function emptyFunction() {}
1116
-
1117
- emptyFunction.thatReturns = makeEmptyFunction;
1118
- emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
1119
- emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
1120
- emptyFunction.thatReturnsNull = makeEmptyFunction(null);
1121
- emptyFunction.thatReturnsThis = function () {
1122
- return this;
1123
- };
1124
- emptyFunction.thatReturnsArgument = function (arg) {
1125
- return arg;
1126
- };
1127
-
1128
- module.exports = emptyFunction;
1129
- },{}],11:[function(require,module,exports){
1130
- (function (process){
1131
- /**
1132
- * Copyright 2013-2015, Facebook, Inc.
1133
- * All rights reserved.
1134
- *
1135
- * This source code is licensed under the BSD-style license found in the
1136
- * LICENSE file in the root directory of this source tree. An additional grant
1137
- * of patent rights can be found in the PATENTS file in the same directory.
1138
- *
1139
- * @providesModule emptyObject
1140
- */
1141
-
1142
- 'use strict';
1143
-
1144
- var emptyObject = {};
1145
-
1146
- if (process.env.NODE_ENV !== 'production') {
1147
- Object.freeze(emptyObject);
1148
- }
1149
-
1150
- module.exports = emptyObject;
1151
- }).call(this,require('_process'))
1152
-
1153
- },{"_process":31}],12:[function(require,module,exports){
1154
- /**
1155
- * Copyright 2013-2015, Facebook, Inc.
1156
- * All rights reserved.
1157
- *
1158
- * This source code is licensed under the BSD-style license found in the
1159
- * LICENSE file in the root directory of this source tree. An additional grant
1160
- * of patent rights can be found in the PATENTS file in the same directory.
1161
- *
1162
- * @providesModule focusNode
1163
- */
1164
-
1165
- 'use strict';
1166
-
1167
- /**
1168
- * @param {DOMElement} node input/textarea to focus
1169
- */
1170
- function focusNode(node) {
1171
- // IE8 can throw "Can't move focus to the control because it is invisible,
1172
- // not enabled, or of a type that does not accept the focus." for all kinds of
1173
- // reasons that are too expensive and fragile to test.
1174
- try {
1175
- node.focus();
1176
- } catch (e) {}
1177
- }
1178
-
1179
- module.exports = focusNode;
1180
- },{}],13:[function(require,module,exports){
1181
- /**
1182
- * Copyright 2013-2015, Facebook, Inc.
1183
- * All rights reserved.
1184
- *
1185
- * This source code is licensed under the BSD-style license found in the
1186
- * LICENSE file in the root directory of this source tree. An additional grant
1187
- * of patent rights can be found in the PATENTS file in the same directory.
1188
- *
1189
- * @providesModule getActiveElement
1190
- * @typechecks
1191
- */
1192
-
1193
- /* eslint-disable fb-www/typeof-undefined */
1194
-
1195
- /**
1196
- * Same as document.activeElement but wraps in a try-catch block. In IE it is
1197
- * not safe to call document.activeElement if there is nothing focused.
1198
- *
1199
- * The activeElement will be null only if the document or document body is not
1200
- * yet defined.
1201
- */
1202
- 'use strict';
1203
-
1204
- function getActiveElement() /*?DOMElement*/{
1205
- if (typeof document === 'undefined') {
1206
- return null;
1207
- }
1208
- try {
1209
- return document.activeElement || document.body;
1210
- } catch (e) {
1211
- return document.body;
1212
- }
1213
- }
1214
-
1215
- module.exports = getActiveElement;
1216
- },{}],14:[function(require,module,exports){
1217
- (function (process){
1218
- /**
1219
- * Copyright 2013-2015, Facebook, Inc.
1220
- * All rights reserved.
1221
- *
1222
- * This source code is licensed under the BSD-style license found in the
1223
- * LICENSE file in the root directory of this source tree. An additional grant
1224
- * of patent rights can be found in the PATENTS file in the same directory.
1225
- *
1226
- * @providesModule getMarkupWrap
1227
- */
1228
-
1229
- /*eslint-disable fb-www/unsafe-html */
1230
-
1231
- 'use strict';
1232
-
1233
- var ExecutionEnvironment = require('./ExecutionEnvironment');
1234
-
1235
- var invariant = require('./invariant');
1236
-
1237
- /**
1238
- * Dummy container used to detect which wraps are necessary.
1239
- */
1240
- var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
1241
-
1242
- /**
1243
- * Some browsers cannot use `innerHTML` to render certain elements standalone,
1244
- * so we wrap them, render the wrapped nodes, then extract the desired node.
1245
- *
1246
- * In IE8, certain elements cannot render alone, so wrap all elements ('*').
1247
- */
1248
-
1249
- var shouldWrap = {};
1250
-
1251
- var selectWrap = [1, '<select multiple="true">', '</select>'];
1252
- var tableWrap = [1, '<table>', '</table>'];
1253
- var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
1254
-
1255
- var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>'];
1256
-
1257
- var markupWrap = {
1258
- '*': [1, '?<div>', '</div>'],
1259
-
1260
- 'area': [1, '<map>', '</map>'],
1261
- 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
1262
- 'legend': [1, '<fieldset>', '</fieldset>'],
1263
- 'param': [1, '<object>', '</object>'],
1264
- 'tr': [2, '<table><tbody>', '</tbody></table>'],
1265
-
1266
- 'optgroup': selectWrap,
1267
- 'option': selectWrap,
1268
-
1269
- 'caption': tableWrap,
1270
- 'colgroup': tableWrap,
1271
- 'tbody': tableWrap,
1272
- 'tfoot': tableWrap,
1273
- 'thead': tableWrap,
1274
-
1275
- 'td': trWrap,
1276
- 'th': trWrap
1277
- };
1278
-
1279
- // Initialize the SVG elements since we know they'll always need to be wrapped
1280
- // consistently. If they are created inside a <div> they will be initialized in
1281
- // the wrong namespace (and will not display).
1282
- var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan'];
1283
- svgElements.forEach(function (nodeName) {
1284
- markupWrap[nodeName] = svgWrap;
1285
- shouldWrap[nodeName] = true;
1286
- });
1287
-
1288
- /**
1289
- * Gets the markup wrap configuration for the supplied `nodeName`.
1290
- *
1291
- * NOTE: This lazily detects which wraps are necessary for the current browser.
1292
- *
1293
- * @param {string} nodeName Lowercase `nodeName`.
1294
- * @return {?array} Markup wrap configuration, if applicable.
1295
- */
1296
- function getMarkupWrap(nodeName) {
1297
- !!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : undefined;
1298
- if (!markupWrap.hasOwnProperty(nodeName)) {
1299
- nodeName = '*';
1300
- }
1301
- if (!shouldWrap.hasOwnProperty(nodeName)) {
1302
- if (nodeName === '*') {
1303
- dummyNode.innerHTML = '<link />';
1304
- } else {
1305
- dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
1306
- }
1307
- shouldWrap[nodeName] = !dummyNode.firstChild;
1308
- }
1309
- return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
1310
- }
1311
-
1312
- module.exports = getMarkupWrap;
1313
- }).call(this,require('_process'))
1314
-
1315
- },{"./ExecutionEnvironment":4,"./invariant":18,"_process":31}],15:[function(require,module,exports){
1316
- /**
1317
- * Copyright 2013-2015, Facebook, Inc.
1318
- * All rights reserved.
1319
- *
1320
- * This source code is licensed under the BSD-style license found in the
1321
- * LICENSE file in the root directory of this source tree. An additional grant
1322
- * of patent rights can be found in the PATENTS file in the same directory.
1323
- *
1324
- * @providesModule getUnboundedScrollPosition
1325
- * @typechecks
1326
- */
1327
-
1328
- 'use strict';
1329
-
1330
- /**
1331
- * Gets the scroll position of the supplied element or window.
1332
- *
1333
- * The return values are unbounded, unlike `getScrollPosition`. This means they
1334
- * may be negative or exceed the element boundaries (which is possible using
1335
- * inertial scrolling).
1336
- *
1337
- * @param {DOMWindow|DOMElement} scrollable
1338
- * @return {object} Map with `x` and `y` keys.
1339
- */
1340
- function getUnboundedScrollPosition(scrollable) {
1341
- if (scrollable === window) {
1342
- return {
1343
- x: window.pageXOffset || document.documentElement.scrollLeft,
1344
- y: window.pageYOffset || document.documentElement.scrollTop
1345
- };
1346
- }
1347
- return {
1348
- x: scrollable.scrollLeft,
1349
- y: scrollable.scrollTop
1350
- };
1351
- }
1352
-
1353
- module.exports = getUnboundedScrollPosition;
1354
- },{}],16:[function(require,module,exports){
1355
- /**
1356
- * Copyright 2013-2015, Facebook, Inc.
1357
- * All rights reserved.
1358
- *
1359
- * This source code is licensed under the BSD-style license found in the
1360
- * LICENSE file in the root directory of this source tree. An additional grant
1361
- * of patent rights can be found in the PATENTS file in the same directory.
1362
- *
1363
- * @providesModule hyphenate
1364
- * @typechecks
1365
- */
1366
-
1367
- 'use strict';
1368
-
1369
- var _uppercasePattern = /([A-Z])/g;
1370
-
1371
- /**
1372
- * Hyphenates a camelcased string, for example:
1373
- *
1374
- * > hyphenate('backgroundColor')
1375
- * < "background-color"
1376
- *
1377
- * For CSS style names, use `hyphenateStyleName` instead which works properly
1378
- * with all vendor prefixes, including `ms`.
1379
- *
1380
- * @param {string} string
1381
- * @return {string}
1382
- */
1383
- function hyphenate(string) {
1384
- return string.replace(_uppercasePattern, '-$1').toLowerCase();
1385
- }
1386
-
1387
- module.exports = hyphenate;
1388
- },{}],17:[function(require,module,exports){
1389
- /**
1390
- * Copyright 2013-2015, Facebook, Inc.
1391
- * All rights reserved.
1392
- *
1393
- * This source code is licensed under the BSD-style license found in the
1394
- * LICENSE file in the root directory of this source tree. An additional grant
1395
- * of patent rights can be found in the PATENTS file in the same directory.
1396
- *
1397
- * @providesModule hyphenateStyleName
1398
- * @typechecks
1399
- */
1400
-
1401
- 'use strict';
1402
-
1403
- var hyphenate = require('./hyphenate');
1404
-
1405
- var msPattern = /^ms-/;
1406
-
1407
- /**
1408
- * Hyphenates a camelcased CSS property name, for example:
1409
- *
1410
- * > hyphenateStyleName('backgroundColor')
1411
- * < "background-color"
1412
- * > hyphenateStyleName('MozTransition')
1413
- * < "-moz-transition"
1414
- * > hyphenateStyleName('msTransition')
1415
- * < "-ms-transition"
1416
- *
1417
- * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
1418
- * is converted to `-ms-`.
1419
- *
1420
- * @param {string} string
1421
- * @return {string}
1422
- */
1423
- function hyphenateStyleName(string) {
1424
- return hyphenate(string).replace(msPattern, '-ms-');
1425
- }
1426
-
1427
- module.exports = hyphenateStyleName;
1428
- },{"./hyphenate":16}],18:[function(require,module,exports){
1429
- (function (process){
1430
- /**
1431
- * Copyright 2013-2015, Facebook, Inc.
1432
- * All rights reserved.
1433
- *
1434
- * This source code is licensed under the BSD-style license found in the
1435
- * LICENSE file in the root directory of this source tree. An additional grant
1436
- * of patent rights can be found in the PATENTS file in the same directory.
1437
- *
1438
- * @providesModule invariant
1439
- */
1440
-
1441
- 'use strict';
1442
-
1443
- /**
1444
- * Use invariant() to assert state which your program assumes to be true.
1445
- *
1446
- * Provide sprintf-style format (only %s is supported) and arguments
1447
- * to provide information about what broke and what you were
1448
- * expecting.
1449
- *
1450
- * The invariant message will be stripped in production, but the invariant
1451
- * will remain to ensure logic does not differ in production.
1452
- */
1453
-
1454
- function invariant(condition, format, a, b, c, d, e, f) {
1455
- if (process.env.NODE_ENV !== 'production') {
1456
- if (format === undefined) {
1457
- throw new Error('invariant requires an error message argument');
1458
- }
1459
- }
1460
-
1461
- if (!condition) {
1462
- var error;
1463
- if (format === undefined) {
1464
- error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
1465
- } else {
1466
- var args = [a, b, c, d, e, f];
1467
- var argIndex = 0;
1468
- error = new Error(format.replace(/%s/g, function () {
1469
- return args[argIndex++];
1470
- }));
1471
- error.name = 'Invariant Violation';
1472
- }
1473
-
1474
- error.framesToPop = 1; // we don't care about invariant's own frame
1475
- throw error;
1476
- }
1477
- }
1478
-
1479
- module.exports = invariant;
1480
- }).call(this,require('_process'))
1481
-
1482
- },{"_process":31}],19:[function(require,module,exports){
1483
- /**
1484
- * Copyright 2013-2015, Facebook, Inc.
1485
- * All rights reserved.
1486
- *
1487
- * This source code is licensed under the BSD-style license found in the
1488
- * LICENSE file in the root directory of this source tree. An additional grant
1489
- * of patent rights can be found in the PATENTS file in the same directory.
1490
- *
1491
- * @providesModule isNode
1492
- * @typechecks
1493
- */
1494
-
1495
- /**
1496
- * @param {*} object The object to check.
1497
- * @return {boolean} Whether or not the object is a DOM node.
1498
- */
1499
- 'use strict';
1500
-
1501
- function isNode(object) {
1502
- return !!(object && (typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));
1503
- }
1504
-
1505
- module.exports = isNode;
1506
- },{}],20:[function(require,module,exports){
1507
- /**
1508
- * Copyright 2013-2015, Facebook, Inc.
1509
- * All rights reserved.
1510
- *
1511
- * This source code is licensed under the BSD-style license found in the
1512
- * LICENSE file in the root directory of this source tree. An additional grant
1513
- * of patent rights can be found in the PATENTS file in the same directory.
1514
- *
1515
- * @providesModule isTextNode
1516
- * @typechecks
1517
- */
1518
-
1519
- 'use strict';
1520
-
1521
- var isNode = require('./isNode');
1522
-
1523
- /**
1524
- * @param {*} object The object to check.
1525
- * @return {boolean} Whether or not the object is a DOM text node.
1526
- */
1527
- function isTextNode(object) {
1528
- return isNode(object) && object.nodeType == 3;
1529
- }
1530
-
1531
- module.exports = isTextNode;
1532
- },{"./isNode":19}],21:[function(require,module,exports){
1533
- (function (process){
1534
- /**
1535
- * Copyright 2013-2015, Facebook, Inc.
1536
- * All rights reserved.
1537
- *
1538
- * This source code is licensed under the BSD-style license found in the
1539
- * LICENSE file in the root directory of this source tree. An additional grant
1540
- * of patent rights can be found in the PATENTS file in the same directory.
1541
- *
1542
- * @providesModule keyMirror
1543
- * @typechecks static-only
1544
- */
1545
-
1546
- 'use strict';
1547
-
1548
- var invariant = require('./invariant');
1549
-
1550
- /**
1551
- * Constructs an enumeration with keys equal to their value.
1552
- *
1553
- * For example:
1554
- *
1555
- * var COLORS = keyMirror({blue: null, red: null});
1556
- * var myColor = COLORS.blue;
1557
- * var isColorValid = !!COLORS[myColor];
1558
- *
1559
- * The last line could not be performed if the values of the generated enum were
1560
- * not equal to their keys.
1561
- *
1562
- * Input: {key1: val1, key2: val2}
1563
- * Output: {key1: key1, key2: key2}
1564
- *
1565
- * @param {object} obj
1566
- * @return {object}
1567
- */
1568
- var keyMirror = function (obj) {
1569
- var ret = {};
1570
- var key;
1571
- !(obj instanceof Object && !Array.isArray(obj)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'keyMirror(...): Argument must be an object.') : invariant(false) : undefined;
1572
- for (key in obj) {
1573
- if (!obj.hasOwnProperty(key)) {
1574
- continue;
1575
- }
1576
- ret[key] = key;
1577
- }
1578
- return ret;
1579
- };
1580
-
1581
- module.exports = keyMirror;
1582
- }).call(this,require('_process'))
1583
-
1584
- },{"./invariant":18,"_process":31}],22:[function(require,module,exports){
1585
- /**
1586
- * Copyright 2013-2015, Facebook, Inc.
1587
- * All rights reserved.
1588
- *
1589
- * This source code is licensed under the BSD-style license found in the
1590
- * LICENSE file in the root directory of this source tree. An additional grant
1591
- * of patent rights can be found in the PATENTS file in the same directory.
1592
- *
1593
- * @providesModule keyOf
1594
- */
1595
-
1596
- /**
1597
- * Allows extraction of a minified key. Let's the build system minify keys
1598
- * without losing the ability to dynamically use key strings as values
1599
- * themselves. Pass in an object with a single key/val pair and it will return
1600
- * you the string key of that single record. Suppose you want to grab the
1601
- * value for a key 'className' inside of an object. Key/val minification may
1602
- * have aliased that key to be 'xa12'. keyOf({className: null}) will return
1603
- * 'xa12' in that case. Resolve keys you want to use once at startup time, then
1604
- * reuse those resolutions.
1605
- */
1606
- "use strict";
1607
-
1608
- var keyOf = function (oneKeyObj) {
1609
- var key;
1610
- for (key in oneKeyObj) {
1611
- if (!oneKeyObj.hasOwnProperty(key)) {
1612
- continue;
1613
- }
1614
- return key;
1615
- }
1616
- return null;
1617
- };
1618
-
1619
- module.exports = keyOf;
1620
- },{}],23:[function(require,module,exports){
1621
- /**
1622
- * Copyright 2013-2015, Facebook, Inc.
1623
- * All rights reserved.
1624
- *
1625
- * This source code is licensed under the BSD-style license found in the
1626
- * LICENSE file in the root directory of this source tree. An additional grant
1627
- * of patent rights can be found in the PATENTS file in the same directory.
1628
- *
1629
- * @providesModule mapObject
1630
- */
1631
-
1632
- 'use strict';
1633
-
1634
- var hasOwnProperty = Object.prototype.hasOwnProperty;
1635
-
1636
- /**
1637
- * Executes the provided `callback` once for each enumerable own property in the
1638
- * object and constructs a new object from the results. The `callback` is
1639
- * invoked with three arguments:
1640
- *
1641
- * - the property value
1642
- * - the property name
1643
- * - the object being traversed
1644
- *
1645
- * Properties that are added after the call to `mapObject` will not be visited
1646
- * by `callback`. If the values of existing properties are changed, the value
1647
- * passed to `callback` will be the value at the time `mapObject` visits them.
1648
- * Properties that are deleted before being visited are not visited.
1649
- *
1650
- * @grep function objectMap()
1651
- * @grep function objMap()
1652
- *
1653
- * @param {?object} object
1654
- * @param {function} callback
1655
- * @param {*} context
1656
- * @return {?object}
1657
- */
1658
- function mapObject(object, callback, context) {
1659
- if (!object) {
1660
- return null;
1661
- }
1662
- var result = {};
1663
- for (var name in object) {
1664
- if (hasOwnProperty.call(object, name)) {
1665
- result[name] = callback.call(context, object[name], name, object);
1666
- }
1667
- }
1668
- return result;
1669
- }
1670
-
1671
- module.exports = mapObject;
1672
- },{}],24:[function(require,module,exports){
1673
- /**
1674
- * Copyright 2013-2015, Facebook, Inc.
1675
- * All rights reserved.
1676
- *
1677
- * This source code is licensed under the BSD-style license found in the
1678
- * LICENSE file in the root directory of this source tree. An additional grant
1679
- * of patent rights can be found in the PATENTS file in the same directory.
1680
- *
1681
- * @providesModule memoizeStringOnly
1682
- * @typechecks static-only
1683
- */
1684
-
1685
- 'use strict';
1686
-
1687
- /**
1688
- * Memoizes the return value of a function that accepts one string argument.
1689
- *
1690
- * @param {function} callback
1691
- * @return {function}
1692
- */
1693
- function memoizeStringOnly(callback) {
1694
- var cache = {};
1695
- return function (string) {
1696
- if (!cache.hasOwnProperty(string)) {
1697
- cache[string] = callback.call(this, string);
1698
- }
1699
- return cache[string];
1700
- };
1701
- }
1702
-
1703
- module.exports = memoizeStringOnly;
1704
- },{}],25:[function(require,module,exports){
1705
- /**
1706
- * Copyright 2013-2015, Facebook, Inc.
1707
- * All rights reserved.
1708
- *
1709
- * This source code is licensed under the BSD-style license found in the
1710
- * LICENSE file in the root directory of this source tree. An additional grant
1711
- * of patent rights can be found in the PATENTS file in the same directory.
1712
- *
1713
- * @providesModule performance
1714
- * @typechecks
1715
- */
1716
-
1717
- 'use strict';
1718
-
1719
- var ExecutionEnvironment = require('./ExecutionEnvironment');
1720
-
1721
- var performance;
1722
-
1723
- if (ExecutionEnvironment.canUseDOM) {
1724
- performance = window.performance || window.msPerformance || window.webkitPerformance;
1725
- }
1726
-
1727
- module.exports = performance || {};
1728
- },{"./ExecutionEnvironment":4}],26:[function(require,module,exports){
1729
- /**
1730
- * Copyright 2013-2015, Facebook, Inc.
1731
- * All rights reserved.
1732
- *
1733
- * This source code is licensed under the BSD-style license found in the
1734
- * LICENSE file in the root directory of this source tree. An additional grant
1735
- * of patent rights can be found in the PATENTS file in the same directory.
1736
- *
1737
- * @providesModule performanceNow
1738
- * @typechecks
1739
- */
1740
-
1741
- 'use strict';
1742
-
1743
- var performance = require('./performance');
1744
-
1745
- var performanceNow;
1746
-
1747
- /**
1748
- * Detect if we can use `window.performance.now()` and gracefully fallback to
1749
- * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
1750
- * because of Facebook's testing infrastructure.
1751
- */
1752
- if (performance.now) {
1753
- performanceNow = function () {
1754
- return performance.now();
1755
- };
1756
- } else {
1757
- performanceNow = function () {
1758
- return Date.now();
1759
- };
1760
- }
1761
-
1762
- module.exports = performanceNow;
1763
- },{"./performance":25}],27:[function(require,module,exports){
1764
- /**
1765
- * Copyright 2013-2015, Facebook, Inc.
1766
- * All rights reserved.
1767
- *
1768
- * This source code is licensed under the BSD-style license found in the
1769
- * LICENSE file in the root directory of this source tree. An additional grant
1770
- * of patent rights can be found in the PATENTS file in the same directory.
1771
- *
1772
- * @providesModule shallowEqual
1773
- * @typechecks
1774
- *
1775
- */
1776
-
1777
- 'use strict';
1778
-
1779
- var hasOwnProperty = Object.prototype.hasOwnProperty;
1780
-
1781
- /**
1782
- * Performs equality by iterating through keys on an object and returning false
1783
- * when any key has values which are not strictly equal between the arguments.
1784
- * Returns true when the values of all keys are strictly equal.
1785
- */
1786
- function shallowEqual(objA, objB) {
1787
- if (objA === objB) {
1788
- return true;
1789
- }
1790
-
1791
- if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
1792
- return false;
1793
- }
1794
-
1795
- var keysA = Object.keys(objA);
1796
- var keysB = Object.keys(objB);
1797
-
1798
- if (keysA.length !== keysB.length) {
1799
- return false;
1800
- }
1801
-
1802
- // Test for A's keys different from B.
1803
- var bHasOwnProperty = hasOwnProperty.bind(objB);
1804
- for (var i = 0; i < keysA.length; i++) {
1805
- if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
1806
- return false;
1807
- }
1808
- }
1809
-
1810
- return true;
1811
- }
1812
-
1813
- module.exports = shallowEqual;
1814
- },{}],28:[function(require,module,exports){
1815
- (function (process){
1816
- /**
1817
- * Copyright 2013-2015, Facebook, Inc.
1818
- * All rights reserved.
1819
- *
1820
- * This source code is licensed under the BSD-style license found in the
1821
- * LICENSE file in the root directory of this source tree. An additional grant
1822
- * of patent rights can be found in the PATENTS file in the same directory.
1823
- *
1824
- * @providesModule toArray
1825
- * @typechecks
1826
- */
1827
-
1828
- 'use strict';
1829
-
1830
- var invariant = require('./invariant');
1831
-
1832
- /**
1833
- * Convert array-like objects to arrays.
1834
- *
1835
- * This API assumes the caller knows the contents of the data type. For less
1836
- * well defined inputs use createArrayFromMixed.
1837
- *
1838
- * @param {object|function|filelist} obj
1839
- * @return {array}
1840
- */
1841
- function toArray(obj) {
1842
- var length = obj.length;
1843
-
1844
- // Some browse builtin objects can report typeof 'function' (e.g. NodeList in
1845
- // old versions of Safari).
1846
- !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : undefined;
1847
-
1848
- !(typeof length === 'number') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : undefined;
1849
-
1850
- !(length === 0 || length - 1 in obj) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : undefined;
1851
-
1852
- // Old IE doesn't give collections access to hasOwnProperty. Assume inputs
1853
- // without method will throw during the slice call and skip straight to the
1854
- // fallback.
1855
- if (obj.hasOwnProperty) {
1856
- try {
1857
- return Array.prototype.slice.call(obj);
1858
- } catch (e) {
1859
- // IE < 9 does not support Array#slice on collections objects
1860
- }
1861
- }
1862
-
1863
- // Fall back to copying key by key. This assumes all keys have a value,
1864
- // so will not preserve sparsely populated inputs.
1865
- var ret = Array(length);
1866
- for (var ii = 0; ii < length; ii++) {
1867
- ret[ii] = obj[ii];
1868
- }
1869
- return ret;
1870
- }
1871
-
1872
- module.exports = toArray;
1873
- }).call(this,require('_process'))
1874
-
1875
- },{"./invariant":18,"_process":31}],29:[function(require,module,exports){
1876
- (function (process){
1877
- /**
1878
- * Copyright 2014-2015, Facebook, Inc.
1879
- * All rights reserved.
1880
- *
1881
- * This source code is licensed under the BSD-style license found in the
1882
- * LICENSE file in the root directory of this source tree. An additional grant
1883
- * of patent rights can be found in the PATENTS file in the same directory.
1884
- *
1885
- * @providesModule warning
1886
- */
1887
-
1888
- 'use strict';
1889
-
1890
- var emptyFunction = require('./emptyFunction');
1891
-
1892
- /**
1893
- * Similar to invariant but only logs a warning if the condition is not met.
1894
- * This can be used to log issues in development environments in critical
1895
- * paths. Removing the logging code for production environments will keep the
1896
- * same logic and follow the same code paths.
1897
- */
1898
-
1899
- var warning = emptyFunction;
1900
-
1901
- if (process.env.NODE_ENV !== 'production') {
1902
- warning = function (condition, format) {
1903
- for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
1904
- args[_key - 2] = arguments[_key];
1905
- }
1906
-
1907
- if (format === undefined) {
1908
- throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
1909
- }
1910
-
1911
- if (format.indexOf('Failed Composite propType: ') === 0) {
1912
- return; // Ignore CompositeComponent proptype check.
1913
- }
1914
-
1915
- if (!condition) {
1916
- var argIndex = 0;
1917
- var message = 'Warning: ' + format.replace(/%s/g, function () {
1918
- return args[argIndex++];
1919
- });
1920
- if (typeof console !== 'undefined') {
1921
- console.error(message);
1922
- }
1923
- try {
1924
- // --- Welcome to debugging React ---
1925
- // This error was thrown as a convenience so that you can use this stack
1926
- // to find the callsite that caused this warning to fire.
1927
- throw new Error(message);
1928
- } catch (x) {}
1929
- }
1930
- };
1931
- }
1932
-
1933
- module.exports = warning;
1934
- }).call(this,require('_process'))
1935
-
1936
- },{"./emptyFunction":10,"_process":31}],30:[function(require,module,exports){
1937
- /*!
1938
- * jQuery JavaScript Library v3.1.1
1939
- * https://jquery.com/
1940
- *
1941
- * Includes Sizzle.js
1942
- * https://sizzlejs.com/
1943
- *
1944
- * Copyright jQuery Foundation and other contributors
1945
- * Released under the MIT license
1946
- * https://jquery.org/license
1947
- *
1948
- * Date: 2016-09-22T22:30Z
1949
- */
1950
- ( function( global, factory ) {
1951
-
1952
- "use strict";
1953
-
1954
- if ( typeof module === "object" && typeof module.exports === "object" ) {
1955
-
1956
- // For CommonJS and CommonJS-like environments where a proper `window`
1957
- // is present, execute the factory and get jQuery.
1958
- // For environments that do not have a `window` with a `document`
1959
- // (such as Node.js), expose a factory as module.exports.
1960
- // This accentuates the need for the creation of a real `window`.
1961
- // e.g. var jQuery = require("jquery")(window);
1962
- // See ticket #14549 for more info.
1963
- module.exports = global.document ?
1964
- factory( global, true ) :
1965
- function( w ) {
1966
- if ( !w.document ) {
1967
- throw new Error( "jQuery requires a window with a document" );
1968
- }
1969
- return factory( w );
1970
- };
1971
- } else {
1972
- factory( global );
1973
- }
1974
-
1975
- // Pass this if window is not defined yet
1976
- } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
1977
-
1978
- // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
1979
- // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
1980
- // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
1981
- // enough that all such attempts are guarded in a try block.
1982
- "use strict";
1983
-
1984
- var arr = [];
1985
-
1986
- var document = window.document;
1987
-
1988
- var getProto = Object.getPrototypeOf;
1989
-
1990
- var slice = arr.slice;
1991
-
1992
- var concat = arr.concat;
1993
-
1994
- var push = arr.push;
1995
-
1996
- var indexOf = arr.indexOf;
1997
-
1998
- var class2type = {};
1999
-
2000
- var toString = class2type.toString;
2001
-
2002
- var hasOwn = class2type.hasOwnProperty;
2003
-
2004
- var fnToString = hasOwn.toString;
2005
-
2006
- var ObjectFunctionString = fnToString.call( Object );
2007
-
2008
- var support = {};
2009
-
2010
-
2011
-
2012
- function DOMEval( code, doc ) {
2013
- doc = doc || document;
2014
-
2015
- var script = doc.createElement( "script" );
2016
-
2017
- script.text = code;
2018
- doc.head.appendChild( script ).parentNode.removeChild( script );
2019
- }
2020
- /* global Symbol */
2021
- // Defining this global in .eslintrc.json would create a danger of using the global
2022
- // unguarded in another place, it seems safer to define global only for this module
2023
-
2024
-
2025
-
2026
- var
2027
- version = "3.1.1",
2028
-
2029
- // Define a local copy of jQuery
2030
- jQuery = function( selector, context ) {
2031
-
2032
- // The jQuery object is actually just the init constructor 'enhanced'
2033
- // Need init if jQuery is called (just allow error to be thrown if not included)
2034
- return new jQuery.fn.init( selector, context );
2035
- },
2036
-
2037
- // Support: Android <=4.0 only
2038
- // Make sure we trim BOM and NBSP
2039
- rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
2040
-
2041
- // Matches dashed string for camelizing
2042
- rmsPrefix = /^-ms-/,
2043
- rdashAlpha = /-([a-z])/g,
2044
-
2045
- // Used by jQuery.camelCase as callback to replace()
2046
- fcamelCase = function( all, letter ) {
2047
- return letter.toUpperCase();
2048
- };
2049
-
2050
- jQuery.fn = jQuery.prototype = {
2051
-
2052
- // The current version of jQuery being used
2053
- jquery: version,
2054
-
2055
- constructor: jQuery,
2056
-
2057
- // The default length of a jQuery object is 0
2058
- length: 0,
2059
-
2060
- toArray: function() {
2061
- return slice.call( this );
2062
- },
2063
-
2064
- // Get the Nth element in the matched element set OR
2065
- // Get the whole matched element set as a clean array
2066
- get: function( num ) {
2067
-
2068
- // Return all the elements in a clean array
2069
- if ( num == null ) {
2070
- return slice.call( this );
2071
- }
2072
-
2073
- // Return just the one element from the set
2074
- return num < 0 ? this[ num + this.length ] : this[ num ];
2075
- },
2076
-
2077
- // Take an array of elements and push it onto the stack
2078
- // (returning the new matched element set)
2079
- pushStack: function( elems ) {
2080
-
2081
- // Build a new jQuery matched element set
2082
- var ret = jQuery.merge( this.constructor(), elems );
2083
-
2084
- // Add the old object onto the stack (as a reference)
2085
- ret.prevObject = this;
2086
-
2087
- // Return the newly-formed element set
2088
- return ret;
2089
- },
2090
-
2091
- // Execute a callback for every element in the matched set.
2092
- each: function( callback ) {
2093
- return jQuery.each( this, callback );
2094
- },
2095
-
2096
- map: function( callback ) {
2097
- return this.pushStack( jQuery.map( this, function( elem, i ) {
2098
- return callback.call( elem, i, elem );
2099
- } ) );
2100
- },
2101
-
2102
- slice: function() {
2103
- return this.pushStack( slice.apply( this, arguments ) );
2104
- },
2105
-
2106
- first: function() {
2107
- return this.eq( 0 );
2108
- },
2109
-
2110
- last: function() {
2111
- return this.eq( -1 );
2112
- },
2113
-
2114
- eq: function( i ) {
2115
- var len = this.length,
2116
- j = +i + ( i < 0 ? len : 0 );
2117
- return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
2118
- },
2119
-
2120
- end: function() {
2121
- return this.prevObject || this.constructor();
2122
- },
2123
-
2124
- // For internal use only.
2125
- // Behaves like an Array's method, not like a jQuery method.
2126
- push: push,
2127
- sort: arr.sort,
2128
- splice: arr.splice
2129
- };
2130
-
2131
- jQuery.extend = jQuery.fn.extend = function() {
2132
- var options, name, src, copy, copyIsArray, clone,
2133
- target = arguments[ 0 ] || {},
2134
- i = 1,
2135
- length = arguments.length,
2136
- deep = false;
2137
-
2138
- // Handle a deep copy situation
2139
- if ( typeof target === "boolean" ) {
2140
- deep = target;
2141
-
2142
- // Skip the boolean and the target
2143
- target = arguments[ i ] || {};
2144
- i++;
2145
- }
2146
-
2147
- // Handle case when target is a string or something (possible in deep copy)
2148
- if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
2149
- target = {};
2150
- }
2151
-
2152
- // Extend jQuery itself if only one argument is passed
2153
- if ( i === length ) {
2154
- target = this;
2155
- i--;
2156
- }
2157
-
2158
- for ( ; i < length; i++ ) {
2159
-
2160
- // Only deal with non-null/undefined values
2161
- if ( ( options = arguments[ i ] ) != null ) {
2162
-
2163
- // Extend the base object
2164
- for ( name in options ) {
2165
- src = target[ name ];
2166
- copy = options[ name ];
2167
-
2168
- // Prevent never-ending loop
2169
- if ( target === copy ) {
2170
- continue;
2171
- }
2172
-
2173
- // Recurse if we're merging plain objects or arrays
2174
- if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
2175
- ( copyIsArray = jQuery.isArray( copy ) ) ) ) {
2176
-
2177
- if ( copyIsArray ) {
2178
- copyIsArray = false;
2179
- clone = src && jQuery.isArray( src ) ? src : [];
2180
-
2181
- } else {
2182
- clone = src && jQuery.isPlainObject( src ) ? src : {};
2183
- }
2184
-
2185
- // Never move original objects, clone them
2186
- target[ name ] = jQuery.extend( deep, clone, copy );
2187
-
2188
- // Don't bring in undefined values
2189
- } else if ( copy !== undefined ) {
2190
- target[ name ] = copy;
2191
- }
2192
- }
2193
- }
2194
- }
2195
-
2196
- // Return the modified object
2197
- return target;
2198
- };
2199
-
2200
- jQuery.extend( {
2201
-
2202
- // Unique for each copy of jQuery on the page
2203
- expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
2204
-
2205
- // Assume jQuery is ready without the ready module
2206
- isReady: true,
2207
-
2208
- error: function( msg ) {
2209
- throw new Error( msg );
2210
- },
2211
-
2212
- noop: function() {},
2213
-
2214
- isFunction: function( obj ) {
2215
- return jQuery.type( obj ) === "function";
2216
- },
2217
-
2218
- isArray: Array.isArray,
2219
-
2220
- isWindow: function( obj ) {
2221
- return obj != null && obj === obj.window;
2222
- },
2223
-
2224
- isNumeric: function( obj ) {
2225
-
2226
- // As of jQuery 3.0, isNumeric is limited to
2227
- // strings and numbers (primitives or objects)
2228
- // that can be coerced to finite numbers (gh-2662)
2229
- var type = jQuery.type( obj );
2230
- return ( type === "number" || type === "string" ) &&
2231
-
2232
- // parseFloat NaNs numeric-cast false positives ("")
2233
- // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
2234
- // subtraction forces infinities to NaN
2235
- !isNaN( obj - parseFloat( obj ) );
2236
- },
2237
-
2238
- isPlainObject: function( obj ) {
2239
- var proto, Ctor;
2240
-
2241
- // Detect obvious negatives
2242
- // Use toString instead of jQuery.type to catch host objects
2243
- if ( !obj || toString.call( obj ) !== "[object Object]" ) {
2244
- return false;
2245
- }
2246
-
2247
- proto = getProto( obj );
2248
-
2249
- // Objects with no prototype (e.g., `Object.create( null )`) are plain
2250
- if ( !proto ) {
2251
- return true;
2252
- }
2253
-
2254
- // Objects with prototype are plain iff they were constructed by a global Object function
2255
- Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
2256
- return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
2257
- },
2258
-
2259
- isEmptyObject: function( obj ) {
2260
-
2261
- /* eslint-disable no-unused-vars */
2262
- // See https://github.com/eslint/eslint/issues/6125
2263
- var name;
2264
-
2265
- for ( name in obj ) {
2266
- return false;
2267
- }
2268
- return true;
2269
- },
2270
-
2271
- type: function( obj ) {
2272
- if ( obj == null ) {
2273
- return obj + "";
2274
- }
2275
-
2276
- // Support: Android <=2.3 only (functionish RegExp)
2277
- return typeof obj === "object" || typeof obj === "function" ?
2278
- class2type[ toString.call( obj ) ] || "object" :
2279
- typeof obj;
2280
- },
2281
-
2282
- // Evaluates a script in a global context
2283
- globalEval: function( code ) {
2284
- DOMEval( code );
2285
- },
2286
-
2287
- // Convert dashed to camelCase; used by the css and data modules
2288
- // Support: IE <=9 - 11, Edge 12 - 13
2289
- // Microsoft forgot to hump their vendor prefix (#9572)
2290
- camelCase: function( string ) {
2291
- return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
2292
- },
2293
-
2294
- nodeName: function( elem, name ) {
2295
- return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
2296
- },
2297
-
2298
- each: function( obj, callback ) {
2299
- var length, i = 0;
2300
-
2301
- if ( isArrayLike( obj ) ) {
2302
- length = obj.length;
2303
- for ( ; i < length; i++ ) {
2304
- if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
2305
- break;
2306
- }
2307
- }
2308
- } else {
2309
- for ( i in obj ) {
2310
- if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
2311
- break;
2312
- }
2313
- }
2314
- }
2315
-
2316
- return obj;
2317
- },
2318
-
2319
- // Support: Android <=4.0 only
2320
- trim: function( text ) {
2321
- return text == null ?
2322
- "" :
2323
- ( text + "" ).replace( rtrim, "" );
2324
- },
2325
-
2326
- // results is for internal usage only
2327
- makeArray: function( arr, results ) {
2328
- var ret = results || [];
2329
-
2330
- if ( arr != null ) {
2331
- if ( isArrayLike( Object( arr ) ) ) {
2332
- jQuery.merge( ret,
2333
- typeof arr === "string" ?
2334
- [ arr ] : arr
2335
- );
2336
- } else {
2337
- push.call( ret, arr );
2338
- }
2339
- }
2340
-
2341
- return ret;
2342
- },
2343
-
2344
- inArray: function( elem, arr, i ) {
2345
- return arr == null ? -1 : indexOf.call( arr, elem, i );
2346
- },
2347
-
2348
- // Support: Android <=4.0 only, PhantomJS 1 only
2349
- // push.apply(_, arraylike) throws on ancient WebKit
2350
- merge: function( first, second ) {
2351
- var len = +second.length,
2352
- j = 0,
2353
- i = first.length;
2354
-
2355
- for ( ; j < len; j++ ) {
2356
- first[ i++ ] = second[ j ];
2357
- }
2358
-
2359
- first.length = i;
2360
-
2361
- return first;
2362
- },
2363
-
2364
- grep: function( elems, callback, invert ) {
2365
- var callbackInverse,
2366
- matches = [],
2367
- i = 0,
2368
- length = elems.length,
2369
- callbackExpect = !invert;
2370
-
2371
- // Go through the array, only saving the items
2372
- // that pass the validator function
2373
- for ( ; i < length; i++ ) {
2374
- callbackInverse = !callback( elems[ i ], i );
2375
- if ( callbackInverse !== callbackExpect ) {
2376
- matches.push( elems[ i ] );
2377
- }
2378
- }
2379
-
2380
- return matches;
2381
- },
2382
-
2383
- // arg is for internal usage only
2384
- map: function( elems, callback, arg ) {
2385
- var length, value,
2386
- i = 0,
2387
- ret = [];
2388
-
2389
- // Go through the array, translating each of the items to their new values
2390
- if ( isArrayLike( elems ) ) {
2391
- length = elems.length;
2392
- for ( ; i < length; i++ ) {
2393
- value = callback( elems[ i ], i, arg );
2394
-
2395
- if ( value != null ) {
2396
- ret.push( value );
2397
- }
2398
- }
2399
-
2400
- // Go through every key on the object,
2401
- } else {
2402
- for ( i in elems ) {
2403
- value = callback( elems[ i ], i, arg );
2404
-
2405
- if ( value != null ) {
2406
- ret.push( value );
2407
- }
2408
- }
2409
- }
2410
-
2411
- // Flatten any nested arrays
2412
- return concat.apply( [], ret );
2413
- },
2414
-
2415
- // A global GUID counter for objects
2416
- guid: 1,
2417
-
2418
- // Bind a function to a context, optionally partially applying any
2419
- // arguments.
2420
- proxy: function( fn, context ) {
2421
- var tmp, args, proxy;
2422
-
2423
- if ( typeof context === "string" ) {
2424
- tmp = fn[ context ];
2425
- context = fn;
2426
- fn = tmp;
2427
- }
2428
-
2429
- // Quick check to determine if target is callable, in the spec
2430
- // this throws a TypeError, but we will just return undefined.
2431
- if ( !jQuery.isFunction( fn ) ) {
2432
- return undefined;
2433
- }
2434
-
2435
- // Simulated bind
2436
- args = slice.call( arguments, 2 );
2437
- proxy = function() {
2438
- return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
2439
- };
2440
-
2441
- // Set the guid of unique handler to the same of original handler, so it can be removed
2442
- proxy.guid = fn.guid = fn.guid || jQuery.guid++;
2443
-
2444
- return proxy;
2445
- },
2446
-
2447
- now: Date.now,
2448
-
2449
- // jQuery.support is not used in Core but other projects attach their
2450
- // properties to it so it needs to exist.
2451
- support: support
2452
- } );
2453
-
2454
- if ( typeof Symbol === "function" ) {
2455
- jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
2456
- }
2457
-
2458
- // Populate the class2type map
2459
- jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
2460
- function( i, name ) {
2461
- class2type[ "[object " + name + "]" ] = name.toLowerCase();
2462
- } );
2463
-
2464
- function isArrayLike( obj ) {
2465
-
2466
- // Support: real iOS 8.2 only (not reproducible in simulator)
2467
- // `in` check used to prevent JIT error (gh-2145)
2468
- // hasOwn isn't used here due to false negatives
2469
- // regarding Nodelist length in IE
2470
- var length = !!obj && "length" in obj && obj.length,
2471
- type = jQuery.type( obj );
2472
-
2473
- if ( type === "function" || jQuery.isWindow( obj ) ) {
2474
- return false;
2475
- }
2476
-
2477
- return type === "array" || length === 0 ||
2478
- typeof length === "number" && length > 0 && ( length - 1 ) in obj;
2479
- }
2480
- var Sizzle =
2481
- /*!
2482
- * Sizzle CSS Selector Engine v2.3.3
2483
- * https://sizzlejs.com/
2484
- *
2485
- * Copyright jQuery Foundation and other contributors
2486
- * Released under the MIT license
2487
- * http://jquery.org/license
2488
- *
2489
- * Date: 2016-08-08
2490
- */
2491
- (function( window ) {
2492
-
2493
- var i,
2494
- support,
2495
- Expr,
2496
- getText,
2497
- isXML,
2498
- tokenize,
2499
- compile,
2500
- select,
2501
- outermostContext,
2502
- sortInput,
2503
- hasDuplicate,
2504
-
2505
- // Local document vars
2506
- setDocument,
2507
- document,
2508
- docElem,
2509
- documentIsHTML,
2510
- rbuggyQSA,
2511
- rbuggyMatches,
2512
- matches,
2513
- contains,
2514
-
2515
- // Instance-specific data
2516
- expando = "sizzle" + 1 * new Date(),
2517
- preferredDoc = window.document,
2518
- dirruns = 0,
2519
- done = 0,
2520
- classCache = createCache(),
2521
- tokenCache = createCache(),
2522
- compilerCache = createCache(),
2523
- sortOrder = function( a, b ) {
2524
- if ( a === b ) {
2525
- hasDuplicate = true;
2526
- }
2527
- return 0;
2528
- },
2529
-
2530
- // Instance methods
2531
- hasOwn = ({}).hasOwnProperty,
2532
- arr = [],
2533
- pop = arr.pop,
2534
- push_native = arr.push,
2535
- push = arr.push,
2536
- slice = arr.slice,
2537
- // Use a stripped-down indexOf as it's faster than native
2538
- // https://jsperf.com/thor-indexof-vs-for/5
2539
- indexOf = function( list, elem ) {
2540
- var i = 0,
2541
- len = list.length;
2542
- for ( ; i < len; i++ ) {
2543
- if ( list[i] === elem ) {
2544
- return i;
2545
- }
2546
- }
2547
- return -1;
2548
- },
2549
-
2550
- booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
2551
-
2552
- // Regular expressions
2553
-
2554
- // http://www.w3.org/TR/css3-selectors/#whitespace
2555
- whitespace = "[\\x20\\t\\r\\n\\f]",
2556
-
2557
- // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
2558
- identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
2559
-
2560
- // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
2561
- attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
2562
- // Operator (capture 2)
2563
- "*([*^$|!~]?=)" + whitespace +
2564
- // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
2565
- "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
2566
- "*\\]",
2567
-
2568
- pseudos = ":(" + identifier + ")(?:\\((" +
2569
- // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
2570
- // 1. quoted (capture 3; capture 4 or capture 5)
2571
- "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
2572
- // 2. simple (capture 6)
2573
- "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
2574
- // 3. anything else (capture 2)
2575
- ".*" +
2576
- ")\\)|)",
2577
-
2578
- // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
2579
- rwhitespace = new RegExp( whitespace + "+", "g" ),
2580
- rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
2581
-
2582
- rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
2583
- rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
2584
-
2585
- rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
2586
-
2587
- rpseudo = new RegExp( pseudos ),
2588
- ridentifier = new RegExp( "^" + identifier + "$" ),
2589
-
2590
- matchExpr = {
2591
- "ID": new RegExp( "^#(" + identifier + ")" ),
2592
- "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
2593
- "TAG": new RegExp( "^(" + identifier + "|[*])" ),
2594
- "ATTR": new RegExp( "^" + attributes ),
2595
- "PSEUDO": new RegExp( "^" + pseudos ),
2596
- "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
2597
- "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
2598
- "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
2599
- "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
2600
- // For use in libraries implementing .is()
2601
- // We use this for POS matching in `select`
2602
- "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
2603
- whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
2604
- },
2605
-
2606
- rinputs = /^(?:input|select|textarea|button)$/i,
2607
- rheader = /^h\d$/i,
2608
-
2609
- rnative = /^[^{]+\{\s*\[native \w/,
2610
-
2611
- // Easily-parseable/retrievable ID or TAG or CLASS selectors
2612
- rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
2613
-
2614
- rsibling = /[+~]/,
2615
-
2616
- // CSS escapes
2617
- // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
2618
- runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
2619
- funescape = function( _, escaped, escapedWhitespace ) {
2620
- var high = "0x" + escaped - 0x10000;
2621
- // NaN means non-codepoint
2622
- // Support: Firefox<24
2623
- // Workaround erroneous numeric interpretation of +"0x"
2624
- return high !== high || escapedWhitespace ?
2625
- escaped :
2626
- high < 0 ?
2627
- // BMP codepoint
2628
- String.fromCharCode( high + 0x10000 ) :
2629
- // Supplemental Plane codepoint (surrogate pair)
2630
- String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
2631
- },
2632
-
2633
- // CSS string/identifier serialization
2634
- // https://drafts.csswg.org/cssom/#common-serializing-idioms
2635
- rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
2636
- fcssescape = function( ch, asCodePoint ) {
2637
- if ( asCodePoint ) {
2638
-
2639
- // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
2640
- if ( ch === "\0" ) {
2641
- return "\uFFFD";
2642
- }
2643
-
2644
- // Control characters and (dependent upon position) numbers get escaped as code points
2645
- return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
2646
- }
2647
-
2648
- // Other potentially-special ASCII characters get backslash-escaped
2649
- return "\\" + ch;
2650
- },
2651
-
2652
- // Used for iframes
2653
- // See setDocument()
2654
- // Removing the function wrapper causes a "Permission Denied"
2655
- // error in IE
2656
- unloadHandler = function() {
2657
- setDocument();
2658
- },
2659
-
2660
- disabledAncestor = addCombinator(
2661
- function( elem ) {
2662
- return elem.disabled === true && ("form" in elem || "label" in elem);
2663
- },
2664
- { dir: "parentNode", next: "legend" }
2665
- );
2666
-
2667
- // Optimize for push.apply( _, NodeList )
2668
- try {
2669
- push.apply(
2670
- (arr = slice.call( preferredDoc.childNodes )),
2671
- preferredDoc.childNodes
2672
- );
2673
- // Support: Android<4.0
2674
- // Detect silently failing push.apply
2675
- arr[ preferredDoc.childNodes.length ].nodeType;
2676
- } catch ( e ) {
2677
- push = { apply: arr.length ?
2678
-
2679
- // Leverage slice if possible
2680
- function( target, els ) {
2681
- push_native.apply( target, slice.call(els) );
2682
- } :
2683
-
2684
- // Support: IE<9
2685
- // Otherwise append directly
2686
- function( target, els ) {
2687
- var j = target.length,
2688
- i = 0;
2689
- // Can't trust NodeList.length
2690
- while ( (target[j++] = els[i++]) ) {}
2691
- target.length = j - 1;
2692
- }
2693
- };
2694
- }
2695
-
2696
- function Sizzle( selector, context, results, seed ) {
2697
- var m, i, elem, nid, match, groups, newSelector,
2698
- newContext = context && context.ownerDocument,
2699
-
2700
- // nodeType defaults to 9, since context defaults to document
2701
- nodeType = context ? context.nodeType : 9;
2702
-
2703
- results = results || [];
2704
-
2705
- // Return early from calls with invalid selector or context
2706
- if ( typeof selector !== "string" || !selector ||
2707
- nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
2708
-
2709
- return results;
2710
- }
2711
-
2712
- // Try to shortcut find operations (as opposed to filters) in HTML documents
2713
- if ( !seed ) {
2714
-
2715
- if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
2716
- setDocument( context );
2717
- }
2718
- context = context || document;
2719
-
2720
- if ( documentIsHTML ) {
2721
-
2722
- // If the selector is sufficiently simple, try using a "get*By*" DOM method
2723
- // (excepting DocumentFragment context, where the methods don't exist)
2724
- if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
2725
-
2726
- // ID selector
2727
- if ( (m = match[1]) ) {
2728
-
2729
- // Document context
2730
- if ( nodeType === 9 ) {
2731
- if ( (elem = context.getElementById( m )) ) {
2732
-
2733
- // Support: IE, Opera, Webkit
2734
- // TODO: identify versions
2735
- // getElementById can match elements by name instead of ID
2736
- if ( elem.id === m ) {
2737
- results.push( elem );
2738
- return results;
2739
- }
2740
- } else {
2741
- return results;
2742
- }
2743
-
2744
- // Element context
2745
- } else {
2746
-
2747
- // Support: IE, Opera, Webkit
2748
- // TODO: identify versions
2749
- // getElementById can match elements by name instead of ID
2750
- if ( newContext && (elem = newContext.getElementById( m )) &&
2751
- contains( context, elem ) &&
2752
- elem.id === m ) {
2753
-
2754
- results.push( elem );
2755
- return results;
2756
- }
2757
- }
2758
-
2759
- // Type selector
2760
- } else if ( match[2] ) {
2761
- push.apply( results, context.getElementsByTagName( selector ) );
2762
- return results;
2763
-
2764
- // Class selector
2765
- } else if ( (m = match[3]) && support.getElementsByClassName &&
2766
- context.getElementsByClassName ) {
2767
-
2768
- push.apply( results, context.getElementsByClassName( m ) );
2769
- return results;
2770
- }
2771
- }
2772
-
2773
- // Take advantage of querySelectorAll
2774
- if ( support.qsa &&
2775
- !compilerCache[ selector + " " ] &&
2776
- (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
2777
-
2778
- if ( nodeType !== 1 ) {
2779
- newContext = context;
2780
- newSelector = selector;
2781
-
2782
- // qSA looks outside Element context, which is not what we want
2783
- // Thanks to Andrew Dupont for this workaround technique
2784
- // Support: IE <=8
2785
- // Exclude object elements
2786
- } else if ( context.nodeName.toLowerCase() !== "object" ) {
2787
-
2788
- // Capture the context ID, setting it first if necessary
2789
- if ( (nid = context.getAttribute( "id" )) ) {
2790
- nid = nid.replace( rcssescape, fcssescape );
2791
- } else {
2792
- context.setAttribute( "id", (nid = expando) );
2793
- }
2794
-
2795
- // Prefix every selector in the list
2796
- groups = tokenize( selector );
2797
- i = groups.length;
2798
- while ( i-- ) {
2799
- groups[i] = "#" + nid + " " + toSelector( groups[i] );
2800
- }
2801
- newSelector = groups.join( "," );
2802
-
2803
- // Expand context for sibling selectors
2804
- newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
2805
- context;
2806
- }
2807
-
2808
- if ( newSelector ) {
2809
- try {
2810
- push.apply( results,
2811
- newContext.querySelectorAll( newSelector )
2812
- );
2813
- return results;
2814
- } catch ( qsaError ) {
2815
- } finally {
2816
- if ( nid === expando ) {
2817
- context.removeAttribute( "id" );
2818
- }
2819
- }
2820
- }
2821
- }
2822
- }
2823
- }
2824
-
2825
- // All others
2826
- return select( selector.replace( rtrim, "$1" ), context, results, seed );
2827
- }
2828
-
2829
- /**
2830
- * Create key-value caches of limited size
2831
- * @returns {function(string, object)} Returns the Object data after storing it on itself with
2832
- * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
2833
- * deleting the oldest entry
2834
- */
2835
- function createCache() {
2836
- var keys = [];
2837
-
2838
- function cache( key, value ) {
2839
- // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
2840
- if ( keys.push( key + " " ) > Expr.cacheLength ) {
2841
- // Only keep the most recent entries
2842
- delete cache[ keys.shift() ];
2843
- }
2844
- return (cache[ key + " " ] = value);
2845
- }
2846
- return cache;
2847
- }
2848
-
2849
- /**
2850
- * Mark a function for special use by Sizzle
2851
- * @param {Function} fn The function to mark
2852
- */
2853
- function markFunction( fn ) {
2854
- fn[ expando ] = true;
2855
- return fn;
2856
- }
2857
-
2858
- /**
2859
- * Support testing using an element
2860
- * @param {Function} fn Passed the created element and returns a boolean result
2861
- */
2862
- function assert( fn ) {
2863
- var el = document.createElement("fieldset");
2864
-
2865
- try {
2866
- return !!fn( el );
2867
- } catch (e) {
2868
- return false;
2869
- } finally {
2870
- // Remove from its parent by default
2871
- if ( el.parentNode ) {
2872
- el.parentNode.removeChild( el );
2873
- }
2874
- // release memory in IE
2875
- el = null;
2876
- }
2877
- }
2878
-
2879
- /**
2880
- * Adds the same handler for all of the specified attrs
2881
- * @param {String} attrs Pipe-separated list of attributes
2882
- * @param {Function} handler The method that will be applied
2883
- */
2884
- function addHandle( attrs, handler ) {
2885
- var arr = attrs.split("|"),
2886
- i = arr.length;
2887
-
2888
- while ( i-- ) {
2889
- Expr.attrHandle[ arr[i] ] = handler;
2890
- }
2891
- }
2892
-
2893
- /**
2894
- * Checks document order of two siblings
2895
- * @param {Element} a
2896
- * @param {Element} b
2897
- * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
2898
- */
2899
- function siblingCheck( a, b ) {
2900
- var cur = b && a,
2901
- diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
2902
- a.sourceIndex - b.sourceIndex;
2903
-
2904
- // Use IE sourceIndex if available on both nodes
2905
- if ( diff ) {
2906
- return diff;
2907
- }
2908
-
2909
- // Check if b follows a
2910
- if ( cur ) {
2911
- while ( (cur = cur.nextSibling) ) {
2912
- if ( cur === b ) {
2913
- return -1;
2914
- }
2915
- }
2916
- }
2917
-
2918
- return a ? 1 : -1;
2919
- }
2920
-
2921
- /**
2922
- * Returns a function to use in pseudos for input types
2923
- * @param {String} type
2924
- */
2925
- function createInputPseudo( type ) {
2926
- return function( elem ) {
2927
- var name = elem.nodeName.toLowerCase();
2928
- return name === "input" && elem.type === type;
2929
- };
2930
- }
2931
-
2932
- /**
2933
- * Returns a function to use in pseudos for buttons
2934
- * @param {String} type
2935
- */
2936
- function createButtonPseudo( type ) {
2937
- return function( elem ) {
2938
- var name = elem.nodeName.toLowerCase();
2939
- return (name === "input" || name === "button") && elem.type === type;
2940
- };
2941
- }
2942
-
2943
- /**
2944
- * Returns a function to use in pseudos for :enabled/:disabled
2945
- * @param {Boolean} disabled true for :disabled; false for :enabled
2946
- */
2947
- function createDisabledPseudo( disabled ) {
2948
-
2949
- // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
2950
- return function( elem ) {
2951
-
2952
- // Only certain elements can match :enabled or :disabled
2953
- // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
2954
- // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
2955
- if ( "form" in elem ) {
2956
-
2957
- // Check for inherited disabledness on relevant non-disabled elements:
2958
- // * listed form-associated elements in a disabled fieldset
2959
- // https://html.spec.whatwg.org/multipage/forms.html#category-listed
2960
- // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
2961
- // * option elements in a disabled optgroup
2962
- // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
2963
- // All such elements have a "form" property.
2964
- if ( elem.parentNode && elem.disabled === false ) {
2965
-
2966
- // Option elements defer to a parent optgroup if present
2967
- if ( "label" in elem ) {
2968
- if ( "label" in elem.parentNode ) {
2969
- return elem.parentNode.disabled === disabled;
2970
- } else {
2971
- return elem.disabled === disabled;
2972
- }
2973
- }
2974
-
2975
- // Support: IE 6 - 11
2976
- // Use the isDisabled shortcut property to check for disabled fieldset ancestors
2977
- return elem.isDisabled === disabled ||
2978
-
2979
- // Where there is no isDisabled, check manually
2980
- /* jshint -W018 */
2981
- elem.isDisabled !== !disabled &&
2982
- disabledAncestor( elem ) === disabled;
2983
- }
2984
-
2985
- return elem.disabled === disabled;
2986
-
2987
- // Try to winnow out elements that can't be disabled before trusting the disabled property.
2988
- // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
2989
- // even exist on them, let alone have a boolean value.
2990
- } else if ( "label" in elem ) {
2991
- return elem.disabled === disabled;
2992
- }
2993
-
2994
- // Remaining elements are neither :enabled nor :disabled
2995
- return false;
2996
- };
2997
- }
2998
-
2999
- /**
3000
- * Returns a function to use in pseudos for positionals
3001
- * @param {Function} fn
3002
- */
3003
- function createPositionalPseudo( fn ) {
3004
- return markFunction(function( argument ) {
3005
- argument = +argument;
3006
- return markFunction(function( seed, matches ) {
3007
- var j,
3008
- matchIndexes = fn( [], seed.length, argument ),
3009
- i = matchIndexes.length;
3010
-
3011
- // Match elements found at the specified indexes
3012
- while ( i-- ) {
3013
- if ( seed[ (j = matchIndexes[i]) ] ) {
3014
- seed[j] = !(matches[j] = seed[j]);
3015
- }
3016
- }
3017
- });
3018
- });
3019
- }
3020
-
3021
- /**
3022
- * Checks a node for validity as a Sizzle context
3023
- * @param {Element|Object=} context
3024
- * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
3025
- */
3026
- function testContext( context ) {
3027
- return context && typeof context.getElementsByTagName !== "undefined" && context;
3028
- }
3029
-
3030
- // Expose support vars for convenience
3031
- support = Sizzle.support = {};
3032
-
3033
- /**
3034
- * Detects XML nodes
3035
- * @param {Element|Object} elem An element or a document
3036
- * @returns {Boolean} True iff elem is a non-HTML XML node
3037
- */
3038
- isXML = Sizzle.isXML = function( elem ) {
3039
- // documentElement is verified for cases where it doesn't yet exist
3040
- // (such as loading iframes in IE - #4833)
3041
- var documentElement = elem && (elem.ownerDocument || elem).documentElement;
3042
- return documentElement ? documentElement.nodeName !== "HTML" : false;
3043
- };
3044
-
3045
- /**
3046
- * Sets document-related variables once based on the current document
3047
- * @param {Element|Object} [doc] An element or document object to use to set the document
3048
- * @returns {Object} Returns the current document
3049
- */
3050
- setDocument = Sizzle.setDocument = function( node ) {
3051
- var hasCompare, subWindow,
3052
- doc = node ? node.ownerDocument || node : preferredDoc;
3053
-
3054
- // Return early if doc is invalid or already selected
3055
- if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
3056
- return document;
3057
- }
3058
-
3059
- // Update global variables
3060
- document = doc;
3061
- docElem = document.documentElement;
3062
- documentIsHTML = !isXML( document );
3063
-
3064
- // Support: IE 9-11, Edge
3065
- // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
3066
- if ( preferredDoc !== document &&
3067
- (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
3068
-
3069
- // Support: IE 11, Edge
3070
- if ( subWindow.addEventListener ) {
3071
- subWindow.addEventListener( "unload", unloadHandler, false );
3072
-
3073
- // Support: IE 9 - 10 only
3074
- } else if ( subWindow.attachEvent ) {
3075
- subWindow.attachEvent( "onunload", unloadHandler );
3076
- }
3077
- }
3078
-
3079
- /* Attributes
3080
- ---------------------------------------------------------------------- */
3081
-
3082
- // Support: IE<8
3083
- // Verify that getAttribute really returns attributes and not properties
3084
- // (excepting IE8 booleans)
3085
- support.attributes = assert(function( el ) {
3086
- el.className = "i";
3087
- return !el.getAttribute("className");
3088
- });
3089
-
3090
- /* getElement(s)By*
3091
- ---------------------------------------------------------------------- */
3092
-
3093
- // Check if getElementsByTagName("*") returns only elements
3094
- support.getElementsByTagName = assert(function( el ) {
3095
- el.appendChild( document.createComment("") );
3096
- return !el.getElementsByTagName("*").length;
3097
- });
3098
-
3099
- // Support: IE<9
3100
- support.getElementsByClassName = rnative.test( document.getElementsByClassName );
3101
-
3102
- // Support: IE<10
3103
- // Check if getElementById returns elements by name
3104
- // The broken getElementById methods don't pick up programmatically-set names,
3105
- // so use a roundabout getElementsByName test
3106
- support.getById = assert(function( el ) {
3107
- docElem.appendChild( el ).id = expando;
3108
- return !document.getElementsByName || !document.getElementsByName( expando ).length;
3109
- });
3110
-
3111
- // ID filter and find
3112
- if ( support.getById ) {
3113
- Expr.filter["ID"] = function( id ) {
3114
- var attrId = id.replace( runescape, funescape );
3115
- return function( elem ) {
3116
- return elem.getAttribute("id") === attrId;
3117
- };
3118
- };
3119
- Expr.find["ID"] = function( id, context ) {
3120
- if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
3121
- var elem = context.getElementById( id );
3122
- return elem ? [ elem ] : [];
3123
- }
3124
- };
3125
- } else {
3126
- Expr.filter["ID"] = function( id ) {
3127
- var attrId = id.replace( runescape, funescape );
3128
- return function( elem ) {
3129
- var node = typeof elem.getAttributeNode !== "undefined" &&
3130
- elem.getAttributeNode("id");
3131
- return node && node.value === attrId;
3132
- };
3133
- };
3134
-
3135
- // Support: IE 6 - 7 only
3136
- // getElementById is not reliable as a find shortcut
3137
- Expr.find["ID"] = function( id, context ) {
3138
- if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
3139
- var node, i, elems,
3140
- elem = context.getElementById( id );
3141
-
3142
- if ( elem ) {
3143
-
3144
- // Verify the id attribute
3145
- node = elem.getAttributeNode("id");
3146
- if ( node && node.value === id ) {
3147
- return [ elem ];
3148
- }
3149
-
3150
- // Fall back on getElementsByName
3151
- elems = context.getElementsByName( id );
3152
- i = 0;
3153
- while ( (elem = elems[i++]) ) {
3154
- node = elem.getAttributeNode("id");
3155
- if ( node && node.value === id ) {
3156
- return [ elem ];
3157
- }
3158
- }
3159
- }
3160
-
3161
- return [];
3162
- }
3163
- };
3164
- }
3165
-
3166
- // Tag
3167
- Expr.find["TAG"] = support.getElementsByTagName ?
3168
- function( tag, context ) {
3169
- if ( typeof context.getElementsByTagName !== "undefined" ) {
3170
- return context.getElementsByTagName( tag );
3171
-
3172
- // DocumentFragment nodes don't have gEBTN
3173
- } else if ( support.qsa ) {
3174
- return context.querySelectorAll( tag );
3175
- }
3176
- } :
3177
-
3178
- function( tag, context ) {
3179
- var elem,
3180
- tmp = [],
3181
- i = 0,
3182
- // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
3183
- results = context.getElementsByTagName( tag );
3184
-
3185
- // Filter out possible comments
3186
- if ( tag === "*" ) {
3187
- while ( (elem = results[i++]) ) {
3188
- if ( elem.nodeType === 1 ) {
3189
- tmp.push( elem );
3190
- }
3191
- }
3192
-
3193
- return tmp;
3194
- }
3195
- return results;
3196
- };
3197
-
3198
- // Class
3199
- Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
3200
- if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
3201
- return context.getElementsByClassName( className );
3202
- }
3203
- };
3204
-
3205
- /* QSA/matchesSelector
3206
- ---------------------------------------------------------------------- */
3207
-
3208
- // QSA and matchesSelector support
3209
-
3210
- // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
3211
- rbuggyMatches = [];
3212
-
3213
- // qSa(:focus) reports false when true (Chrome 21)
3214
- // We allow this because of a bug in IE8/9 that throws an error
3215
- // whenever `document.activeElement` is accessed on an iframe
3216
- // So, we allow :focus to pass through QSA all the time to avoid the IE error
3217
- // See https://bugs.jquery.com/ticket/13378
3218
- rbuggyQSA = [];
3219
-
3220
- if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
3221
- // Build QSA regex
3222
- // Regex strategy adopted from Diego Perini
3223
- assert(function( el ) {
3224
- // Select is set to empty string on purpose
3225
- // This is to test IE's treatment of not explicitly
3226
- // setting a boolean content attribute,
3227
- // since its presence should be enough
3228
- // https://bugs.jquery.com/ticket/12359
3229
- docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
3230
- "<select id='" + expando + "-\r\\' msallowcapture=''>" +
3231
- "<option selected=''></option></select>";
3232
-
3233
- // Support: IE8, Opera 11-12.16
3234
- // Nothing should be selected when empty strings follow ^= or $= or *=
3235
- // The test attribute must be unknown in Opera but "safe" for WinRT
3236
- // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
3237
- if ( el.querySelectorAll("[msallowcapture^='']").length ) {
3238
- rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
3239
- }
3240
-
3241
- // Support: IE8
3242
- // Boolean attributes and "value" are not treated correctly
3243
- if ( !el.querySelectorAll("[selected]").length ) {
3244
- rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
3245
- }
3246
-
3247
- // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
3248
- if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
3249
- rbuggyQSA.push("~=");
3250
- }
3251
-
3252
- // Webkit/Opera - :checked should return selected option elements
3253
- // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
3254
- // IE8 throws error here and will not see later tests
3255
- if ( !el.querySelectorAll(":checked").length ) {
3256
- rbuggyQSA.push(":checked");
3257
- }
3258
-
3259
- // Support: Safari 8+, iOS 8+
3260
- // https://bugs.webkit.org/show_bug.cgi?id=136851
3261
- // In-page `selector#id sibling-combinator selector` fails
3262
- if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
3263
- rbuggyQSA.push(".#.+[+~]");
3264
- }
3265
- });
3266
-
3267
- assert(function( el ) {
3268
- el.innerHTML = "<a href='' disabled='disabled'></a>" +
3269
- "<select disabled='disabled'><option/></select>";
3270
-
3271
- // Support: Windows 8 Native Apps
3272
- // The type and name attributes are restricted during .innerHTML assignment
3273
- var input = document.createElement("input");
3274
- input.setAttribute( "type", "hidden" );
3275
- el.appendChild( input ).setAttribute( "name", "D" );
3276
-
3277
- // Support: IE8
3278
- // Enforce case-sensitivity of name attribute
3279
- if ( el.querySelectorAll("[name=d]").length ) {
3280
- rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
3281
- }
3282
-
3283
- // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
3284
- // IE8 throws error here and will not see later tests
3285
- if ( el.querySelectorAll(":enabled").length !== 2 ) {
3286
- rbuggyQSA.push( ":enabled", ":disabled" );
3287
- }
3288
-
3289
- // Support: IE9-11+
3290
- // IE's :disabled selector does not pick up the children of disabled fieldsets
3291
- docElem.appendChild( el ).disabled = true;
3292
- if ( el.querySelectorAll(":disabled").length !== 2 ) {
3293
- rbuggyQSA.push( ":enabled", ":disabled" );
3294
- }
3295
-
3296
- // Opera 10-11 does not throw on post-comma invalid pseudos
3297
- el.querySelectorAll("*,:x");
3298
- rbuggyQSA.push(",.*:");
3299
- });
3300
- }
3301
-
3302
- if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
3303
- docElem.webkitMatchesSelector ||
3304
- docElem.mozMatchesSelector ||
3305
- docElem.oMatchesSelector ||
3306
- docElem.msMatchesSelector) )) ) {
3307
-
3308
- assert(function( el ) {
3309
- // Check to see if it's possible to do matchesSelector
3310
- // on a disconnected node (IE 9)
3311
- support.disconnectedMatch = matches.call( el, "*" );
3312
-
3313
- // This should fail with an exception
3314
- // Gecko does not error, returns false instead
3315
- matches.call( el, "[s!='']:x" );
3316
- rbuggyMatches.push( "!=", pseudos );
3317
- });
3318
- }
3319
-
3320
- rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
3321
- rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
3322
-
3323
- /* Contains
3324
- ---------------------------------------------------------------------- */
3325
- hasCompare = rnative.test( docElem.compareDocumentPosition );
3326
-
3327
- // Element contains another
3328
- // Purposefully self-exclusive
3329
- // As in, an element does not contain itself
3330
- contains = hasCompare || rnative.test( docElem.contains ) ?
3331
- function( a, b ) {
3332
- var adown = a.nodeType === 9 ? a.documentElement : a,
3333
- bup = b && b.parentNode;
3334
- return a === bup || !!( bup && bup.nodeType === 1 && (
3335
- adown.contains ?
3336
- adown.contains( bup ) :
3337
- a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
3338
- ));
3339
- } :
3340
- function( a, b ) {
3341
- if ( b ) {
3342
- while ( (b = b.parentNode) ) {
3343
- if ( b === a ) {
3344
- return true;
3345
- }
3346
- }
3347
- }
3348
- return false;
3349
- };
3350
-
3351
- /* Sorting
3352
- ---------------------------------------------------------------------- */
3353
-
3354
- // Document order sorting
3355
- sortOrder = hasCompare ?
3356
- function( a, b ) {
3357
-
3358
- // Flag for duplicate removal
3359
- if ( a === b ) {
3360
- hasDuplicate = true;
3361
- return 0;
3362
- }
3363
-
3364
- // Sort on method existence if only one input has compareDocumentPosition
3365
- var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
3366
- if ( compare ) {
3367
- return compare;
3368
- }
3369
-
3370
- // Calculate position if both inputs belong to the same document
3371
- compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
3372
- a.compareDocumentPosition( b ) :
3373
-
3374
- // Otherwise we know they are disconnected
3375
- 1;
3376
-
3377
- // Disconnected nodes
3378
- if ( compare & 1 ||
3379
- (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
3380
-
3381
- // Choose the first element that is related to our preferred document
3382
- if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
3383
- return -1;
3384
- }
3385
- if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
3386
- return 1;
3387
- }
3388
-
3389
- // Maintain original order
3390
- return sortInput ?
3391
- ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
3392
- 0;
3393
- }
3394
-
3395
- return compare & 4 ? -1 : 1;
3396
- } :
3397
- function( a, b ) {
3398
- // Exit early if the nodes are identical
3399
- if ( a === b ) {
3400
- hasDuplicate = true;
3401
- return 0;
3402
- }
3403
-
3404
- var cur,
3405
- i = 0,
3406
- aup = a.parentNode,
3407
- bup = b.parentNode,
3408
- ap = [ a ],
3409
- bp = [ b ];
3410
-
3411
- // Parentless nodes are either documents or disconnected
3412
- if ( !aup || !bup ) {
3413
- return a === document ? -1 :
3414
- b === document ? 1 :
3415
- aup ? -1 :
3416
- bup ? 1 :
3417
- sortInput ?
3418
- ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
3419
- 0;
3420
-
3421
- // If the nodes are siblings, we can do a quick check
3422
- } else if ( aup === bup ) {
3423
- return siblingCheck( a, b );
3424
- }
3425
-
3426
- // Otherwise we need full lists of their ancestors for comparison
3427
- cur = a;
3428
- while ( (cur = cur.parentNode) ) {
3429
- ap.unshift( cur );
3430
- }
3431
- cur = b;
3432
- while ( (cur = cur.parentNode) ) {
3433
- bp.unshift( cur );
3434
- }
3435
-
3436
- // Walk down the tree looking for a discrepancy
3437
- while ( ap[i] === bp[i] ) {
3438
- i++;
3439
- }
3440
-
3441
- return i ?
3442
- // Do a sibling check if the nodes have a common ancestor
3443
- siblingCheck( ap[i], bp[i] ) :
3444
-
3445
- // Otherwise nodes in our document sort first
3446
- ap[i] === preferredDoc ? -1 :
3447
- bp[i] === preferredDoc ? 1 :
3448
- 0;
3449
- };
3450
-
3451
- return document;
3452
- };
3453
-
3454
- Sizzle.matches = function( expr, elements ) {
3455
- return Sizzle( expr, null, null, elements );
3456
- };
3457
-
3458
- Sizzle.matchesSelector = function( elem, expr ) {
3459
- // Set document vars if needed
3460
- if ( ( elem.ownerDocument || elem ) !== document ) {
3461
- setDocument( elem );
3462
- }
3463
-
3464
- // Make sure that attribute selectors are quoted
3465
- expr = expr.replace( rattributeQuotes, "='$1']" );
3466
-
3467
- if ( support.matchesSelector && documentIsHTML &&
3468
- !compilerCache[ expr + " " ] &&
3469
- ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
3470
- ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
3471
-
3472
- try {
3473
- var ret = matches.call( elem, expr );
3474
-
3475
- // IE 9's matchesSelector returns false on disconnected nodes
3476
- if ( ret || support.disconnectedMatch ||
3477
- // As well, disconnected nodes are said to be in a document
3478
- // fragment in IE 9
3479
- elem.document && elem.document.nodeType !== 11 ) {
3480
- return ret;
3481
- }
3482
- } catch (e) {}
3483
- }
3484
-
3485
- return Sizzle( expr, document, null, [ elem ] ).length > 0;
3486
- };
3487
-
3488
- Sizzle.contains = function( context, elem ) {
3489
- // Set document vars if needed
3490
- if ( ( context.ownerDocument || context ) !== document ) {
3491
- setDocument( context );
3492
- }
3493
- return contains( context, elem );
3494
- };
3495
-
3496
- Sizzle.attr = function( elem, name ) {
3497
- // Set document vars if needed
3498
- if ( ( elem.ownerDocument || elem ) !== document ) {
3499
- setDocument( elem );
3500
- }
3501
-
3502
- var fn = Expr.attrHandle[ name.toLowerCase() ],
3503
- // Don't get fooled by Object.prototype properties (jQuery #13807)
3504
- val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
3505
- fn( elem, name, !documentIsHTML ) :
3506
- undefined;
3507
-
3508
- return val !== undefined ?
3509
- val :
3510
- support.attributes || !documentIsHTML ?
3511
- elem.getAttribute( name ) :
3512
- (val = elem.getAttributeNode(name)) && val.specified ?
3513
- val.value :
3514
- null;
3515
- };
3516
-
3517
- Sizzle.escape = function( sel ) {
3518
- return (sel + "").replace( rcssescape, fcssescape );
3519
- };
3520
-
3521
- Sizzle.error = function( msg ) {
3522
- throw new Error( "Syntax error, unrecognized expression: " + msg );
3523
- };
3524
-
3525
- /**
3526
- * Document sorting and removing duplicates
3527
- * @param {ArrayLike} results
3528
- */
3529
- Sizzle.uniqueSort = function( results ) {
3530
- var elem,
3531
- duplicates = [],
3532
- j = 0,
3533
- i = 0;
3534
-
3535
- // Unless we *know* we can detect duplicates, assume their presence
3536
- hasDuplicate = !support.detectDuplicates;
3537
- sortInput = !support.sortStable && results.slice( 0 );
3538
- results.sort( sortOrder );
3539
-
3540
- if ( hasDuplicate ) {
3541
- while ( (elem = results[i++]) ) {
3542
- if ( elem === results[ i ] ) {
3543
- j = duplicates.push( i );
3544
- }
3545
- }
3546
- while ( j-- ) {
3547
- results.splice( duplicates[ j ], 1 );
3548
- }
3549
- }
3550
-
3551
- // Clear input after sorting to release objects
3552
- // See https://github.com/jquery/sizzle/pull/225
3553
- sortInput = null;
3554
-
3555
- return results;
3556
- };
3557
-
3558
- /**
3559
- * Utility function for retrieving the text value of an array of DOM nodes
3560
- * @param {Array|Element} elem
3561
- */
3562
- getText = Sizzle.getText = function( elem ) {
3563
- var node,
3564
- ret = "",
3565
- i = 0,
3566
- nodeType = elem.nodeType;
3567
-
3568
- if ( !nodeType ) {
3569
- // If no nodeType, this is expected to be an array
3570
- while ( (node = elem[i++]) ) {
3571
- // Do not traverse comment nodes
3572
- ret += getText( node );
3573
- }
3574
- } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
3575
- // Use textContent for elements
3576
- // innerText usage removed for consistency of new lines (jQuery #11153)
3577
- if ( typeof elem.textContent === "string" ) {
3578
- return elem.textContent;
3579
- } else {
3580
- // Traverse its children
3581
- for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
3582
- ret += getText( elem );
3583
- }
3584
- }
3585
- } else if ( nodeType === 3 || nodeType === 4 ) {
3586
- return elem.nodeValue;
3587
- }
3588
- // Do not include comment or processing instruction nodes
3589
-
3590
- return ret;
3591
- };
3592
-
3593
- Expr = Sizzle.selectors = {
3594
-
3595
- // Can be adjusted by the user
3596
- cacheLength: 50,
3597
-
3598
- createPseudo: markFunction,
3599
-
3600
- match: matchExpr,
3601
-
3602
- attrHandle: {},
3603
-
3604
- find: {},
3605
-
3606
- relative: {
3607
- ">": { dir: "parentNode", first: true },
3608
- " ": { dir: "parentNode" },
3609
- "+": { dir: "previousSibling", first: true },
3610
- "~": { dir: "previousSibling" }
3611
- },
3612
-
3613
- preFilter: {
3614
- "ATTR": function( match ) {
3615
- match[1] = match[1].replace( runescape, funescape );
3616
-
3617
- // Move the given value to match[3] whether quoted or unquoted
3618
- match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
3619
-
3620
- if ( match[2] === "~=" ) {
3621
- match[3] = " " + match[3] + " ";
3622
- }
3623
-
3624
- return match.slice( 0, 4 );
3625
- },
3626
-
3627
- "CHILD": function( match ) {
3628
- /* matches from matchExpr["CHILD"]
3629
- 1 type (only|nth|...)
3630
- 2 what (child|of-type)
3631
- 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
3632
- 4 xn-component of xn+y argument ([+-]?\d*n|)
3633
- 5 sign of xn-component
3634
- 6 x of xn-component
3635
- 7 sign of y-component
3636
- 8 y of y-component
3637
- */
3638
- match[1] = match[1].toLowerCase();
3639
-
3640
- if ( match[1].slice( 0, 3 ) === "nth" ) {
3641
- // nth-* requires argument
3642
- if ( !match[3] ) {
3643
- Sizzle.error( match[0] );
3644
- }
3645
-
3646
- // numeric x and y parameters for Expr.filter.CHILD
3647
- // remember that false/true cast respectively to 0/1
3648
- match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
3649
- match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
3650
-
3651
- // other types prohibit arguments
3652
- } else if ( match[3] ) {
3653
- Sizzle.error( match[0] );
3654
- }
3655
-
3656
- return match;
3657
- },
3658
-
3659
- "PSEUDO": function( match ) {
3660
- var excess,
3661
- unquoted = !match[6] && match[2];
3662
-
3663
- if ( matchExpr["CHILD"].test( match[0] ) ) {
3664
- return null;
3665
- }
3666
-
3667
- // Accept quoted arguments as-is
3668
- if ( match[3] ) {
3669
- match[2] = match[4] || match[5] || "";
3670
-
3671
- // Strip excess characters from unquoted arguments
3672
- } else if ( unquoted && rpseudo.test( unquoted ) &&
3673
- // Get excess from tokenize (recursively)
3674
- (excess = tokenize( unquoted, true )) &&
3675
- // advance to the next closing parenthesis
3676
- (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
3677
-
3678
- // excess is a negative index
3679
- match[0] = match[0].slice( 0, excess );
3680
- match[2] = unquoted.slice( 0, excess );
3681
- }
3682
-
3683
- // Return only captures needed by the pseudo filter method (type and argument)
3684
- return match.slice( 0, 3 );
3685
- }
3686
- },
3687
-
3688
- filter: {
3689
-
3690
- "TAG": function( nodeNameSelector ) {
3691
- var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
3692
- return nodeNameSelector === "*" ?
3693
- function() { return true; } :
3694
- function( elem ) {
3695
- return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
3696
- };
3697
- },
3698
-
3699
- "CLASS": function( className ) {
3700
- var pattern = classCache[ className + " " ];
3701
-
3702
- return pattern ||
3703
- (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
3704
- classCache( className, function( elem ) {
3705
- return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
3706
- });
3707
- },
3708
-
3709
- "ATTR": function( name, operator, check ) {
3710
- return function( elem ) {
3711
- var result = Sizzle.attr( elem, name );
3712
-
3713
- if ( result == null ) {
3714
- return operator === "!=";
3715
- }
3716
- if ( !operator ) {
3717
- return true;
3718
- }
3719
-
3720
- result += "";
3721
-
3722
- return operator === "=" ? result === check :
3723
- operator === "!=" ? result !== check :
3724
- operator === "^=" ? check && result.indexOf( check ) === 0 :
3725
- operator === "*=" ? check && result.indexOf( check ) > -1 :
3726
- operator === "$=" ? check && result.slice( -check.length ) === check :
3727
- operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
3728
- operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
3729
- false;
3730
- };
3731
- },
3732
-
3733
- "CHILD": function( type, what, argument, first, last ) {
3734
- var simple = type.slice( 0, 3 ) !== "nth",
3735
- forward = type.slice( -4 ) !== "last",
3736
- ofType = what === "of-type";
3737
-
3738
- return first === 1 && last === 0 ?
3739
-
3740
- // Shortcut for :nth-*(n)
3741
- function( elem ) {
3742
- return !!elem.parentNode;
3743
- } :
3744
-
3745
- function( elem, context, xml ) {
3746
- var cache, uniqueCache, outerCache, node, nodeIndex, start,
3747
- dir = simple !== forward ? "nextSibling" : "previousSibling",
3748
- parent = elem.parentNode,
3749
- name = ofType && elem.nodeName.toLowerCase(),
3750
- useCache = !xml && !ofType,
3751
- diff = false;
3752
-
3753
- if ( parent ) {
3754
-
3755
- // :(first|last|only)-(child|of-type)
3756
- if ( simple ) {
3757
- while ( dir ) {
3758
- node = elem;
3759
- while ( (node = node[ dir ]) ) {
3760
- if ( ofType ?
3761
- node.nodeName.toLowerCase() === name :
3762
- node.nodeType === 1 ) {
3763
-
3764
- return false;
3765
- }
3766
- }
3767
- // Reverse direction for :only-* (if we haven't yet done so)
3768
- start = dir = type === "only" && !start && "nextSibling";
3769
- }
3770
- return true;
3771
- }
3772
-
3773
- start = [ forward ? parent.firstChild : parent.lastChild ];
3774
-
3775
- // non-xml :nth-child(...) stores cache data on `parent`
3776
- if ( forward && useCache ) {
3777
-
3778
- // Seek `elem` from a previously-cached index
3779
-
3780
- // ...in a gzip-friendly way
3781
- node = parent;
3782
- outerCache = node[ expando ] || (node[ expando ] = {});
3783
-
3784
- // Support: IE <9 only
3785
- // Defend against cloned attroperties (jQuery gh-1709)
3786
- uniqueCache = outerCache[ node.uniqueID ] ||
3787
- (outerCache[ node.uniqueID ] = {});
3788
-
3789
- cache = uniqueCache[ type ] || [];
3790
- nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
3791
- diff = nodeIndex && cache[ 2 ];
3792
- node = nodeIndex && parent.childNodes[ nodeIndex ];
3793
-
3794
- while ( (node = ++nodeIndex && node && node[ dir ] ||
3795
-
3796
- // Fallback to seeking `elem` from the start
3797
- (diff = nodeIndex = 0) || start.pop()) ) {
3798
-
3799
- // When found, cache indexes on `parent` and break
3800
- if ( node.nodeType === 1 && ++diff && node === elem ) {
3801
- uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
3802
- break;
3803
- }
3804
- }
3805
-
3806
- } else {
3807
- // Use previously-cached element index if available
3808
- if ( useCache ) {
3809
- // ...in a gzip-friendly way
3810
- node = elem;
3811
- outerCache = node[ expando ] || (node[ expando ] = {});
3812
-
3813
- // Support: IE <9 only
3814
- // Defend against cloned attroperties (jQuery gh-1709)
3815
- uniqueCache = outerCache[ node.uniqueID ] ||
3816
- (outerCache[ node.uniqueID ] = {});
3817
-
3818
- cache = uniqueCache[ type ] || [];
3819
- nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
3820
- diff = nodeIndex;
3821
- }
3822
-
3823
- // xml :nth-child(...)
3824
- // or :nth-last-child(...) or :nth(-last)?-of-type(...)
3825
- if ( diff === false ) {
3826
- // Use the same loop as above to seek `elem` from the start
3827
- while ( (node = ++nodeIndex && node && node[ dir ] ||
3828
- (diff = nodeIndex = 0) || start.pop()) ) {
3829
-
3830
- if ( ( ofType ?
3831
- node.nodeName.toLowerCase() === name :
3832
- node.nodeType === 1 ) &&
3833
- ++diff ) {
3834
-
3835
- // Cache the index of each encountered element
3836
- if ( useCache ) {
3837
- outerCache = node[ expando ] || (node[ expando ] = {});
3838
-
3839
- // Support: IE <9 only
3840
- // Defend against cloned attroperties (jQuery gh-1709)
3841
- uniqueCache = outerCache[ node.uniqueID ] ||
3842
- (outerCache[ node.uniqueID ] = {});
3843
-
3844
- uniqueCache[ type ] = [ dirruns, diff ];
3845
- }
3846
-
3847
- if ( node === elem ) {
3848
- break;
3849
- }
3850
- }
3851
- }
3852
- }
3853
- }
3854
-
3855
- // Incorporate the offset, then check against cycle size
3856
- diff -= last;
3857
- return diff === first || ( diff % first === 0 && diff / first >= 0 );
3858
- }
3859
- };
3860
- },
3861
-
3862
- "PSEUDO": function( pseudo, argument ) {
3863
- // pseudo-class names are case-insensitive
3864
- // http://www.w3.org/TR/selectors/#pseudo-classes
3865
- // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
3866
- // Remember that setFilters inherits from pseudos
3867
- var args,
3868
- fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
3869
- Sizzle.error( "unsupported pseudo: " + pseudo );
3870
-
3871
- // The user may use createPseudo to indicate that
3872
- // arguments are needed to create the filter function
3873
- // just as Sizzle does
3874
- if ( fn[ expando ] ) {
3875
- return fn( argument );
3876
- }
3877
-
3878
- // But maintain support for old signatures
3879
- if ( fn.length > 1 ) {
3880
- args = [ pseudo, pseudo, "", argument ];
3881
- return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
3882
- markFunction(function( seed, matches ) {
3883
- var idx,
3884
- matched = fn( seed, argument ),
3885
- i = matched.length;
3886
- while ( i-- ) {
3887
- idx = indexOf( seed, matched[i] );
3888
- seed[ idx ] = !( matches[ idx ] = matched[i] );
3889
- }
3890
- }) :
3891
- function( elem ) {
3892
- return fn( elem, 0, args );
3893
- };
3894
- }
3895
-
3896
- return fn;
3897
- }
3898
- },
3899
-
3900
- pseudos: {
3901
- // Potentially complex pseudos
3902
- "not": markFunction(function( selector ) {
3903
- // Trim the selector passed to compile
3904
- // to avoid treating leading and trailing
3905
- // spaces as combinators
3906
- var input = [],
3907
- results = [],
3908
- matcher = compile( selector.replace( rtrim, "$1" ) );
3909
-
3910
- return matcher[ expando ] ?
3911
- markFunction(function( seed, matches, context, xml ) {
3912
- var elem,
3913
- unmatched = matcher( seed, null, xml, [] ),
3914
- i = seed.length;
3915
-
3916
- // Match elements unmatched by `matcher`
3917
- while ( i-- ) {
3918
- if ( (elem = unmatched[i]) ) {
3919
- seed[i] = !(matches[i] = elem);
3920
- }
3921
- }
3922
- }) :
3923
- function( elem, context, xml ) {
3924
- input[0] = elem;
3925
- matcher( input, null, xml, results );
3926
- // Don't keep the element (issue #299)
3927
- input[0] = null;
3928
- return !results.pop();
3929
- };
3930
- }),
3931
-
3932
- "has": markFunction(function( selector ) {
3933
- return function( elem ) {
3934
- return Sizzle( selector, elem ).length > 0;
3935
- };
3936
- }),
3937
-
3938
- "contains": markFunction(function( text ) {
3939
- text = text.replace( runescape, funescape );
3940
- return function( elem ) {
3941
- return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
3942
- };
3943
- }),
3944
-
3945
- // "Whether an element is represented by a :lang() selector
3946
- // is based solely on the element's language value
3947
- // being equal to the identifier C,
3948
- // or beginning with the identifier C immediately followed by "-".
3949
- // The matching of C against the element's language value is performed case-insensitively.
3950
- // The identifier C does not have to be a valid language name."
3951
- // http://www.w3.org/TR/selectors/#lang-pseudo
3952
- "lang": markFunction( function( lang ) {
3953
- // lang value must be a valid identifier
3954
- if ( !ridentifier.test(lang || "") ) {
3955
- Sizzle.error( "unsupported lang: " + lang );
3956
- }
3957
- lang = lang.replace( runescape, funescape ).toLowerCase();
3958
- return function( elem ) {
3959
- var elemLang;
3960
- do {
3961
- if ( (elemLang = documentIsHTML ?
3962
- elem.lang :
3963
- elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
3964
-
3965
- elemLang = elemLang.toLowerCase();
3966
- return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
3967
- }
3968
- } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
3969
- return false;
3970
- };
3971
- }),
3972
-
3973
- // Miscellaneous
3974
- "target": function( elem ) {
3975
- var hash = window.location && window.location.hash;
3976
- return hash && hash.slice( 1 ) === elem.id;
3977
- },
3978
-
3979
- "root": function( elem ) {
3980
- return elem === docElem;
3981
- },
3982
-
3983
- "focus": function( elem ) {
3984
- return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
3985
- },
3986
-
3987
- // Boolean properties
3988
- "enabled": createDisabledPseudo( false ),
3989
- "disabled": createDisabledPseudo( true ),
3990
-
3991
- "checked": function( elem ) {
3992
- // In CSS3, :checked should return both checked and selected elements
3993
- // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
3994
- var nodeName = elem.nodeName.toLowerCase();
3995
- return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
3996
- },
3997
-
3998
- "selected": function( elem ) {
3999
- // Accessing this property makes selected-by-default
4000
- // options in Safari work properly
4001
- if ( elem.parentNode ) {
4002
- elem.parentNode.selectedIndex;
4003
- }
4004
-
4005
- return elem.selected === true;
4006
- },
4007
-
4008
- // Contents
4009
- "empty": function( elem ) {
4010
- // http://www.w3.org/TR/selectors/#empty-pseudo
4011
- // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
4012
- // but not by others (comment: 8; processing instruction: 7; etc.)
4013
- // nodeType < 6 works because attributes (2) do not appear as children
4014
- for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
4015
- if ( elem.nodeType < 6 ) {
4016
- return false;
4017
- }
4018
- }
4019
- return true;
4020
- },
4021
-
4022
- "parent": function( elem ) {
4023
- return !Expr.pseudos["empty"]( elem );
4024
- },
4025
-
4026
- // Element/input types
4027
- "header": function( elem ) {
4028
- return rheader.test( elem.nodeName );
4029
- },
4030
-
4031
- "input": function( elem ) {
4032
- return rinputs.test( elem.nodeName );
4033
- },
4034
-
4035
- "button": function( elem ) {
4036
- var name = elem.nodeName.toLowerCase();
4037
- return name === "input" && elem.type === "button" || name === "button";
4038
- },
4039
-
4040
- "text": function( elem ) {
4041
- var attr;
4042
- return elem.nodeName.toLowerCase() === "input" &&
4043
- elem.type === "text" &&
4044
-
4045
- // Support: IE<8
4046
- // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
4047
- ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
4048
- },
4049
-
4050
- // Position-in-collection
4051
- "first": createPositionalPseudo(function() {
4052
- return [ 0 ];
4053
- }),
4054
-
4055
- "last": createPositionalPseudo(function( matchIndexes, length ) {
4056
- return [ length - 1 ];
4057
- }),
4058
-
4059
- "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
4060
- return [ argument < 0 ? argument + length : argument ];
4061
- }),
4062
-
4063
- "even": createPositionalPseudo(function( matchIndexes, length ) {
4064
- var i = 0;
4065
- for ( ; i < length; i += 2 ) {
4066
- matchIndexes.push( i );
4067
- }
4068
- return matchIndexes;
4069
- }),
4070
-
4071
- "odd": createPositionalPseudo(function( matchIndexes, length ) {
4072
- var i = 1;
4073
- for ( ; i < length; i += 2 ) {
4074
- matchIndexes.push( i );
4075
- }
4076
- return matchIndexes;
4077
- }),
4078
-
4079
- "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
4080
- var i = argument < 0 ? argument + length : argument;
4081
- for ( ; --i >= 0; ) {
4082
- matchIndexes.push( i );
4083
- }
4084
- return matchIndexes;
4085
- }),
4086
-
4087
- "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
4088
- var i = argument < 0 ? argument + length : argument;
4089
- for ( ; ++i < length; ) {
4090
- matchIndexes.push( i );
4091
- }
4092
- return matchIndexes;
4093
- })
4094
- }
4095
- };
4096
-
4097
- Expr.pseudos["nth"] = Expr.pseudos["eq"];
4098
-
4099
- // Add button/input type pseudos
4100
- for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
4101
- Expr.pseudos[ i ] = createInputPseudo( i );
4102
- }
4103
- for ( i in { submit: true, reset: true } ) {
4104
- Expr.pseudos[ i ] = createButtonPseudo( i );
4105
- }
4106
-
4107
- // Easy API for creating new setFilters
4108
- function setFilters() {}
4109
- setFilters.prototype = Expr.filters = Expr.pseudos;
4110
- Expr.setFilters = new setFilters();
4111
-
4112
- tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
4113
- var matched, match, tokens, type,
4114
- soFar, groups, preFilters,
4115
- cached = tokenCache[ selector + " " ];
4116
-
4117
- if ( cached ) {
4118
- return parseOnly ? 0 : cached.slice( 0 );
4119
- }
4120
-
4121
- soFar = selector;
4122
- groups = [];
4123
- preFilters = Expr.preFilter;
4124
-
4125
- while ( soFar ) {
4126
-
4127
- // Comma and first run
4128
- if ( !matched || (match = rcomma.exec( soFar )) ) {
4129
- if ( match ) {
4130
- // Don't consume trailing commas as valid
4131
- soFar = soFar.slice( match[0].length ) || soFar;
4132
- }
4133
- groups.push( (tokens = []) );
4134
- }
4135
-
4136
- matched = false;
4137
-
4138
- // Combinators
4139
- if ( (match = rcombinators.exec( soFar )) ) {
4140
- matched = match.shift();
4141
- tokens.push({
4142
- value: matched,
4143
- // Cast descendant combinators to space
4144
- type: match[0].replace( rtrim, " " )
4145
- });
4146
- soFar = soFar.slice( matched.length );
4147
- }
4148
-
4149
- // Filters
4150
- for ( type in Expr.filter ) {
4151
- if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
4152
- (match = preFilters[ type ]( match ))) ) {
4153
- matched = match.shift();
4154
- tokens.push({
4155
- value: matched,
4156
- type: type,
4157
- matches: match
4158
- });
4159
- soFar = soFar.slice( matched.length );
4160
- }
4161
- }
4162
-
4163
- if ( !matched ) {
4164
- break;
4165
- }
4166
- }
4167
-
4168
- // Return the length of the invalid excess
4169
- // if we're just parsing
4170
- // Otherwise, throw an error or return tokens
4171
- return parseOnly ?
4172
- soFar.length :
4173
- soFar ?
4174
- Sizzle.error( selector ) :
4175
- // Cache the tokens
4176
- tokenCache( selector, groups ).slice( 0 );
4177
- };
4178
-
4179
- function toSelector( tokens ) {
4180
- var i = 0,
4181
- len = tokens.length,
4182
- selector = "";
4183
- for ( ; i < len; i++ ) {
4184
- selector += tokens[i].value;
4185
- }
4186
- return selector;
4187
- }
4188
-
4189
- function addCombinator( matcher, combinator, base ) {
4190
- var dir = combinator.dir,
4191
- skip = combinator.next,
4192
- key = skip || dir,
4193
- checkNonElements = base && key === "parentNode",
4194
- doneName = done++;
4195
-
4196
- return combinator.first ?
4197
- // Check against closest ancestor/preceding element
4198
- function( elem, context, xml ) {
4199
- while ( (elem = elem[ dir ]) ) {
4200
- if ( elem.nodeType === 1 || checkNonElements ) {
4201
- return matcher( elem, context, xml );
4202
- }
4203
- }
4204
- return false;
4205
- } :
4206
-
4207
- // Check against all ancestor/preceding elements
4208
- function( elem, context, xml ) {
4209
- var oldCache, uniqueCache, outerCache,
4210
- newCache = [ dirruns, doneName ];
4211
-
4212
- // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
4213
- if ( xml ) {
4214
- while ( (elem = elem[ dir ]) ) {
4215
- if ( elem.nodeType === 1 || checkNonElements ) {
4216
- if ( matcher( elem, context, xml ) ) {
4217
- return true;
4218
- }
4219
- }
4220
- }
4221
- } else {
4222
- while ( (elem = elem[ dir ]) ) {
4223
- if ( elem.nodeType === 1 || checkNonElements ) {
4224
- outerCache = elem[ expando ] || (elem[ expando ] = {});
4225
-
4226
- // Support: IE <9 only
4227
- // Defend against cloned attroperties (jQuery gh-1709)
4228
- uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
4229
-
4230
- if ( skip && skip === elem.nodeName.toLowerCase() ) {
4231
- elem = elem[ dir ] || elem;
4232
- } else if ( (oldCache = uniqueCache[ key ]) &&
4233
- oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
4234
-
4235
- // Assign to newCache so results back-propagate to previous elements
4236
- return (newCache[ 2 ] = oldCache[ 2 ]);
4237
- } else {
4238
- // Reuse newcache so results back-propagate to previous elements
4239
- uniqueCache[ key ] = newCache;
4240
-
4241
- // A match means we're done; a fail means we have to keep checking
4242
- if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
4243
- return true;
4244
- }
4245
- }
4246
- }
4247
- }
4248
- }
4249
- return false;
4250
- };
4251
- }
4252
-
4253
- function elementMatcher( matchers ) {
4254
- return matchers.length > 1 ?
4255
- function( elem, context, xml ) {
4256
- var i = matchers.length;
4257
- while ( i-- ) {
4258
- if ( !matchers[i]( elem, context, xml ) ) {
4259
- return false;
4260
- }
4261
- }
4262
- return true;
4263
- } :
4264
- matchers[0];
4265
- }
4266
-
4267
- function multipleContexts( selector, contexts, results ) {
4268
- var i = 0,
4269
- len = contexts.length;
4270
- for ( ; i < len; i++ ) {
4271
- Sizzle( selector, contexts[i], results );
4272
- }
4273
- return results;
4274
- }
4275
-
4276
- function condense( unmatched, map, filter, context, xml ) {
4277
- var elem,
4278
- newUnmatched = [],
4279
- i = 0,
4280
- len = unmatched.length,
4281
- mapped = map != null;
4282
-
4283
- for ( ; i < len; i++ ) {
4284
- if ( (elem = unmatched[i]) ) {
4285
- if ( !filter || filter( elem, context, xml ) ) {
4286
- newUnmatched.push( elem );
4287
- if ( mapped ) {
4288
- map.push( i );
4289
- }
4290
- }
4291
- }
4292
- }
4293
-
4294
- return newUnmatched;
4295
- }
4296
-
4297
- function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
4298
- if ( postFilter && !postFilter[ expando ] ) {
4299
- postFilter = setMatcher( postFilter );
4300
- }
4301
- if ( postFinder && !postFinder[ expando ] ) {
4302
- postFinder = setMatcher( postFinder, postSelector );
4303
- }
4304
- return markFunction(function( seed, results, context, xml ) {
4305
- var temp, i, elem,
4306
- preMap = [],
4307
- postMap = [],
4308
- preexisting = results.length,
4309
-
4310
- // Get initial elements from seed or context
4311
- elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
4312
-
4313
- // Prefilter to get matcher input, preserving a map for seed-results synchronization
4314
- matcherIn = preFilter && ( seed || !selector ) ?
4315
- condense( elems, preMap, preFilter, context, xml ) :
4316
- elems,
4317
-
4318
- matcherOut = matcher ?
4319
- // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
4320
- postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
4321
-
4322
- // ...intermediate processing is necessary
4323
- [] :
4324
-
4325
- // ...otherwise use results directly
4326
- results :
4327
- matcherIn;
4328
-
4329
- // Find primary matches
4330
- if ( matcher ) {
4331
- matcher( matcherIn, matcherOut, context, xml );
4332
- }
4333
-
4334
- // Apply postFilter
4335
- if ( postFilter ) {
4336
- temp = condense( matcherOut, postMap );
4337
- postFilter( temp, [], context, xml );
4338
-
4339
- // Un-match failing elements by moving them back to matcherIn
4340
- i = temp.length;
4341
- while ( i-- ) {
4342
- if ( (elem = temp[i]) ) {
4343
- matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
4344
- }
4345
- }
4346
- }
4347
-
4348
- if ( seed ) {
4349
- if ( postFinder || preFilter ) {
4350
- if ( postFinder ) {
4351
- // Get the final matcherOut by condensing this intermediate into postFinder contexts
4352
- temp = [];
4353
- i = matcherOut.length;
4354
- while ( i-- ) {
4355
- if ( (elem = matcherOut[i]) ) {
4356
- // Restore matcherIn since elem is not yet a final match
4357
- temp.push( (matcherIn[i] = elem) );
4358
- }
4359
- }
4360
- postFinder( null, (matcherOut = []), temp, xml );
4361
- }
4362
-
4363
- // Move matched elements from seed to results to keep them synchronized
4364
- i = matcherOut.length;
4365
- while ( i-- ) {
4366
- if ( (elem = matcherOut[i]) &&
4367
- (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
4368
-
4369
- seed[temp] = !(results[temp] = elem);
4370
- }
4371
- }
4372
- }
4373
-
4374
- // Add elements to results, through postFinder if defined
4375
- } else {
4376
- matcherOut = condense(
4377
- matcherOut === results ?
4378
- matcherOut.splice( preexisting, matcherOut.length ) :
4379
- matcherOut
4380
- );
4381
- if ( postFinder ) {
4382
- postFinder( null, results, matcherOut, xml );
4383
- } else {
4384
- push.apply( results, matcherOut );
4385
- }
4386
- }
4387
- });
4388
- }
4389
-
4390
- function matcherFromTokens( tokens ) {
4391
- var checkContext, matcher, j,
4392
- len = tokens.length,
4393
- leadingRelative = Expr.relative[ tokens[0].type ],
4394
- implicitRelative = leadingRelative || Expr.relative[" "],
4395
- i = leadingRelative ? 1 : 0,
4396
-
4397
- // The foundational matcher ensures that elements are reachable from top-level context(s)
4398
- matchContext = addCombinator( function( elem ) {
4399
- return elem === checkContext;
4400
- }, implicitRelative, true ),
4401
- matchAnyContext = addCombinator( function( elem ) {
4402
- return indexOf( checkContext, elem ) > -1;
4403
- }, implicitRelative, true ),
4404
- matchers = [ function( elem, context, xml ) {
4405
- var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
4406
- (checkContext = context).nodeType ?
4407
- matchContext( elem, context, xml ) :
4408
- matchAnyContext( elem, context, xml ) );
4409
- // Avoid hanging onto element (issue #299)
4410
- checkContext = null;
4411
- return ret;
4412
- } ];
4413
-
4414
- for ( ; i < len; i++ ) {
4415
- if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
4416
- matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
4417
- } else {
4418
- matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
4419
-
4420
- // Return special upon seeing a positional matcher
4421
- if ( matcher[ expando ] ) {
4422
- // Find the next relative operator (if any) for proper handling
4423
- j = ++i;
4424
- for ( ; j < len; j++ ) {
4425
- if ( Expr.relative[ tokens[j].type ] ) {
4426
- break;
4427
- }
4428
- }
4429
- return setMatcher(
4430
- i > 1 && elementMatcher( matchers ),
4431
- i > 1 && toSelector(
4432
- // If the preceding token was a descendant combinator, insert an implicit any-element `*`
4433
- tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
4434
- ).replace( rtrim, "$1" ),
4435
- matcher,
4436
- i < j && matcherFromTokens( tokens.slice( i, j ) ),
4437
- j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
4438
- j < len && toSelector( tokens )
4439
- );
4440
- }
4441
- matchers.push( matcher );
4442
- }
4443
- }
4444
-
4445
- return elementMatcher( matchers );
4446
- }
4447
-
4448
- function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
4449
- var bySet = setMatchers.length > 0,
4450
- byElement = elementMatchers.length > 0,
4451
- superMatcher = function( seed, context, xml, results, outermost ) {
4452
- var elem, j, matcher,
4453
- matchedCount = 0,
4454
- i = "0",
4455
- unmatched = seed && [],
4456
- setMatched = [],
4457
- contextBackup = outermostContext,
4458
- // We must always have either seed elements or outermost context
4459
- elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
4460
- // Use integer dirruns iff this is the outermost matcher
4461
- dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
4462
- len = elems.length;
4463
-
4464
- if ( outermost ) {
4465
- outermostContext = context === document || context || outermost;
4466
- }
4467
-
4468
- // Add elements passing elementMatchers directly to results
4469
- // Support: IE<9, Safari
4470
- // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
4471
- for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
4472
- if ( byElement && elem ) {
4473
- j = 0;
4474
- if ( !context && elem.ownerDocument !== document ) {
4475
- setDocument( elem );
4476
- xml = !documentIsHTML;
4477
- }
4478
- while ( (matcher = elementMatchers[j++]) ) {
4479
- if ( matcher( elem, context || document, xml) ) {
4480
- results.push( elem );
4481
- break;
4482
- }
4483
- }
4484
- if ( outermost ) {
4485
- dirruns = dirrunsUnique;
4486
- }
4487
- }
4488
-
4489
- // Track unmatched elements for set filters
4490
- if ( bySet ) {
4491
- // They will have gone through all possible matchers
4492
- if ( (elem = !matcher && elem) ) {
4493
- matchedCount--;
4494
- }
4495
-
4496
- // Lengthen the array for every element, matched or not
4497
- if ( seed ) {
4498
- unmatched.push( elem );
4499
- }
4500
- }
4501
- }
4502
-
4503
- // `i` is now the count of elements visited above, and adding it to `matchedCount`
4504
- // makes the latter nonnegative.
4505
- matchedCount += i;
4506
-
4507
- // Apply set filters to unmatched elements
4508
- // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
4509
- // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
4510
- // no element matchers and no seed.
4511
- // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
4512
- // case, which will result in a "00" `matchedCount` that differs from `i` but is also
4513
- // numerically zero.
4514
- if ( bySet && i !== matchedCount ) {
4515
- j = 0;
4516
- while ( (matcher = setMatchers[j++]) ) {
4517
- matcher( unmatched, setMatched, context, xml );
4518
- }
4519
-
4520
- if ( seed ) {
4521
- // Reintegrate element matches to eliminate the need for sorting
4522
- if ( matchedCount > 0 ) {
4523
- while ( i-- ) {
4524
- if ( !(unmatched[i] || setMatched[i]) ) {
4525
- setMatched[i] = pop.call( results );
4526
- }
4527
- }
4528
- }
4529
-
4530
- // Discard index placeholder values to get only actual matches
4531
- setMatched = condense( setMatched );
4532
- }
4533
-
4534
- // Add matches to results
4535
- push.apply( results, setMatched );
4536
-
4537
- // Seedless set matches succeeding multiple successful matchers stipulate sorting
4538
- if ( outermost && !seed && setMatched.length > 0 &&
4539
- ( matchedCount + setMatchers.length ) > 1 ) {
4540
-
4541
- Sizzle.uniqueSort( results );
4542
- }
4543
- }
4544
-
4545
- // Override manipulation of globals by nested matchers
4546
- if ( outermost ) {
4547
- dirruns = dirrunsUnique;
4548
- outermostContext = contextBackup;
4549
- }
4550
-
4551
- return unmatched;
4552
- };
4553
-
4554
- return bySet ?
4555
- markFunction( superMatcher ) :
4556
- superMatcher;
4557
- }
4558
-
4559
- compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
4560
- var i,
4561
- setMatchers = [],
4562
- elementMatchers = [],
4563
- cached = compilerCache[ selector + " " ];
4564
-
4565
- if ( !cached ) {
4566
- // Generate a function of recursive functions that can be used to check each element
4567
- if ( !match ) {
4568
- match = tokenize( selector );
4569
- }
4570
- i = match.length;
4571
- while ( i-- ) {
4572
- cached = matcherFromTokens( match[i] );
4573
- if ( cached[ expando ] ) {
4574
- setMatchers.push( cached );
4575
- } else {
4576
- elementMatchers.push( cached );
4577
- }
4578
- }
4579
-
4580
- // Cache the compiled function
4581
- cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
4582
-
4583
- // Save selector and tokenization
4584
- cached.selector = selector;
4585
- }
4586
- return cached;
4587
- };
4588
-
4589
- /**
4590
- * A low-level selection function that works with Sizzle's compiled
4591
- * selector functions
4592
- * @param {String|Function} selector A selector or a pre-compiled
4593
- * selector function built with Sizzle.compile
4594
- * @param {Element} context
4595
- * @param {Array} [results]
4596
- * @param {Array} [seed] A set of elements to match against
4597
- */
4598
- select = Sizzle.select = function( selector, context, results, seed ) {
4599
- var i, tokens, token, type, find,
4600
- compiled = typeof selector === "function" && selector,
4601
- match = !seed && tokenize( (selector = compiled.selector || selector) );
4602
-
4603
- results = results || [];
4604
-
4605
- // Try to minimize operations if there is only one selector in the list and no seed
4606
- // (the latter of which guarantees us context)
4607
- if ( match.length === 1 ) {
4608
-
4609
- // Reduce context if the leading compound selector is an ID
4610
- tokens = match[0] = match[0].slice( 0 );
4611
- if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
4612
- context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
4613
-
4614
- context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
4615
- if ( !context ) {
4616
- return results;
4617
-
4618
- // Precompiled matchers will still verify ancestry, so step up a level
4619
- } else if ( compiled ) {
4620
- context = context.parentNode;
4621
- }
4622
-
4623
- selector = selector.slice( tokens.shift().value.length );
4624
- }
4625
-
4626
- // Fetch a seed set for right-to-left matching
4627
- i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
4628
- while ( i-- ) {
4629
- token = tokens[i];
4630
-
4631
- // Abort if we hit a combinator
4632
- if ( Expr.relative[ (type = token.type) ] ) {
4633
- break;
4634
- }
4635
- if ( (find = Expr.find[ type ]) ) {
4636
- // Search, expanding context for leading sibling combinators
4637
- if ( (seed = find(
4638
- token.matches[0].replace( runescape, funescape ),
4639
- rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
4640
- )) ) {
4641
-
4642
- // If seed is empty or no tokens remain, we can return early
4643
- tokens.splice( i, 1 );
4644
- selector = seed.length && toSelector( tokens );
4645
- if ( !selector ) {
4646
- push.apply( results, seed );
4647
- return results;
4648
- }
4649
-
4650
- break;
4651
- }
4652
- }
4653
- }
4654
- }
4655
-
4656
- // Compile and execute a filtering function if one is not provided
4657
- // Provide `match` to avoid retokenization if we modified the selector above
4658
- ( compiled || compile( selector, match ) )(
4659
- seed,
4660
- context,
4661
- !documentIsHTML,
4662
- results,
4663
- !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
4664
- );
4665
- return results;
4666
- };
4667
-
4668
- // One-time assignments
4669
-
4670
- // Sort stability
4671
- support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
4672
-
4673
- // Support: Chrome 14-35+
4674
- // Always assume duplicates if they aren't passed to the comparison function
4675
- support.detectDuplicates = !!hasDuplicate;
4676
-
4677
- // Initialize against the default document
4678
- setDocument();
4679
-
4680
- // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
4681
- // Detached nodes confoundingly follow *each other*
4682
- support.sortDetached = assert(function( el ) {
4683
- // Should return 1, but returns 4 (following)
4684
- return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
4685
- });
4686
-
4687
- // Support: IE<8
4688
- // Prevent attribute/property "interpolation"
4689
- // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
4690
- if ( !assert(function( el ) {
4691
- el.innerHTML = "<a href='#'></a>";
4692
- return el.firstChild.getAttribute("href") === "#" ;
4693
- }) ) {
4694
- addHandle( "type|href|height|width", function( elem, name, isXML ) {
4695
- if ( !isXML ) {
4696
- return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
4697
- }
4698
- });
4699
- }
4700
-
4701
- // Support: IE<9
4702
- // Use defaultValue in place of getAttribute("value")
4703
- if ( !support.attributes || !assert(function( el ) {
4704
- el.innerHTML = "<input/>";
4705
- el.firstChild.setAttribute( "value", "" );
4706
- return el.firstChild.getAttribute( "value" ) === "";
4707
- }) ) {
4708
- addHandle( "value", function( elem, name, isXML ) {
4709
- if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
4710
- return elem.defaultValue;
4711
- }
4712
- });
4713
- }
4714
-
4715
- // Support: IE<9
4716
- // Use getAttributeNode to fetch booleans when getAttribute lies
4717
- if ( !assert(function( el ) {
4718
- return el.getAttribute("disabled") == null;
4719
- }) ) {
4720
- addHandle( booleans, function( elem, name, isXML ) {
4721
- var val;
4722
- if ( !isXML ) {
4723
- return elem[ name ] === true ? name.toLowerCase() :
4724
- (val = elem.getAttributeNode( name )) && val.specified ?
4725
- val.value :
4726
- null;
4727
- }
4728
- });
4729
- }
4730
-
4731
- return Sizzle;
4732
-
4733
- })( window );
4734
-
4735
-
4736
-
4737
- jQuery.find = Sizzle;
4738
- jQuery.expr = Sizzle.selectors;
4739
-
4740
- // Deprecated
4741
- jQuery.expr[ ":" ] = jQuery.expr.pseudos;
4742
- jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
4743
- jQuery.text = Sizzle.getText;
4744
- jQuery.isXMLDoc = Sizzle.isXML;
4745
- jQuery.contains = Sizzle.contains;
4746
- jQuery.escapeSelector = Sizzle.escape;
4747
-
4748
-
4749
-
4750
-
4751
- var dir = function( elem, dir, until ) {
4752
- var matched = [],
4753
- truncate = until !== undefined;
4754
-
4755
- while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
4756
- if ( elem.nodeType === 1 ) {
4757
- if ( truncate && jQuery( elem ).is( until ) ) {
4758
- break;
4759
- }
4760
- matched.push( elem );
4761
- }
4762
- }
4763
- return matched;
4764
- };
4765
-
4766
-
4767
- var siblings = function( n, elem ) {
4768
- var matched = [];
4769
-
4770
- for ( ; n; n = n.nextSibling ) {
4771
- if ( n.nodeType === 1 && n !== elem ) {
4772
- matched.push( n );
4773
- }
4774
- }
4775
-
4776
- return matched;
4777
- };
4778
-
4779
-
4780
- var rneedsContext = jQuery.expr.match.needsContext;
4781
-
4782
- var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
4783
-
4784
-
4785
-
4786
- var risSimple = /^.[^:#\[\.,]*$/;
4787
-
4788
- // Implement the identical functionality for filter and not
4789
- function winnow( elements, qualifier, not ) {
4790
- if ( jQuery.isFunction( qualifier ) ) {
4791
- return jQuery.grep( elements, function( elem, i ) {
4792
- return !!qualifier.call( elem, i, elem ) !== not;
4793
- } );
4794
- }
4795
-
4796
- // Single element
4797
- if ( qualifier.nodeType ) {
4798
- return jQuery.grep( elements, function( elem ) {
4799
- return ( elem === qualifier ) !== not;
4800
- } );
4801
- }
4802
-
4803
- // Arraylike of elements (jQuery, arguments, Array)
4804
- if ( typeof qualifier !== "string" ) {
4805
- return jQuery.grep( elements, function( elem ) {
4806
- return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
4807
- } );
4808
- }
4809
-
4810
- // Simple selector that can be filtered directly, removing non-Elements
4811
- if ( risSimple.test( qualifier ) ) {
4812
- return jQuery.filter( qualifier, elements, not );
4813
- }
4814
-
4815
- // Complex selector, compare the two sets, removing non-Elements
4816
- qualifier = jQuery.filter( qualifier, elements );
4817
- return jQuery.grep( elements, function( elem ) {
4818
- return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1;
4819
- } );
4820
- }
4821
-
4822
- jQuery.filter = function( expr, elems, not ) {
4823
- var elem = elems[ 0 ];
4824
-
4825
- if ( not ) {
4826
- expr = ":not(" + expr + ")";
4827
- }
4828
-
4829
- if ( elems.length === 1 && elem.nodeType === 1 ) {
4830
- return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
4831
- }
4832
-
4833
- return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
4834
- return elem.nodeType === 1;
4835
- } ) );
4836
- };
4837
-
4838
- jQuery.fn.extend( {
4839
- find: function( selector ) {
4840
- var i, ret,
4841
- len = this.length,
4842
- self = this;
4843
-
4844
- if ( typeof selector !== "string" ) {
4845
- return this.pushStack( jQuery( selector ).filter( function() {
4846
- for ( i = 0; i < len; i++ ) {
4847
- if ( jQuery.contains( self[ i ], this ) ) {
4848
- return true;
4849
- }
4850
- }
4851
- } ) );
4852
- }
4853
-
4854
- ret = this.pushStack( [] );
4855
-
4856
- for ( i = 0; i < len; i++ ) {
4857
- jQuery.find( selector, self[ i ], ret );
4858
- }
4859
-
4860
- return len > 1 ? jQuery.uniqueSort( ret ) : ret;
4861
- },
4862
- filter: function( selector ) {
4863
- return this.pushStack( winnow( this, selector || [], false ) );
4864
- },
4865
- not: function( selector ) {
4866
- return this.pushStack( winnow( this, selector || [], true ) );
4867
- },
4868
- is: function( selector ) {
4869
- return !!winnow(
4870
- this,
4871
-
4872
- // If this is a positional/relative selector, check membership in the returned set
4873
- // so $("p:first").is("p:last") won't return true for a doc with two "p".
4874
- typeof selector === "string" && rneedsContext.test( selector ) ?
4875
- jQuery( selector ) :
4876
- selector || [],
4877
- false
4878
- ).length;
4879
- }
4880
- } );
4881
-
4882
-
4883
- // Initialize a jQuery object
4884
-
4885
-
4886
- // A central reference to the root jQuery(document)
4887
- var rootjQuery,
4888
-
4889
- // A simple way to check for HTML strings
4890
- // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
4891
- // Strict HTML recognition (#11290: must start with <)
4892
- // Shortcut simple #id case for speed
4893
- rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
4894
-
4895
- init = jQuery.fn.init = function( selector, context, root ) {
4896
- var match, elem;
4897
-
4898
- // HANDLE: $(""), $(null), $(undefined), $(false)
4899
- if ( !selector ) {
4900
- return this;
4901
- }
4902
-
4903
- // Method init() accepts an alternate rootjQuery
4904
- // so migrate can support jQuery.sub (gh-2101)
4905
- root = root || rootjQuery;
4906
-
4907
- // Handle HTML strings
4908
- if ( typeof selector === "string" ) {
4909
- if ( selector[ 0 ] === "<" &&
4910
- selector[ selector.length - 1 ] === ">" &&
4911
- selector.length >= 3 ) {
4912
-
4913
- // Assume that strings that start and end with <> are HTML and skip the regex check
4914
- match = [ null, selector, null ];
4915
-
4916
- } else {
4917
- match = rquickExpr.exec( selector );
4918
- }
4919
-
4920
- // Match html or make sure no context is specified for #id
4921
- if ( match && ( match[ 1 ] || !context ) ) {
4922
-
4923
- // HANDLE: $(html) -> $(array)
4924
- if ( match[ 1 ] ) {
4925
- context = context instanceof jQuery ? context[ 0 ] : context;
4926
-
4927
- // Option to run scripts is true for back-compat
4928
- // Intentionally let the error be thrown if parseHTML is not present
4929
- jQuery.merge( this, jQuery.parseHTML(
4930
- match[ 1 ],
4931
- context && context.nodeType ? context.ownerDocument || context : document,
4932
- true
4933
- ) );
4934
-
4935
- // HANDLE: $(html, props)
4936
- if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
4937
- for ( match in context ) {
4938
-
4939
- // Properties of context are called as methods if possible
4940
- if ( jQuery.isFunction( this[ match ] ) ) {
4941
- this[ match ]( context[ match ] );
4942
-
4943
- // ...and otherwise set as attributes
4944
- } else {
4945
- this.attr( match, context[ match ] );
4946
- }
4947
- }
4948
- }
4949
-
4950
- return this;
4951
-
4952
- // HANDLE: $(#id)
4953
- } else {
4954
- elem = document.getElementById( match[ 2 ] );
4955
-
4956
- if ( elem ) {
4957
-
4958
- // Inject the element directly into the jQuery object
4959
- this[ 0 ] = elem;
4960
- this.length = 1;
4961
- }
4962
- return this;
4963
- }
4964
-
4965
- // HANDLE: $(expr, $(...))
4966
- } else if ( !context || context.jquery ) {
4967
- return ( context || root ).find( selector );
4968
-
4969
- // HANDLE: $(expr, context)
4970
- // (which is just equivalent to: $(context).find(expr)
4971
- } else {
4972
- return this.constructor( context ).find( selector );
4973
- }
4974
-
4975
- // HANDLE: $(DOMElement)
4976
- } else if ( selector.nodeType ) {
4977
- this[ 0 ] = selector;
4978
- this.length = 1;
4979
- return this;
4980
-
4981
- // HANDLE: $(function)
4982
- // Shortcut for document ready
4983
- } else if ( jQuery.isFunction( selector ) ) {
4984
- return root.ready !== undefined ?
4985
- root.ready( selector ) :
4986
-
4987
- // Execute immediately if ready is not present
4988
- selector( jQuery );
4989
- }
4990
-
4991
- return jQuery.makeArray( selector, this );
4992
- };
4993
-
4994
- // Give the init function the jQuery prototype for later instantiation
4995
- init.prototype = jQuery.fn;
4996
-
4997
- // Initialize central reference
4998
- rootjQuery = jQuery( document );
4999
-
5000
-
5001
- var rparentsprev = /^(?:parents|prev(?:Until|All))/,
5002
-
5003
- // Methods guaranteed to produce a unique set when starting from a unique set
5004
- guaranteedUnique = {
5005
- children: true,
5006
- contents: true,
5007
- next: true,
5008
- prev: true
5009
- };
5010
-
5011
- jQuery.fn.extend( {
5012
- has: function( target ) {
5013
- var targets = jQuery( target, this ),
5014
- l = targets.length;
5015
-
5016
- return this.filter( function() {
5017
- var i = 0;
5018
- for ( ; i < l; i++ ) {
5019
- if ( jQuery.contains( this, targets[ i ] ) ) {
5020
- return true;
5021
- }
5022
- }
5023
- } );
5024
- },
5025
-
5026
- closest: function( selectors, context ) {
5027
- var cur,
5028
- i = 0,
5029
- l = this.length,
5030
- matched = [],
5031
- targets = typeof selectors !== "string" && jQuery( selectors );
5032
-
5033
- // Positional selectors never match, since there's no _selection_ context
5034
- if ( !rneedsContext.test( selectors ) ) {
5035
- for ( ; i < l; i++ ) {
5036
- for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
5037
-
5038
- // Always skip document fragments
5039
- if ( cur.nodeType < 11 && ( targets ?
5040
- targets.index( cur ) > -1 :
5041
-
5042
- // Don't pass non-elements to Sizzle
5043
- cur.nodeType === 1 &&
5044
- jQuery.find.matchesSelector( cur, selectors ) ) ) {
5045
-
5046
- matched.push( cur );
5047
- break;
5048
- }
5049
- }
5050
- }
5051
- }
5052
-
5053
- return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
5054
- },
5055
-
5056
- // Determine the position of an element within the set
5057
- index: function( elem ) {
5058
-
5059
- // No argument, return index in parent
5060
- if ( !elem ) {
5061
- return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
5062
- }
5063
-
5064
- // Index in selector
5065
- if ( typeof elem === "string" ) {
5066
- return indexOf.call( jQuery( elem ), this[ 0 ] );
5067
- }
5068
-
5069
- // Locate the position of the desired element
5070
- return indexOf.call( this,
5071
-
5072
- // If it receives a jQuery object, the first element is used
5073
- elem.jquery ? elem[ 0 ] : elem
5074
- );
5075
- },
5076
-
5077
- add: function( selector, context ) {
5078
- return this.pushStack(
5079
- jQuery.uniqueSort(
5080
- jQuery.merge( this.get(), jQuery( selector, context ) )
5081
- )
5082
- );
5083
- },
5084
-
5085
- addBack: function( selector ) {
5086
- return this.add( selector == null ?
5087
- this.prevObject : this.prevObject.filter( selector )
5088
- );
5089
- }
5090
- } );
5091
-
5092
- function sibling( cur, dir ) {
5093
- while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
5094
- return cur;
5095
- }
5096
-
5097
- jQuery.each( {
5098
- parent: function( elem ) {
5099
- var parent = elem.parentNode;
5100
- return parent && parent.nodeType !== 11 ? parent : null;
5101
- },
5102
- parents: function( elem ) {
5103
- return dir( elem, "parentNode" );
5104
- },
5105
- parentsUntil: function( elem, i, until ) {
5106
- return dir( elem, "parentNode", until );
5107
- },
5108
- next: function( elem ) {
5109
- return sibling( elem, "nextSibling" );
5110
- },
5111
- prev: function( elem ) {
5112
- return sibling( elem, "previousSibling" );
5113
- },
5114
- nextAll: function( elem ) {
5115
- return dir( elem, "nextSibling" );
5116
- },
5117
- prevAll: function( elem ) {
5118
- return dir( elem, "previousSibling" );
5119
- },
5120
- nextUntil: function( elem, i, until ) {
5121
- return dir( elem, "nextSibling", until );
5122
- },
5123
- prevUntil: function( elem, i, until ) {
5124
- return dir( elem, "previousSibling", until );
5125
- },
5126
- siblings: function( elem ) {
5127
- return siblings( ( elem.parentNode || {} ).firstChild, elem );
5128
- },
5129
- children: function( elem ) {
5130
- return siblings( elem.firstChild );
5131
- },
5132
- contents: function( elem ) {
5133
- return elem.contentDocument || jQuery.merge( [], elem.childNodes );
5134
- }
5135
- }, function( name, fn ) {
5136
- jQuery.fn[ name ] = function( until, selector ) {
5137
- var matched = jQuery.map( this, fn, until );
5138
-
5139
- if ( name.slice( -5 ) !== "Until" ) {
5140
- selector = until;
5141
- }
5142
-
5143
- if ( selector && typeof selector === "string" ) {
5144
- matched = jQuery.filter( selector, matched );
5145
- }
5146
-
5147
- if ( this.length > 1 ) {
5148
-
5149
- // Remove duplicates
5150
- if ( !guaranteedUnique[ name ] ) {
5151
- jQuery.uniqueSort( matched );
5152
- }
5153
-
5154
- // Reverse order for parents* and prev-derivatives
5155
- if ( rparentsprev.test( name ) ) {
5156
- matched.reverse();
5157
- }
5158
- }
5159
-
5160
- return this.pushStack( matched );
5161
- };
5162
- } );
5163
- var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
5164
-
5165
-
5166
-
5167
- // Convert String-formatted options into Object-formatted ones
5168
- function createOptions( options ) {
5169
- var object = {};
5170
- jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
5171
- object[ flag ] = true;
5172
- } );
5173
- return object;
5174
- }
5175
-
5176
- /*
5177
- * Create a callback list using the following parameters:
5178
- *
5179
- * options: an optional list of space-separated options that will change how
5180
- * the callback list behaves or a more traditional option object
5181
- *
5182
- * By default a callback list will act like an event callback list and can be
5183
- * "fired" multiple times.
5184
- *
5185
- * Possible options:
5186
- *
5187
- * once: will ensure the callback list can only be fired once (like a Deferred)
5188
- *
5189
- * memory: will keep track of previous values and will call any callback added
5190
- * after the list has been fired right away with the latest "memorized"
5191
- * values (like a Deferred)
5192
- *
5193
- * unique: will ensure a callback can only be added once (no duplicate in the list)
5194
- *
5195
- * stopOnFalse: interrupt callings when a callback returns false
5196
- *
5197
- */
5198
- jQuery.Callbacks = function( options ) {
5199
-
5200
- // Convert options from String-formatted to Object-formatted if needed
5201
- // (we check in cache first)
5202
- options = typeof options === "string" ?
5203
- createOptions( options ) :
5204
- jQuery.extend( {}, options );
5205
-
5206
- var // Flag to know if list is currently firing
5207
- firing,
5208
-
5209
- // Last fire value for non-forgettable lists
5210
- memory,
5211
-
5212
- // Flag to know if list was already fired
5213
- fired,
5214
-
5215
- // Flag to prevent firing
5216
- locked,
5217
-
5218
- // Actual callback list
5219
- list = [],
5220
-
5221
- // Queue of execution data for repeatable lists
5222
- queue = [],
5223
-
5224
- // Index of currently firing callback (modified by add/remove as needed)
5225
- firingIndex = -1,
5226
-
5227
- // Fire callbacks
5228
- fire = function() {
5229
-
5230
- // Enforce single-firing
5231
- locked = options.once;
5232
-
5233
- // Execute callbacks for all pending executions,
5234
- // respecting firingIndex overrides and runtime changes
5235
- fired = firing = true;
5236
- for ( ; queue.length; firingIndex = -1 ) {
5237
- memory = queue.shift();
5238
- while ( ++firingIndex < list.length ) {
5239
-
5240
- // Run callback and check for early termination
5241
- if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
5242
- options.stopOnFalse ) {
5243
-
5244
- // Jump to end and forget the data so .add doesn't re-fire
5245
- firingIndex = list.length;
5246
- memory = false;
5247
- }
5248
- }
5249
- }
5250
-
5251
- // Forget the data if we're done with it
5252
- if ( !options.memory ) {
5253
- memory = false;
5254
- }
5255
-
5256
- firing = false;
5257
-
5258
- // Clean up if we're done firing for good
5259
- if ( locked ) {
5260
-
5261
- // Keep an empty list if we have data for future add calls
5262
- if ( memory ) {
5263
- list = [];
5264
-
5265
- // Otherwise, this object is spent
5266
- } else {
5267
- list = "";
5268
- }
5269
- }
5270
- },
5271
-
5272
- // Actual Callbacks object
5273
- self = {
5274
-
5275
- // Add a callback or a collection of callbacks to the list
5276
- add: function() {
5277
- if ( list ) {
5278
-
5279
- // If we have memory from a past run, we should fire after adding
5280
- if ( memory && !firing ) {
5281
- firingIndex = list.length - 1;
5282
- queue.push( memory );
5283
- }
5284
-
5285
- ( function add( args ) {
5286
- jQuery.each( args, function( _, arg ) {
5287
- if ( jQuery.isFunction( arg ) ) {
5288
- if ( !options.unique || !self.has( arg ) ) {
5289
- list.push( arg );
5290
- }
5291
- } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
5292
-
5293
- // Inspect recursively
5294
- add( arg );
5295
- }
5296
- } );
5297
- } )( arguments );
5298
-
5299
- if ( memory && !firing ) {
5300
- fire();
5301
- }
5302
- }
5303
- return this;
5304
- },
5305
-
5306
- // Remove a callback from the list
5307
- remove: function() {
5308
- jQuery.each( arguments, function( _, arg ) {
5309
- var index;
5310
- while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
5311
- list.splice( index, 1 );
5312
-
5313
- // Handle firing indexes
5314
- if ( index <= firingIndex ) {
5315
- firingIndex--;
5316
- }
5317
- }
5318
- } );
5319
- return this;
5320
- },
5321
-
5322
- // Check if a given callback is in the list.
5323
- // If no argument is given, return whether or not list has callbacks attached.
5324
- has: function( fn ) {
5325
- return fn ?
5326
- jQuery.inArray( fn, list ) > -1 :
5327
- list.length > 0;
5328
- },
5329
-
5330
- // Remove all callbacks from the list
5331
- empty: function() {
5332
- if ( list ) {
5333
- list = [];
5334
- }
5335
- return this;
5336
- },
5337
-
5338
- // Disable .fire and .add
5339
- // Abort any current/pending executions
5340
- // Clear all callbacks and values
5341
- disable: function() {
5342
- locked = queue = [];
5343
- list = memory = "";
5344
- return this;
5345
- },
5346
- disabled: function() {
5347
- return !list;
5348
- },
5349
-
5350
- // Disable .fire
5351
- // Also disable .add unless we have memory (since it would have no effect)
5352
- // Abort any pending executions
5353
- lock: function() {
5354
- locked = queue = [];
5355
- if ( !memory && !firing ) {
5356
- list = memory = "";
5357
- }
5358
- return this;
5359
- },
5360
- locked: function() {
5361
- return !!locked;
5362
- },
5363
-
5364
- // Call all callbacks with the given context and arguments
5365
- fireWith: function( context, args ) {
5366
- if ( !locked ) {
5367
- args = args || [];
5368
- args = [ context, args.slice ? args.slice() : args ];
5369
- queue.push( args );
5370
- if ( !firing ) {
5371
- fire();
5372
- }
5373
- }
5374
- return this;
5375
- },
5376
-
5377
- // Call all the callbacks with the given arguments
5378
- fire: function() {
5379
- self.fireWith( this, arguments );
5380
- return this;
5381
- },
5382
-
5383
- // To know if the callbacks have already been called at least once
5384
- fired: function() {
5385
- return !!fired;
5386
- }
5387
- };
5388
-
5389
- return self;
5390
- };
5391
-
5392
-
5393
- function Identity( v ) {
5394
- return v;
5395
- }
5396
- function Thrower( ex ) {
5397
- throw ex;
5398
- }
5399
-
5400
- function adoptValue( value, resolve, reject ) {
5401
- var method;
5402
-
5403
- try {
5404
-
5405
- // Check for promise aspect first to privilege synchronous behavior
5406
- if ( value && jQuery.isFunction( ( method = value.promise ) ) ) {
5407
- method.call( value ).done( resolve ).fail( reject );
5408
-
5409
- // Other thenables
5410
- } else if ( value && jQuery.isFunction( ( method = value.then ) ) ) {
5411
- method.call( value, resolve, reject );
5412
-
5413
- // Other non-thenables
5414
- } else {
5415
-
5416
- // Support: Android 4.0 only
5417
- // Strict mode functions invoked without .call/.apply get global-object context
5418
- resolve.call( undefined, value );
5419
- }
5420
-
5421
- // For Promises/A+, convert exceptions into rejections
5422
- // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
5423
- // Deferred#then to conditionally suppress rejection.
5424
- } catch ( value ) {
5425
-
5426
- // Support: Android 4.0 only
5427
- // Strict mode functions invoked without .call/.apply get global-object context
5428
- reject.call( undefined, value );
5429
- }
5430
- }
5431
-
5432
- jQuery.extend( {
5433
-
5434
- Deferred: function( func ) {
5435
- var tuples = [
5436
-
5437
- // action, add listener, callbacks,
5438
- // ... .then handlers, argument index, [final state]
5439
- [ "notify", "progress", jQuery.Callbacks( "memory" ),
5440
- jQuery.Callbacks( "memory" ), 2 ],
5441
- [ "resolve", "done", jQuery.Callbacks( "once memory" ),
5442
- jQuery.Callbacks( "once memory" ), 0, "resolved" ],
5443
- [ "reject", "fail", jQuery.Callbacks( "once memory" ),
5444
- jQuery.Callbacks( "once memory" ), 1, "rejected" ]
5445
- ],
5446
- state = "pending",
5447
- promise = {
5448
- state: function() {
5449
- return state;
5450
- },
5451
- always: function() {
5452
- deferred.done( arguments ).fail( arguments );
5453
- return this;
5454
- },
5455
- "catch": function( fn ) {
5456
- return promise.then( null, fn );
5457
- },
5458
-
5459
- // Keep pipe for back-compat
5460
- pipe: function( /* fnDone, fnFail, fnProgress */ ) {
5461
- var fns = arguments;
5462
-
5463
- return jQuery.Deferred( function( newDefer ) {
5464
- jQuery.each( tuples, function( i, tuple ) {
5465
-
5466
- // Map tuples (progress, done, fail) to arguments (done, fail, progress)
5467
- var fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
5468
-
5469
- // deferred.progress(function() { bind to newDefer or newDefer.notify })
5470
- // deferred.done(function() { bind to newDefer or newDefer.resolve })
5471
- // deferred.fail(function() { bind to newDefer or newDefer.reject })
5472
- deferred[ tuple[ 1 ] ]( function() {
5473
- var returned = fn && fn.apply( this, arguments );
5474
- if ( returned && jQuery.isFunction( returned.promise ) ) {
5475
- returned.promise()
5476
- .progress( newDefer.notify )
5477
- .done( newDefer.resolve )
5478
- .fail( newDefer.reject );
5479
- } else {
5480
- newDefer[ tuple[ 0 ] + "With" ](
5481
- this,
5482
- fn ? [ returned ] : arguments
5483
- );
5484
- }
5485
- } );
5486
- } );
5487
- fns = null;
5488
- } ).promise();
5489
- },
5490
- then: function( onFulfilled, onRejected, onProgress ) {
5491
- var maxDepth = 0;
5492
- function resolve( depth, deferred, handler, special ) {
5493
- return function() {
5494
- var that = this,
5495
- args = arguments,
5496
- mightThrow = function() {
5497
- var returned, then;
5498
-
5499
- // Support: Promises/A+ section 2.3.3.3.3
5500
- // https://promisesaplus.com/#point-59
5501
- // Ignore double-resolution attempts
5502
- if ( depth < maxDepth ) {
5503
- return;
5504
- }
5505
-
5506
- returned = handler.apply( that, args );
5507
-
5508
- // Support: Promises/A+ section 2.3.1
5509
- // https://promisesaplus.com/#point-48
5510
- if ( returned === deferred.promise() ) {
5511
- throw new TypeError( "Thenable self-resolution" );
5512
- }
5513
-
5514
- // Support: Promises/A+ sections 2.3.3.1, 3.5
5515
- // https://promisesaplus.com/#point-54
5516
- // https://promisesaplus.com/#point-75
5517
- // Retrieve `then` only once
5518
- then = returned &&
5519
-
5520
- // Support: Promises/A+ section 2.3.4
5521
- // https://promisesaplus.com/#point-64
5522
- // Only check objects and functions for thenability
5523
- ( typeof returned === "object" ||
5524
- typeof returned === "function" ) &&
5525
- returned.then;
5526
-
5527
- // Handle a returned thenable
5528
- if ( jQuery.isFunction( then ) ) {
5529
-
5530
- // Special processors (notify) just wait for resolution
5531
- if ( special ) {
5532
- then.call(
5533
- returned,
5534
- resolve( maxDepth, deferred, Identity, special ),
5535
- resolve( maxDepth, deferred, Thrower, special )
5536
- );
5537
-
5538
- // Normal processors (resolve) also hook into progress
5539
- } else {
5540
-
5541
- // ...and disregard older resolution values
5542
- maxDepth++;
5543
-
5544
- then.call(
5545
- returned,
5546
- resolve( maxDepth, deferred, Identity, special ),
5547
- resolve( maxDepth, deferred, Thrower, special ),
5548
- resolve( maxDepth, deferred, Identity,
5549
- deferred.notifyWith )
5550
- );
5551
- }
5552
-
5553
- // Handle all other returned values
5554
- } else {
5555
-
5556
- // Only substitute handlers pass on context
5557
- // and multiple values (non-spec behavior)
5558
- if ( handler !== Identity ) {
5559
- that = undefined;
5560
- args = [ returned ];
5561
- }
5562
-
5563
- // Process the value(s)
5564
- // Default process is resolve
5565
- ( special || deferred.resolveWith )( that, args );
5566
- }
5567
- },
5568
-
5569
- // Only normal processors (resolve) catch and reject exceptions
5570
- process = special ?
5571
- mightThrow :
5572
- function() {
5573
- try {
5574
- mightThrow();
5575
- } catch ( e ) {
5576
-
5577
- if ( jQuery.Deferred.exceptionHook ) {
5578
- jQuery.Deferred.exceptionHook( e,
5579
- process.stackTrace );
5580
- }
5581
-
5582
- // Support: Promises/A+ section 2.3.3.3.4.1
5583
- // https://promisesaplus.com/#point-61
5584
- // Ignore post-resolution exceptions
5585
- if ( depth + 1 >= maxDepth ) {
5586
-
5587
- // Only substitute handlers pass on context
5588
- // and multiple values (non-spec behavior)
5589
- if ( handler !== Thrower ) {
5590
- that = undefined;
5591
- args = [ e ];
5592
- }
5593
-
5594
- deferred.rejectWith( that, args );
5595
- }
5596
- }
5597
- };
5598
-
5599
- // Support: Promises/A+ section 2.3.3.3.1
5600
- // https://promisesaplus.com/#point-57
5601
- // Re-resolve promises immediately to dodge false rejection from
5602
- // subsequent errors
5603
- if ( depth ) {
5604
- process();
5605
- } else {
5606
-
5607
- // Call an optional hook to record the stack, in case of exception
5608
- // since it's otherwise lost when execution goes async
5609
- if ( jQuery.Deferred.getStackHook ) {
5610
- process.stackTrace = jQuery.Deferred.getStackHook();
5611
- }
5612
- window.setTimeout( process );
5613
- }
5614
- };
5615
- }
5616
-
5617
- return jQuery.Deferred( function( newDefer ) {
5618
-
5619
- // progress_handlers.add( ... )
5620
- tuples[ 0 ][ 3 ].add(
5621
- resolve(
5622
- 0,
5623
- newDefer,
5624
- jQuery.isFunction( onProgress ) ?
5625
- onProgress :
5626
- Identity,
5627
- newDefer.notifyWith
5628
- )
5629
- );
5630
-
5631
- // fulfilled_handlers.add( ... )
5632
- tuples[ 1 ][ 3 ].add(
5633
- resolve(
5634
- 0,
5635
- newDefer,
5636
- jQuery.isFunction( onFulfilled ) ?
5637
- onFulfilled :
5638
- Identity
5639
- )
5640
- );
5641
-
5642
- // rejected_handlers.add( ... )
5643
- tuples[ 2 ][ 3 ].add(
5644
- resolve(
5645
- 0,
5646
- newDefer,
5647
- jQuery.isFunction( onRejected ) ?
5648
- onRejected :
5649
- Thrower
5650
- )
5651
- );
5652
- } ).promise();
5653
- },
5654
-
5655
- // Get a promise for this deferred
5656
- // If obj is provided, the promise aspect is added to the object
5657
- promise: function( obj ) {
5658
- return obj != null ? jQuery.extend( obj, promise ) : promise;
5659
- }
5660
- },
5661
- deferred = {};
5662
-
5663
- // Add list-specific methods
5664
- jQuery.each( tuples, function( i, tuple ) {
5665
- var list = tuple[ 2 ],
5666
- stateString = tuple[ 5 ];
5667
-
5668
- // promise.progress = list.add
5669
- // promise.done = list.add
5670
- // promise.fail = list.add
5671
- promise[ tuple[ 1 ] ] = list.add;
5672
-
5673
- // Handle state
5674
- if ( stateString ) {
5675
- list.add(
5676
- function() {
5677
-
5678
- // state = "resolved" (i.e., fulfilled)
5679
- // state = "rejected"
5680
- state = stateString;
5681
- },
5682
-
5683
- // rejected_callbacks.disable
5684
- // fulfilled_callbacks.disable
5685
- tuples[ 3 - i ][ 2 ].disable,
5686
-
5687
- // progress_callbacks.lock
5688
- tuples[ 0 ][ 2 ].lock
5689
- );
5690
- }
5691
-
5692
- // progress_handlers.fire
5693
- // fulfilled_handlers.fire
5694
- // rejected_handlers.fire
5695
- list.add( tuple[ 3 ].fire );
5696
-
5697
- // deferred.notify = function() { deferred.notifyWith(...) }
5698
- // deferred.resolve = function() { deferred.resolveWith(...) }
5699
- // deferred.reject = function() { deferred.rejectWith(...) }
5700
- deferred[ tuple[ 0 ] ] = function() {
5701
- deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
5702
- return this;
5703
- };
5704
-
5705
- // deferred.notifyWith = list.fireWith
5706
- // deferred.resolveWith = list.fireWith
5707
- // deferred.rejectWith = list.fireWith
5708
- deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
5709
- } );
5710
-
5711
- // Make the deferred a promise
5712
- promise.promise( deferred );
5713
-
5714
- // Call given func if any
5715
- if ( func ) {
5716
- func.call( deferred, deferred );
5717
- }
5718
-
5719
- // All done!
5720
- return deferred;
5721
- },
5722
-
5723
- // Deferred helper
5724
- when: function( singleValue ) {
5725
- var
5726
-
5727
- // count of uncompleted subordinates
5728
- remaining = arguments.length,
5729
-
5730
- // count of unprocessed arguments
5731
- i = remaining,
5732
-
5733
- // subordinate fulfillment data
5734
- resolveContexts = Array( i ),
5735
- resolveValues = slice.call( arguments ),
5736
-
5737
- // the master Deferred
5738
- master = jQuery.Deferred(),
5739
-
5740
- // subordinate callback factory
5741
- updateFunc = function( i ) {
5742
- return function( value ) {
5743
- resolveContexts[ i ] = this;
5744
- resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
5745
- if ( !( --remaining ) ) {
5746
- master.resolveWith( resolveContexts, resolveValues );
5747
- }
5748
- };
5749
- };
5750
-
5751
- // Single- and empty arguments are adopted like Promise.resolve
5752
- if ( remaining <= 1 ) {
5753
- adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject );
5754
-
5755
- // Use .then() to unwrap secondary thenables (cf. gh-3000)
5756
- if ( master.state() === "pending" ||
5757
- jQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
5758
-
5759
- return master.then();
5760
- }
5761
- }
5762
-
5763
- // Multiple arguments are aggregated like Promise.all array elements
5764
- while ( i-- ) {
5765
- adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
5766
- }
5767
-
5768
- return master.promise();
5769
- }
5770
- } );
5771
-
5772
-
5773
- // These usually indicate a programmer mistake during development,
5774
- // warn about them ASAP rather than swallowing them by default.
5775
- var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
5776
-
5777
- jQuery.Deferred.exceptionHook = function( error, stack ) {
5778
-
5779
- // Support: IE 8 - 9 only
5780
- // Console exists when dev tools are open, which can happen at any time
5781
- if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
5782
- window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
5783
- }
5784
- };
5785
-
5786
-
5787
-
5788
-
5789
- jQuery.readyException = function( error ) {
5790
- window.setTimeout( function() {
5791
- throw error;
5792
- } );
5793
- };
5794
-
5795
-
5796
-
5797
-
5798
- // The deferred used on DOM ready
5799
- var readyList = jQuery.Deferred();
5800
-
5801
- jQuery.fn.ready = function( fn ) {
5802
-
5803
- readyList
5804
- .then( fn )
5805
-
5806
- // Wrap jQuery.readyException in a function so that the lookup
5807
- // happens at the time of error handling instead of callback
5808
- // registration.
5809
- .catch( function( error ) {
5810
- jQuery.readyException( error );
5811
- } );
5812
-
5813
- return this;
5814
- };
5815
-
5816
- jQuery.extend( {
5817
-
5818
- // Is the DOM ready to be used? Set to true once it occurs.
5819
- isReady: false,
5820
-
5821
- // A counter to track how many items to wait for before
5822
- // the ready event fires. See #6781
5823
- readyWait: 1,
5824
-
5825
- // Hold (or release) the ready event
5826
- holdReady: function( hold ) {
5827
- if ( hold ) {
5828
- jQuery.readyWait++;
5829
- } else {
5830
- jQuery.ready( true );
5831
- }
5832
- },
5833
-
5834
- // Handle when the DOM is ready
5835
- ready: function( wait ) {
5836
-
5837
- // Abort if there are pending holds or we're already ready
5838
- if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
5839
- return;
5840
- }
5841
-
5842
- // Remember that the DOM is ready
5843
- jQuery.isReady = true;
5844
-
5845
- // If a normal DOM Ready event fired, decrement, and wait if need be
5846
- if ( wait !== true && --jQuery.readyWait > 0 ) {
5847
- return;
5848
- }
5849
-
5850
- // If there are functions bound, to execute
5851
- readyList.resolveWith( document, [ jQuery ] );
5852
- }
5853
- } );
5854
-
5855
- jQuery.ready.then = readyList.then;
5856
-
5857
- // The ready event handler and self cleanup method
5858
- function completed() {
5859
- document.removeEventListener( "DOMContentLoaded", completed );
5860
- window.removeEventListener( "load", completed );
5861
- jQuery.ready();
5862
- }
5863
-
5864
- // Catch cases where $(document).ready() is called
5865
- // after the browser event has already occurred.
5866
- // Support: IE <=9 - 10 only
5867
- // Older IE sometimes signals "interactive" too soon
5868
- if ( document.readyState === "complete" ||
5869
- ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
5870
-
5871
- // Handle it asynchronously to allow scripts the opportunity to delay ready
5872
- window.setTimeout( jQuery.ready );
5873
-
5874
- } else {
5875
-
5876
- // Use the handy event callback
5877
- document.addEventListener( "DOMContentLoaded", completed );
5878
-
5879
- // A fallback to window.onload, that will always work
5880
- window.addEventListener( "load", completed );
5881
- }
5882
-
5883
-
5884
-
5885
-
5886
- // Multifunctional method to get and set values of a collection
5887
- // The value/s can optionally be executed if it's a function
5888
- var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
5889
- var i = 0,
5890
- len = elems.length,
5891
- bulk = key == null;
5892
-
5893
- // Sets many values
5894
- if ( jQuery.type( key ) === "object" ) {
5895
- chainable = true;
5896
- for ( i in key ) {
5897
- access( elems, fn, i, key[ i ], true, emptyGet, raw );
5898
- }
5899
-
5900
- // Sets one value
5901
- } else if ( value !== undefined ) {
5902
- chainable = true;
5903
-
5904
- if ( !jQuery.isFunction( value ) ) {
5905
- raw = true;
5906
- }
5907
-
5908
- if ( bulk ) {
5909
-
5910
- // Bulk operations run against the entire set
5911
- if ( raw ) {
5912
- fn.call( elems, value );
5913
- fn = null;
5914
-
5915
- // ...except when executing function values
5916
- } else {
5917
- bulk = fn;
5918
- fn = function( elem, key, value ) {
5919
- return bulk.call( jQuery( elem ), value );
5920
- };
5921
- }
5922
- }
5923
-
5924
- if ( fn ) {
5925
- for ( ; i < len; i++ ) {
5926
- fn(
5927
- elems[ i ], key, raw ?
5928
- value :
5929
- value.call( elems[ i ], i, fn( elems[ i ], key ) )
5930
- );
5931
- }
5932
- }
5933
- }
5934
-
5935
- if ( chainable ) {
5936
- return elems;
5937
- }
5938
-
5939
- // Gets
5940
- if ( bulk ) {
5941
- return fn.call( elems );
5942
- }
5943
-
5944
- return len ? fn( elems[ 0 ], key ) : emptyGet;
5945
- };
5946
- var acceptData = function( owner ) {
5947
-
5948
- // Accepts only:
5949
- // - Node
5950
- // - Node.ELEMENT_NODE
5951
- // - Node.DOCUMENT_NODE
5952
- // - Object
5953
- // - Any
5954
- return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
5955
- };
5956
-
5957
-
5958
-
5959
-
5960
- function Data() {
5961
- this.expando = jQuery.expando + Data.uid++;
5962
- }
5963
-
5964
- Data.uid = 1;
5965
-
5966
- Data.prototype = {
5967
-
5968
- cache: function( owner ) {
5969
-
5970
- // Check if the owner object already has a cache
5971
- var value = owner[ this.expando ];
5972
-
5973
- // If not, create one
5974
- if ( !value ) {
5975
- value = {};
5976
-
5977
- // We can accept data for non-element nodes in modern browsers,
5978
- // but we should not, see #8335.
5979
- // Always return an empty object.
5980
- if ( acceptData( owner ) ) {
5981
-
5982
- // If it is a node unlikely to be stringify-ed or looped over
5983
- // use plain assignment
5984
- if ( owner.nodeType ) {
5985
- owner[ this.expando ] = value;
5986
-
5987
- // Otherwise secure it in a non-enumerable property
5988
- // configurable must be true to allow the property to be
5989
- // deleted when data is removed
5990
- } else {
5991
- Object.defineProperty( owner, this.expando, {
5992
- value: value,
5993
- configurable: true
5994
- } );
5995
- }
5996
- }
5997
- }
5998
-
5999
- return value;
6000
- },
6001
- set: function( owner, data, value ) {
6002
- var prop,
6003
- cache = this.cache( owner );
6004
-
6005
- // Handle: [ owner, key, value ] args
6006
- // Always use camelCase key (gh-2257)
6007
- if ( typeof data === "string" ) {
6008
- cache[ jQuery.camelCase( data ) ] = value;
6009
-
6010
- // Handle: [ owner, { properties } ] args
6011
- } else {
6012
-
6013
- // Copy the properties one-by-one to the cache object
6014
- for ( prop in data ) {
6015
- cache[ jQuery.camelCase( prop ) ] = data[ prop ];
6016
- }
6017
- }
6018
- return cache;
6019
- },
6020
- get: function( owner, key ) {
6021
- return key === undefined ?
6022
- this.cache( owner ) :
6023
-
6024
- // Always use camelCase key (gh-2257)
6025
- owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ];
6026
- },
6027
- access: function( owner, key, value ) {
6028
-
6029
- // In cases where either:
6030
- //
6031
- // 1. No key was specified
6032
- // 2. A string key was specified, but no value provided
6033
- //
6034
- // Take the "read" path and allow the get method to determine
6035
- // which value to return, respectively either:
6036
- //
6037
- // 1. The entire cache object
6038
- // 2. The data stored at the key
6039
- //
6040
- if ( key === undefined ||
6041
- ( ( key && typeof key === "string" ) && value === undefined ) ) {
6042
-
6043
- return this.get( owner, key );
6044
- }
6045
-
6046
- // When the key is not a string, or both a key and value
6047
- // are specified, set or extend (existing objects) with either:
6048
- //
6049
- // 1. An object of properties
6050
- // 2. A key and value
6051
- //
6052
- this.set( owner, key, value );
6053
-
6054
- // Since the "set" path can have two possible entry points
6055
- // return the expected data based on which path was taken[*]
6056
- return value !== undefined ? value : key;
6057
- },
6058
- remove: function( owner, key ) {
6059
- var i,
6060
- cache = owner[ this.expando ];
6061
-
6062
- if ( cache === undefined ) {
6063
- return;
6064
- }
6065
-
6066
- if ( key !== undefined ) {
6067
-
6068
- // Support array or space separated string of keys
6069
- if ( jQuery.isArray( key ) ) {
6070
-
6071
- // If key is an array of keys...
6072
- // We always set camelCase keys, so remove that.
6073
- key = key.map( jQuery.camelCase );
6074
- } else {
6075
- key = jQuery.camelCase( key );
6076
-
6077
- // If a key with the spaces exists, use it.
6078
- // Otherwise, create an array by matching non-whitespace
6079
- key = key in cache ?
6080
- [ key ] :
6081
- ( key.match( rnothtmlwhite ) || [] );
6082
- }
6083
-
6084
- i = key.length;
6085
-
6086
- while ( i-- ) {
6087
- delete cache[ key[ i ] ];
6088
- }
6089
- }
6090
-
6091
- // Remove the expando if there's no more data
6092
- if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
6093
-
6094
- // Support: Chrome <=35 - 45
6095
- // Webkit & Blink performance suffers when deleting properties
6096
- // from DOM nodes, so set to undefined instead
6097
- // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
6098
- if ( owner.nodeType ) {
6099
- owner[ this.expando ] = undefined;
6100
- } else {
6101
- delete owner[ this.expando ];
6102
- }
6103
- }
6104
- },
6105
- hasData: function( owner ) {
6106
- var cache = owner[ this.expando ];
6107
- return cache !== undefined && !jQuery.isEmptyObject( cache );
6108
- }
6109
- };
6110
- var dataPriv = new Data();
6111
-
6112
- var dataUser = new Data();
6113
-
6114
-
6115
-
6116
- // Implementation Summary
6117
- //
6118
- // 1. Enforce API surface and semantic compatibility with 1.9.x branch
6119
- // 2. Improve the module's maintainability by reducing the storage
6120
- // paths to a single mechanism.
6121
- // 3. Use the same single mechanism to support "private" and "user" data.
6122
- // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
6123
- // 5. Avoid exposing implementation details on user objects (eg. expando properties)
6124
- // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
6125
-
6126
- var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
6127
- rmultiDash = /[A-Z]/g;
6128
-
6129
- function getData( data ) {
6130
- if ( data === "true" ) {
6131
- return true;
6132
- }
6133
-
6134
- if ( data === "false" ) {
6135
- return false;
6136
- }
6137
-
6138
- if ( data === "null" ) {
6139
- return null;
6140
- }
6141
-
6142
- // Only convert to a number if it doesn't change the string
6143
- if ( data === +data + "" ) {
6144
- return +data;
6145
- }
6146
-
6147
- if ( rbrace.test( data ) ) {
6148
- return JSON.parse( data );
6149
- }
6150
-
6151
- return data;
6152
- }
6153
-
6154
- function dataAttr( elem, key, data ) {
6155
- var name;
6156
-
6157
- // If nothing was found internally, try to fetch any
6158
- // data from the HTML5 data-* attribute
6159
- if ( data === undefined && elem.nodeType === 1 ) {
6160
- name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
6161
- data = elem.getAttribute( name );
6162
-
6163
- if ( typeof data === "string" ) {
6164
- try {
6165
- data = getData( data );
6166
- } catch ( e ) {}
6167
-
6168
- // Make sure we set the data so it isn't changed later
6169
- dataUser.set( elem, key, data );
6170
- } else {
6171
- data = undefined;
6172
- }
6173
- }
6174
- return data;
6175
- }
6176
-
6177
- jQuery.extend( {
6178
- hasData: function( elem ) {
6179
- return dataUser.hasData( elem ) || dataPriv.hasData( elem );
6180
- },
6181
-
6182
- data: function( elem, name, data ) {
6183
- return dataUser.access( elem, name, data );
6184
- },
6185
-
6186
- removeData: function( elem, name ) {
6187
- dataUser.remove( elem, name );
6188
- },
6189
-
6190
- // TODO: Now that all calls to _data and _removeData have been replaced
6191
- // with direct calls to dataPriv methods, these can be deprecated.
6192
- _data: function( elem, name, data ) {
6193
- return dataPriv.access( elem, name, data );
6194
- },
6195
-
6196
- _removeData: function( elem, name ) {
6197
- dataPriv.remove( elem, name );
6198
- }
6199
- } );
6200
-
6201
- jQuery.fn.extend( {
6202
- data: function( key, value ) {
6203
- var i, name, data,
6204
- elem = this[ 0 ],
6205
- attrs = elem && elem.attributes;
6206
-
6207
- // Gets all values
6208
- if ( key === undefined ) {
6209
- if ( this.length ) {
6210
- data = dataUser.get( elem );
6211
-
6212
- if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
6213
- i = attrs.length;
6214
- while ( i-- ) {
6215
-
6216
- // Support: IE 11 only
6217
- // The attrs elements can be null (#14894)
6218
- if ( attrs[ i ] ) {
6219
- name = attrs[ i ].name;
6220
- if ( name.indexOf( "data-" ) === 0 ) {
6221
- name = jQuery.camelCase( name.slice( 5 ) );
6222
- dataAttr( elem, name, data[ name ] );
6223
- }
6224
- }
6225
- }
6226
- dataPriv.set( elem, "hasDataAttrs", true );
6227
- }
6228
- }
6229
-
6230
- return data;
6231
- }
6232
-
6233
- // Sets multiple values
6234
- if ( typeof key === "object" ) {
6235
- return this.each( function() {
6236
- dataUser.set( this, key );
6237
- } );
6238
- }
6239
-
6240
- return access( this, function( value ) {
6241
- var data;
6242
-
6243
- // The calling jQuery object (element matches) is not empty
6244
- // (and therefore has an element appears at this[ 0 ]) and the
6245
- // `value` parameter was not undefined. An empty jQuery object
6246
- // will result in `undefined` for elem = this[ 0 ] which will
6247
- // throw an exception if an attempt to read a data cache is made.
6248
- if ( elem && value === undefined ) {
6249
-
6250
- // Attempt to get data from the cache
6251
- // The key will always be camelCased in Data
6252
- data = dataUser.get( elem, key );
6253
- if ( data !== undefined ) {
6254
- return data;
6255
- }
6256
-
6257
- // Attempt to "discover" the data in
6258
- // HTML5 custom data-* attrs
6259
- data = dataAttr( elem, key );
6260
- if ( data !== undefined ) {
6261
- return data;
6262
- }
6263
-
6264
- // We tried really hard, but the data doesn't exist.
6265
- return;
6266
- }
6267
-
6268
- // Set the data...
6269
- this.each( function() {
6270
-
6271
- // We always store the camelCased key
6272
- dataUser.set( this, key, value );
6273
- } );
6274
- }, null, value, arguments.length > 1, null, true );
6275
- },
6276
-
6277
- removeData: function( key ) {
6278
- return this.each( function() {
6279
- dataUser.remove( this, key );
6280
- } );
6281
- }
6282
- } );
6283
-
6284
-
6285
- jQuery.extend( {
6286
- queue: function( elem, type, data ) {
6287
- var queue;
6288
-
6289
- if ( elem ) {
6290
- type = ( type || "fx" ) + "queue";
6291
- queue = dataPriv.get( elem, type );
6292
-
6293
- // Speed up dequeue by getting out quickly if this is just a lookup
6294
- if ( data ) {
6295
- if ( !queue || jQuery.isArray( data ) ) {
6296
- queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
6297
- } else {
6298
- queue.push( data );
6299
- }
6300
- }
6301
- return queue || [];
6302
- }
6303
- },
6304
-
6305
- dequeue: function( elem, type ) {
6306
- type = type || "fx";
6307
-
6308
- var queue = jQuery.queue( elem, type ),
6309
- startLength = queue.length,
6310
- fn = queue.shift(),
6311
- hooks = jQuery._queueHooks( elem, type ),
6312
- next = function() {
6313
- jQuery.dequeue( elem, type );
6314
- };
6315
-
6316
- // If the fx queue is dequeued, always remove the progress sentinel
6317
- if ( fn === "inprogress" ) {
6318
- fn = queue.shift();
6319
- startLength--;
6320
- }
6321
-
6322
- if ( fn ) {
6323
-
6324
- // Add a progress sentinel to prevent the fx queue from being
6325
- // automatically dequeued
6326
- if ( type === "fx" ) {
6327
- queue.unshift( "inprogress" );
6328
- }
6329
-
6330
- // Clear up the last queue stop function
6331
- delete hooks.stop;
6332
- fn.call( elem, next, hooks );
6333
- }
6334
-
6335
- if ( !startLength && hooks ) {
6336
- hooks.empty.fire();
6337
- }
6338
- },
6339
-
6340
- // Not public - generate a queueHooks object, or return the current one
6341
- _queueHooks: function( elem, type ) {
6342
- var key = type + "queueHooks";
6343
- return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
6344
- empty: jQuery.Callbacks( "once memory" ).add( function() {
6345
- dataPriv.remove( elem, [ type + "queue", key ] );
6346
- } )
6347
- } );
6348
- }
6349
- } );
6350
-
6351
- jQuery.fn.extend( {
6352
- queue: function( type, data ) {
6353
- var setter = 2;
6354
-
6355
- if ( typeof type !== "string" ) {
6356
- data = type;
6357
- type = "fx";
6358
- setter--;
6359
- }
6360
-
6361
- if ( arguments.length < setter ) {
6362
- return jQuery.queue( this[ 0 ], type );
6363
- }
6364
-
6365
- return data === undefined ?
6366
- this :
6367
- this.each( function() {
6368
- var queue = jQuery.queue( this, type, data );
6369
-
6370
- // Ensure a hooks for this queue
6371
- jQuery._queueHooks( this, type );
6372
-
6373
- if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
6374
- jQuery.dequeue( this, type );
6375
- }
6376
- } );
6377
- },
6378
- dequeue: function( type ) {
6379
- return this.each( function() {
6380
- jQuery.dequeue( this, type );
6381
- } );
6382
- },
6383
- clearQueue: function( type ) {
6384
- return this.queue( type || "fx", [] );
6385
- },
6386
-
6387
- // Get a promise resolved when queues of a certain type
6388
- // are emptied (fx is the type by default)
6389
- promise: function( type, obj ) {
6390
- var tmp,
6391
- count = 1,
6392
- defer = jQuery.Deferred(),
6393
- elements = this,
6394
- i = this.length,
6395
- resolve = function() {
6396
- if ( !( --count ) ) {
6397
- defer.resolveWith( elements, [ elements ] );
6398
- }
6399
- };
6400
-
6401
- if ( typeof type !== "string" ) {
6402
- obj = type;
6403
- type = undefined;
6404
- }
6405
- type = type || "fx";
6406
-
6407
- while ( i-- ) {
6408
- tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
6409
- if ( tmp && tmp.empty ) {
6410
- count++;
6411
- tmp.empty.add( resolve );
6412
- }
6413
- }
6414
- resolve();
6415
- return defer.promise( obj );
6416
- }
6417
- } );
6418
- var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
6419
-
6420
- var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
6421
-
6422
-
6423
- var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
6424
-
6425
- var isHiddenWithinTree = function( elem, el ) {
6426
-
6427
- // isHiddenWithinTree might be called from jQuery#filter function;
6428
- // in that case, element will be second argument
6429
- elem = el || elem;
6430
-
6431
- // Inline style trumps all
6432
- return elem.style.display === "none" ||
6433
- elem.style.display === "" &&
6434
-
6435
- // Otherwise, check computed style
6436
- // Support: Firefox <=43 - 45
6437
- // Disconnected elements can have computed display: none, so first confirm that elem is
6438
- // in the document.
6439
- jQuery.contains( elem.ownerDocument, elem ) &&
6440
-
6441
- jQuery.css( elem, "display" ) === "none";
6442
- };
6443
-
6444
- var swap = function( elem, options, callback, args ) {
6445
- var ret, name,
6446
- old = {};
6447
-
6448
- // Remember the old values, and insert the new ones
6449
- for ( name in options ) {
6450
- old[ name ] = elem.style[ name ];
6451
- elem.style[ name ] = options[ name ];
6452
- }
6453
-
6454
- ret = callback.apply( elem, args || [] );
6455
-
6456
- // Revert the old values
6457
- for ( name in options ) {
6458
- elem.style[ name ] = old[ name ];
6459
- }
6460
-
6461
- return ret;
6462
- };
6463
-
6464
-
6465
-
6466
-
6467
- function adjustCSS( elem, prop, valueParts, tween ) {
6468
- var adjusted,
6469
- scale = 1,
6470
- maxIterations = 20,
6471
- currentValue = tween ?
6472
- function() {
6473
- return tween.cur();
6474
- } :
6475
- function() {
6476
- return jQuery.css( elem, prop, "" );
6477
- },
6478
- initial = currentValue(),
6479
- unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
6480
-
6481
- // Starting value computation is required for potential unit mismatches
6482
- initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
6483
- rcssNum.exec( jQuery.css( elem, prop ) );
6484
-
6485
- if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
6486
-
6487
- // Trust units reported by jQuery.css
6488
- unit = unit || initialInUnit[ 3 ];
6489
-
6490
- // Make sure we update the tween properties later on
6491
- valueParts = valueParts || [];
6492
-
6493
- // Iteratively approximate from a nonzero starting point
6494
- initialInUnit = +initial || 1;
6495
-
6496
- do {
6497
-
6498
- // If previous iteration zeroed out, double until we get *something*.
6499
- // Use string for doubling so we don't accidentally see scale as unchanged below
6500
- scale = scale || ".5";
6501
-
6502
- // Adjust and apply
6503
- initialInUnit = initialInUnit / scale;
6504
- jQuery.style( elem, prop, initialInUnit + unit );
6505
-
6506
- // Update scale, tolerating zero or NaN from tween.cur()
6507
- // Break the loop if scale is unchanged or perfect, or if we've just had enough.
6508
- } while (
6509
- scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
6510
- );
6511
- }
6512
-
6513
- if ( valueParts ) {
6514
- initialInUnit = +initialInUnit || +initial || 0;
6515
-
6516
- // Apply relative offset (+=/-=) if specified
6517
- adjusted = valueParts[ 1 ] ?
6518
- initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
6519
- +valueParts[ 2 ];
6520
- if ( tween ) {
6521
- tween.unit = unit;
6522
- tween.start = initialInUnit;
6523
- tween.end = adjusted;
6524
- }
6525
- }
6526
- return adjusted;
6527
- }
6528
-
6529
-
6530
- var defaultDisplayMap = {};
6531
-
6532
- function getDefaultDisplay( elem ) {
6533
- var temp,
6534
- doc = elem.ownerDocument,
6535
- nodeName = elem.nodeName,
6536
- display = defaultDisplayMap[ nodeName ];
6537
-
6538
- if ( display ) {
6539
- return display;
6540
- }
6541
-
6542
- temp = doc.body.appendChild( doc.createElement( nodeName ) );
6543
- display = jQuery.css( temp, "display" );
6544
-
6545
- temp.parentNode.removeChild( temp );
6546
-
6547
- if ( display === "none" ) {
6548
- display = "block";
6549
- }
6550
- defaultDisplayMap[ nodeName ] = display;
6551
-
6552
- return display;
6553
- }
6554
-
6555
- function showHide( elements, show ) {
6556
- var display, elem,
6557
- values = [],
6558
- index = 0,
6559
- length = elements.length;
6560
-
6561
- // Determine new display value for elements that need to change
6562
- for ( ; index < length; index++ ) {
6563
- elem = elements[ index ];
6564
- if ( !elem.style ) {
6565
- continue;
6566
- }
6567
-
6568
- display = elem.style.display;
6569
- if ( show ) {
6570
-
6571
- // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
6572
- // check is required in this first loop unless we have a nonempty display value (either
6573
- // inline or about-to-be-restored)
6574
- if ( display === "none" ) {
6575
- values[ index ] = dataPriv.get( elem, "display" ) || null;
6576
- if ( !values[ index ] ) {
6577
- elem.style.display = "";
6578
- }
6579
- }
6580
- if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
6581
- values[ index ] = getDefaultDisplay( elem );
6582
- }
6583
- } else {
6584
- if ( display !== "none" ) {
6585
- values[ index ] = "none";
6586
-
6587
- // Remember what we're overwriting
6588
- dataPriv.set( elem, "display", display );
6589
- }
6590
- }
6591
- }
6592
-
6593
- // Set the display of the elements in a second loop to avoid constant reflow
6594
- for ( index = 0; index < length; index++ ) {
6595
- if ( values[ index ] != null ) {
6596
- elements[ index ].style.display = values[ index ];
6597
- }
6598
- }
6599
-
6600
- return elements;
6601
- }
6602
-
6603
- jQuery.fn.extend( {
6604
- show: function() {
6605
- return showHide( this, true );
6606
- },
6607
- hide: function() {
6608
- return showHide( this );
6609
- },
6610
- toggle: function( state ) {
6611
- if ( typeof state === "boolean" ) {
6612
- return state ? this.show() : this.hide();
6613
- }
6614
-
6615
- return this.each( function() {
6616
- if ( isHiddenWithinTree( this ) ) {
6617
- jQuery( this ).show();
6618
- } else {
6619
- jQuery( this ).hide();
6620
- }
6621
- } );
6622
- }
6623
- } );
6624
- var rcheckableType = ( /^(?:checkbox|radio)$/i );
6625
-
6626
- var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
6627
-
6628
- var rscriptType = ( /^$|\/(?:java|ecma)script/i );
6629
-
6630
-
6631
-
6632
- // We have to close these tags to support XHTML (#13200)
6633
- var wrapMap = {
6634
-
6635
- // Support: IE <=9 only
6636
- option: [ 1, "<select multiple='multiple'>", "</select>" ],
6637
-
6638
- // XHTML parsers do not magically insert elements in the
6639
- // same way that tag soup parsers do. So we cannot shorten
6640
- // this by omitting <tbody> or other required elements.
6641
- thead: [ 1, "<table>", "</table>" ],
6642
- col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
6643
- tr: [ 2, "<table><tbody>", "</tbody></table>" ],
6644
- td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
6645
-
6646
- _default: [ 0, "", "" ]
6647
- };
6648
-
6649
- // Support: IE <=9 only
6650
- wrapMap.optgroup = wrapMap.option;
6651
-
6652
- wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
6653
- wrapMap.th = wrapMap.td;
6654
-
6655
-
6656
- function getAll( context, tag ) {
6657
-
6658
- // Support: IE <=9 - 11 only
6659
- // Use typeof to avoid zero-argument method invocation on host objects (#15151)
6660
- var ret;
6661
-
6662
- if ( typeof context.getElementsByTagName !== "undefined" ) {
6663
- ret = context.getElementsByTagName( tag || "*" );
6664
-
6665
- } else if ( typeof context.querySelectorAll !== "undefined" ) {
6666
- ret = context.querySelectorAll( tag || "*" );
6667
-
6668
- } else {
6669
- ret = [];
6670
- }
6671
-
6672
- if ( tag === undefined || tag && jQuery.nodeName( context, tag ) ) {
6673
- return jQuery.merge( [ context ], ret );
6674
- }
6675
-
6676
- return ret;
6677
- }
6678
-
6679
-
6680
- // Mark scripts as having already been evaluated
6681
- function setGlobalEval( elems, refElements ) {
6682
- var i = 0,
6683
- l = elems.length;
6684
-
6685
- for ( ; i < l; i++ ) {
6686
- dataPriv.set(
6687
- elems[ i ],
6688
- "globalEval",
6689
- !refElements || dataPriv.get( refElements[ i ], "globalEval" )
6690
- );
6691
- }
6692
- }
6693
-
6694
-
6695
- var rhtml = /<|&#?\w+;/;
6696
-
6697
- function buildFragment( elems, context, scripts, selection, ignored ) {
6698
- var elem, tmp, tag, wrap, contains, j,
6699
- fragment = context.createDocumentFragment(),
6700
- nodes = [],
6701
- i = 0,
6702
- l = elems.length;
6703
-
6704
- for ( ; i < l; i++ ) {
6705
- elem = elems[ i ];
6706
-
6707
- if ( elem || elem === 0 ) {
6708
-
6709
- // Add nodes directly
6710
- if ( jQuery.type( elem ) === "object" ) {
6711
-
6712
- // Support: Android <=4.0 only, PhantomJS 1 only
6713
- // push.apply(_, arraylike) throws on ancient WebKit
6714
- jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
6715
-
6716
- // Convert non-html into a text node
6717
- } else if ( !rhtml.test( elem ) ) {
6718
- nodes.push( context.createTextNode( elem ) );
6719
-
6720
- // Convert html into DOM nodes
6721
- } else {
6722
- tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
6723
-
6724
- // Deserialize a standard representation
6725
- tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
6726
- wrap = wrapMap[ tag ] || wrapMap._default;
6727
- tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
6728
-
6729
- // Descend through wrappers to the right content
6730
- j = wrap[ 0 ];
6731
- while ( j-- ) {
6732
- tmp = tmp.lastChild;
6733
- }
6734
-
6735
- // Support: Android <=4.0 only, PhantomJS 1 only
6736
- // push.apply(_, arraylike) throws on ancient WebKit
6737
- jQuery.merge( nodes, tmp.childNodes );
6738
-
6739
- // Remember the top-level container
6740
- tmp = fragment.firstChild;
6741
-
6742
- // Ensure the created nodes are orphaned (#12392)
6743
- tmp.textContent = "";
6744
- }
6745
- }
6746
- }
6747
-
6748
- // Remove wrapper from fragment
6749
- fragment.textContent = "";
6750
-
6751
- i = 0;
6752
- while ( ( elem = nodes[ i++ ] ) ) {
6753
-
6754
- // Skip elements already in the context collection (trac-4087)
6755
- if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
6756
- if ( ignored ) {
6757
- ignored.push( elem );
6758
- }
6759
- continue;
6760
- }
6761
-
6762
- contains = jQuery.contains( elem.ownerDocument, elem );
6763
-
6764
- // Append to fragment
6765
- tmp = getAll( fragment.appendChild( elem ), "script" );
6766
-
6767
- // Preserve script evaluation history
6768
- if ( contains ) {
6769
- setGlobalEval( tmp );
6770
- }
6771
-
6772
- // Capture executables
6773
- if ( scripts ) {
6774
- j = 0;
6775
- while ( ( elem = tmp[ j++ ] ) ) {
6776
- if ( rscriptType.test( elem.type || "" ) ) {
6777
- scripts.push( elem );
6778
- }
6779
- }
6780
- }
6781
- }
6782
-
6783
- return fragment;
6784
- }
6785
-
6786
-
6787
- ( function() {
6788
- var fragment = document.createDocumentFragment(),
6789
- div = fragment.appendChild( document.createElement( "div" ) ),
6790
- input = document.createElement( "input" );
6791
-
6792
- // Support: Android 4.0 - 4.3 only
6793
- // Check state lost if the name is set (#11217)
6794
- // Support: Windows Web Apps (WWA)
6795
- // `name` and `type` must use .setAttribute for WWA (#14901)
6796
- input.setAttribute( "type", "radio" );
6797
- input.setAttribute( "checked", "checked" );
6798
- input.setAttribute( "name", "t" );
6799
-
6800
- div.appendChild( input );
6801
-
6802
- // Support: Android <=4.1 only
6803
- // Older WebKit doesn't clone checked state correctly in fragments
6804
- support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
6805
-
6806
- // Support: IE <=11 only
6807
- // Make sure textarea (and checkbox) defaultValue is properly cloned
6808
- div.innerHTML = "<textarea>x</textarea>";
6809
- support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
6810
- } )();
6811
- var documentElement = document.documentElement;
6812
-
6813
-
6814
-
6815
- var
6816
- rkeyEvent = /^key/,
6817
- rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
6818
- rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
6819
-
6820
- function returnTrue() {
6821
- return true;
6822
- }
6823
-
6824
- function returnFalse() {
6825
- return false;
6826
- }
6827
-
6828
- // Support: IE <=9 only
6829
- // See #13393 for more info
6830
- function safeActiveElement() {
6831
- try {
6832
- return document.activeElement;
6833
- } catch ( err ) { }
6834
- }
6835
-
6836
- function on( elem, types, selector, data, fn, one ) {
6837
- var origFn, type;
6838
-
6839
- // Types can be a map of types/handlers
6840
- if ( typeof types === "object" ) {
6841
-
6842
- // ( types-Object, selector, data )
6843
- if ( typeof selector !== "string" ) {
6844
-
6845
- // ( types-Object, data )
6846
- data = data || selector;
6847
- selector = undefined;
6848
- }
6849
- for ( type in types ) {
6850
- on( elem, type, selector, data, types[ type ], one );
6851
- }
6852
- return elem;
6853
- }
6854
-
6855
- if ( data == null && fn == null ) {
6856
-
6857
- // ( types, fn )
6858
- fn = selector;
6859
- data = selector = undefined;
6860
- } else if ( fn == null ) {
6861
- if ( typeof selector === "string" ) {
6862
-
6863
- // ( types, selector, fn )
6864
- fn = data;
6865
- data = undefined;
6866
- } else {
6867
-
6868
- // ( types, data, fn )
6869
- fn = data;
6870
- data = selector;
6871
- selector = undefined;
6872
- }
6873
- }
6874
- if ( fn === false ) {
6875
- fn = returnFalse;
6876
- } else if ( !fn ) {
6877
- return elem;
6878
- }
6879
-
6880
- if ( one === 1 ) {
6881
- origFn = fn;
6882
- fn = function( event ) {
6883
-
6884
- // Can use an empty set, since event contains the info
6885
- jQuery().off( event );
6886
- return origFn.apply( this, arguments );
6887
- };
6888
-
6889
- // Use same guid so caller can remove using origFn
6890
- fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
6891
- }
6892
- return elem.each( function() {
6893
- jQuery.event.add( this, types, fn, data, selector );
6894
- } );
6895
- }
6896
-
6897
- /*
6898
- * Helper functions for managing events -- not part of the public interface.
6899
- * Props to Dean Edwards' addEvent library for many of the ideas.
6900
- */
6901
- jQuery.event = {
6902
-
6903
- global: {},
6904
-
6905
- add: function( elem, types, handler, data, selector ) {
6906
-
6907
- var handleObjIn, eventHandle, tmp,
6908
- events, t, handleObj,
6909
- special, handlers, type, namespaces, origType,
6910
- elemData = dataPriv.get( elem );
6911
-
6912
- // Don't attach events to noData or text/comment nodes (but allow plain objects)
6913
- if ( !elemData ) {
6914
- return;
6915
- }
6916
-
6917
- // Caller can pass in an object of custom data in lieu of the handler
6918
- if ( handler.handler ) {
6919
- handleObjIn = handler;
6920
- handler = handleObjIn.handler;
6921
- selector = handleObjIn.selector;
6922
- }
6923
-
6924
- // Ensure that invalid selectors throw exceptions at attach time
6925
- // Evaluate against documentElement in case elem is a non-element node (e.g., document)
6926
- if ( selector ) {
6927
- jQuery.find.matchesSelector( documentElement, selector );
6928
- }
6929
-
6930
- // Make sure that the handler has a unique ID, used to find/remove it later
6931
- if ( !handler.guid ) {
6932
- handler.guid = jQuery.guid++;
6933
- }
6934
-
6935
- // Init the element's event structure and main handler, if this is the first
6936
- if ( !( events = elemData.events ) ) {
6937
- events = elemData.events = {};
6938
- }
6939
- if ( !( eventHandle = elemData.handle ) ) {
6940
- eventHandle = elemData.handle = function( e ) {
6941
-
6942
- // Discard the second event of a jQuery.event.trigger() and
6943
- // when an event is called after a page has unloaded
6944
- return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
6945
- jQuery.event.dispatch.apply( elem, arguments ) : undefined;
6946
- };
6947
- }
6948
-
6949
- // Handle multiple events separated by a space
6950
- types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
6951
- t = types.length;
6952
- while ( t-- ) {
6953
- tmp = rtypenamespace.exec( types[ t ] ) || [];
6954
- type = origType = tmp[ 1 ];
6955
- namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
6956
-
6957
- // There *must* be a type, no attaching namespace-only handlers
6958
- if ( !type ) {
6959
- continue;
6960
- }
6961
-
6962
- // If event changes its type, use the special event handlers for the changed type
6963
- special = jQuery.event.special[ type ] || {};
6964
-
6965
- // If selector defined, determine special event api type, otherwise given type
6966
- type = ( selector ? special.delegateType : special.bindType ) || type;
6967
-
6968
- // Update special based on newly reset type
6969
- special = jQuery.event.special[ type ] || {};
6970
-
6971
- // handleObj is passed to all event handlers
6972
- handleObj = jQuery.extend( {
6973
- type: type,
6974
- origType: origType,
6975
- data: data,
6976
- handler: handler,
6977
- guid: handler.guid,
6978
- selector: selector,
6979
- needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
6980
- namespace: namespaces.join( "." )
6981
- }, handleObjIn );
6982
-
6983
- // Init the event handler queue if we're the first
6984
- if ( !( handlers = events[ type ] ) ) {
6985
- handlers = events[ type ] = [];
6986
- handlers.delegateCount = 0;
6987
-
6988
- // Only use addEventListener if the special events handler returns false
6989
- if ( !special.setup ||
6990
- special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
6991
-
6992
- if ( elem.addEventListener ) {
6993
- elem.addEventListener( type, eventHandle );
6994
- }
6995
- }
6996
- }
6997
-
6998
- if ( special.add ) {
6999
- special.add.call( elem, handleObj );
7000
-
7001
- if ( !handleObj.handler.guid ) {
7002
- handleObj.handler.guid = handler.guid;
7003
- }
7004
- }
7005
-
7006
- // Add to the element's handler list, delegates in front
7007
- if ( selector ) {
7008
- handlers.splice( handlers.delegateCount++, 0, handleObj );
7009
- } else {
7010
- handlers.push( handleObj );
7011
- }
7012
-
7013
- // Keep track of which events have ever been used, for event optimization
7014
- jQuery.event.global[ type ] = true;
7015
- }
7016
-
7017
- },
7018
-
7019
- // Detach an event or set of events from an element
7020
- remove: function( elem, types, handler, selector, mappedTypes ) {
7021
-
7022
- var j, origCount, tmp,
7023
- events, t, handleObj,
7024
- special, handlers, type, namespaces, origType,
7025
- elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
7026
-
7027
- if ( !elemData || !( events = elemData.events ) ) {
7028
- return;
7029
- }
7030
-
7031
- // Once for each type.namespace in types; type may be omitted
7032
- types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
7033
- t = types.length;
7034
- while ( t-- ) {
7035
- tmp = rtypenamespace.exec( types[ t ] ) || [];
7036
- type = origType = tmp[ 1 ];
7037
- namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
7038
-
7039
- // Unbind all events (on this namespace, if provided) for the element
7040
- if ( !type ) {
7041
- for ( type in events ) {
7042
- jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
7043
- }
7044
- continue;
7045
- }
7046
-
7047
- special = jQuery.event.special[ type ] || {};
7048
- type = ( selector ? special.delegateType : special.bindType ) || type;
7049
- handlers = events[ type ] || [];
7050
- tmp = tmp[ 2 ] &&
7051
- new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
7052
-
7053
- // Remove matching events
7054
- origCount = j = handlers.length;
7055
- while ( j-- ) {
7056
- handleObj = handlers[ j ];
7057
-
7058
- if ( ( mappedTypes || origType === handleObj.origType ) &&
7059
- ( !handler || handler.guid === handleObj.guid ) &&
7060
- ( !tmp || tmp.test( handleObj.namespace ) ) &&
7061
- ( !selector || selector === handleObj.selector ||
7062
- selector === "**" && handleObj.selector ) ) {
7063
- handlers.splice( j, 1 );
7064
-
7065
- if ( handleObj.selector ) {
7066
- handlers.delegateCount--;
7067
- }
7068
- if ( special.remove ) {
7069
- special.remove.call( elem, handleObj );
7070
- }
7071
- }
7072
- }
7073
-
7074
- // Remove generic event handler if we removed something and no more handlers exist
7075
- // (avoids potential for endless recursion during removal of special event handlers)
7076
- if ( origCount && !handlers.length ) {
7077
- if ( !special.teardown ||
7078
- special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
7079
-
7080
- jQuery.removeEvent( elem, type, elemData.handle );
7081
- }
7082
-
7083
- delete events[ type ];
7084
- }
7085
- }
7086
-
7087
- // Remove data and the expando if it's no longer used
7088
- if ( jQuery.isEmptyObject( events ) ) {
7089
- dataPriv.remove( elem, "handle events" );
7090
- }
7091
- },
7092
-
7093
- dispatch: function( nativeEvent ) {
7094
-
7095
- // Make a writable jQuery.Event from the native event object
7096
- var event = jQuery.event.fix( nativeEvent );
7097
-
7098
- var i, j, ret, matched, handleObj, handlerQueue,
7099
- args = new Array( arguments.length ),
7100
- handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
7101
- special = jQuery.event.special[ event.type ] || {};
7102
-
7103
- // Use the fix-ed jQuery.Event rather than the (read-only) native event
7104
- args[ 0 ] = event;
7105
-
7106
- for ( i = 1; i < arguments.length; i++ ) {
7107
- args[ i ] = arguments[ i ];
7108
- }
7109
-
7110
- event.delegateTarget = this;
7111
-
7112
- // Call the preDispatch hook for the mapped type, and let it bail if desired
7113
- if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
7114
- return;
7115
- }
7116
-
7117
- // Determine handlers
7118
- handlerQueue = jQuery.event.handlers.call( this, event, handlers );
7119
-
7120
- // Run delegates first; they may want to stop propagation beneath us
7121
- i = 0;
7122
- while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
7123
- event.currentTarget = matched.elem;
7124
-
7125
- j = 0;
7126
- while ( ( handleObj = matched.handlers[ j++ ] ) &&
7127
- !event.isImmediatePropagationStopped() ) {
7128
-
7129
- // Triggered event must either 1) have no namespace, or 2) have namespace(s)
7130
- // a subset or equal to those in the bound event (both can have no namespace).
7131
- if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
7132
-
7133
- event.handleObj = handleObj;
7134
- event.data = handleObj.data;
7135
-
7136
- ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
7137
- handleObj.handler ).apply( matched.elem, args );
7138
-
7139
- if ( ret !== undefined ) {
7140
- if ( ( event.result = ret ) === false ) {
7141
- event.preventDefault();
7142
- event.stopPropagation();
7143
- }
7144
- }
7145
- }
7146
- }
7147
- }
7148
-
7149
- // Call the postDispatch hook for the mapped type
7150
- if ( special.postDispatch ) {
7151
- special.postDispatch.call( this, event );
7152
- }
7153
-
7154
- return event.result;
7155
- },
7156
-
7157
- handlers: function( event, handlers ) {
7158
- var i, handleObj, sel, matchedHandlers, matchedSelectors,
7159
- handlerQueue = [],
7160
- delegateCount = handlers.delegateCount,
7161
- cur = event.target;
7162
-
7163
- // Find delegate handlers
7164
- if ( delegateCount &&
7165
-
7166
- // Support: IE <=9
7167
- // Black-hole SVG <use> instance trees (trac-13180)
7168
- cur.nodeType &&
7169
-
7170
- // Support: Firefox <=42
7171
- // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
7172
- // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
7173
- // Support: IE 11 only
7174
- // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
7175
- !( event.type === "click" && event.button >= 1 ) ) {
7176
-
7177
- for ( ; cur !== this; cur = cur.parentNode || this ) {
7178
-
7179
- // Don't check non-elements (#13208)
7180
- // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
7181
- if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
7182
- matchedHandlers = [];
7183
- matchedSelectors = {};
7184
- for ( i = 0; i < delegateCount; i++ ) {
7185
- handleObj = handlers[ i ];
7186
-
7187
- // Don't conflict with Object.prototype properties (#13203)
7188
- sel = handleObj.selector + " ";
7189
-
7190
- if ( matchedSelectors[ sel ] === undefined ) {
7191
- matchedSelectors[ sel ] = handleObj.needsContext ?
7192
- jQuery( sel, this ).index( cur ) > -1 :
7193
- jQuery.find( sel, this, null, [ cur ] ).length;
7194
- }
7195
- if ( matchedSelectors[ sel ] ) {
7196
- matchedHandlers.push( handleObj );
7197
- }
7198
- }
7199
- if ( matchedHandlers.length ) {
7200
- handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
7201
- }
7202
- }
7203
- }
7204
- }
7205
-
7206
- // Add the remaining (directly-bound) handlers
7207
- cur = this;
7208
- if ( delegateCount < handlers.length ) {
7209
- handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
7210
- }
7211
-
7212
- return handlerQueue;
7213
- },
7214
-
7215
- addProp: function( name, hook ) {
7216
- Object.defineProperty( jQuery.Event.prototype, name, {
7217
- enumerable: true,
7218
- configurable: true,
7219
-
7220
- get: jQuery.isFunction( hook ) ?
7221
- function() {
7222
- if ( this.originalEvent ) {
7223
- return hook( this.originalEvent );
7224
- }
7225
- } :
7226
- function() {
7227
- if ( this.originalEvent ) {
7228
- return this.originalEvent[ name ];
7229
- }
7230
- },
7231
-
7232
- set: function( value ) {
7233
- Object.defineProperty( this, name, {
7234
- enumerable: true,
7235
- configurable: true,
7236
- writable: true,
7237
- value: value
7238
- } );
7239
- }
7240
- } );
7241
- },
7242
-
7243
- fix: function( originalEvent ) {
7244
- return originalEvent[ jQuery.expando ] ?
7245
- originalEvent :
7246
- new jQuery.Event( originalEvent );
7247
- },
7248
-
7249
- special: {
7250
- load: {
7251
-
7252
- // Prevent triggered image.load events from bubbling to window.load
7253
- noBubble: true
7254
- },
7255
- focus: {
7256
-
7257
- // Fire native event if possible so blur/focus sequence is correct
7258
- trigger: function() {
7259
- if ( this !== safeActiveElement() && this.focus ) {
7260
- this.focus();
7261
- return false;
7262
- }
7263
- },
7264
- delegateType: "focusin"
7265
- },
7266
- blur: {
7267
- trigger: function() {
7268
- if ( this === safeActiveElement() && this.blur ) {
7269
- this.blur();
7270
- return false;
7271
- }
7272
- },
7273
- delegateType: "focusout"
7274
- },
7275
- click: {
7276
-
7277
- // For checkbox, fire native event so checked state will be right
7278
- trigger: function() {
7279
- if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
7280
- this.click();
7281
- return false;
7282
- }
7283
- },
7284
-
7285
- // For cross-browser consistency, don't fire native .click() on links
7286
- _default: function( event ) {
7287
- return jQuery.nodeName( event.target, "a" );
7288
- }
7289
- },
7290
-
7291
- beforeunload: {
7292
- postDispatch: function( event ) {
7293
-
7294
- // Support: Firefox 20+
7295
- // Firefox doesn't alert if the returnValue field is not set.
7296
- if ( event.result !== undefined && event.originalEvent ) {
7297
- event.originalEvent.returnValue = event.result;
7298
- }
7299
- }
7300
- }
7301
- }
7302
- };
7303
-
7304
- jQuery.removeEvent = function( elem, type, handle ) {
7305
-
7306
- // This "if" is needed for plain objects
7307
- if ( elem.removeEventListener ) {
7308
- elem.removeEventListener( type, handle );
7309
- }
7310
- };
7311
-
7312
- jQuery.Event = function( src, props ) {
7313
-
7314
- // Allow instantiation without the 'new' keyword
7315
- if ( !( this instanceof jQuery.Event ) ) {
7316
- return new jQuery.Event( src, props );
7317
- }
7318
-
7319
- // Event object
7320
- if ( src && src.type ) {
7321
- this.originalEvent = src;
7322
- this.type = src.type;
7323
-
7324
- // Events bubbling up the document may have been marked as prevented
7325
- // by a handler lower down the tree; reflect the correct value.
7326
- this.isDefaultPrevented = src.defaultPrevented ||
7327
- src.defaultPrevented === undefined &&
7328
-
7329
- // Support: Android <=2.3 only
7330
- src.returnValue === false ?
7331
- returnTrue :
7332
- returnFalse;
7333
-
7334
- // Create target properties
7335
- // Support: Safari <=6 - 7 only
7336
- // Target should not be a text node (#504, #13143)
7337
- this.target = ( src.target && src.target.nodeType === 3 ) ?
7338
- src.target.parentNode :
7339
- src.target;
7340
-
7341
- this.currentTarget = src.currentTarget;
7342
- this.relatedTarget = src.relatedTarget;
7343
-
7344
- // Event type
7345
- } else {
7346
- this.type = src;
7347
- }
7348
-
7349
- // Put explicitly provided properties onto the event object
7350
- if ( props ) {
7351
- jQuery.extend( this, props );
7352
- }
7353
-
7354
- // Create a timestamp if incoming event doesn't have one
7355
- this.timeStamp = src && src.timeStamp || jQuery.now();
7356
-
7357
- // Mark it as fixed
7358
- this[ jQuery.expando ] = true;
7359
- };
7360
-
7361
- // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
7362
- // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
7363
- jQuery.Event.prototype = {
7364
- constructor: jQuery.Event,
7365
- isDefaultPrevented: returnFalse,
7366
- isPropagationStopped: returnFalse,
7367
- isImmediatePropagationStopped: returnFalse,
7368
- isSimulated: false,
7369
-
7370
- preventDefault: function() {
7371
- var e = this.originalEvent;
7372
-
7373
- this.isDefaultPrevented = returnTrue;
7374
-
7375
- if ( e && !this.isSimulated ) {
7376
- e.preventDefault();
7377
- }
7378
- },
7379
- stopPropagation: function() {
7380
- var e = this.originalEvent;
7381
-
7382
- this.isPropagationStopped = returnTrue;
7383
-
7384
- if ( e && !this.isSimulated ) {
7385
- e.stopPropagation();
7386
- }
7387
- },
7388
- stopImmediatePropagation: function() {
7389
- var e = this.originalEvent;
7390
-
7391
- this.isImmediatePropagationStopped = returnTrue;
7392
-
7393
- if ( e && !this.isSimulated ) {
7394
- e.stopImmediatePropagation();
7395
- }
7396
-
7397
- this.stopPropagation();
7398
- }
7399
- };
7400
-
7401
- // Includes all common event props including KeyEvent and MouseEvent specific props
7402
- jQuery.each( {
7403
- altKey: true,
7404
- bubbles: true,
7405
- cancelable: true,
7406
- changedTouches: true,
7407
- ctrlKey: true,
7408
- detail: true,
7409
- eventPhase: true,
7410
- metaKey: true,
7411
- pageX: true,
7412
- pageY: true,
7413
- shiftKey: true,
7414
- view: true,
7415
- "char": true,
7416
- charCode: true,
7417
- key: true,
7418
- keyCode: true,
7419
- button: true,
7420
- buttons: true,
7421
- clientX: true,
7422
- clientY: true,
7423
- offsetX: true,
7424
- offsetY: true,
7425
- pointerId: true,
7426
- pointerType: true,
7427
- screenX: true,
7428
- screenY: true,
7429
- targetTouches: true,
7430
- toElement: true,
7431
- touches: true,
7432
-
7433
- which: function( event ) {
7434
- var button = event.button;
7435
-
7436
- // Add which for key events
7437
- if ( event.which == null && rkeyEvent.test( event.type ) ) {
7438
- return event.charCode != null ? event.charCode : event.keyCode;
7439
- }
7440
-
7441
- // Add which for click: 1 === left; 2 === middle; 3 === right
7442
- if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
7443
- if ( button & 1 ) {
7444
- return 1;
7445
- }
7446
-
7447
- if ( button & 2 ) {
7448
- return 3;
7449
- }
7450
-
7451
- if ( button & 4 ) {
7452
- return 2;
7453
- }
7454
-
7455
- return 0;
7456
- }
7457
-
7458
- return event.which;
7459
- }
7460
- }, jQuery.event.addProp );
7461
-
7462
- // Create mouseenter/leave events using mouseover/out and event-time checks
7463
- // so that event delegation works in jQuery.
7464
- // Do the same for pointerenter/pointerleave and pointerover/pointerout
7465
- //
7466
- // Support: Safari 7 only
7467
- // Safari sends mouseenter too often; see:
7468
- // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
7469
- // for the description of the bug (it existed in older Chrome versions as well).
7470
- jQuery.each( {
7471
- mouseenter: "mouseover",
7472
- mouseleave: "mouseout",
7473
- pointerenter: "pointerover",
7474
- pointerleave: "pointerout"
7475
- }, function( orig, fix ) {
7476
- jQuery.event.special[ orig ] = {
7477
- delegateType: fix,
7478
- bindType: fix,
7479
-
7480
- handle: function( event ) {
7481
- var ret,
7482
- target = this,
7483
- related = event.relatedTarget,
7484
- handleObj = event.handleObj;
7485
-
7486
- // For mouseenter/leave call the handler if related is outside the target.
7487
- // NB: No relatedTarget if the mouse left/entered the browser window
7488
- if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
7489
- event.type = handleObj.origType;
7490
- ret = handleObj.handler.apply( this, arguments );
7491
- event.type = fix;
7492
- }
7493
- return ret;
7494
- }
7495
- };
7496
- } );
7497
-
7498
- jQuery.fn.extend( {
7499
-
7500
- on: function( types, selector, data, fn ) {
7501
- return on( this, types, selector, data, fn );
7502
- },
7503
- one: function( types, selector, data, fn ) {
7504
- return on( this, types, selector, data, fn, 1 );
7505
- },
7506
- off: function( types, selector, fn ) {
7507
- var handleObj, type;
7508
- if ( types && types.preventDefault && types.handleObj ) {
7509
-
7510
- // ( event ) dispatched jQuery.Event
7511
- handleObj = types.handleObj;
7512
- jQuery( types.delegateTarget ).off(
7513
- handleObj.namespace ?
7514
- handleObj.origType + "." + handleObj.namespace :
7515
- handleObj.origType,
7516
- handleObj.selector,
7517
- handleObj.handler
7518
- );
7519
- return this;
7520
- }
7521
- if ( typeof types === "object" ) {
7522
-
7523
- // ( types-object [, selector] )
7524
- for ( type in types ) {
7525
- this.off( type, selector, types[ type ] );
7526
- }
7527
- return this;
7528
- }
7529
- if ( selector === false || typeof selector === "function" ) {
7530
-
7531
- // ( types [, fn] )
7532
- fn = selector;
7533
- selector = undefined;
7534
- }
7535
- if ( fn === false ) {
7536
- fn = returnFalse;
7537
- }
7538
- return this.each( function() {
7539
- jQuery.event.remove( this, types, fn, selector );
7540
- } );
7541
- }
7542
- } );
7543
-
7544
-
7545
- var
7546
-
7547
- /* eslint-disable max-len */
7548
-
7549
- // See https://github.com/eslint/eslint/issues/3229
7550
- rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
7551
-
7552
- /* eslint-enable */
7553
-
7554
- // Support: IE <=10 - 11, Edge 12 - 13
7555
- // In IE/Edge using regex groups here causes severe slowdowns.
7556
- // See https://connect.microsoft.com/IE/feedback/details/1736512/
7557
- rnoInnerhtml = /<script|<style|<link/i,
7558
-
7559
- // checked="checked" or checked
7560
- rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
7561
- rscriptTypeMasked = /^true\/(.*)/,
7562
- rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
7563
-
7564
- function manipulationTarget( elem, content ) {
7565
- if ( jQuery.nodeName( elem, "table" ) &&
7566
- jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
7567
-
7568
- return elem.getElementsByTagName( "tbody" )[ 0 ] || elem;
7569
- }
7570
-
7571
- return elem;
7572
- }
7573
-
7574
- // Replace/restore the type attribute of script elements for safe DOM manipulation
7575
- function disableScript( elem ) {
7576
- elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
7577
- return elem;
7578
- }
7579
- function restoreScript( elem ) {
7580
- var match = rscriptTypeMasked.exec( elem.type );
7581
-
7582
- if ( match ) {
7583
- elem.type = match[ 1 ];
7584
- } else {
7585
- elem.removeAttribute( "type" );
7586
- }
7587
-
7588
- return elem;
7589
- }
7590
-
7591
- function cloneCopyEvent( src, dest ) {
7592
- var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
7593
-
7594
- if ( dest.nodeType !== 1 ) {
7595
- return;
7596
- }
7597
-
7598
- // 1. Copy private data: events, handlers, etc.
7599
- if ( dataPriv.hasData( src ) ) {
7600
- pdataOld = dataPriv.access( src );
7601
- pdataCur = dataPriv.set( dest, pdataOld );
7602
- events = pdataOld.events;
7603
-
7604
- if ( events ) {
7605
- delete pdataCur.handle;
7606
- pdataCur.events = {};
7607
-
7608
- for ( type in events ) {
7609
- for ( i = 0, l = events[ type ].length; i < l; i++ ) {
7610
- jQuery.event.add( dest, type, events[ type ][ i ] );
7611
- }
7612
- }
7613
- }
7614
- }
7615
-
7616
- // 2. Copy user data
7617
- if ( dataUser.hasData( src ) ) {
7618
- udataOld = dataUser.access( src );
7619
- udataCur = jQuery.extend( {}, udataOld );
7620
-
7621
- dataUser.set( dest, udataCur );
7622
- }
7623
- }
7624
-
7625
- // Fix IE bugs, see support tests
7626
- function fixInput( src, dest ) {
7627
- var nodeName = dest.nodeName.toLowerCase();
7628
-
7629
- // Fails to persist the checked state of a cloned checkbox or radio button.
7630
- if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
7631
- dest.checked = src.checked;
7632
-
7633
- // Fails to return the selected option to the default selected state when cloning options
7634
- } else if ( nodeName === "input" || nodeName === "textarea" ) {
7635
- dest.defaultValue = src.defaultValue;
7636
- }
7637
- }
7638
-
7639
- function domManip( collection, args, callback, ignored ) {
7640
-
7641
- // Flatten any nested arrays
7642
- args = concat.apply( [], args );
7643
-
7644
- var fragment, first, scripts, hasScripts, node, doc,
7645
- i = 0,
7646
- l = collection.length,
7647
- iNoClone = l - 1,
7648
- value = args[ 0 ],
7649
- isFunction = jQuery.isFunction( value );
7650
-
7651
- // We can't cloneNode fragments that contain checked, in WebKit
7652
- if ( isFunction ||
7653
- ( l > 1 && typeof value === "string" &&
7654
- !support.checkClone && rchecked.test( value ) ) ) {
7655
- return collection.each( function( index ) {
7656
- var self = collection.eq( index );
7657
- if ( isFunction ) {
7658
- args[ 0 ] = value.call( this, index, self.html() );
7659
- }
7660
- domManip( self, args, callback, ignored );
7661
- } );
7662
- }
7663
-
7664
- if ( l ) {
7665
- fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
7666
- first = fragment.firstChild;
7667
-
7668
- if ( fragment.childNodes.length === 1 ) {
7669
- fragment = first;
7670
- }
7671
-
7672
- // Require either new content or an interest in ignored elements to invoke the callback
7673
- if ( first || ignored ) {
7674
- scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
7675
- hasScripts = scripts.length;
7676
-
7677
- // Use the original fragment for the last item
7678
- // instead of the first because it can end up
7679
- // being emptied incorrectly in certain situations (#8070).
7680
- for ( ; i < l; i++ ) {
7681
- node = fragment;
7682
-
7683
- if ( i !== iNoClone ) {
7684
- node = jQuery.clone( node, true, true );
7685
-
7686
- // Keep references to cloned scripts for later restoration
7687
- if ( hasScripts ) {
7688
-
7689
- // Support: Android <=4.0 only, PhantomJS 1 only
7690
- // push.apply(_, arraylike) throws on ancient WebKit
7691
- jQuery.merge( scripts, getAll( node, "script" ) );
7692
- }
7693
- }
7694
-
7695
- callback.call( collection[ i ], node, i );
7696
- }
7697
-
7698
- if ( hasScripts ) {
7699
- doc = scripts[ scripts.length - 1 ].ownerDocument;
7700
-
7701
- // Reenable scripts
7702
- jQuery.map( scripts, restoreScript );
7703
-
7704
- // Evaluate executable scripts on first document insertion
7705
- for ( i = 0; i < hasScripts; i++ ) {
7706
- node = scripts[ i ];
7707
- if ( rscriptType.test( node.type || "" ) &&
7708
- !dataPriv.access( node, "globalEval" ) &&
7709
- jQuery.contains( doc, node ) ) {
7710
-
7711
- if ( node.src ) {
7712
-
7713
- // Optional AJAX dependency, but won't run scripts if not present
7714
- if ( jQuery._evalUrl ) {
7715
- jQuery._evalUrl( node.src );
7716
- }
7717
- } else {
7718
- DOMEval( node.textContent.replace( rcleanScript, "" ), doc );
7719
- }
7720
- }
7721
- }
7722
- }
7723
- }
7724
- }
7725
-
7726
- return collection;
7727
- }
7728
-
7729
- function remove( elem, selector, keepData ) {
7730
- var node,
7731
- nodes = selector ? jQuery.filter( selector, elem ) : elem,
7732
- i = 0;
7733
-
7734
- for ( ; ( node = nodes[ i ] ) != null; i++ ) {
7735
- if ( !keepData && node.nodeType === 1 ) {
7736
- jQuery.cleanData( getAll( node ) );
7737
- }
7738
-
7739
- if ( node.parentNode ) {
7740
- if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
7741
- setGlobalEval( getAll( node, "script" ) );
7742
- }
7743
- node.parentNode.removeChild( node );
7744
- }
7745
- }
7746
-
7747
- return elem;
7748
- }
7749
-
7750
- jQuery.extend( {
7751
- htmlPrefilter: function( html ) {
7752
- return html.replace( rxhtmlTag, "<$1></$2>" );
7753
- },
7754
-
7755
- clone: function( elem, dataAndEvents, deepDataAndEvents ) {
7756
- var i, l, srcElements, destElements,
7757
- clone = elem.cloneNode( true ),
7758
- inPage = jQuery.contains( elem.ownerDocument, elem );
7759
-
7760
- // Fix IE cloning issues
7761
- if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
7762
- !jQuery.isXMLDoc( elem ) ) {
7763
-
7764
- // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
7765
- destElements = getAll( clone );
7766
- srcElements = getAll( elem );
7767
-
7768
- for ( i = 0, l = srcElements.length; i < l; i++ ) {
7769
- fixInput( srcElements[ i ], destElements[ i ] );
7770
- }
7771
- }
7772
-
7773
- // Copy the events from the original to the clone
7774
- if ( dataAndEvents ) {
7775
- if ( deepDataAndEvents ) {
7776
- srcElements = srcElements || getAll( elem );
7777
- destElements = destElements || getAll( clone );
7778
-
7779
- for ( i = 0, l = srcElements.length; i < l; i++ ) {
7780
- cloneCopyEvent( srcElements[ i ], destElements[ i ] );
7781
- }
7782
- } else {
7783
- cloneCopyEvent( elem, clone );
7784
- }
7785
- }
7786
-
7787
- // Preserve script evaluation history
7788
- destElements = getAll( clone, "script" );
7789
- if ( destElements.length > 0 ) {
7790
- setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
7791
- }
7792
-
7793
- // Return the cloned set
7794
- return clone;
7795
- },
7796
-
7797
- cleanData: function( elems ) {
7798
- var data, elem, type,
7799
- special = jQuery.event.special,
7800
- i = 0;
7801
-
7802
- for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
7803
- if ( acceptData( elem ) ) {
7804
- if ( ( data = elem[ dataPriv.expando ] ) ) {
7805
- if ( data.events ) {
7806
- for ( type in data.events ) {
7807
- if ( special[ type ] ) {
7808
- jQuery.event.remove( elem, type );
7809
-
7810
- // This is a shortcut to avoid jQuery.event.remove's overhead
7811
- } else {
7812
- jQuery.removeEvent( elem, type, data.handle );
7813
- }
7814
- }
7815
- }
7816
-
7817
- // Support: Chrome <=35 - 45+
7818
- // Assign undefined instead of using delete, see Data#remove
7819
- elem[ dataPriv.expando ] = undefined;
7820
- }
7821
- if ( elem[ dataUser.expando ] ) {
7822
-
7823
- // Support: Chrome <=35 - 45+
7824
- // Assign undefined instead of using delete, see Data#remove
7825
- elem[ dataUser.expando ] = undefined;
7826
- }
7827
- }
7828
- }
7829
- }
7830
- } );
7831
-
7832
- jQuery.fn.extend( {
7833
- detach: function( selector ) {
7834
- return remove( this, selector, true );
7835
- },
7836
-
7837
- remove: function( selector ) {
7838
- return remove( this, selector );
7839
- },
7840
-
7841
- text: function( value ) {
7842
- return access( this, function( value ) {
7843
- return value === undefined ?
7844
- jQuery.text( this ) :
7845
- this.empty().each( function() {
7846
- if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
7847
- this.textContent = value;
7848
- }
7849
- } );
7850
- }, null, value, arguments.length );
7851
- },
7852
-
7853
- append: function() {
7854
- return domManip( this, arguments, function( elem ) {
7855
- if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
7856
- var target = manipulationTarget( this, elem );
7857
- target.appendChild( elem );
7858
- }
7859
- } );
7860
- },
7861
-
7862
- prepend: function() {
7863
- return domManip( this, arguments, function( elem ) {
7864
- if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
7865
- var target = manipulationTarget( this, elem );
7866
- target.insertBefore( elem, target.firstChild );
7867
- }
7868
- } );
7869
- },
7870
-
7871
- before: function() {
7872
- return domManip( this, arguments, function( elem ) {
7873
- if ( this.parentNode ) {
7874
- this.parentNode.insertBefore( elem, this );
7875
- }
7876
- } );
7877
- },
7878
-
7879
- after: function() {
7880
- return domManip( this, arguments, function( elem ) {
7881
- if ( this.parentNode ) {
7882
- this.parentNode.insertBefore( elem, this.nextSibling );
7883
- }
7884
- } );
7885
- },
7886
-
7887
- empty: function() {
7888
- var elem,
7889
- i = 0;
7890
-
7891
- for ( ; ( elem = this[ i ] ) != null; i++ ) {
7892
- if ( elem.nodeType === 1 ) {
7893
-
7894
- // Prevent memory leaks
7895
- jQuery.cleanData( getAll( elem, false ) );
7896
-
7897
- // Remove any remaining nodes
7898
- elem.textContent = "";
7899
- }
7900
- }
7901
-
7902
- return this;
7903
- },
7904
-
7905
- clone: function( dataAndEvents, deepDataAndEvents ) {
7906
- dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
7907
- deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
7908
-
7909
- return this.map( function() {
7910
- return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
7911
- } );
7912
- },
7913
-
7914
- html: function( value ) {
7915
- return access( this, function( value ) {
7916
- var elem = this[ 0 ] || {},
7917
- i = 0,
7918
- l = this.length;
7919
-
7920
- if ( value === undefined && elem.nodeType === 1 ) {
7921
- return elem.innerHTML;
7922
- }
7923
-
7924
- // See if we can take a shortcut and just use innerHTML
7925
- if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
7926
- !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
7927
-
7928
- value = jQuery.htmlPrefilter( value );
7929
-
7930
- try {
7931
- for ( ; i < l; i++ ) {
7932
- elem = this[ i ] || {};
7933
-
7934
- // Remove element nodes and prevent memory leaks
7935
- if ( elem.nodeType === 1 ) {
7936
- jQuery.cleanData( getAll( elem, false ) );
7937
- elem.innerHTML = value;
7938
- }
7939
- }
7940
-
7941
- elem = 0;
7942
-
7943
- // If using innerHTML throws an exception, use the fallback method
7944
- } catch ( e ) {}
7945
- }
7946
-
7947
- if ( elem ) {
7948
- this.empty().append( value );
7949
- }
7950
- }, null, value, arguments.length );
7951
- },
7952
-
7953
- replaceWith: function() {
7954
- var ignored = [];
7955
-
7956
- // Make the changes, replacing each non-ignored context element with the new content
7957
- return domManip( this, arguments, function( elem ) {
7958
- var parent = this.parentNode;
7959
-
7960
- if ( jQuery.inArray( this, ignored ) < 0 ) {
7961
- jQuery.cleanData( getAll( this ) );
7962
- if ( parent ) {
7963
- parent.replaceChild( elem, this );
7964
- }
7965
- }
7966
-
7967
- // Force callback invocation
7968
- }, ignored );
7969
- }
7970
- } );
7971
-
7972
- jQuery.each( {
7973
- appendTo: "append",
7974
- prependTo: "prepend",
7975
- insertBefore: "before",
7976
- insertAfter: "after",
7977
- replaceAll: "replaceWith"
7978
- }, function( name, original ) {
7979
- jQuery.fn[ name ] = function( selector ) {
7980
- var elems,
7981
- ret = [],
7982
- insert = jQuery( selector ),
7983
- last = insert.length - 1,
7984
- i = 0;
7985
-
7986
- for ( ; i <= last; i++ ) {
7987
- elems = i === last ? this : this.clone( true );
7988
- jQuery( insert[ i ] )[ original ]( elems );
7989
-
7990
- // Support: Android <=4.0 only, PhantomJS 1 only
7991
- // .get() because push.apply(_, arraylike) throws on ancient WebKit
7992
- push.apply( ret, elems.get() );
7993
- }
7994
-
7995
- return this.pushStack( ret );
7996
- };
7997
- } );
7998
- var rmargin = ( /^margin/ );
7999
-
8000
- var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
8001
-
8002
- var getStyles = function( elem ) {
8003
-
8004
- // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
8005
- // IE throws on elements created in popups
8006
- // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
8007
- var view = elem.ownerDocument.defaultView;
8008
-
8009
- if ( !view || !view.opener ) {
8010
- view = window;
8011
- }
8012
-
8013
- return view.getComputedStyle( elem );
8014
- };
8015
-
8016
-
8017
-
8018
- ( function() {
8019
-
8020
- // Executing both pixelPosition & boxSizingReliable tests require only one layout
8021
- // so they're executed at the same time to save the second computation.
8022
- function computeStyleTests() {
8023
-
8024
- // This is a singleton, we need to execute it only once
8025
- if ( !div ) {
8026
- return;
8027
- }
8028
-
8029
- div.style.cssText =
8030
- "box-sizing:border-box;" +
8031
- "position:relative;display:block;" +
8032
- "margin:auto;border:1px;padding:1px;" +
8033
- "top:1%;width:50%";
8034
- div.innerHTML = "";
8035
- documentElement.appendChild( container );
8036
-
8037
- var divStyle = window.getComputedStyle( div );
8038
- pixelPositionVal = divStyle.top !== "1%";
8039
-
8040
- // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
8041
- reliableMarginLeftVal = divStyle.marginLeft === "2px";
8042
- boxSizingReliableVal = divStyle.width === "4px";
8043
-
8044
- // Support: Android 4.0 - 4.3 only
8045
- // Some styles come back with percentage values, even though they shouldn't
8046
- div.style.marginRight = "50%";
8047
- pixelMarginRightVal = divStyle.marginRight === "4px";
8048
-
8049
- documentElement.removeChild( container );
8050
-
8051
- // Nullify the div so it wouldn't be stored in the memory and
8052
- // it will also be a sign that checks already performed
8053
- div = null;
8054
- }
8055
-
8056
- var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal,
8057
- container = document.createElement( "div" ),
8058
- div = document.createElement( "div" );
8059
-
8060
- // Finish early in limited (non-browser) environments
8061
- if ( !div.style ) {
8062
- return;
8063
- }
8064
-
8065
- // Support: IE <=9 - 11 only
8066
- // Style of cloned element affects source element cloned (#8908)
8067
- div.style.backgroundClip = "content-box";
8068
- div.cloneNode( true ).style.backgroundClip = "";
8069
- support.clearCloneStyle = div.style.backgroundClip === "content-box";
8070
-
8071
- container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
8072
- "padding:0;margin-top:1px;position:absolute";
8073
- container.appendChild( div );
8074
-
8075
- jQuery.extend( support, {
8076
- pixelPosition: function() {
8077
- computeStyleTests();
8078
- return pixelPositionVal;
8079
- },
8080
- boxSizingReliable: function() {
8081
- computeStyleTests();
8082
- return boxSizingReliableVal;
8083
- },
8084
- pixelMarginRight: function() {
8085
- computeStyleTests();
8086
- return pixelMarginRightVal;
8087
- },
8088
- reliableMarginLeft: function() {
8089
- computeStyleTests();
8090
- return reliableMarginLeftVal;
8091
- }
8092
- } );
8093
- } )();
8094
-
8095
-
8096
- function curCSS( elem, name, computed ) {
8097
- var width, minWidth, maxWidth, ret,
8098
- style = elem.style;
8099
-
8100
- computed = computed || getStyles( elem );
8101
-
8102
- // Support: IE <=9 only
8103
- // getPropertyValue is only needed for .css('filter') (#12537)
8104
- if ( computed ) {
8105
- ret = computed.getPropertyValue( name ) || computed[ name ];
8106
-
8107
- if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
8108
- ret = jQuery.style( elem, name );
8109
- }
8110
-
8111
- // A tribute to the "awesome hack by Dean Edwards"
8112
- // Android Browser returns percentage for some values,
8113
- // but width seems to be reliably pixels.
8114
- // This is against the CSSOM draft spec:
8115
- // https://drafts.csswg.org/cssom/#resolved-values
8116
- if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
8117
-
8118
- // Remember the original values
8119
- width = style.width;
8120
- minWidth = style.minWidth;
8121
- maxWidth = style.maxWidth;
8122
-
8123
- // Put in the new values to get a computed value out
8124
- style.minWidth = style.maxWidth = style.width = ret;
8125
- ret = computed.width;
8126
-
8127
- // Revert the changed values
8128
- style.width = width;
8129
- style.minWidth = minWidth;
8130
- style.maxWidth = maxWidth;
8131
- }
8132
- }
8133
-
8134
- return ret !== undefined ?
8135
-
8136
- // Support: IE <=9 - 11 only
8137
- // IE returns zIndex value as an integer.
8138
- ret + "" :
8139
- ret;
8140
- }
8141
-
8142
-
8143
- function addGetHookIf( conditionFn, hookFn ) {
8144
-
8145
- // Define the hook, we'll check on the first run if it's really needed.
8146
- return {
8147
- get: function() {
8148
- if ( conditionFn() ) {
8149
-
8150
- // Hook not needed (or it's not possible to use it due
8151
- // to missing dependency), remove it.
8152
- delete this.get;
8153
- return;
8154
- }
8155
-
8156
- // Hook needed; redefine it so that the support test is not executed again.
8157
- return ( this.get = hookFn ).apply( this, arguments );
8158
- }
8159
- };
8160
- }
8161
-
8162
-
8163
- var
8164
-
8165
- // Swappable if display is none or starts with table
8166
- // except "table", "table-cell", or "table-caption"
8167
- // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
8168
- rdisplayswap = /^(none|table(?!-c[ea]).+)/,
8169
- cssShow = { position: "absolute", visibility: "hidden", display: "block" },
8170
- cssNormalTransform = {
8171
- letterSpacing: "0",
8172
- fontWeight: "400"
8173
- },
8174
-
8175
- cssPrefixes = [ "Webkit", "Moz", "ms" ],
8176
- emptyStyle = document.createElement( "div" ).style;
8177
-
8178
- // Return a css property mapped to a potentially vendor prefixed property
8179
- function vendorPropName( name ) {
8180
-
8181
- // Shortcut for names that are not vendor prefixed
8182
- if ( name in emptyStyle ) {
8183
- return name;
8184
- }
8185
-
8186
- // Check for vendor prefixed names
8187
- var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
8188
- i = cssPrefixes.length;
8189
-
8190
- while ( i-- ) {
8191
- name = cssPrefixes[ i ] + capName;
8192
- if ( name in emptyStyle ) {
8193
- return name;
8194
- }
8195
- }
8196
- }
8197
-
8198
- function setPositiveNumber( elem, value, subtract ) {
8199
-
8200
- // Any relative (+/-) values have already been
8201
- // normalized at this point
8202
- var matches = rcssNum.exec( value );
8203
- return matches ?
8204
-
8205
- // Guard against undefined "subtract", e.g., when used as in cssHooks
8206
- Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
8207
- value;
8208
- }
8209
-
8210
- function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
8211
- var i,
8212
- val = 0;
8213
-
8214
- // If we already have the right measurement, avoid augmentation
8215
- if ( extra === ( isBorderBox ? "border" : "content" ) ) {
8216
- i = 4;
8217
-
8218
- // Otherwise initialize for horizontal or vertical properties
8219
- } else {
8220
- i = name === "width" ? 1 : 0;
8221
- }
8222
-
8223
- for ( ; i < 4; i += 2 ) {
8224
-
8225
- // Both box models exclude margin, so add it if we want it
8226
- if ( extra === "margin" ) {
8227
- val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
8228
- }
8229
-
8230
- if ( isBorderBox ) {
8231
-
8232
- // border-box includes padding, so remove it if we want content
8233
- if ( extra === "content" ) {
8234
- val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
8235
- }
8236
-
8237
- // At this point, extra isn't border nor margin, so remove border
8238
- if ( extra !== "margin" ) {
8239
- val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
8240
- }
8241
- } else {
8242
-
8243
- // At this point, extra isn't content, so add padding
8244
- val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
8245
-
8246
- // At this point, extra isn't content nor padding, so add border
8247
- if ( extra !== "padding" ) {
8248
- val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
8249
- }
8250
- }
8251
- }
8252
-
8253
- return val;
8254
- }
8255
-
8256
- function getWidthOrHeight( elem, name, extra ) {
8257
-
8258
- // Start with offset property, which is equivalent to the border-box value
8259
- var val,
8260
- valueIsBorderBox = true,
8261
- styles = getStyles( elem ),
8262
- isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
8263
-
8264
- // Support: IE <=11 only
8265
- // Running getBoundingClientRect on a disconnected node
8266
- // in IE throws an error.
8267
- if ( elem.getClientRects().length ) {
8268
- val = elem.getBoundingClientRect()[ name ];
8269
- }
8270
-
8271
- // Some non-html elements return undefined for offsetWidth, so check for null/undefined
8272
- // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
8273
- // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
8274
- if ( val <= 0 || val == null ) {
8275
-
8276
- // Fall back to computed then uncomputed css if necessary
8277
- val = curCSS( elem, name, styles );
8278
- if ( val < 0 || val == null ) {
8279
- val = elem.style[ name ];
8280
- }
8281
-
8282
- // Computed unit is not pixels. Stop here and return.
8283
- if ( rnumnonpx.test( val ) ) {
8284
- return val;
8285
- }
8286
-
8287
- // Check for style in case a browser which returns unreliable values
8288
- // for getComputedStyle silently falls back to the reliable elem.style
8289
- valueIsBorderBox = isBorderBox &&
8290
- ( support.boxSizingReliable() || val === elem.style[ name ] );
8291
-
8292
- // Normalize "", auto, and prepare for extra
8293
- val = parseFloat( val ) || 0;
8294
- }
8295
-
8296
- // Use the active box-sizing model to add/subtract irrelevant styles
8297
- return ( val +
8298
- augmentWidthOrHeight(
8299
- elem,
8300
- name,
8301
- extra || ( isBorderBox ? "border" : "content" ),
8302
- valueIsBorderBox,
8303
- styles
8304
- )
8305
- ) + "px";
8306
- }
8307
-
8308
- jQuery.extend( {
8309
-
8310
- // Add in style property hooks for overriding the default
8311
- // behavior of getting and setting a style property
8312
- cssHooks: {
8313
- opacity: {
8314
- get: function( elem, computed ) {
8315
- if ( computed ) {
8316
-
8317
- // We should always get a number back from opacity
8318
- var ret = curCSS( elem, "opacity" );
8319
- return ret === "" ? "1" : ret;
8320
- }
8321
- }
8322
- }
8323
- },
8324
-
8325
- // Don't automatically add "px" to these possibly-unitless properties
8326
- cssNumber: {
8327
- "animationIterationCount": true,
8328
- "columnCount": true,
8329
- "fillOpacity": true,
8330
- "flexGrow": true,
8331
- "flexShrink": true,
8332
- "fontWeight": true,
8333
- "lineHeight": true,
8334
- "opacity": true,
8335
- "order": true,
8336
- "orphans": true,
8337
- "widows": true,
8338
- "zIndex": true,
8339
- "zoom": true
8340
- },
8341
-
8342
- // Add in properties whose names you wish to fix before
8343
- // setting or getting the value
8344
- cssProps: {
8345
- "float": "cssFloat"
8346
- },
8347
-
8348
- // Get and set the style property on a DOM Node
8349
- style: function( elem, name, value, extra ) {
8350
-
8351
- // Don't set styles on text and comment nodes
8352
- if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
8353
- return;
8354
- }
8355
-
8356
- // Make sure that we're working with the right name
8357
- var ret, type, hooks,
8358
- origName = jQuery.camelCase( name ),
8359
- style = elem.style;
8360
-
8361
- name = jQuery.cssProps[ origName ] ||
8362
- ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
8363
-
8364
- // Gets hook for the prefixed version, then unprefixed version
8365
- hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
8366
-
8367
- // Check if we're setting a value
8368
- if ( value !== undefined ) {
8369
- type = typeof value;
8370
-
8371
- // Convert "+=" or "-=" to relative numbers (#7345)
8372
- if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
8373
- value = adjustCSS( elem, name, ret );
8374
-
8375
- // Fixes bug #9237
8376
- type = "number";
8377
- }
8378
-
8379
- // Make sure that null and NaN values aren't set (#7116)
8380
- if ( value == null || value !== value ) {
8381
- return;
8382
- }
8383
-
8384
- // If a number was passed in, add the unit (except for certain CSS properties)
8385
- if ( type === "number" ) {
8386
- value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
8387
- }
8388
-
8389
- // background-* props affect original clone's values
8390
- if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
8391
- style[ name ] = "inherit";
8392
- }
8393
-
8394
- // If a hook was provided, use that value, otherwise just set the specified value
8395
- if ( !hooks || !( "set" in hooks ) ||
8396
- ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
8397
-
8398
- style[ name ] = value;
8399
- }
8400
-
8401
- } else {
8402
-
8403
- // If a hook was provided get the non-computed value from there
8404
- if ( hooks && "get" in hooks &&
8405
- ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
8406
-
8407
- return ret;
8408
- }
8409
-
8410
- // Otherwise just get the value from the style object
8411
- return style[ name ];
8412
- }
8413
- },
8414
-
8415
- css: function( elem, name, extra, styles ) {
8416
- var val, num, hooks,
8417
- origName = jQuery.camelCase( name );
8418
-
8419
- // Make sure that we're working with the right name
8420
- name = jQuery.cssProps[ origName ] ||
8421
- ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
8422
-
8423
- // Try prefixed name followed by the unprefixed name
8424
- hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
8425
-
8426
- // If a hook was provided get the computed value from there
8427
- if ( hooks && "get" in hooks ) {
8428
- val = hooks.get( elem, true, extra );
8429
- }
8430
-
8431
- // Otherwise, if a way to get the computed value exists, use that
8432
- if ( val === undefined ) {
8433
- val = curCSS( elem, name, styles );
8434
- }
8435
-
8436
- // Convert "normal" to computed value
8437
- if ( val === "normal" && name in cssNormalTransform ) {
8438
- val = cssNormalTransform[ name ];
8439
- }
8440
-
8441
- // Make numeric if forced or a qualifier was provided and val looks numeric
8442
- if ( extra === "" || extra ) {
8443
- num = parseFloat( val );
8444
- return extra === true || isFinite( num ) ? num || 0 : val;
8445
- }
8446
- return val;
8447
- }
8448
- } );
8449
-
8450
- jQuery.each( [ "height", "width" ], function( i, name ) {
8451
- jQuery.cssHooks[ name ] = {
8452
- get: function( elem, computed, extra ) {
8453
- if ( computed ) {
8454
-
8455
- // Certain elements can have dimension info if we invisibly show them
8456
- // but it must have a current display style that would benefit
8457
- return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
8458
-
8459
- // Support: Safari 8+
8460
- // Table columns in Safari have non-zero offsetWidth & zero
8461
- // getBoundingClientRect().width unless display is changed.
8462
- // Support: IE <=11 only
8463
- // Running getBoundingClientRect on a disconnected node
8464
- // in IE throws an error.
8465
- ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
8466
- swap( elem, cssShow, function() {
8467
- return getWidthOrHeight( elem, name, extra );
8468
- } ) :
8469
- getWidthOrHeight( elem, name, extra );
8470
- }
8471
- },
8472
-
8473
- set: function( elem, value, extra ) {
8474
- var matches,
8475
- styles = extra && getStyles( elem ),
8476
- subtract = extra && augmentWidthOrHeight(
8477
- elem,
8478
- name,
8479
- extra,
8480
- jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
8481
- styles
8482
- );
8483
-
8484
- // Convert to pixels if value adjustment is needed
8485
- if ( subtract && ( matches = rcssNum.exec( value ) ) &&
8486
- ( matches[ 3 ] || "px" ) !== "px" ) {
8487
-
8488
- elem.style[ name ] = value;
8489
- value = jQuery.css( elem, name );
8490
- }
8491
-
8492
- return setPositiveNumber( elem, value, subtract );
8493
- }
8494
- };
8495
- } );
8496
-
8497
- jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
8498
- function( elem, computed ) {
8499
- if ( computed ) {
8500
- return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
8501
- elem.getBoundingClientRect().left -
8502
- swap( elem, { marginLeft: 0 }, function() {
8503
- return elem.getBoundingClientRect().left;
8504
- } )
8505
- ) + "px";
8506
- }
8507
- }
8508
- );
8509
-
8510
- // These hooks are used by animate to expand properties
8511
- jQuery.each( {
8512
- margin: "",
8513
- padding: "",
8514
- border: "Width"
8515
- }, function( prefix, suffix ) {
8516
- jQuery.cssHooks[ prefix + suffix ] = {
8517
- expand: function( value ) {
8518
- var i = 0,
8519
- expanded = {},
8520
-
8521
- // Assumes a single number if not a string
8522
- parts = typeof value === "string" ? value.split( " " ) : [ value ];
8523
-
8524
- for ( ; i < 4; i++ ) {
8525
- expanded[ prefix + cssExpand[ i ] + suffix ] =
8526
- parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
8527
- }
8528
-
8529
- return expanded;
8530
- }
8531
- };
8532
-
8533
- if ( !rmargin.test( prefix ) ) {
8534
- jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
8535
- }
8536
- } );
8537
-
8538
- jQuery.fn.extend( {
8539
- css: function( name, value ) {
8540
- return access( this, function( elem, name, value ) {
8541
- var styles, len,
8542
- map = {},
8543
- i = 0;
8544
-
8545
- if ( jQuery.isArray( name ) ) {
8546
- styles = getStyles( elem );
8547
- len = name.length;
8548
-
8549
- for ( ; i < len; i++ ) {
8550
- map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
8551
- }
8552
-
8553
- return map;
8554
- }
8555
-
8556
- return value !== undefined ?
8557
- jQuery.style( elem, name, value ) :
8558
- jQuery.css( elem, name );
8559
- }, name, value, arguments.length > 1 );
8560
- }
8561
- } );
8562
-
8563
-
8564
- function Tween( elem, options, prop, end, easing ) {
8565
- return new Tween.prototype.init( elem, options, prop, end, easing );
8566
- }
8567
- jQuery.Tween = Tween;
8568
-
8569
- Tween.prototype = {
8570
- constructor: Tween,
8571
- init: function( elem, options, prop, end, easing, unit ) {
8572
- this.elem = elem;
8573
- this.prop = prop;
8574
- this.easing = easing || jQuery.easing._default;
8575
- this.options = options;
8576
- this.start = this.now = this.cur();
8577
- this.end = end;
8578
- this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
8579
- },
8580
- cur: function() {
8581
- var hooks = Tween.propHooks[ this.prop ];
8582
-
8583
- return hooks && hooks.get ?
8584
- hooks.get( this ) :
8585
- Tween.propHooks._default.get( this );
8586
- },
8587
- run: function( percent ) {
8588
- var eased,
8589
- hooks = Tween.propHooks[ this.prop ];
8590
-
8591
- if ( this.options.duration ) {
8592
- this.pos = eased = jQuery.easing[ this.easing ](
8593
- percent, this.options.duration * percent, 0, 1, this.options.duration
8594
- );
8595
- } else {
8596
- this.pos = eased = percent;
8597
- }
8598
- this.now = ( this.end - this.start ) * eased + this.start;
8599
-
8600
- if ( this.options.step ) {
8601
- this.options.step.call( this.elem, this.now, this );
8602
- }
8603
-
8604
- if ( hooks && hooks.set ) {
8605
- hooks.set( this );
8606
- } else {
8607
- Tween.propHooks._default.set( this );
8608
- }
8609
- return this;
8610
- }
8611
- };
8612
-
8613
- Tween.prototype.init.prototype = Tween.prototype;
8614
-
8615
- Tween.propHooks = {
8616
- _default: {
8617
- get: function( tween ) {
8618
- var result;
8619
-
8620
- // Use a property on the element directly when it is not a DOM element,
8621
- // or when there is no matching style property that exists.
8622
- if ( tween.elem.nodeType !== 1 ||
8623
- tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
8624
- return tween.elem[ tween.prop ];
8625
- }
8626
-
8627
- // Passing an empty string as a 3rd parameter to .css will automatically
8628
- // attempt a parseFloat and fallback to a string if the parse fails.
8629
- // Simple values such as "10px" are parsed to Float;
8630
- // complex values such as "rotate(1rad)" are returned as-is.
8631
- result = jQuery.css( tween.elem, tween.prop, "" );
8632
-
8633
- // Empty strings, null, undefined and "auto" are converted to 0.
8634
- return !result || result === "auto" ? 0 : result;
8635
- },
8636
- set: function( tween ) {
8637
-
8638
- // Use step hook for back compat.
8639
- // Use cssHook if its there.
8640
- // Use .style if available and use plain properties where available.
8641
- if ( jQuery.fx.step[ tween.prop ] ) {
8642
- jQuery.fx.step[ tween.prop ]( tween );
8643
- } else if ( tween.elem.nodeType === 1 &&
8644
- ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
8645
- jQuery.cssHooks[ tween.prop ] ) ) {
8646
- jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
8647
- } else {
8648
- tween.elem[ tween.prop ] = tween.now;
8649
- }
8650
- }
8651
- }
8652
- };
8653
-
8654
- // Support: IE <=9 only
8655
- // Panic based approach to setting things on disconnected nodes
8656
- Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
8657
- set: function( tween ) {
8658
- if ( tween.elem.nodeType && tween.elem.parentNode ) {
8659
- tween.elem[ tween.prop ] = tween.now;
8660
- }
8661
- }
8662
- };
8663
-
8664
- jQuery.easing = {
8665
- linear: function( p ) {
8666
- return p;
8667
- },
8668
- swing: function( p ) {
8669
- return 0.5 - Math.cos( p * Math.PI ) / 2;
8670
- },
8671
- _default: "swing"
8672
- };
8673
-
8674
- jQuery.fx = Tween.prototype.init;
8675
-
8676
- // Back compat <1.8 extension point
8677
- jQuery.fx.step = {};
8678
-
8679
-
8680
-
8681
-
8682
- var
8683
- fxNow, timerId,
8684
- rfxtypes = /^(?:toggle|show|hide)$/,
8685
- rrun = /queueHooks$/;
8686
-
8687
- function raf() {
8688
- if ( timerId ) {
8689
- window.requestAnimationFrame( raf );
8690
- jQuery.fx.tick();
8691
- }
8692
- }
8693
-
8694
- // Animations created synchronously will run synchronously
8695
- function createFxNow() {
8696
- window.setTimeout( function() {
8697
- fxNow = undefined;
8698
- } );
8699
- return ( fxNow = jQuery.now() );
8700
- }
8701
-
8702
- // Generate parameters to create a standard animation
8703
- function genFx( type, includeWidth ) {
8704
- var which,
8705
- i = 0,
8706
- attrs = { height: type };
8707
-
8708
- // If we include width, step value is 1 to do all cssExpand values,
8709
- // otherwise step value is 2 to skip over Left and Right
8710
- includeWidth = includeWidth ? 1 : 0;
8711
- for ( ; i < 4; i += 2 - includeWidth ) {
8712
- which = cssExpand[ i ];
8713
- attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
8714
- }
8715
-
8716
- if ( includeWidth ) {
8717
- attrs.opacity = attrs.width = type;
8718
- }
8719
-
8720
- return attrs;
8721
- }
8722
-
8723
- function createTween( value, prop, animation ) {
8724
- var tween,
8725
- collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
8726
- index = 0,
8727
- length = collection.length;
8728
- for ( ; index < length; index++ ) {
8729
- if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
8730
-
8731
- // We're done with this property
8732
- return tween;
8733
- }
8734
- }
8735
- }
8736
-
8737
- function defaultPrefilter( elem, props, opts ) {
8738
- var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
8739
- isBox = "width" in props || "height" in props,
8740
- anim = this,
8741
- orig = {},
8742
- style = elem.style,
8743
- hidden = elem.nodeType && isHiddenWithinTree( elem ),
8744
- dataShow = dataPriv.get( elem, "fxshow" );
8745
-
8746
- // Queue-skipping animations hijack the fx hooks
8747
- if ( !opts.queue ) {
8748
- hooks = jQuery._queueHooks( elem, "fx" );
8749
- if ( hooks.unqueued == null ) {
8750
- hooks.unqueued = 0;
8751
- oldfire = hooks.empty.fire;
8752
- hooks.empty.fire = function() {
8753
- if ( !hooks.unqueued ) {
8754
- oldfire();
8755
- }
8756
- };
8757
- }
8758
- hooks.unqueued++;
8759
-
8760
- anim.always( function() {
8761
-
8762
- // Ensure the complete handler is called before this completes
8763
- anim.always( function() {
8764
- hooks.unqueued--;
8765
- if ( !jQuery.queue( elem, "fx" ).length ) {
8766
- hooks.empty.fire();
8767
- }
8768
- } );
8769
- } );
8770
- }
8771
-
8772
- // Detect show/hide animations
8773
- for ( prop in props ) {
8774
- value = props[ prop ];
8775
- if ( rfxtypes.test( value ) ) {
8776
- delete props[ prop ];
8777
- toggle = toggle || value === "toggle";
8778
- if ( value === ( hidden ? "hide" : "show" ) ) {
8779
-
8780
- // Pretend to be hidden if this is a "show" and
8781
- // there is still data from a stopped show/hide
8782
- if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
8783
- hidden = true;
8784
-
8785
- // Ignore all other no-op show/hide data
8786
- } else {
8787
- continue;
8788
- }
8789
- }
8790
- orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
8791
- }
8792
- }
8793
-
8794
- // Bail out if this is a no-op like .hide().hide()
8795
- propTween = !jQuery.isEmptyObject( props );
8796
- if ( !propTween && jQuery.isEmptyObject( orig ) ) {
8797
- return;
8798
- }
8799
-
8800
- // Restrict "overflow" and "display" styles during box animations
8801
- if ( isBox && elem.nodeType === 1 ) {
8802
-
8803
- // Support: IE <=9 - 11, Edge 12 - 13
8804
- // Record all 3 overflow attributes because IE does not infer the shorthand
8805
- // from identically-valued overflowX and overflowY
8806
- opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
8807
-
8808
- // Identify a display type, preferring old show/hide data over the CSS cascade
8809
- restoreDisplay = dataShow && dataShow.display;
8810
- if ( restoreDisplay == null ) {
8811
- restoreDisplay = dataPriv.get( elem, "display" );
8812
- }
8813
- display = jQuery.css( elem, "display" );
8814
- if ( display === "none" ) {
8815
- if ( restoreDisplay ) {
8816
- display = restoreDisplay;
8817
- } else {
8818
-
8819
- // Get nonempty value(s) by temporarily forcing visibility
8820
- showHide( [ elem ], true );
8821
- restoreDisplay = elem.style.display || restoreDisplay;
8822
- display = jQuery.css( elem, "display" );
8823
- showHide( [ elem ] );
8824
- }
8825
- }
8826
-
8827
- // Animate inline elements as inline-block
8828
- if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
8829
- if ( jQuery.css( elem, "float" ) === "none" ) {
8830
-
8831
- // Restore the original display value at the end of pure show/hide animations
8832
- if ( !propTween ) {
8833
- anim.done( function() {
8834
- style.display = restoreDisplay;
8835
- } );
8836
- if ( restoreDisplay == null ) {
8837
- display = style.display;
8838
- restoreDisplay = display === "none" ? "" : display;
8839
- }
8840
- }
8841
- style.display = "inline-block";
8842
- }
8843
- }
8844
- }
8845
-
8846
- if ( opts.overflow ) {
8847
- style.overflow = "hidden";
8848
- anim.always( function() {
8849
- style.overflow = opts.overflow[ 0 ];
8850
- style.overflowX = opts.overflow[ 1 ];
8851
- style.overflowY = opts.overflow[ 2 ];
8852
- } );
8853
- }
8854
-
8855
- // Implement show/hide animations
8856
- propTween = false;
8857
- for ( prop in orig ) {
8858
-
8859
- // General show/hide setup for this element animation
8860
- if ( !propTween ) {
8861
- if ( dataShow ) {
8862
- if ( "hidden" in dataShow ) {
8863
- hidden = dataShow.hidden;
8864
- }
8865
- } else {
8866
- dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
8867
- }
8868
-
8869
- // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
8870
- if ( toggle ) {
8871
- dataShow.hidden = !hidden;
8872
- }
8873
-
8874
- // Show elements before animating them
8875
- if ( hidden ) {
8876
- showHide( [ elem ], true );
8877
- }
8878
-
8879
- /* eslint-disable no-loop-func */
8880
-
8881
- anim.done( function() {
8882
-
8883
- /* eslint-enable no-loop-func */
8884
-
8885
- // The final step of a "hide" animation is actually hiding the element
8886
- if ( !hidden ) {
8887
- showHide( [ elem ] );
8888
- }
8889
- dataPriv.remove( elem, "fxshow" );
8890
- for ( prop in orig ) {
8891
- jQuery.style( elem, prop, orig[ prop ] );
8892
- }
8893
- } );
8894
- }
8895
-
8896
- // Per-property setup
8897
- propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
8898
- if ( !( prop in dataShow ) ) {
8899
- dataShow[ prop ] = propTween.start;
8900
- if ( hidden ) {
8901
- propTween.end = propTween.start;
8902
- propTween.start = 0;
8903
- }
8904
- }
8905
- }
8906
- }
8907
-
8908
- function propFilter( props, specialEasing ) {
8909
- var index, name, easing, value, hooks;
8910
-
8911
- // camelCase, specialEasing and expand cssHook pass
8912
- for ( index in props ) {
8913
- name = jQuery.camelCase( index );
8914
- easing = specialEasing[ name ];
8915
- value = props[ index ];
8916
- if ( jQuery.isArray( value ) ) {
8917
- easing = value[ 1 ];
8918
- value = props[ index ] = value[ 0 ];
8919
- }
8920
-
8921
- if ( index !== name ) {
8922
- props[ name ] = value;
8923
- delete props[ index ];
8924
- }
8925
-
8926
- hooks = jQuery.cssHooks[ name ];
8927
- if ( hooks && "expand" in hooks ) {
8928
- value = hooks.expand( value );
8929
- delete props[ name ];
8930
-
8931
- // Not quite $.extend, this won't overwrite existing keys.
8932
- // Reusing 'index' because we have the correct "name"
8933
- for ( index in value ) {
8934
- if ( !( index in props ) ) {
8935
- props[ index ] = value[ index ];
8936
- specialEasing[ index ] = easing;
8937
- }
8938
- }
8939
- } else {
8940
- specialEasing[ name ] = easing;
8941
- }
8942
- }
8943
- }
8944
-
8945
- function Animation( elem, properties, options ) {
8946
- var result,
8947
- stopped,
8948
- index = 0,
8949
- length = Animation.prefilters.length,
8950
- deferred = jQuery.Deferred().always( function() {
8951
-
8952
- // Don't match elem in the :animated selector
8953
- delete tick.elem;
8954
- } ),
8955
- tick = function() {
8956
- if ( stopped ) {
8957
- return false;
8958
- }
8959
- var currentTime = fxNow || createFxNow(),
8960
- remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
8961
-
8962
- // Support: Android 2.3 only
8963
- // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
8964
- temp = remaining / animation.duration || 0,
8965
- percent = 1 - temp,
8966
- index = 0,
8967
- length = animation.tweens.length;
8968
-
8969
- for ( ; index < length; index++ ) {
8970
- animation.tweens[ index ].run( percent );
8971
- }
8972
-
8973
- deferred.notifyWith( elem, [ animation, percent, remaining ] );
8974
-
8975
- if ( percent < 1 && length ) {
8976
- return remaining;
8977
- } else {
8978
- deferred.resolveWith( elem, [ animation ] );
8979
- return false;
8980
- }
8981
- },
8982
- animation = deferred.promise( {
8983
- elem: elem,
8984
- props: jQuery.extend( {}, properties ),
8985
- opts: jQuery.extend( true, {
8986
- specialEasing: {},
8987
- easing: jQuery.easing._default
8988
- }, options ),
8989
- originalProperties: properties,
8990
- originalOptions: options,
8991
- startTime: fxNow || createFxNow(),
8992
- duration: options.duration,
8993
- tweens: [],
8994
- createTween: function( prop, end ) {
8995
- var tween = jQuery.Tween( elem, animation.opts, prop, end,
8996
- animation.opts.specialEasing[ prop ] || animation.opts.easing );
8997
- animation.tweens.push( tween );
8998
- return tween;
8999
- },
9000
- stop: function( gotoEnd ) {
9001
- var index = 0,
9002
-
9003
- // If we are going to the end, we want to run all the tweens
9004
- // otherwise we skip this part
9005
- length = gotoEnd ? animation.tweens.length : 0;
9006
- if ( stopped ) {
9007
- return this;
9008
- }
9009
- stopped = true;
9010
- for ( ; index < length; index++ ) {
9011
- animation.tweens[ index ].run( 1 );
9012
- }
9013
-
9014
- // Resolve when we played the last frame; otherwise, reject
9015
- if ( gotoEnd ) {
9016
- deferred.notifyWith( elem, [ animation, 1, 0 ] );
9017
- deferred.resolveWith( elem, [ animation, gotoEnd ] );
9018
- } else {
9019
- deferred.rejectWith( elem, [ animation, gotoEnd ] );
9020
- }
9021
- return this;
9022
- }
9023
- } ),
9024
- props = animation.props;
9025
-
9026
- propFilter( props, animation.opts.specialEasing );
9027
-
9028
- for ( ; index < length; index++ ) {
9029
- result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
9030
- if ( result ) {
9031
- if ( jQuery.isFunction( result.stop ) ) {
9032
- jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
9033
- jQuery.proxy( result.stop, result );
9034
- }
9035
- return result;
9036
- }
9037
- }
9038
-
9039
- jQuery.map( props, createTween, animation );
9040
-
9041
- if ( jQuery.isFunction( animation.opts.start ) ) {
9042
- animation.opts.start.call( elem, animation );
9043
- }
9044
-
9045
- jQuery.fx.timer(
9046
- jQuery.extend( tick, {
9047
- elem: elem,
9048
- anim: animation,
9049
- queue: animation.opts.queue
9050
- } )
9051
- );
9052
-
9053
- // attach callbacks from options
9054
- return animation.progress( animation.opts.progress )
9055
- .done( animation.opts.done, animation.opts.complete )
9056
- .fail( animation.opts.fail )
9057
- .always( animation.opts.always );
9058
- }
9059
-
9060
- jQuery.Animation = jQuery.extend( Animation, {
9061
-
9062
- tweeners: {
9063
- "*": [ function( prop, value ) {
9064
- var tween = this.createTween( prop, value );
9065
- adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
9066
- return tween;
9067
- } ]
9068
- },
9069
-
9070
- tweener: function( props, callback ) {
9071
- if ( jQuery.isFunction( props ) ) {
9072
- callback = props;
9073
- props = [ "*" ];
9074
- } else {
9075
- props = props.match( rnothtmlwhite );
9076
- }
9077
-
9078
- var prop,
9079
- index = 0,
9080
- length = props.length;
9081
-
9082
- for ( ; index < length; index++ ) {
9083
- prop = props[ index ];
9084
- Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
9085
- Animation.tweeners[ prop ].unshift( callback );
9086
- }
9087
- },
9088
-
9089
- prefilters: [ defaultPrefilter ],
9090
-
9091
- prefilter: function( callback, prepend ) {
9092
- if ( prepend ) {
9093
- Animation.prefilters.unshift( callback );
9094
- } else {
9095
- Animation.prefilters.push( callback );
9096
- }
9097
- }
9098
- } );
9099
-
9100
- jQuery.speed = function( speed, easing, fn ) {
9101
- var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
9102
- complete: fn || !fn && easing ||
9103
- jQuery.isFunction( speed ) && speed,
9104
- duration: speed,
9105
- easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
9106
- };
9107
-
9108
- // Go to the end state if fx are off or if document is hidden
9109
- if ( jQuery.fx.off || document.hidden ) {
9110
- opt.duration = 0;
9111
-
9112
- } else {
9113
- if ( typeof opt.duration !== "number" ) {
9114
- if ( opt.duration in jQuery.fx.speeds ) {
9115
- opt.duration = jQuery.fx.speeds[ opt.duration ];
9116
-
9117
- } else {
9118
- opt.duration = jQuery.fx.speeds._default;
9119
- }
9120
- }
9121
- }
9122
-
9123
- // Normalize opt.queue - true/undefined/null -> "fx"
9124
- if ( opt.queue == null || opt.queue === true ) {
9125
- opt.queue = "fx";
9126
- }
9127
-
9128
- // Queueing
9129
- opt.old = opt.complete;
9130
-
9131
- opt.complete = function() {
9132
- if ( jQuery.isFunction( opt.old ) ) {
9133
- opt.old.call( this );
9134
- }
9135
-
9136
- if ( opt.queue ) {
9137
- jQuery.dequeue( this, opt.queue );
9138
- }
9139
- };
9140
-
9141
- return opt;
9142
- };
9143
-
9144
- jQuery.fn.extend( {
9145
- fadeTo: function( speed, to, easing, callback ) {
9146
-
9147
- // Show any hidden elements after setting opacity to 0
9148
- return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
9149
-
9150
- // Animate to the value specified
9151
- .end().animate( { opacity: to }, speed, easing, callback );
9152
- },
9153
- animate: function( prop, speed, easing, callback ) {
9154
- var empty = jQuery.isEmptyObject( prop ),
9155
- optall = jQuery.speed( speed, easing, callback ),
9156
- doAnimation = function() {
9157
-
9158
- // Operate on a copy of prop so per-property easing won't be lost
9159
- var anim = Animation( this, jQuery.extend( {}, prop ), optall );
9160
-
9161
- // Empty animations, or finishing resolves immediately
9162
- if ( empty || dataPriv.get( this, "finish" ) ) {
9163
- anim.stop( true );
9164
- }
9165
- };
9166
- doAnimation.finish = doAnimation;
9167
-
9168
- return empty || optall.queue === false ?
9169
- this.each( doAnimation ) :
9170
- this.queue( optall.queue, doAnimation );
9171
- },
9172
- stop: function( type, clearQueue, gotoEnd ) {
9173
- var stopQueue = function( hooks ) {
9174
- var stop = hooks.stop;
9175
- delete hooks.stop;
9176
- stop( gotoEnd );
9177
- };
9178
-
9179
- if ( typeof type !== "string" ) {
9180
- gotoEnd = clearQueue;
9181
- clearQueue = type;
9182
- type = undefined;
9183
- }
9184
- if ( clearQueue && type !== false ) {
9185
- this.queue( type || "fx", [] );
9186
- }
9187
-
9188
- return this.each( function() {
9189
- var dequeue = true,
9190
- index = type != null && type + "queueHooks",
9191
- timers = jQuery.timers,
9192
- data = dataPriv.get( this );
9193
-
9194
- if ( index ) {
9195
- if ( data[ index ] && data[ index ].stop ) {
9196
- stopQueue( data[ index ] );
9197
- }
9198
- } else {
9199
- for ( index in data ) {
9200
- if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
9201
- stopQueue( data[ index ] );
9202
- }
9203
- }
9204
- }
9205
-
9206
- for ( index = timers.length; index--; ) {
9207
- if ( timers[ index ].elem === this &&
9208
- ( type == null || timers[ index ].queue === type ) ) {
9209
-
9210
- timers[ index ].anim.stop( gotoEnd );
9211
- dequeue = false;
9212
- timers.splice( index, 1 );
9213
- }
9214
- }
9215
-
9216
- // Start the next in the queue if the last step wasn't forced.
9217
- // Timers currently will call their complete callbacks, which
9218
- // will dequeue but only if they were gotoEnd.
9219
- if ( dequeue || !gotoEnd ) {
9220
- jQuery.dequeue( this, type );
9221
- }
9222
- } );
9223
- },
9224
- finish: function( type ) {
9225
- if ( type !== false ) {
9226
- type = type || "fx";
9227
- }
9228
- return this.each( function() {
9229
- var index,
9230
- data = dataPriv.get( this ),
9231
- queue = data[ type + "queue" ],
9232
- hooks = data[ type + "queueHooks" ],
9233
- timers = jQuery.timers,
9234
- length = queue ? queue.length : 0;
9235
-
9236
- // Enable finishing flag on private data
9237
- data.finish = true;
9238
-
9239
- // Empty the queue first
9240
- jQuery.queue( this, type, [] );
9241
-
9242
- if ( hooks && hooks.stop ) {
9243
- hooks.stop.call( this, true );
9244
- }
9245
-
9246
- // Look for any active animations, and finish them
9247
- for ( index = timers.length; index--; ) {
9248
- if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
9249
- timers[ index ].anim.stop( true );
9250
- timers.splice( index, 1 );
9251
- }
9252
- }
9253
-
9254
- // Look for any animations in the old queue and finish them
9255
- for ( index = 0; index < length; index++ ) {
9256
- if ( queue[ index ] && queue[ index ].finish ) {
9257
- queue[ index ].finish.call( this );
9258
- }
9259
- }
9260
-
9261
- // Turn off finishing flag
9262
- delete data.finish;
9263
- } );
9264
- }
9265
- } );
9266
-
9267
- jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
9268
- var cssFn = jQuery.fn[ name ];
9269
- jQuery.fn[ name ] = function( speed, easing, callback ) {
9270
- return speed == null || typeof speed === "boolean" ?
9271
- cssFn.apply( this, arguments ) :
9272
- this.animate( genFx( name, true ), speed, easing, callback );
9273
- };
9274
- } );
9275
-
9276
- // Generate shortcuts for custom animations
9277
- jQuery.each( {
9278
- slideDown: genFx( "show" ),
9279
- slideUp: genFx( "hide" ),
9280
- slideToggle: genFx( "toggle" ),
9281
- fadeIn: { opacity: "show" },
9282
- fadeOut: { opacity: "hide" },
9283
- fadeToggle: { opacity: "toggle" }
9284
- }, function( name, props ) {
9285
- jQuery.fn[ name ] = function( speed, easing, callback ) {
9286
- return this.animate( props, speed, easing, callback );
9287
- };
9288
- } );
9289
-
9290
- jQuery.timers = [];
9291
- jQuery.fx.tick = function() {
9292
- var timer,
9293
- i = 0,
9294
- timers = jQuery.timers;
9295
-
9296
- fxNow = jQuery.now();
9297
-
9298
- for ( ; i < timers.length; i++ ) {
9299
- timer = timers[ i ];
9300
-
9301
- // Checks the timer has not already been removed
9302
- if ( !timer() && timers[ i ] === timer ) {
9303
- timers.splice( i--, 1 );
9304
- }
9305
- }
9306
-
9307
- if ( !timers.length ) {
9308
- jQuery.fx.stop();
9309
- }
9310
- fxNow = undefined;
9311
- };
9312
-
9313
- jQuery.fx.timer = function( timer ) {
9314
- jQuery.timers.push( timer );
9315
- if ( timer() ) {
9316
- jQuery.fx.start();
9317
- } else {
9318
- jQuery.timers.pop();
9319
- }
9320
- };
9321
-
9322
- jQuery.fx.interval = 13;
9323
- jQuery.fx.start = function() {
9324
- if ( !timerId ) {
9325
- timerId = window.requestAnimationFrame ?
9326
- window.requestAnimationFrame( raf ) :
9327
- window.setInterval( jQuery.fx.tick, jQuery.fx.interval );
9328
- }
9329
- };
9330
-
9331
- jQuery.fx.stop = function() {
9332
- if ( window.cancelAnimationFrame ) {
9333
- window.cancelAnimationFrame( timerId );
9334
- } else {
9335
- window.clearInterval( timerId );
9336
- }
9337
-
9338
- timerId = null;
9339
- };
9340
-
9341
- jQuery.fx.speeds = {
9342
- slow: 600,
9343
- fast: 200,
9344
-
9345
- // Default speed
9346
- _default: 400
9347
- };
9348
-
9349
-
9350
- // Based off of the plugin by Clint Helfers, with permission.
9351
- // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
9352
- jQuery.fn.delay = function( time, type ) {
9353
- time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
9354
- type = type || "fx";
9355
-
9356
- return this.queue( type, function( next, hooks ) {
9357
- var timeout = window.setTimeout( next, time );
9358
- hooks.stop = function() {
9359
- window.clearTimeout( timeout );
9360
- };
9361
- } );
9362
- };
9363
-
9364
-
9365
- ( function() {
9366
- var input = document.createElement( "input" ),
9367
- select = document.createElement( "select" ),
9368
- opt = select.appendChild( document.createElement( "option" ) );
9369
-
9370
- input.type = "checkbox";
9371
-
9372
- // Support: Android <=4.3 only
9373
- // Default value for a checkbox should be "on"
9374
- support.checkOn = input.value !== "";
9375
-
9376
- // Support: IE <=11 only
9377
- // Must access selectedIndex to make default options select
9378
- support.optSelected = opt.selected;
9379
-
9380
- // Support: IE <=11 only
9381
- // An input loses its value after becoming a radio
9382
- input = document.createElement( "input" );
9383
- input.value = "t";
9384
- input.type = "radio";
9385
- support.radioValue = input.value === "t";
9386
- } )();
9387
-
9388
-
9389
- var boolHook,
9390
- attrHandle = jQuery.expr.attrHandle;
9391
-
9392
- jQuery.fn.extend( {
9393
- attr: function( name, value ) {
9394
- return access( this, jQuery.attr, name, value, arguments.length > 1 );
9395
- },
9396
-
9397
- removeAttr: function( name ) {
9398
- return this.each( function() {
9399
- jQuery.removeAttr( this, name );
9400
- } );
9401
- }
9402
- } );
9403
-
9404
- jQuery.extend( {
9405
- attr: function( elem, name, value ) {
9406
- var ret, hooks,
9407
- nType = elem.nodeType;
9408
-
9409
- // Don't get/set attributes on text, comment and attribute nodes
9410
- if ( nType === 3 || nType === 8 || nType === 2 ) {
9411
- return;
9412
- }
9413
-
9414
- // Fallback to prop when attributes are not supported
9415
- if ( typeof elem.getAttribute === "undefined" ) {
9416
- return jQuery.prop( elem, name, value );
9417
- }
9418
-
9419
- // Attribute hooks are determined by the lowercase version
9420
- // Grab necessary hook if one is defined
9421
- if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
9422
- hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
9423
- ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
9424
- }
9425
-
9426
- if ( value !== undefined ) {
9427
- if ( value === null ) {
9428
- jQuery.removeAttr( elem, name );
9429
- return;
9430
- }
9431
-
9432
- if ( hooks && "set" in hooks &&
9433
- ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
9434
- return ret;
9435
- }
9436
-
9437
- elem.setAttribute( name, value + "" );
9438
- return value;
9439
- }
9440
-
9441
- if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
9442
- return ret;
9443
- }
9444
-
9445
- ret = jQuery.find.attr( elem, name );
9446
-
9447
- // Non-existent attributes return null, we normalize to undefined
9448
- return ret == null ? undefined : ret;
9449
- },
9450
-
9451
- attrHooks: {
9452
- type: {
9453
- set: function( elem, value ) {
9454
- if ( !support.radioValue && value === "radio" &&
9455
- jQuery.nodeName( elem, "input" ) ) {
9456
- var val = elem.value;
9457
- elem.setAttribute( "type", value );
9458
- if ( val ) {
9459
- elem.value = val;
9460
- }
9461
- return value;
9462
- }
9463
- }
9464
- }
9465
- },
9466
-
9467
- removeAttr: function( elem, value ) {
9468
- var name,
9469
- i = 0,
9470
-
9471
- // Attribute names can contain non-HTML whitespace characters
9472
- // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
9473
- attrNames = value && value.match( rnothtmlwhite );
9474
-
9475
- if ( attrNames && elem.nodeType === 1 ) {
9476
- while ( ( name = attrNames[ i++ ] ) ) {
9477
- elem.removeAttribute( name );
9478
- }
9479
- }
9480
- }
9481
- } );
9482
-
9483
- // Hooks for boolean attributes
9484
- boolHook = {
9485
- set: function( elem, value, name ) {
9486
- if ( value === false ) {
9487
-
9488
- // Remove boolean attributes when set to false
9489
- jQuery.removeAttr( elem, name );
9490
- } else {
9491
- elem.setAttribute( name, name );
9492
- }
9493
- return name;
9494
- }
9495
- };
9496
-
9497
- jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
9498
- var getter = attrHandle[ name ] || jQuery.find.attr;
9499
-
9500
- attrHandle[ name ] = function( elem, name, isXML ) {
9501
- var ret, handle,
9502
- lowercaseName = name.toLowerCase();
9503
-
9504
- if ( !isXML ) {
9505
-
9506
- // Avoid an infinite loop by temporarily removing this function from the getter
9507
- handle = attrHandle[ lowercaseName ];
9508
- attrHandle[ lowercaseName ] = ret;
9509
- ret = getter( elem, name, isXML ) != null ?
9510
- lowercaseName :
9511
- null;
9512
- attrHandle[ lowercaseName ] = handle;
9513
- }
9514
- return ret;
9515
- };
9516
- } );
9517
-
9518
-
9519
-
9520
-
9521
- var rfocusable = /^(?:input|select|textarea|button)$/i,
9522
- rclickable = /^(?:a|area)$/i;
9523
-
9524
- jQuery.fn.extend( {
9525
- prop: function( name, value ) {
9526
- return access( this, jQuery.prop, name, value, arguments.length > 1 );
9527
- },
9528
-
9529
- removeProp: function( name ) {
9530
- return this.each( function() {
9531
- delete this[ jQuery.propFix[ name ] || name ];
9532
- } );
9533
- }
9534
- } );
9535
-
9536
- jQuery.extend( {
9537
- prop: function( elem, name, value ) {
9538
- var ret, hooks,
9539
- nType = elem.nodeType;
9540
-
9541
- // Don't get/set properties on text, comment and attribute nodes
9542
- if ( nType === 3 || nType === 8 || nType === 2 ) {
9543
- return;
9544
- }
9545
-
9546
- if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
9547
-
9548
- // Fix name and attach hooks
9549
- name = jQuery.propFix[ name ] || name;
9550
- hooks = jQuery.propHooks[ name ];
9551
- }
9552
-
9553
- if ( value !== undefined ) {
9554
- if ( hooks && "set" in hooks &&
9555
- ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
9556
- return ret;
9557
- }
9558
-
9559
- return ( elem[ name ] = value );
9560
- }
9561
-
9562
- if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
9563
- return ret;
9564
- }
9565
-
9566
- return elem[ name ];
9567
- },
9568
-
9569
- propHooks: {
9570
- tabIndex: {
9571
- get: function( elem ) {
9572
-
9573
- // Support: IE <=9 - 11 only
9574
- // elem.tabIndex doesn't always return the
9575
- // correct value when it hasn't been explicitly set
9576
- // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
9577
- // Use proper attribute retrieval(#12072)
9578
- var tabindex = jQuery.find.attr( elem, "tabindex" );
9579
-
9580
- if ( tabindex ) {
9581
- return parseInt( tabindex, 10 );
9582
- }
9583
-
9584
- if (
9585
- rfocusable.test( elem.nodeName ) ||
9586
- rclickable.test( elem.nodeName ) &&
9587
- elem.href
9588
- ) {
9589
- return 0;
9590
- }
9591
-
9592
- return -1;
9593
- }
9594
- }
9595
- },
9596
-
9597
- propFix: {
9598
- "for": "htmlFor",
9599
- "class": "className"
9600
- }
9601
- } );
9602
-
9603
- // Support: IE <=11 only
9604
- // Accessing the selectedIndex property
9605
- // forces the browser to respect setting selected
9606
- // on the option
9607
- // The getter ensures a default option is selected
9608
- // when in an optgroup
9609
- // eslint rule "no-unused-expressions" is disabled for this code
9610
- // since it considers such accessions noop
9611
- if ( !support.optSelected ) {
9612
- jQuery.propHooks.selected = {
9613
- get: function( elem ) {
9614
-
9615
- /* eslint no-unused-expressions: "off" */
9616
-
9617
- var parent = elem.parentNode;
9618
- if ( parent && parent.parentNode ) {
9619
- parent.parentNode.selectedIndex;
9620
- }
9621
- return null;
9622
- },
9623
- set: function( elem ) {
9624
-
9625
- /* eslint no-unused-expressions: "off" */
9626
-
9627
- var parent = elem.parentNode;
9628
- if ( parent ) {
9629
- parent.selectedIndex;
9630
-
9631
- if ( parent.parentNode ) {
9632
- parent.parentNode.selectedIndex;
9633
- }
9634
- }
9635
- }
9636
- };
9637
- }
9638
-
9639
- jQuery.each( [
9640
- "tabIndex",
9641
- "readOnly",
9642
- "maxLength",
9643
- "cellSpacing",
9644
- "cellPadding",
9645
- "rowSpan",
9646
- "colSpan",
9647
- "useMap",
9648
- "frameBorder",
9649
- "contentEditable"
9650
- ], function() {
9651
- jQuery.propFix[ this.toLowerCase() ] = this;
9652
- } );
9653
-
9654
-
9655
-
9656
-
9657
- // Strip and collapse whitespace according to HTML spec
9658
- // https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace
9659
- function stripAndCollapse( value ) {
9660
- var tokens = value.match( rnothtmlwhite ) || [];
9661
- return tokens.join( " " );
9662
- }
9663
-
9664
-
9665
- function getClass( elem ) {
9666
- return elem.getAttribute && elem.getAttribute( "class" ) || "";
9667
- }
9668
-
9669
- jQuery.fn.extend( {
9670
- addClass: function( value ) {
9671
- var classes, elem, cur, curValue, clazz, j, finalValue,
9672
- i = 0;
9673
-
9674
- if ( jQuery.isFunction( value ) ) {
9675
- return this.each( function( j ) {
9676
- jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
9677
- } );
9678
- }
9679
-
9680
- if ( typeof value === "string" && value ) {
9681
- classes = value.match( rnothtmlwhite ) || [];
9682
-
9683
- while ( ( elem = this[ i++ ] ) ) {
9684
- curValue = getClass( elem );
9685
- cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
9686
-
9687
- if ( cur ) {
9688
- j = 0;
9689
- while ( ( clazz = classes[ j++ ] ) ) {
9690
- if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
9691
- cur += clazz + " ";
9692
- }
9693
- }
9694
-
9695
- // Only assign if different to avoid unneeded rendering.
9696
- finalValue = stripAndCollapse( cur );
9697
- if ( curValue !== finalValue ) {
9698
- elem.setAttribute( "class", finalValue );
9699
- }
9700
- }
9701
- }
9702
- }
9703
-
9704
- return this;
9705
- },
9706
-
9707
- removeClass: function( value ) {
9708
- var classes, elem, cur, curValue, clazz, j, finalValue,
9709
- i = 0;
9710
-
9711
- if ( jQuery.isFunction( value ) ) {
9712
- return this.each( function( j ) {
9713
- jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
9714
- } );
9715
- }
9716
-
9717
- if ( !arguments.length ) {
9718
- return this.attr( "class", "" );
9719
- }
9720
-
9721
- if ( typeof value === "string" && value ) {
9722
- classes = value.match( rnothtmlwhite ) || [];
9723
-
9724
- while ( ( elem = this[ i++ ] ) ) {
9725
- curValue = getClass( elem );
9726
-
9727
- // This expression is here for better compressibility (see addClass)
9728
- cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
9729
-
9730
- if ( cur ) {
9731
- j = 0;
9732
- while ( ( clazz = classes[ j++ ] ) ) {
9733
-
9734
- // Remove *all* instances
9735
- while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
9736
- cur = cur.replace( " " + clazz + " ", " " );
9737
- }
9738
- }
9739
-
9740
- // Only assign if different to avoid unneeded rendering.
9741
- finalValue = stripAndCollapse( cur );
9742
- if ( curValue !== finalValue ) {
9743
- elem.setAttribute( "class", finalValue );
9744
- }
9745
- }
9746
- }
9747
- }
9748
-
9749
- return this;
9750
- },
9751
-
9752
- toggleClass: function( value, stateVal ) {
9753
- var type = typeof value;
9754
-
9755
- if ( typeof stateVal === "boolean" && type === "string" ) {
9756
- return stateVal ? this.addClass( value ) : this.removeClass( value );
9757
- }
9758
-
9759
- if ( jQuery.isFunction( value ) ) {
9760
- return this.each( function( i ) {
9761
- jQuery( this ).toggleClass(
9762
- value.call( this, i, getClass( this ), stateVal ),
9763
- stateVal
9764
- );
9765
- } );
9766
- }
9767
-
9768
- return this.each( function() {
9769
- var className, i, self, classNames;
9770
-
9771
- if ( type === "string" ) {
9772
-
9773
- // Toggle individual class names
9774
- i = 0;
9775
- self = jQuery( this );
9776
- classNames = value.match( rnothtmlwhite ) || [];
9777
-
9778
- while ( ( className = classNames[ i++ ] ) ) {
9779
-
9780
- // Check each className given, space separated list
9781
- if ( self.hasClass( className ) ) {
9782
- self.removeClass( className );
9783
- } else {
9784
- self.addClass( className );
9785
- }
9786
- }
9787
-
9788
- // Toggle whole class name
9789
- } else if ( value === undefined || type === "boolean" ) {
9790
- className = getClass( this );
9791
- if ( className ) {
9792
-
9793
- // Store className if set
9794
- dataPriv.set( this, "__className__", className );
9795
- }
9796
-
9797
- // If the element has a class name or if we're passed `false`,
9798
- // then remove the whole classname (if there was one, the above saved it).
9799
- // Otherwise bring back whatever was previously saved (if anything),
9800
- // falling back to the empty string if nothing was stored.
9801
- if ( this.setAttribute ) {
9802
- this.setAttribute( "class",
9803
- className || value === false ?
9804
- "" :
9805
- dataPriv.get( this, "__className__" ) || ""
9806
- );
9807
- }
9808
- }
9809
- } );
9810
- },
9811
-
9812
- hasClass: function( selector ) {
9813
- var className, elem,
9814
- i = 0;
9815
-
9816
- className = " " + selector + " ";
9817
- while ( ( elem = this[ i++ ] ) ) {
9818
- if ( elem.nodeType === 1 &&
9819
- ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
9820
- return true;
9821
- }
9822
- }
9823
-
9824
- return false;
9825
- }
9826
- } );
9827
-
9828
-
9829
-
9830
-
9831
- var rreturn = /\r/g;
9832
-
9833
- jQuery.fn.extend( {
9834
- val: function( value ) {
9835
- var hooks, ret, isFunction,
9836
- elem = this[ 0 ];
9837
-
9838
- if ( !arguments.length ) {
9839
- if ( elem ) {
9840
- hooks = jQuery.valHooks[ elem.type ] ||
9841
- jQuery.valHooks[ elem.nodeName.toLowerCase() ];
9842
-
9843
- if ( hooks &&
9844
- "get" in hooks &&
9845
- ( ret = hooks.get( elem, "value" ) ) !== undefined
9846
- ) {
9847
- return ret;
9848
- }
9849
-
9850
- ret = elem.value;
9851
-
9852
- // Handle most common string cases
9853
- if ( typeof ret === "string" ) {
9854
- return ret.replace( rreturn, "" );
9855
- }
9856
-
9857
- // Handle cases where value is null/undef or number
9858
- return ret == null ? "" : ret;
9859
- }
9860
-
9861
- return;
9862
- }
9863
-
9864
- isFunction = jQuery.isFunction( value );
9865
-
9866
- return this.each( function( i ) {
9867
- var val;
9868
-
9869
- if ( this.nodeType !== 1 ) {
9870
- return;
9871
- }
9872
-
9873
- if ( isFunction ) {
9874
- val = value.call( this, i, jQuery( this ).val() );
9875
- } else {
9876
- val = value;
9877
- }
9878
-
9879
- // Treat null/undefined as ""; convert numbers to string
9880
- if ( val == null ) {
9881
- val = "";
9882
-
9883
- } else if ( typeof val === "number" ) {
9884
- val += "";
9885
-
9886
- } else if ( jQuery.isArray( val ) ) {
9887
- val = jQuery.map( val, function( value ) {
9888
- return value == null ? "" : value + "";
9889
- } );
9890
- }
9891
-
9892
- hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
9893
-
9894
- // If set returns undefined, fall back to normal setting
9895
- if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
9896
- this.value = val;
9897
- }
9898
- } );
9899
- }
9900
- } );
9901
-
9902
- jQuery.extend( {
9903
- valHooks: {
9904
- option: {
9905
- get: function( elem ) {
9906
-
9907
- var val = jQuery.find.attr( elem, "value" );
9908
- return val != null ?
9909
- val :
9910
-
9911
- // Support: IE <=10 - 11 only
9912
- // option.text throws exceptions (#14686, #14858)
9913
- // Strip and collapse whitespace
9914
- // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
9915
- stripAndCollapse( jQuery.text( elem ) );
9916
- }
9917
- },
9918
- select: {
9919
- get: function( elem ) {
9920
- var value, option, i,
9921
- options = elem.options,
9922
- index = elem.selectedIndex,
9923
- one = elem.type === "select-one",
9924
- values = one ? null : [],
9925
- max = one ? index + 1 : options.length;
9926
-
9927
- if ( index < 0 ) {
9928
- i = max;
9929
-
9930
- } else {
9931
- i = one ? index : 0;
9932
- }
9933
-
9934
- // Loop through all the selected options
9935
- for ( ; i < max; i++ ) {
9936
- option = options[ i ];
9937
-
9938
- // Support: IE <=9 only
9939
- // IE8-9 doesn't update selected after form reset (#2551)
9940
- if ( ( option.selected || i === index ) &&
9941
-
9942
- // Don't return options that are disabled or in a disabled optgroup
9943
- !option.disabled &&
9944
- ( !option.parentNode.disabled ||
9945
- !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
9946
-
9947
- // Get the specific value for the option
9948
- value = jQuery( option ).val();
9949
-
9950
- // We don't need an array for one selects
9951
- if ( one ) {
9952
- return value;
9953
- }
9954
-
9955
- // Multi-Selects return an array
9956
- values.push( value );
9957
- }
9958
- }
9959
-
9960
- return values;
9961
- },
9962
-
9963
- set: function( elem, value ) {
9964
- var optionSet, option,
9965
- options = elem.options,
9966
- values = jQuery.makeArray( value ),
9967
- i = options.length;
9968
-
9969
- while ( i-- ) {
9970
- option = options[ i ];
9971
-
9972
- /* eslint-disable no-cond-assign */
9973
-
9974
- if ( option.selected =
9975
- jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
9976
- ) {
9977
- optionSet = true;
9978
- }
9979
-
9980
- /* eslint-enable no-cond-assign */
9981
- }
9982
-
9983
- // Force browsers to behave consistently when non-matching value is set
9984
- if ( !optionSet ) {
9985
- elem.selectedIndex = -1;
9986
- }
9987
- return values;
9988
- }
9989
- }
9990
- }
9991
- } );
9992
-
9993
- // Radios and checkboxes getter/setter
9994
- jQuery.each( [ "radio", "checkbox" ], function() {
9995
- jQuery.valHooks[ this ] = {
9996
- set: function( elem, value ) {
9997
- if ( jQuery.isArray( value ) ) {
9998
- return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
9999
- }
10000
- }
10001
- };
10002
- if ( !support.checkOn ) {
10003
- jQuery.valHooks[ this ].get = function( elem ) {
10004
- return elem.getAttribute( "value" ) === null ? "on" : elem.value;
10005
- };
10006
- }
10007
- } );
10008
-
10009
-
10010
-
10011
-
10012
- // Return jQuery for attributes-only inclusion
10013
-
10014
-
10015
- var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/;
10016
-
10017
- jQuery.extend( jQuery.event, {
10018
-
10019
- trigger: function( event, data, elem, onlyHandlers ) {
10020
-
10021
- var i, cur, tmp, bubbleType, ontype, handle, special,
10022
- eventPath = [ elem || document ],
10023
- type = hasOwn.call( event, "type" ) ? event.type : event,
10024
- namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
10025
-
10026
- cur = tmp = elem = elem || document;
10027
-
10028
- // Don't do events on text and comment nodes
10029
- if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
10030
- return;
10031
- }
10032
-
10033
- // focus/blur morphs to focusin/out; ensure we're not firing them right now
10034
- if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
10035
- return;
10036
- }
10037
-
10038
- if ( type.indexOf( "." ) > -1 ) {
10039
-
10040
- // Namespaced trigger; create a regexp to match event type in handle()
10041
- namespaces = type.split( "." );
10042
- type = namespaces.shift();
10043
- namespaces.sort();
10044
- }
10045
- ontype = type.indexOf( ":" ) < 0 && "on" + type;
10046
-
10047
- // Caller can pass in a jQuery.Event object, Object, or just an event type string
10048
- event = event[ jQuery.expando ] ?
10049
- event :
10050
- new jQuery.Event( type, typeof event === "object" && event );
10051
-
10052
- // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
10053
- event.isTrigger = onlyHandlers ? 2 : 3;
10054
- event.namespace = namespaces.join( "." );
10055
- event.rnamespace = event.namespace ?
10056
- new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
10057
- null;
10058
-
10059
- // Clean up the event in case it is being reused
10060
- event.result = undefined;
10061
- if ( !event.target ) {
10062
- event.target = elem;
10063
- }
10064
-
10065
- // Clone any incoming data and prepend the event, creating the handler arg list
10066
- data = data == null ?
10067
- [ event ] :
10068
- jQuery.makeArray( data, [ event ] );
10069
-
10070
- // Allow special events to draw outside the lines
10071
- special = jQuery.event.special[ type ] || {};
10072
- if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
10073
- return;
10074
- }
10075
-
10076
- // Determine event propagation path in advance, per W3C events spec (#9951)
10077
- // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
10078
- if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
10079
-
10080
- bubbleType = special.delegateType || type;
10081
- if ( !rfocusMorph.test( bubbleType + type ) ) {
10082
- cur = cur.parentNode;
10083
- }
10084
- for ( ; cur; cur = cur.parentNode ) {
10085
- eventPath.push( cur );
10086
- tmp = cur;
10087
- }
10088
-
10089
- // Only add window if we got to document (e.g., not plain obj or detached DOM)
10090
- if ( tmp === ( elem.ownerDocument || document ) ) {
10091
- eventPath.push( tmp.defaultView || tmp.parentWindow || window );
10092
- }
10093
- }
10094
-
10095
- // Fire handlers on the event path
10096
- i = 0;
10097
- while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
10098
-
10099
- event.type = i > 1 ?
10100
- bubbleType :
10101
- special.bindType || type;
10102
-
10103
- // jQuery handler
10104
- handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
10105
- dataPriv.get( cur, "handle" );
10106
- if ( handle ) {
10107
- handle.apply( cur, data );
10108
- }
10109
-
10110
- // Native handler
10111
- handle = ontype && cur[ ontype ];
10112
- if ( handle && handle.apply && acceptData( cur ) ) {
10113
- event.result = handle.apply( cur, data );
10114
- if ( event.result === false ) {
10115
- event.preventDefault();
10116
- }
10117
- }
10118
- }
10119
- event.type = type;
10120
-
10121
- // If nobody prevented the default action, do it now
10122
- if ( !onlyHandlers && !event.isDefaultPrevented() ) {
10123
-
10124
- if ( ( !special._default ||
10125
- special._default.apply( eventPath.pop(), data ) === false ) &&
10126
- acceptData( elem ) ) {
10127
-
10128
- // Call a native DOM method on the target with the same name as the event.
10129
- // Don't do default actions on window, that's where global variables be (#6170)
10130
- if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
10131
-
10132
- // Don't re-trigger an onFOO event when we call its FOO() method
10133
- tmp = elem[ ontype ];
10134
-
10135
- if ( tmp ) {
10136
- elem[ ontype ] = null;
10137
- }
10138
-
10139
- // Prevent re-triggering of the same event, since we already bubbled it above
10140
- jQuery.event.triggered = type;
10141
- elem[ type ]();
10142
- jQuery.event.triggered = undefined;
10143
-
10144
- if ( tmp ) {
10145
- elem[ ontype ] = tmp;
10146
- }
10147
- }
10148
- }
10149
- }
10150
-
10151
- return event.result;
10152
- },
10153
-
10154
- // Piggyback on a donor event to simulate a different one
10155
- // Used only for `focus(in | out)` events
10156
- simulate: function( type, elem, event ) {
10157
- var e = jQuery.extend(
10158
- new jQuery.Event(),
10159
- event,
10160
- {
10161
- type: type,
10162
- isSimulated: true
10163
- }
10164
- );
10165
-
10166
- jQuery.event.trigger( e, null, elem );
10167
- }
10168
-
10169
- } );
10170
-
10171
- jQuery.fn.extend( {
10172
-
10173
- trigger: function( type, data ) {
10174
- return this.each( function() {
10175
- jQuery.event.trigger( type, data, this );
10176
- } );
10177
- },
10178
- triggerHandler: function( type, data ) {
10179
- var elem = this[ 0 ];
10180
- if ( elem ) {
10181
- return jQuery.event.trigger( type, data, elem, true );
10182
- }
10183
- }
10184
- } );
10185
-
10186
-
10187
- jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
10188
- "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
10189
- "change select submit keydown keypress keyup contextmenu" ).split( " " ),
10190
- function( i, name ) {
10191
-
10192
- // Handle event binding
10193
- jQuery.fn[ name ] = function( data, fn ) {
10194
- return arguments.length > 0 ?
10195
- this.on( name, null, data, fn ) :
10196
- this.trigger( name );
10197
- };
10198
- } );
10199
-
10200
- jQuery.fn.extend( {
10201
- hover: function( fnOver, fnOut ) {
10202
- return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
10203
- }
10204
- } );
10205
-
10206
-
10207
-
10208
-
10209
- support.focusin = "onfocusin" in window;
10210
-
10211
-
10212
- // Support: Firefox <=44
10213
- // Firefox doesn't have focus(in | out) events
10214
- // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
10215
- //
10216
- // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
10217
- // focus(in | out) events fire after focus & blur events,
10218
- // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
10219
- // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
10220
- if ( !support.focusin ) {
10221
- jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
10222
-
10223
- // Attach a single capturing handler on the document while someone wants focusin/focusout
10224
- var handler = function( event ) {
10225
- jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
10226
- };
10227
-
10228
- jQuery.event.special[ fix ] = {
10229
- setup: function() {
10230
- var doc = this.ownerDocument || this,
10231
- attaches = dataPriv.access( doc, fix );
10232
-
10233
- if ( !attaches ) {
10234
- doc.addEventListener( orig, handler, true );
10235
- }
10236
- dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
10237
- },
10238
- teardown: function() {
10239
- var doc = this.ownerDocument || this,
10240
- attaches = dataPriv.access( doc, fix ) - 1;
10241
-
10242
- if ( !attaches ) {
10243
- doc.removeEventListener( orig, handler, true );
10244
- dataPriv.remove( doc, fix );
10245
-
10246
- } else {
10247
- dataPriv.access( doc, fix, attaches );
10248
- }
10249
- }
10250
- };
10251
- } );
10252
- }
10253
- var location = window.location;
10254
-
10255
- var nonce = jQuery.now();
10256
-
10257
- var rquery = ( /\?/ );
10258
-
10259
-
10260
-
10261
- // Cross-browser xml parsing
10262
- jQuery.parseXML = function( data ) {
10263
- var xml;
10264
- if ( !data || typeof data !== "string" ) {
10265
- return null;
10266
- }
10267
-
10268
- // Support: IE 9 - 11 only
10269
- // IE throws on parseFromString with invalid input.
10270
- try {
10271
- xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
10272
- } catch ( e ) {
10273
- xml = undefined;
10274
- }
10275
-
10276
- if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
10277
- jQuery.error( "Invalid XML: " + data );
10278
- }
10279
- return xml;
10280
- };
10281
-
10282
-
10283
- var
10284
- rbracket = /\[\]$/,
10285
- rCRLF = /\r?\n/g,
10286
- rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
10287
- rsubmittable = /^(?:input|select|textarea|keygen)/i;
10288
-
10289
- function buildParams( prefix, obj, traditional, add ) {
10290
- var name;
10291
-
10292
- if ( jQuery.isArray( obj ) ) {
10293
-
10294
- // Serialize array item.
10295
- jQuery.each( obj, function( i, v ) {
10296
- if ( traditional || rbracket.test( prefix ) ) {
10297
-
10298
- // Treat each array item as a scalar.
10299
- add( prefix, v );
10300
-
10301
- } else {
10302
-
10303
- // Item is non-scalar (array or object), encode its numeric index.
10304
- buildParams(
10305
- prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
10306
- v,
10307
- traditional,
10308
- add
10309
- );
10310
- }
10311
- } );
10312
-
10313
- } else if ( !traditional && jQuery.type( obj ) === "object" ) {
10314
-
10315
- // Serialize object item.
10316
- for ( name in obj ) {
10317
- buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
10318
- }
10319
-
10320
- } else {
10321
-
10322
- // Serialize scalar item.
10323
- add( prefix, obj );
10324
- }
10325
- }
10326
-
10327
- // Serialize an array of form elements or a set of
10328
- // key/values into a query string
10329
- jQuery.param = function( a, traditional ) {
10330
- var prefix,
10331
- s = [],
10332
- add = function( key, valueOrFunction ) {
10333
-
10334
- // If value is a function, invoke it and use its return value
10335
- var value = jQuery.isFunction( valueOrFunction ) ?
10336
- valueOrFunction() :
10337
- valueOrFunction;
10338
-
10339
- s[ s.length ] = encodeURIComponent( key ) + "=" +
10340
- encodeURIComponent( value == null ? "" : value );
10341
- };
10342
-
10343
- // If an array was passed in, assume that it is an array of form elements.
10344
- if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
10345
-
10346
- // Serialize the form elements
10347
- jQuery.each( a, function() {
10348
- add( this.name, this.value );
10349
- } );
10350
-
10351
- } else {
10352
-
10353
- // If traditional, encode the "old" way (the way 1.3.2 or older
10354
- // did it), otherwise encode params recursively.
10355
- for ( prefix in a ) {
10356
- buildParams( prefix, a[ prefix ], traditional, add );
10357
- }
10358
- }
10359
-
10360
- // Return the resulting serialization
10361
- return s.join( "&" );
10362
- };
10363
-
10364
- jQuery.fn.extend( {
10365
- serialize: function() {
10366
- return jQuery.param( this.serializeArray() );
10367
- },
10368
- serializeArray: function() {
10369
- return this.map( function() {
10370
-
10371
- // Can add propHook for "elements" to filter or add form elements
10372
- var elements = jQuery.prop( this, "elements" );
10373
- return elements ? jQuery.makeArray( elements ) : this;
10374
- } )
10375
- .filter( function() {
10376
- var type = this.type;
10377
-
10378
- // Use .is( ":disabled" ) so that fieldset[disabled] works
10379
- return this.name && !jQuery( this ).is( ":disabled" ) &&
10380
- rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
10381
- ( this.checked || !rcheckableType.test( type ) );
10382
- } )
10383
- .map( function( i, elem ) {
10384
- var val = jQuery( this ).val();
10385
-
10386
- if ( val == null ) {
10387
- return null;
10388
- }
10389
-
10390
- if ( jQuery.isArray( val ) ) {
10391
- return jQuery.map( val, function( val ) {
10392
- return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
10393
- } );
10394
- }
10395
-
10396
- return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
10397
- } ).get();
10398
- }
10399
- } );
10400
-
10401
-
10402
- var
10403
- r20 = /%20/g,
10404
- rhash = /#.*$/,
10405
- rantiCache = /([?&])_=[^&]*/,
10406
- rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
10407
-
10408
- // #7653, #8125, #8152: local protocol detection
10409
- rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
10410
- rnoContent = /^(?:GET|HEAD)$/,
10411
- rprotocol = /^\/\//,
10412
-
10413
- /* Prefilters
10414
- * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
10415
- * 2) These are called:
10416
- * - BEFORE asking for a transport
10417
- * - AFTER param serialization (s.data is a string if s.processData is true)
10418
- * 3) key is the dataType
10419
- * 4) the catchall symbol "*" can be used
10420
- * 5) execution will start with transport dataType and THEN continue down to "*" if needed
10421
- */
10422
- prefilters = {},
10423
-
10424
- /* Transports bindings
10425
- * 1) key is the dataType
10426
- * 2) the catchall symbol "*" can be used
10427
- * 3) selection will start with transport dataType and THEN go to "*" if needed
10428
- */
10429
- transports = {},
10430
-
10431
- // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
10432
- allTypes = "*/".concat( "*" ),
10433
-
10434
- // Anchor tag for parsing the document origin
10435
- originAnchor = document.createElement( "a" );
10436
- originAnchor.href = location.href;
10437
-
10438
- // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
10439
- function addToPrefiltersOrTransports( structure ) {
10440
-
10441
- // dataTypeExpression is optional and defaults to "*"
10442
- return function( dataTypeExpression, func ) {
10443
-
10444
- if ( typeof dataTypeExpression !== "string" ) {
10445
- func = dataTypeExpression;
10446
- dataTypeExpression = "*";
10447
- }
10448
-
10449
- var dataType,
10450
- i = 0,
10451
- dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
10452
-
10453
- if ( jQuery.isFunction( func ) ) {
10454
-
10455
- // For each dataType in the dataTypeExpression
10456
- while ( ( dataType = dataTypes[ i++ ] ) ) {
10457
-
10458
- // Prepend if requested
10459
- if ( dataType[ 0 ] === "+" ) {
10460
- dataType = dataType.slice( 1 ) || "*";
10461
- ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
10462
-
10463
- // Otherwise append
10464
- } else {
10465
- ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
10466
- }
10467
- }
10468
- }
10469
- };
10470
- }
10471
-
10472
- // Base inspection function for prefilters and transports
10473
- function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
10474
-
10475
- var inspected = {},
10476
- seekingTransport = ( structure === transports );
10477
-
10478
- function inspect( dataType ) {
10479
- var selected;
10480
- inspected[ dataType ] = true;
10481
- jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
10482
- var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
10483
- if ( typeof dataTypeOrTransport === "string" &&
10484
- !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
10485
-
10486
- options.dataTypes.unshift( dataTypeOrTransport );
10487
- inspect( dataTypeOrTransport );
10488
- return false;
10489
- } else if ( seekingTransport ) {
10490
- return !( selected = dataTypeOrTransport );
10491
- }
10492
- } );
10493
- return selected;
10494
- }
10495
-
10496
- return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
10497
- }
10498
-
10499
- // A special extend for ajax options
10500
- // that takes "flat" options (not to be deep extended)
10501
- // Fixes #9887
10502
- function ajaxExtend( target, src ) {
10503
- var key, deep,
10504
- flatOptions = jQuery.ajaxSettings.flatOptions || {};
10505
-
10506
- for ( key in src ) {
10507
- if ( src[ key ] !== undefined ) {
10508
- ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
10509
- }
10510
- }
10511
- if ( deep ) {
10512
- jQuery.extend( true, target, deep );
10513
- }
10514
-
10515
- return target;
10516
- }
10517
-
10518
- /* Handles responses to an ajax request:
10519
- * - finds the right dataType (mediates between content-type and expected dataType)
10520
- * - returns the corresponding response
10521
- */
10522
- function ajaxHandleResponses( s, jqXHR, responses ) {
10523
-
10524
- var ct, type, finalDataType, firstDataType,
10525
- contents = s.contents,
10526
- dataTypes = s.dataTypes;
10527
-
10528
- // Remove auto dataType and get content-type in the process
10529
- while ( dataTypes[ 0 ] === "*" ) {
10530
- dataTypes.shift();
10531
- if ( ct === undefined ) {
10532
- ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
10533
- }
10534
- }
10535
-
10536
- // Check if we're dealing with a known content-type
10537
- if ( ct ) {
10538
- for ( type in contents ) {
10539
- if ( contents[ type ] && contents[ type ].test( ct ) ) {
10540
- dataTypes.unshift( type );
10541
- break;
10542
- }
10543
- }
10544
- }
10545
-
10546
- // Check to see if we have a response for the expected dataType
10547
- if ( dataTypes[ 0 ] in responses ) {
10548
- finalDataType = dataTypes[ 0 ];
10549
- } else {
10550
-
10551
- // Try convertible dataTypes
10552
- for ( type in responses ) {
10553
- if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
10554
- finalDataType = type;
10555
- break;
10556
- }
10557
- if ( !firstDataType ) {
10558
- firstDataType = type;
10559
- }
10560
- }
10561
-
10562
- // Or just use first one
10563
- finalDataType = finalDataType || firstDataType;
10564
- }
10565
-
10566
- // If we found a dataType
10567
- // We add the dataType to the list if needed
10568
- // and return the corresponding response
10569
- if ( finalDataType ) {
10570
- if ( finalDataType !== dataTypes[ 0 ] ) {
10571
- dataTypes.unshift( finalDataType );
10572
- }
10573
- return responses[ finalDataType ];
10574
- }
10575
- }
10576
-
10577
- /* Chain conversions given the request and the original response
10578
- * Also sets the responseXXX fields on the jqXHR instance
10579
- */
10580
- function ajaxConvert( s, response, jqXHR, isSuccess ) {
10581
- var conv2, current, conv, tmp, prev,
10582
- converters = {},
10583
-
10584
- // Work with a copy of dataTypes in case we need to modify it for conversion
10585
- dataTypes = s.dataTypes.slice();
10586
-
10587
- // Create converters map with lowercased keys
10588
- if ( dataTypes[ 1 ] ) {
10589
- for ( conv in s.converters ) {
10590
- converters[ conv.toLowerCase() ] = s.converters[ conv ];
10591
- }
10592
- }
10593
-
10594
- current = dataTypes.shift();
10595
-
10596
- // Convert to each sequential dataType
10597
- while ( current ) {
10598
-
10599
- if ( s.responseFields[ current ] ) {
10600
- jqXHR[ s.responseFields[ current ] ] = response;
10601
- }
10602
-
10603
- // Apply the dataFilter if provided
10604
- if ( !prev && isSuccess && s.dataFilter ) {
10605
- response = s.dataFilter( response, s.dataType );
10606
- }
10607
-
10608
- prev = current;
10609
- current = dataTypes.shift();
10610
-
10611
- if ( current ) {
10612
-
10613
- // There's only work to do if current dataType is non-auto
10614
- if ( current === "*" ) {
10615
-
10616
- current = prev;
10617
-
10618
- // Convert response if prev dataType is non-auto and differs from current
10619
- } else if ( prev !== "*" && prev !== current ) {
10620
-
10621
- // Seek a direct converter
10622
- conv = converters[ prev + " " + current ] || converters[ "* " + current ];
10623
-
10624
- // If none found, seek a pair
10625
- if ( !conv ) {
10626
- for ( conv2 in converters ) {
10627
-
10628
- // If conv2 outputs current
10629
- tmp = conv2.split( " " );
10630
- if ( tmp[ 1 ] === current ) {
10631
-
10632
- // If prev can be converted to accepted input
10633
- conv = converters[ prev + " " + tmp[ 0 ] ] ||
10634
- converters[ "* " + tmp[ 0 ] ];
10635
- if ( conv ) {
10636
-
10637
- // Condense equivalence converters
10638
- if ( conv === true ) {
10639
- conv = converters[ conv2 ];
10640
-
10641
- // Otherwise, insert the intermediate dataType
10642
- } else if ( converters[ conv2 ] !== true ) {
10643
- current = tmp[ 0 ];
10644
- dataTypes.unshift( tmp[ 1 ] );
10645
- }
10646
- break;
10647
- }
10648
- }
10649
- }
10650
- }
10651
-
10652
- // Apply converter (if not an equivalence)
10653
- if ( conv !== true ) {
10654
-
10655
- // Unless errors are allowed to bubble, catch and return them
10656
- if ( conv && s.throws ) {
10657
- response = conv( response );
10658
- } else {
10659
- try {
10660
- response = conv( response );
10661
- } catch ( e ) {
10662
- return {
10663
- state: "parsererror",
10664
- error: conv ? e : "No conversion from " + prev + " to " + current
10665
- };
10666
- }
10667
- }
10668
- }
10669
- }
10670
- }
10671
- }
10672
-
10673
- return { state: "success", data: response };
10674
- }
10675
-
10676
- jQuery.extend( {
10677
-
10678
- // Counter for holding the number of active queries
10679
- active: 0,
10680
-
10681
- // Last-Modified header cache for next request
10682
- lastModified: {},
10683
- etag: {},
10684
-
10685
- ajaxSettings: {
10686
- url: location.href,
10687
- type: "GET",
10688
- isLocal: rlocalProtocol.test( location.protocol ),
10689
- global: true,
10690
- processData: true,
10691
- async: true,
10692
- contentType: "application/x-www-form-urlencoded; charset=UTF-8",
10693
-
10694
- /*
10695
- timeout: 0,
10696
- data: null,
10697
- dataType: null,
10698
- username: null,
10699
- password: null,
10700
- cache: null,
10701
- throws: false,
10702
- traditional: false,
10703
- headers: {},
10704
- */
10705
-
10706
- accepts: {
10707
- "*": allTypes,
10708
- text: "text/plain",
10709
- html: "text/html",
10710
- xml: "application/xml, text/xml",
10711
- json: "application/json, text/javascript"
10712
- },
10713
-
10714
- contents: {
10715
- xml: /\bxml\b/,
10716
- html: /\bhtml/,
10717
- json: /\bjson\b/
10718
- },
10719
-
10720
- responseFields: {
10721
- xml: "responseXML",
10722
- text: "responseText",
10723
- json: "responseJSON"
10724
- },
10725
-
10726
- // Data converters
10727
- // Keys separate source (or catchall "*") and destination types with a single space
10728
- converters: {
10729
-
10730
- // Convert anything to text
10731
- "* text": String,
10732
-
10733
- // Text to html (true = no transformation)
10734
- "text html": true,
10735
-
10736
- // Evaluate text as a json expression
10737
- "text json": JSON.parse,
10738
-
10739
- // Parse text as xml
10740
- "text xml": jQuery.parseXML
10741
- },
10742
-
10743
- // For options that shouldn't be deep extended:
10744
- // you can add your own custom options here if
10745
- // and when you create one that shouldn't be
10746
- // deep extended (see ajaxExtend)
10747
- flatOptions: {
10748
- url: true,
10749
- context: true
10750
- }
10751
- },
10752
-
10753
- // Creates a full fledged settings object into target
10754
- // with both ajaxSettings and settings fields.
10755
- // If target is omitted, writes into ajaxSettings.
10756
- ajaxSetup: function( target, settings ) {
10757
- return settings ?
10758
-
10759
- // Building a settings object
10760
- ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
10761
-
10762
- // Extending ajaxSettings
10763
- ajaxExtend( jQuery.ajaxSettings, target );
10764
- },
10765
-
10766
- ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
10767
- ajaxTransport: addToPrefiltersOrTransports( transports ),
10768
-
10769
- // Main method
10770
- ajax: function( url, options ) {
10771
-
10772
- // If url is an object, simulate pre-1.5 signature
10773
- if ( typeof url === "object" ) {
10774
- options = url;
10775
- url = undefined;
10776
- }
10777
-
10778
- // Force options to be an object
10779
- options = options || {};
10780
-
10781
- var transport,
10782
-
10783
- // URL without anti-cache param
10784
- cacheURL,
10785
-
10786
- // Response headers
10787
- responseHeadersString,
10788
- responseHeaders,
10789
-
10790
- // timeout handle
10791
- timeoutTimer,
10792
-
10793
- // Url cleanup var
10794
- urlAnchor,
10795
-
10796
- // Request state (becomes false upon send and true upon completion)
10797
- completed,
10798
-
10799
- // To know if global events are to be dispatched
10800
- fireGlobals,
10801
-
10802
- // Loop variable
10803
- i,
10804
-
10805
- // uncached part of the url
10806
- uncached,
10807
-
10808
- // Create the final options object
10809
- s = jQuery.ajaxSetup( {}, options ),
10810
-
10811
- // Callbacks context
10812
- callbackContext = s.context || s,
10813
-
10814
- // Context for global events is callbackContext if it is a DOM node or jQuery collection
10815
- globalEventContext = s.context &&
10816
- ( callbackContext.nodeType || callbackContext.jquery ) ?
10817
- jQuery( callbackContext ) :
10818
- jQuery.event,
10819
-
10820
- // Deferreds
10821
- deferred = jQuery.Deferred(),
10822
- completeDeferred = jQuery.Callbacks( "once memory" ),
10823
-
10824
- // Status-dependent callbacks
10825
- statusCode = s.statusCode || {},
10826
-
10827
- // Headers (they are sent all at once)
10828
- requestHeaders = {},
10829
- requestHeadersNames = {},
10830
-
10831
- // Default abort message
10832
- strAbort = "canceled",
10833
-
10834
- // Fake xhr
10835
- jqXHR = {
10836
- readyState: 0,
10837
-
10838
- // Builds headers hashtable if needed
10839
- getResponseHeader: function( key ) {
10840
- var match;
10841
- if ( completed ) {
10842
- if ( !responseHeaders ) {
10843
- responseHeaders = {};
10844
- while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
10845
- responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
10846
- }
10847
- }
10848
- match = responseHeaders[ key.toLowerCase() ];
10849
- }
10850
- return match == null ? null : match;
10851
- },
10852
-
10853
- // Raw string
10854
- getAllResponseHeaders: function() {
10855
- return completed ? responseHeadersString : null;
10856
- },
10857
-
10858
- // Caches the header
10859
- setRequestHeader: function( name, value ) {
10860
- if ( completed == null ) {
10861
- name = requestHeadersNames[ name.toLowerCase() ] =
10862
- requestHeadersNames[ name.toLowerCase() ] || name;
10863
- requestHeaders[ name ] = value;
10864
- }
10865
- return this;
10866
- },
10867
-
10868
- // Overrides response content-type header
10869
- overrideMimeType: function( type ) {
10870
- if ( completed == null ) {
10871
- s.mimeType = type;
10872
- }
10873
- return this;
10874
- },
10875
-
10876
- // Status-dependent callbacks
10877
- statusCode: function( map ) {
10878
- var code;
10879
- if ( map ) {
10880
- if ( completed ) {
10881
-
10882
- // Execute the appropriate callbacks
10883
- jqXHR.always( map[ jqXHR.status ] );
10884
- } else {
10885
-
10886
- // Lazy-add the new callbacks in a way that preserves old ones
10887
- for ( code in map ) {
10888
- statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
10889
- }
10890
- }
10891
- }
10892
- return this;
10893
- },
10894
-
10895
- // Cancel the request
10896
- abort: function( statusText ) {
10897
- var finalText = statusText || strAbort;
10898
- if ( transport ) {
10899
- transport.abort( finalText );
10900
- }
10901
- done( 0, finalText );
10902
- return this;
10903
- }
10904
- };
10905
-
10906
- // Attach deferreds
10907
- deferred.promise( jqXHR );
10908
-
10909
- // Add protocol if not provided (prefilters might expect it)
10910
- // Handle falsy url in the settings object (#10093: consistency with old signature)
10911
- // We also use the url parameter if available
10912
- s.url = ( ( url || s.url || location.href ) + "" )
10913
- .replace( rprotocol, location.protocol + "//" );
10914
-
10915
- // Alias method option to type as per ticket #12004
10916
- s.type = options.method || options.type || s.method || s.type;
10917
-
10918
- // Extract dataTypes list
10919
- s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
10920
-
10921
- // A cross-domain request is in order when the origin doesn't match the current origin.
10922
- if ( s.crossDomain == null ) {
10923
- urlAnchor = document.createElement( "a" );
10924
-
10925
- // Support: IE <=8 - 11, Edge 12 - 13
10926
- // IE throws exception on accessing the href property if url is malformed,
10927
- // e.g. http://example.com:80x/
10928
- try {
10929
- urlAnchor.href = s.url;
10930
-
10931
- // Support: IE <=8 - 11 only
10932
- // Anchor's host property isn't correctly set when s.url is relative
10933
- urlAnchor.href = urlAnchor.href;
10934
- s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
10935
- urlAnchor.protocol + "//" + urlAnchor.host;
10936
- } catch ( e ) {
10937
-
10938
- // If there is an error parsing the URL, assume it is crossDomain,
10939
- // it can be rejected by the transport if it is invalid
10940
- s.crossDomain = true;
10941
- }
10942
- }
10943
-
10944
- // Convert data if not already a string
10945
- if ( s.data && s.processData && typeof s.data !== "string" ) {
10946
- s.data = jQuery.param( s.data, s.traditional );
10947
- }
10948
-
10949
- // Apply prefilters
10950
- inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
10951
-
10952
- // If request was aborted inside a prefilter, stop there
10953
- if ( completed ) {
10954
- return jqXHR;
10955
- }
10956
-
10957
- // We can fire global events as of now if asked to
10958
- // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
10959
- fireGlobals = jQuery.event && s.global;
10960
-
10961
- // Watch for a new set of requests
10962
- if ( fireGlobals && jQuery.active++ === 0 ) {
10963
- jQuery.event.trigger( "ajaxStart" );
10964
- }
10965
-
10966
- // Uppercase the type
10967
- s.type = s.type.toUpperCase();
10968
-
10969
- // Determine if request has content
10970
- s.hasContent = !rnoContent.test( s.type );
10971
-
10972
- // Save the URL in case we're toying with the If-Modified-Since
10973
- // and/or If-None-Match header later on
10974
- // Remove hash to simplify url manipulation
10975
- cacheURL = s.url.replace( rhash, "" );
10976
-
10977
- // More options handling for requests with no content
10978
- if ( !s.hasContent ) {
10979
-
10980
- // Remember the hash so we can put it back
10981
- uncached = s.url.slice( cacheURL.length );
10982
-
10983
- // If data is available, append data to url
10984
- if ( s.data ) {
10985
- cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
10986
-
10987
- // #9682: remove data so that it's not used in an eventual retry
10988
- delete s.data;
10989
- }
10990
-
10991
- // Add or update anti-cache param if needed
10992
- if ( s.cache === false ) {
10993
- cacheURL = cacheURL.replace( rantiCache, "$1" );
10994
- uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
10995
- }
10996
-
10997
- // Put hash and anti-cache on the URL that will be requested (gh-1732)
10998
- s.url = cacheURL + uncached;
10999
-
11000
- // Change '%20' to '+' if this is encoded form body content (gh-2658)
11001
- } else if ( s.data && s.processData &&
11002
- ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
11003
- s.data = s.data.replace( r20, "+" );
11004
- }
11005
-
11006
- // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
11007
- if ( s.ifModified ) {
11008
- if ( jQuery.lastModified[ cacheURL ] ) {
11009
- jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
11010
- }
11011
- if ( jQuery.etag[ cacheURL ] ) {
11012
- jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
11013
- }
11014
- }
11015
-
11016
- // Set the correct header, if data is being sent
11017
- if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
11018
- jqXHR.setRequestHeader( "Content-Type", s.contentType );
11019
- }
11020
-
11021
- // Set the Accepts header for the server, depending on the dataType
11022
- jqXHR.setRequestHeader(
11023
- "Accept",
11024
- s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
11025
- s.accepts[ s.dataTypes[ 0 ] ] +
11026
- ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
11027
- s.accepts[ "*" ]
11028
- );
11029
-
11030
- // Check for headers option
11031
- for ( i in s.headers ) {
11032
- jqXHR.setRequestHeader( i, s.headers[ i ] );
11033
- }
11034
-
11035
- // Allow custom headers/mimetypes and early abort
11036
- if ( s.beforeSend &&
11037
- ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
11038
-
11039
- // Abort if not done already and return
11040
- return jqXHR.abort();
11041
- }
11042
-
11043
- // Aborting is no longer a cancellation
11044
- strAbort = "abort";
11045
-
11046
- // Install callbacks on deferreds
11047
- completeDeferred.add( s.complete );
11048
- jqXHR.done( s.success );
11049
- jqXHR.fail( s.error );
11050
-
11051
- // Get transport
11052
- transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
11053
-
11054
- // If no transport, we auto-abort
11055
- if ( !transport ) {
11056
- done( -1, "No Transport" );
11057
- } else {
11058
- jqXHR.readyState = 1;
11059
-
11060
- // Send global event
11061
- if ( fireGlobals ) {
11062
- globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
11063
- }
11064
-
11065
- // If request was aborted inside ajaxSend, stop there
11066
- if ( completed ) {
11067
- return jqXHR;
11068
- }
11069
-
11070
- // Timeout
11071
- if ( s.async && s.timeout > 0 ) {
11072
- timeoutTimer = window.setTimeout( function() {
11073
- jqXHR.abort( "timeout" );
11074
- }, s.timeout );
11075
- }
11076
-
11077
- try {
11078
- completed = false;
11079
- transport.send( requestHeaders, done );
11080
- } catch ( e ) {
11081
-
11082
- // Rethrow post-completion exceptions
11083
- if ( completed ) {
11084
- throw e;
11085
- }
11086
-
11087
- // Propagate others as results
11088
- done( -1, e );
11089
- }
11090
- }
11091
-
11092
- // Callback for when everything is done
11093
- function done( status, nativeStatusText, responses, headers ) {
11094
- var isSuccess, success, error, response, modified,
11095
- statusText = nativeStatusText;
11096
-
11097
- // Ignore repeat invocations
11098
- if ( completed ) {
11099
- return;
11100
- }
11101
-
11102
- completed = true;
11103
-
11104
- // Clear timeout if it exists
11105
- if ( timeoutTimer ) {
11106
- window.clearTimeout( timeoutTimer );
11107
- }
11108
-
11109
- // Dereference transport for early garbage collection
11110
- // (no matter how long the jqXHR object will be used)
11111
- transport = undefined;
11112
-
11113
- // Cache response headers
11114
- responseHeadersString = headers || "";
11115
-
11116
- // Set readyState
11117
- jqXHR.readyState = status > 0 ? 4 : 0;
11118
-
11119
- // Determine if successful
11120
- isSuccess = status >= 200 && status < 300 || status === 304;
11121
-
11122
- // Get response data
11123
- if ( responses ) {
11124
- response = ajaxHandleResponses( s, jqXHR, responses );
11125
- }
11126
-
11127
- // Convert no matter what (that way responseXXX fields are always set)
11128
- response = ajaxConvert( s, response, jqXHR, isSuccess );
11129
-
11130
- // If successful, handle type chaining
11131
- if ( isSuccess ) {
11132
-
11133
- // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
11134
- if ( s.ifModified ) {
11135
- modified = jqXHR.getResponseHeader( "Last-Modified" );
11136
- if ( modified ) {
11137
- jQuery.lastModified[ cacheURL ] = modified;
11138
- }
11139
- modified = jqXHR.getResponseHeader( "etag" );
11140
- if ( modified ) {
11141
- jQuery.etag[ cacheURL ] = modified;
11142
- }
11143
- }
11144
-
11145
- // if no content
11146
- if ( status === 204 || s.type === "HEAD" ) {
11147
- statusText = "nocontent";
11148
-
11149
- // if not modified
11150
- } else if ( status === 304 ) {
11151
- statusText = "notmodified";
11152
-
11153
- // If we have data, let's convert it
11154
- } else {
11155
- statusText = response.state;
11156
- success = response.data;
11157
- error = response.error;
11158
- isSuccess = !error;
11159
- }
11160
- } else {
11161
-
11162
- // Extract error from statusText and normalize for non-aborts
11163
- error = statusText;
11164
- if ( status || !statusText ) {
11165
- statusText = "error";
11166
- if ( status < 0 ) {
11167
- status = 0;
11168
- }
11169
- }
11170
- }
11171
-
11172
- // Set data for the fake xhr object
11173
- jqXHR.status = status;
11174
- jqXHR.statusText = ( nativeStatusText || statusText ) + "";
11175
-
11176
- // Success/Error
11177
- if ( isSuccess ) {
11178
- deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
11179
- } else {
11180
- deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
11181
- }
11182
-
11183
- // Status-dependent callbacks
11184
- jqXHR.statusCode( statusCode );
11185
- statusCode = undefined;
11186
-
11187
- if ( fireGlobals ) {
11188
- globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
11189
- [ jqXHR, s, isSuccess ? success : error ] );
11190
- }
11191
-
11192
- // Complete
11193
- completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
11194
-
11195
- if ( fireGlobals ) {
11196
- globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
11197
-
11198
- // Handle the global AJAX counter
11199
- if ( !( --jQuery.active ) ) {
11200
- jQuery.event.trigger( "ajaxStop" );
11201
- }
11202
- }
11203
- }
11204
-
11205
- return jqXHR;
11206
- },
11207
-
11208
- getJSON: function( url, data, callback ) {
11209
- return jQuery.get( url, data, callback, "json" );
11210
- },
11211
-
11212
- getScript: function( url, callback ) {
11213
- return jQuery.get( url, undefined, callback, "script" );
11214
- }
11215
- } );
11216
-
11217
- jQuery.each( [ "get", "post" ], function( i, method ) {
11218
- jQuery[ method ] = function( url, data, callback, type ) {
11219
-
11220
- // Shift arguments if data argument was omitted
11221
- if ( jQuery.isFunction( data ) ) {
11222
- type = type || callback;
11223
- callback = data;
11224
- data = undefined;
11225
- }
11226
-
11227
- // The url can be an options object (which then must have .url)
11228
- return jQuery.ajax( jQuery.extend( {
11229
- url: url,
11230
- type: method,
11231
- dataType: type,
11232
- data: data,
11233
- success: callback
11234
- }, jQuery.isPlainObject( url ) && url ) );
11235
- };
11236
- } );
11237
-
11238
-
11239
- jQuery._evalUrl = function( url ) {
11240
- return jQuery.ajax( {
11241
- url: url,
11242
-
11243
- // Make this explicit, since user can override this through ajaxSetup (#11264)
11244
- type: "GET",
11245
- dataType: "script",
11246
- cache: true,
11247
- async: false,
11248
- global: false,
11249
- "throws": true
11250
- } );
11251
- };
11252
-
11253
-
11254
- jQuery.fn.extend( {
11255
- wrapAll: function( html ) {
11256
- var wrap;
11257
-
11258
- if ( this[ 0 ] ) {
11259
- if ( jQuery.isFunction( html ) ) {
11260
- html = html.call( this[ 0 ] );
11261
- }
11262
-
11263
- // The elements to wrap the target around
11264
- wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
11265
-
11266
- if ( this[ 0 ].parentNode ) {
11267
- wrap.insertBefore( this[ 0 ] );
11268
- }
11269
-
11270
- wrap.map( function() {
11271
- var elem = this;
11272
-
11273
- while ( elem.firstElementChild ) {
11274
- elem = elem.firstElementChild;
11275
- }
11276
-
11277
- return elem;
11278
- } ).append( this );
11279
- }
11280
-
11281
- return this;
11282
- },
11283
-
11284
- wrapInner: function( html ) {
11285
- if ( jQuery.isFunction( html ) ) {
11286
- return this.each( function( i ) {
11287
- jQuery( this ).wrapInner( html.call( this, i ) );
11288
- } );
11289
- }
11290
-
11291
- return this.each( function() {
11292
- var self = jQuery( this ),
11293
- contents = self.contents();
11294
-
11295
- if ( contents.length ) {
11296
- contents.wrapAll( html );
11297
-
11298
- } else {
11299
- self.append( html );
11300
- }
11301
- } );
11302
- },
11303
-
11304
- wrap: function( html ) {
11305
- var isFunction = jQuery.isFunction( html );
11306
-
11307
- return this.each( function( i ) {
11308
- jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
11309
- } );
11310
- },
11311
-
11312
- unwrap: function( selector ) {
11313
- this.parent( selector ).not( "body" ).each( function() {
11314
- jQuery( this ).replaceWith( this.childNodes );
11315
- } );
11316
- return this;
11317
- }
11318
- } );
11319
-
11320
-
11321
- jQuery.expr.pseudos.hidden = function( elem ) {
11322
- return !jQuery.expr.pseudos.visible( elem );
11323
- };
11324
- jQuery.expr.pseudos.visible = function( elem ) {
11325
- return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
11326
- };
11327
-
11328
-
11329
-
11330
-
11331
- jQuery.ajaxSettings.xhr = function() {
11332
- try {
11333
- return new window.XMLHttpRequest();
11334
- } catch ( e ) {}
11335
- };
11336
-
11337
- var xhrSuccessStatus = {
11338
-
11339
- // File protocol always yields status code 0, assume 200
11340
- 0: 200,
11341
-
11342
- // Support: IE <=9 only
11343
- // #1450: sometimes IE returns 1223 when it should be 204
11344
- 1223: 204
11345
- },
11346
- xhrSupported = jQuery.ajaxSettings.xhr();
11347
-
11348
- support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
11349
- support.ajax = xhrSupported = !!xhrSupported;
11350
-
11351
- jQuery.ajaxTransport( function( options ) {
11352
- var callback, errorCallback;
11353
-
11354
- // Cross domain only allowed if supported through XMLHttpRequest
11355
- if ( support.cors || xhrSupported && !options.crossDomain ) {
11356
- return {
11357
- send: function( headers, complete ) {
11358
- var i,
11359
- xhr = options.xhr();
11360
-
11361
- xhr.open(
11362
- options.type,
11363
- options.url,
11364
- options.async,
11365
- options.username,
11366
- options.password
11367
- );
11368
-
11369
- // Apply custom fields if provided
11370
- if ( options.xhrFields ) {
11371
- for ( i in options.xhrFields ) {
11372
- xhr[ i ] = options.xhrFields[ i ];
11373
- }
11374
- }
11375
-
11376
- // Override mime type if needed
11377
- if ( options.mimeType && xhr.overrideMimeType ) {
11378
- xhr.overrideMimeType( options.mimeType );
11379
- }
11380
-
11381
- // X-Requested-With header
11382
- // For cross-domain requests, seeing as conditions for a preflight are
11383
- // akin to a jigsaw puzzle, we simply never set it to be sure.
11384
- // (it can always be set on a per-request basis or even using ajaxSetup)
11385
- // For same-domain requests, won't change header if already provided.
11386
- if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
11387
- headers[ "X-Requested-With" ] = "XMLHttpRequest";
11388
- }
11389
-
11390
- // Set headers
11391
- for ( i in headers ) {
11392
- xhr.setRequestHeader( i, headers[ i ] );
11393
- }
11394
-
11395
- // Callback
11396
- callback = function( type ) {
11397
- return function() {
11398
- if ( callback ) {
11399
- callback = errorCallback = xhr.onload =
11400
- xhr.onerror = xhr.onabort = xhr.onreadystatechange = null;
11401
-
11402
- if ( type === "abort" ) {
11403
- xhr.abort();
11404
- } else if ( type === "error" ) {
11405
-
11406
- // Support: IE <=9 only
11407
- // On a manual native abort, IE9 throws
11408
- // errors on any property access that is not readyState
11409
- if ( typeof xhr.status !== "number" ) {
11410
- complete( 0, "error" );
11411
- } else {
11412
- complete(
11413
-
11414
- // File: protocol always yields status 0; see #8605, #14207
11415
- xhr.status,
11416
- xhr.statusText
11417
- );
11418
- }
11419
- } else {
11420
- complete(
11421
- xhrSuccessStatus[ xhr.status ] || xhr.status,
11422
- xhr.statusText,
11423
-
11424
- // Support: IE <=9 only
11425
- // IE9 has no XHR2 but throws on binary (trac-11426)
11426
- // For XHR2 non-text, let the caller handle it (gh-2498)
11427
- ( xhr.responseType || "text" ) !== "text" ||
11428
- typeof xhr.responseText !== "string" ?
11429
- { binary: xhr.response } :
11430
- { text: xhr.responseText },
11431
- xhr.getAllResponseHeaders()
11432
- );
11433
- }
11434
- }
11435
- };
11436
- };
11437
-
11438
- // Listen to events
11439
- xhr.onload = callback();
11440
- errorCallback = xhr.onerror = callback( "error" );
11441
-
11442
- // Support: IE 9 only
11443
- // Use onreadystatechange to replace onabort
11444
- // to handle uncaught aborts
11445
- if ( xhr.onabort !== undefined ) {
11446
- xhr.onabort = errorCallback;
11447
- } else {
11448
- xhr.onreadystatechange = function() {
11449
-
11450
- // Check readyState before timeout as it changes
11451
- if ( xhr.readyState === 4 ) {
11452
-
11453
- // Allow onerror to be called first,
11454
- // but that will not handle a native abort
11455
- // Also, save errorCallback to a variable
11456
- // as xhr.onerror cannot be accessed
11457
- window.setTimeout( function() {
11458
- if ( callback ) {
11459
- errorCallback();
11460
- }
11461
- } );
11462
- }
11463
- };
11464
- }
11465
-
11466
- // Create the abort callback
11467
- callback = callback( "abort" );
11468
-
11469
- try {
11470
-
11471
- // Do send the request (this may raise an exception)
11472
- xhr.send( options.hasContent && options.data || null );
11473
- } catch ( e ) {
11474
-
11475
- // #14683: Only rethrow if this hasn't been notified as an error yet
11476
- if ( callback ) {
11477
- throw e;
11478
- }
11479
- }
11480
- },
11481
-
11482
- abort: function() {
11483
- if ( callback ) {
11484
- callback();
11485
- }
11486
- }
11487
- };
11488
- }
11489
- } );
11490
-
11491
-
11492
-
11493
-
11494
- // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
11495
- jQuery.ajaxPrefilter( function( s ) {
11496
- if ( s.crossDomain ) {
11497
- s.contents.script = false;
11498
- }
11499
- } );
11500
-
11501
- // Install script dataType
11502
- jQuery.ajaxSetup( {
11503
- accepts: {
11504
- script: "text/javascript, application/javascript, " +
11505
- "application/ecmascript, application/x-ecmascript"
11506
- },
11507
- contents: {
11508
- script: /\b(?:java|ecma)script\b/
11509
- },
11510
- converters: {
11511
- "text script": function( text ) {
11512
- jQuery.globalEval( text );
11513
- return text;
11514
- }
11515
- }
11516
- } );
11517
-
11518
- // Handle cache's special case and crossDomain
11519
- jQuery.ajaxPrefilter( "script", function( s ) {
11520
- if ( s.cache === undefined ) {
11521
- s.cache = false;
11522
- }
11523
- if ( s.crossDomain ) {
11524
- s.type = "GET";
11525
- }
11526
- } );
11527
-
11528
- // Bind script tag hack transport
11529
- jQuery.ajaxTransport( "script", function( s ) {
11530
-
11531
- // This transport only deals with cross domain requests
11532
- if ( s.crossDomain ) {
11533
- var script, callback;
11534
- return {
11535
- send: function( _, complete ) {
11536
- script = jQuery( "<script>" ).prop( {
11537
- charset: s.scriptCharset,
11538
- src: s.url
11539
- } ).on(
11540
- "load error",
11541
- callback = function( evt ) {
11542
- script.remove();
11543
- callback = null;
11544
- if ( evt ) {
11545
- complete( evt.type === "error" ? 404 : 200, evt.type );
11546
- }
11547
- }
11548
- );
11549
-
11550
- // Use native DOM manipulation to avoid our domManip AJAX trickery
11551
- document.head.appendChild( script[ 0 ] );
11552
- },
11553
- abort: function() {
11554
- if ( callback ) {
11555
- callback();
11556
- }
11557
- }
11558
- };
11559
- }
11560
- } );
11561
-
11562
-
11563
-
11564
-
11565
- var oldCallbacks = [],
11566
- rjsonp = /(=)\?(?=&|$)|\?\?/;
11567
-
11568
- // Default jsonp settings
11569
- jQuery.ajaxSetup( {
11570
- jsonp: "callback",
11571
- jsonpCallback: function() {
11572
- var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
11573
- this[ callback ] = true;
11574
- return callback;
11575
- }
11576
- } );
11577
-
11578
- // Detect, normalize options and install callbacks for jsonp requests
11579
- jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
11580
-
11581
- var callbackName, overwritten, responseContainer,
11582
- jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
11583
- "url" :
11584
- typeof s.data === "string" &&
11585
- ( s.contentType || "" )
11586
- .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
11587
- rjsonp.test( s.data ) && "data"
11588
- );
11589
-
11590
- // Handle iff the expected data type is "jsonp" or we have a parameter to set
11591
- if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
11592
-
11593
- // Get callback name, remembering preexisting value associated with it
11594
- callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
11595
- s.jsonpCallback() :
11596
- s.jsonpCallback;
11597
-
11598
- // Insert callback into url or form data
11599
- if ( jsonProp ) {
11600
- s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
11601
- } else if ( s.jsonp !== false ) {
11602
- s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
11603
- }
11604
-
11605
- // Use data converter to retrieve json after script execution
11606
- s.converters[ "script json" ] = function() {
11607
- if ( !responseContainer ) {
11608
- jQuery.error( callbackName + " was not called" );
11609
- }
11610
- return responseContainer[ 0 ];
11611
- };
11612
-
11613
- // Force json dataType
11614
- s.dataTypes[ 0 ] = "json";
11615
-
11616
- // Install callback
11617
- overwritten = window[ callbackName ];
11618
- window[ callbackName ] = function() {
11619
- responseContainer = arguments;
11620
- };
11621
-
11622
- // Clean-up function (fires after converters)
11623
- jqXHR.always( function() {
11624
-
11625
- // If previous value didn't exist - remove it
11626
- if ( overwritten === undefined ) {
11627
- jQuery( window ).removeProp( callbackName );
11628
-
11629
- // Otherwise restore preexisting value
11630
- } else {
11631
- window[ callbackName ] = overwritten;
11632
- }
11633
-
11634
- // Save back as free
11635
- if ( s[ callbackName ] ) {
11636
-
11637
- // Make sure that re-using the options doesn't screw things around
11638
- s.jsonpCallback = originalSettings.jsonpCallback;
11639
-
11640
- // Save the callback name for future use
11641
- oldCallbacks.push( callbackName );
11642
- }
11643
-
11644
- // Call if it was a function and we have a response
11645
- if ( responseContainer && jQuery.isFunction( overwritten ) ) {
11646
- overwritten( responseContainer[ 0 ] );
11647
- }
11648
-
11649
- responseContainer = overwritten = undefined;
11650
- } );
11651
-
11652
- // Delegate to script
11653
- return "script";
11654
- }
11655
- } );
11656
-
11657
-
11658
-
11659
-
11660
- // Support: Safari 8 only
11661
- // In Safari 8 documents created via document.implementation.createHTMLDocument
11662
- // collapse sibling forms: the second one becomes a child of the first one.
11663
- // Because of that, this security measure has to be disabled in Safari 8.
11664
- // https://bugs.webkit.org/show_bug.cgi?id=137337
11665
- support.createHTMLDocument = ( function() {
11666
- var body = document.implementation.createHTMLDocument( "" ).body;
11667
- body.innerHTML = "<form></form><form></form>";
11668
- return body.childNodes.length === 2;
11669
- } )();
11670
-
11671
-
11672
- // Argument "data" should be string of html
11673
- // context (optional): If specified, the fragment will be created in this context,
11674
- // defaults to document
11675
- // keepScripts (optional): If true, will include scripts passed in the html string
11676
- jQuery.parseHTML = function( data, context, keepScripts ) {
11677
- if ( typeof data !== "string" ) {
11678
- return [];
11679
- }
11680
- if ( typeof context === "boolean" ) {
11681
- keepScripts = context;
11682
- context = false;
11683
- }
11684
-
11685
- var base, parsed, scripts;
11686
-
11687
- if ( !context ) {
11688
-
11689
- // Stop scripts or inline event handlers from being executed immediately
11690
- // by using document.implementation
11691
- if ( support.createHTMLDocument ) {
11692
- context = document.implementation.createHTMLDocument( "" );
11693
-
11694
- // Set the base href for the created document
11695
- // so any parsed elements with URLs
11696
- // are based on the document's URL (gh-2965)
11697
- base = context.createElement( "base" );
11698
- base.href = document.location.href;
11699
- context.head.appendChild( base );
11700
- } else {
11701
- context = document;
11702
- }
11703
- }
11704
-
11705
- parsed = rsingleTag.exec( data );
11706
- scripts = !keepScripts && [];
11707
-
11708
- // Single tag
11709
- if ( parsed ) {
11710
- return [ context.createElement( parsed[ 1 ] ) ];
11711
- }
11712
-
11713
- parsed = buildFragment( [ data ], context, scripts );
11714
-
11715
- if ( scripts && scripts.length ) {
11716
- jQuery( scripts ).remove();
11717
- }
11718
-
11719
- return jQuery.merge( [], parsed.childNodes );
11720
- };
11721
-
11722
-
11723
- /**
11724
- * Load a url into a page
11725
- */
11726
- jQuery.fn.load = function( url, params, callback ) {
11727
- var selector, type, response,
11728
- self = this,
11729
- off = url.indexOf( " " );
11730
-
11731
- if ( off > -1 ) {
11732
- selector = stripAndCollapse( url.slice( off ) );
11733
- url = url.slice( 0, off );
11734
- }
11735
-
11736
- // If it's a function
11737
- if ( jQuery.isFunction( params ) ) {
11738
-
11739
- // We assume that it's the callback
11740
- callback = params;
11741
- params = undefined;
11742
-
11743
- // Otherwise, build a param string
11744
- } else if ( params && typeof params === "object" ) {
11745
- type = "POST";
11746
- }
11747
-
11748
- // If we have elements to modify, make the request
11749
- if ( self.length > 0 ) {
11750
- jQuery.ajax( {
11751
- url: url,
11752
-
11753
- // If "type" variable is undefined, then "GET" method will be used.
11754
- // Make value of this field explicit since
11755
- // user can override it through ajaxSetup method
11756
- type: type || "GET",
11757
- dataType: "html",
11758
- data: params
11759
- } ).done( function( responseText ) {
11760
-
11761
- // Save response for use in complete callback
11762
- response = arguments;
11763
-
11764
- self.html( selector ?
11765
-
11766
- // If a selector was specified, locate the right elements in a dummy div
11767
- // Exclude scripts to avoid IE 'Permission Denied' errors
11768
- jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
11769
-
11770
- // Otherwise use the full result
11771
- responseText );
11772
-
11773
- // If the request succeeds, this function gets "data", "status", "jqXHR"
11774
- // but they are ignored because response was set above.
11775
- // If it fails, this function gets "jqXHR", "status", "error"
11776
- } ).always( callback && function( jqXHR, status ) {
11777
- self.each( function() {
11778
- callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
11779
- } );
11780
- } );
11781
- }
11782
-
11783
- return this;
11784
- };
11785
-
11786
-
11787
-
11788
-
11789
- // Attach a bunch of functions for handling common AJAX events
11790
- jQuery.each( [
11791
- "ajaxStart",
11792
- "ajaxStop",
11793
- "ajaxComplete",
11794
- "ajaxError",
11795
- "ajaxSuccess",
11796
- "ajaxSend"
11797
- ], function( i, type ) {
11798
- jQuery.fn[ type ] = function( fn ) {
11799
- return this.on( type, fn );
11800
- };
11801
- } );
11802
-
11803
-
11804
-
11805
-
11806
- jQuery.expr.pseudos.animated = function( elem ) {
11807
- return jQuery.grep( jQuery.timers, function( fn ) {
11808
- return elem === fn.elem;
11809
- } ).length;
11810
- };
11811
-
11812
-
11813
-
11814
-
11815
- /**
11816
- * Gets a window from an element
11817
- */
11818
- function getWindow( elem ) {
11819
- return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
11820
- }
11821
-
11822
- jQuery.offset = {
11823
- setOffset: function( elem, options, i ) {
11824
- var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
11825
- position = jQuery.css( elem, "position" ),
11826
- curElem = jQuery( elem ),
11827
- props = {};
11828
-
11829
- // Set position first, in-case top/left are set even on static elem
11830
- if ( position === "static" ) {
11831
- elem.style.position = "relative";
11832
- }
11833
-
11834
- curOffset = curElem.offset();
11835
- curCSSTop = jQuery.css( elem, "top" );
11836
- curCSSLeft = jQuery.css( elem, "left" );
11837
- calculatePosition = ( position === "absolute" || position === "fixed" ) &&
11838
- ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
11839
-
11840
- // Need to be able to calculate position if either
11841
- // top or left is auto and position is either absolute or fixed
11842
- if ( calculatePosition ) {
11843
- curPosition = curElem.position();
11844
- curTop = curPosition.top;
11845
- curLeft = curPosition.left;
11846
-
11847
- } else {
11848
- curTop = parseFloat( curCSSTop ) || 0;
11849
- curLeft = parseFloat( curCSSLeft ) || 0;
11850
- }
11851
-
11852
- if ( jQuery.isFunction( options ) ) {
11853
-
11854
- // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
11855
- options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
11856
- }
11857
-
11858
- if ( options.top != null ) {
11859
- props.top = ( options.top - curOffset.top ) + curTop;
11860
- }
11861
- if ( options.left != null ) {
11862
- props.left = ( options.left - curOffset.left ) + curLeft;
11863
- }
11864
-
11865
- if ( "using" in options ) {
11866
- options.using.call( elem, props );
11867
-
11868
- } else {
11869
- curElem.css( props );
11870
- }
11871
- }
11872
- };
11873
-
11874
- jQuery.fn.extend( {
11875
- offset: function( options ) {
11876
-
11877
- // Preserve chaining for setter
11878
- if ( arguments.length ) {
11879
- return options === undefined ?
11880
- this :
11881
- this.each( function( i ) {
11882
- jQuery.offset.setOffset( this, options, i );
11883
- } );
11884
- }
11885
-
11886
- var docElem, win, rect, doc,
11887
- elem = this[ 0 ];
11888
-
11889
- if ( !elem ) {
11890
- return;
11891
- }
11892
-
11893
- // Support: IE <=11 only
11894
- // Running getBoundingClientRect on a
11895
- // disconnected node in IE throws an error
11896
- if ( !elem.getClientRects().length ) {
11897
- return { top: 0, left: 0 };
11898
- }
11899
-
11900
- rect = elem.getBoundingClientRect();
11901
-
11902
- // Make sure element is not hidden (display: none)
11903
- if ( rect.width || rect.height ) {
11904
- doc = elem.ownerDocument;
11905
- win = getWindow( doc );
11906
- docElem = doc.documentElement;
11907
-
11908
- return {
11909
- top: rect.top + win.pageYOffset - docElem.clientTop,
11910
- left: rect.left + win.pageXOffset - docElem.clientLeft
11911
- };
11912
- }
11913
-
11914
- // Return zeros for disconnected and hidden elements (gh-2310)
11915
- return rect;
11916
- },
11917
-
11918
- position: function() {
11919
- if ( !this[ 0 ] ) {
11920
- return;
11921
- }
11922
-
11923
- var offsetParent, offset,
11924
- elem = this[ 0 ],
11925
- parentOffset = { top: 0, left: 0 };
11926
-
11927
- // Fixed elements are offset from window (parentOffset = {top:0, left: 0},
11928
- // because it is its only offset parent
11929
- if ( jQuery.css( elem, "position" ) === "fixed" ) {
11930
-
11931
- // Assume getBoundingClientRect is there when computed position is fixed
11932
- offset = elem.getBoundingClientRect();
11933
-
11934
- } else {
11935
-
11936
- // Get *real* offsetParent
11937
- offsetParent = this.offsetParent();
11938
-
11939
- // Get correct offsets
11940
- offset = this.offset();
11941
- if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
11942
- parentOffset = offsetParent.offset();
11943
- }
11944
-
11945
- // Add offsetParent borders
11946
- parentOffset = {
11947
- top: parentOffset.top + jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ),
11948
- left: parentOffset.left + jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true )
11949
- };
11950
- }
11951
-
11952
- // Subtract parent offsets and element margins
11953
- return {
11954
- top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
11955
- left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
11956
- };
11957
- },
11958
-
11959
- // This method will return documentElement in the following cases:
11960
- // 1) For the element inside the iframe without offsetParent, this method will return
11961
- // documentElement of the parent window
11962
- // 2) For the hidden or detached element
11963
- // 3) For body or html element, i.e. in case of the html node - it will return itself
11964
- //
11965
- // but those exceptions were never presented as a real life use-cases
11966
- // and might be considered as more preferable results.
11967
- //
11968
- // This logic, however, is not guaranteed and can change at any point in the future
11969
- offsetParent: function() {
11970
- return this.map( function() {
11971
- var offsetParent = this.offsetParent;
11972
-
11973
- while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
11974
- offsetParent = offsetParent.offsetParent;
11975
- }
11976
-
11977
- return offsetParent || documentElement;
11978
- } );
11979
- }
11980
- } );
11981
-
11982
- // Create scrollLeft and scrollTop methods
11983
- jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
11984
- var top = "pageYOffset" === prop;
11985
-
11986
- jQuery.fn[ method ] = function( val ) {
11987
- return access( this, function( elem, method, val ) {
11988
- var win = getWindow( elem );
11989
-
11990
- if ( val === undefined ) {
11991
- return win ? win[ prop ] : elem[ method ];
11992
- }
11993
-
11994
- if ( win ) {
11995
- win.scrollTo(
11996
- !top ? val : win.pageXOffset,
11997
- top ? val : win.pageYOffset
11998
- );
11999
-
12000
- } else {
12001
- elem[ method ] = val;
12002
- }
12003
- }, method, val, arguments.length );
12004
- };
12005
- } );
12006
-
12007
- // Support: Safari <=7 - 9.1, Chrome <=37 - 49
12008
- // Add the top/left cssHooks using jQuery.fn.position
12009
- // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
12010
- // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
12011
- // getComputedStyle returns percent when specified for top/left/bottom/right;
12012
- // rather than make the css module depend on the offset module, just check for it here
12013
- jQuery.each( [ "top", "left" ], function( i, prop ) {
12014
- jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
12015
- function( elem, computed ) {
12016
- if ( computed ) {
12017
- computed = curCSS( elem, prop );
12018
-
12019
- // If curCSS returns percentage, fallback to offset
12020
- return rnumnonpx.test( computed ) ?
12021
- jQuery( elem ).position()[ prop ] + "px" :
12022
- computed;
12023
- }
12024
- }
12025
- );
12026
- } );
12027
-
12028
-
12029
- // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
12030
- jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
12031
- jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
12032
- function( defaultExtra, funcName ) {
12033
-
12034
- // Margin is only for outerHeight, outerWidth
12035
- jQuery.fn[ funcName ] = function( margin, value ) {
12036
- var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
12037
- extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
12038
-
12039
- return access( this, function( elem, type, value ) {
12040
- var doc;
12041
-
12042
- if ( jQuery.isWindow( elem ) ) {
12043
-
12044
- // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
12045
- return funcName.indexOf( "outer" ) === 0 ?
12046
- elem[ "inner" + name ] :
12047
- elem.document.documentElement[ "client" + name ];
12048
- }
12049
-
12050
- // Get document width or height
12051
- if ( elem.nodeType === 9 ) {
12052
- doc = elem.documentElement;
12053
-
12054
- // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
12055
- // whichever is greatest
12056
- return Math.max(
12057
- elem.body[ "scroll" + name ], doc[ "scroll" + name ],
12058
- elem.body[ "offset" + name ], doc[ "offset" + name ],
12059
- doc[ "client" + name ]
12060
- );
12061
- }
12062
-
12063
- return value === undefined ?
12064
-
12065
- // Get width or height on the element, requesting but not forcing parseFloat
12066
- jQuery.css( elem, type, extra ) :
12067
-
12068
- // Set width or height on the element
12069
- jQuery.style( elem, type, value, extra );
12070
- }, type, chainable ? margin : undefined, chainable );
12071
- };
12072
- } );
12073
- } );
12074
-
12075
-
12076
- jQuery.fn.extend( {
12077
-
12078
- bind: function( types, data, fn ) {
12079
- return this.on( types, null, data, fn );
12080
- },
12081
- unbind: function( types, fn ) {
12082
- return this.off( types, null, fn );
12083
- },
12084
-
12085
- delegate: function( selector, types, data, fn ) {
12086
- return this.on( types, selector, data, fn );
12087
- },
12088
- undelegate: function( selector, types, fn ) {
12089
-
12090
- // ( namespace ) or ( selector, types [, fn] )
12091
- return arguments.length === 1 ?
12092
- this.off( selector, "**" ) :
12093
- this.off( types, selector || "**", fn );
12094
- }
12095
- } );
12096
-
12097
- jQuery.parseJSON = JSON.parse;
12098
-
12099
-
12100
-
12101
-
12102
- // Register as a named AMD module, since jQuery can be concatenated with other
12103
- // files that may use define, but not via a proper concatenation script that
12104
- // understands anonymous AMD modules. A named AMD is safest and most robust
12105
- // way to register. Lowercase jquery is used because AMD module names are
12106
- // derived from file names, and jQuery is normally delivered in a lowercase
12107
- // file name. Do this after creating the global so that if an AMD module wants
12108
- // to call noConflict to hide this version of jQuery, it will work.
12109
-
12110
- // Note that for maximum portability, libraries that are not jQuery should
12111
- // declare themselves as anonymous modules, and avoid setting a global if an
12112
- // AMD loader is present. jQuery is a special case. For more information, see
12113
- // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
12114
-
12115
- if ( typeof define === "function" && define.amd ) {
12116
- define( "jquery", [], function() {
12117
- return jQuery;
12118
- } );
12119
- }
12120
-
12121
-
12122
-
12123
-
12124
- var
12125
-
12126
- // Map over jQuery in case of overwrite
12127
- _jQuery = window.jQuery,
12128
-
12129
- // Map over the $ in case of overwrite
12130
- _$ = window.$;
12131
-
12132
- jQuery.noConflict = function( deep ) {
12133
- if ( window.$ === jQuery ) {
12134
- window.$ = _$;
12135
- }
12136
-
12137
- if ( deep && window.jQuery === jQuery ) {
12138
- window.jQuery = _jQuery;
12139
- }
12140
-
12141
- return jQuery;
12142
- };
12143
-
12144
- // Expose jQuery and $ identifiers, even in AMD
12145
- // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
12146
- // and CommonJS for browser emulators (#13566)
12147
- if ( !noGlobal ) {
12148
- window.jQuery = window.$ = jQuery;
12149
- }
12150
-
12151
-
12152
-
12153
-
12154
-
12155
- return jQuery;
12156
- } );
12157
-
12158
- },{}],31:[function(require,module,exports){
12159
- // shim for using process in browser
12160
- var process = module.exports = {};
12161
-
12162
- // cached from whatever global is present so that test runners that stub it
12163
- // don't break things. But we need to wrap it in a try catch in case it is
12164
- // wrapped in strict mode code which doesn't define any globals. It's inside a
12165
- // function because try/catches deoptimize in certain engines.
12166
-
12167
- var cachedSetTimeout;
12168
- var cachedClearTimeout;
12169
-
12170
- function defaultSetTimout() {
12171
- throw new Error('setTimeout has not been defined');
12172
- }
12173
- function defaultClearTimeout () {
12174
- throw new Error('clearTimeout has not been defined');
12175
- }
12176
- (function () {
12177
- try {
12178
- if (typeof setTimeout === 'function') {
12179
- cachedSetTimeout = setTimeout;
12180
- } else {
12181
- cachedSetTimeout = defaultSetTimout;
12182
- }
12183
- } catch (e) {
12184
- cachedSetTimeout = defaultSetTimout;
12185
- }
12186
- try {
12187
- if (typeof clearTimeout === 'function') {
12188
- cachedClearTimeout = clearTimeout;
12189
- } else {
12190
- cachedClearTimeout = defaultClearTimeout;
12191
- }
12192
- } catch (e) {
12193
- cachedClearTimeout = defaultClearTimeout;
12194
- }
12195
- } ())
12196
- function runTimeout(fun) {
12197
- if (cachedSetTimeout === setTimeout) {
12198
- //normal enviroments in sane situations
12199
- return setTimeout(fun, 0);
12200
- }
12201
- // if setTimeout wasn't available but was latter defined
12202
- if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
12203
- cachedSetTimeout = setTimeout;
12204
- return setTimeout(fun, 0);
12205
- }
12206
- try {
12207
- // when when somebody has screwed with setTimeout but no I.E. maddness
12208
- return cachedSetTimeout(fun, 0);
12209
- } catch(e){
12210
- try {
12211
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
12212
- return cachedSetTimeout.call(null, fun, 0);
12213
- } catch(e){
12214
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
12215
- return cachedSetTimeout.call(this, fun, 0);
12216
- }
12217
- }
12218
-
12219
-
12220
- }
12221
- function runClearTimeout(marker) {
12222
- if (cachedClearTimeout === clearTimeout) {
12223
- //normal enviroments in sane situations
12224
- return clearTimeout(marker);
12225
- }
12226
- // if clearTimeout wasn't available but was latter defined
12227
- if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
12228
- cachedClearTimeout = clearTimeout;
12229
- return clearTimeout(marker);
12230
- }
12231
- try {
12232
- // when when somebody has screwed with setTimeout but no I.E. maddness
12233
- return cachedClearTimeout(marker);
12234
- } catch (e){
12235
- try {
12236
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
12237
- return cachedClearTimeout.call(null, marker);
12238
- } catch (e){
12239
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
12240
- // Some versions of I.E. have different rules for clearTimeout vs setTimeout
12241
- return cachedClearTimeout.call(this, marker);
12242
- }
12243
- }
12244
-
12245
-
12246
-
12247
- }
12248
- var queue = [];
12249
- var draining = false;
12250
- var currentQueue;
12251
- var queueIndex = -1;
12252
-
12253
- function cleanUpNextTick() {
12254
- if (!draining || !currentQueue) {
12255
- return;
12256
- }
12257
- draining = false;
12258
- if (currentQueue.length) {
12259
- queue = currentQueue.concat(queue);
12260
- } else {
12261
- queueIndex = -1;
12262
- }
12263
- if (queue.length) {
12264
- drainQueue();
12265
- }
12266
- }
12267
-
12268
- function drainQueue() {
12269
- if (draining) {
12270
- return;
12271
- }
12272
- var timeout = runTimeout(cleanUpNextTick);
12273
- draining = true;
12274
-
12275
- var len = queue.length;
12276
- while(len) {
12277
- currentQueue = queue;
12278
- queue = [];
12279
- while (++queueIndex < len) {
12280
- if (currentQueue) {
12281
- currentQueue[queueIndex].run();
12282
- }
12283
- }
12284
- queueIndex = -1;
12285
- len = queue.length;
12286
- }
12287
- currentQueue = null;
12288
- draining = false;
12289
- runClearTimeout(timeout);
12290
- }
12291
-
12292
- process.nextTick = function (fun) {
12293
- var args = new Array(arguments.length - 1);
12294
- if (arguments.length > 1) {
12295
- for (var i = 1; i < arguments.length; i++) {
12296
- args[i - 1] = arguments[i];
12297
- }
12298
- }
12299
- queue.push(new Item(fun, args));
12300
- if (queue.length === 1 && !draining) {
12301
- runTimeout(drainQueue);
12302
- }
12303
- };
12304
-
12305
- // v8 likes predictible objects
12306
- function Item(fun, array) {
12307
- this.fun = fun;
12308
- this.array = array;
12309
- }
12310
- Item.prototype.run = function () {
12311
- this.fun.apply(null, this.array);
12312
- };
12313
- process.title = 'browser';
12314
- process.browser = true;
12315
- process.env = {};
12316
- process.argv = [];
12317
- process.version = ''; // empty string to avoid regexp issues
12318
- process.versions = {};
12319
-
12320
- function noop() {}
12321
-
12322
- process.on = noop;
12323
- process.addListener = noop;
12324
- process.once = noop;
12325
- process.off = noop;
12326
- process.removeListener = noop;
12327
- process.removeAllListeners = noop;
12328
- process.emit = noop;
12329
-
12330
- process.binding = function (name) {
12331
- throw new Error('process.binding is not supported');
12332
- };
12333
-
12334
- process.cwd = function () { return '/' };
12335
- process.chdir = function (dir) {
12336
- throw new Error('process.chdir is not supported');
12337
- };
12338
- process.umask = function() { return 0; };
12339
-
12340
- },{}],32:[function(require,module,exports){
12341
- 'use strict';
12342
-
12343
- module.exports = require('react/lib/ReactDOM');
12344
-
12345
- },{"react/lib/ReactDOM":67}],33:[function(require,module,exports){
12346
- /**
12347
- * Copyright 2013-2015, Facebook, Inc.
12348
- * All rights reserved.
12349
- *
12350
- * This source code is licensed under the BSD-style license found in the
12351
- * LICENSE file in the root directory of this source tree. An additional grant
12352
- * of patent rights can be found in the PATENTS file in the same directory.
12353
- *
12354
- * @providesModule AutoFocusUtils
12355
- * @typechecks static-only
12356
- */
12357
-
12358
- 'use strict';
12359
-
12360
- var ReactMount = require('./ReactMount');
12361
-
12362
- var findDOMNode = require('./findDOMNode');
12363
- var focusNode = require('fbjs/lib/focusNode');
12364
-
12365
- var Mixin = {
12366
- componentDidMount: function () {
12367
- if (this.props.autoFocus) {
12368
- focusNode(findDOMNode(this));
12369
- }
12370
- }
12371
- };
12372
-
12373
- var AutoFocusUtils = {
12374
- Mixin: Mixin,
12375
-
12376
- focusDOMComponent: function () {
12377
- focusNode(ReactMount.getNode(this._rootNodeID));
12378
- }
12379
- };
12380
-
12381
- module.exports = AutoFocusUtils;
12382
- },{"./ReactMount":97,"./findDOMNode":140,"fbjs/lib/focusNode":12}],34:[function(require,module,exports){
12383
- /**
12384
- * Copyright 2013-2015 Facebook, Inc.
12385
- * All rights reserved.
12386
- *
12387
- * This source code is licensed under the BSD-style license found in the
12388
- * LICENSE file in the root directory of this source tree. An additional grant
12389
- * of patent rights can be found in the PATENTS file in the same directory.
12390
- *
12391
- * @providesModule BeforeInputEventPlugin
12392
- * @typechecks static-only
12393
- */
12394
-
12395
- 'use strict';
12396
-
12397
- var EventConstants = require('./EventConstants');
12398
- var EventPropagators = require('./EventPropagators');
12399
- var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
12400
- var FallbackCompositionState = require('./FallbackCompositionState');
12401
- var SyntheticCompositionEvent = require('./SyntheticCompositionEvent');
12402
- var SyntheticInputEvent = require('./SyntheticInputEvent');
12403
-
12404
- var keyOf = require('fbjs/lib/keyOf');
12405
-
12406
- var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
12407
- var START_KEYCODE = 229;
12408
-
12409
- var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window;
12410
-
12411
- var documentMode = null;
12412
- if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
12413
- documentMode = document.documentMode;
12414
- }
12415
-
12416
- // Webkit offers a very useful `textInput` event that can be used to
12417
- // directly represent `beforeInput`. The IE `textinput` event is not as
12418
- // useful, so we don't use it.
12419
- var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto();
12420
-
12421
- // In IE9+, we have access to composition events, but the data supplied
12422
- // by the native compositionend event may be incorrect. Japanese ideographic
12423
- // spaces, for instance (\u3000) are not recorded correctly.
12424
- var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
12425
-
12426
- /**
12427
- * Opera <= 12 includes TextEvent in window, but does not fire
12428
- * text input events. Rely on keypress instead.
12429
- */
12430
- function isPresto() {
12431
- var opera = window.opera;
12432
- return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
12433
- }
12434
-
12435
- var SPACEBAR_CODE = 32;
12436
- var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
12437
-
12438
- var topLevelTypes = EventConstants.topLevelTypes;
12439
-
12440
- // Events and their corresponding property names.
12441
- var eventTypes = {
12442
- beforeInput: {
12443
- phasedRegistrationNames: {
12444
- bubbled: keyOf({ onBeforeInput: null }),
12445
- captured: keyOf({ onBeforeInputCapture: null })
12446
- },
12447
- dependencies: [topLevelTypes.topCompositionEnd, topLevelTypes.topKeyPress, topLevelTypes.topTextInput, topLevelTypes.topPaste]
12448
- },
12449
- compositionEnd: {
12450
- phasedRegistrationNames: {
12451
- bubbled: keyOf({ onCompositionEnd: null }),
12452
- captured: keyOf({ onCompositionEndCapture: null })
12453
- },
12454
- dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionEnd, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
12455
- },
12456
- compositionStart: {
12457
- phasedRegistrationNames: {
12458
- bubbled: keyOf({ onCompositionStart: null }),
12459
- captured: keyOf({ onCompositionStartCapture: null })
12460
- },
12461
- dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionStart, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
12462
- },
12463
- compositionUpdate: {
12464
- phasedRegistrationNames: {
12465
- bubbled: keyOf({ onCompositionUpdate: null }),
12466
- captured: keyOf({ onCompositionUpdateCapture: null })
12467
- },
12468
- dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionUpdate, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
12469
- }
12470
- };
12471
-
12472
- // Track whether we've ever handled a keypress on the space key.
12473
- var hasSpaceKeypress = false;
12474
-
12475
- /**
12476
- * Return whether a native keypress event is assumed to be a command.
12477
- * This is required because Firefox fires `keypress` events for key commands
12478
- * (cut, copy, select-all, etc.) even though no character is inserted.
12479
- */
12480
- function isKeypressCommand(nativeEvent) {
12481
- return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
12482
- // ctrlKey && altKey is equivalent to AltGr, and is not a command.
12483
- !(nativeEvent.ctrlKey && nativeEvent.altKey);
12484
- }
12485
-
12486
- /**
12487
- * Translate native top level events into event types.
12488
- *
12489
- * @param {string} topLevelType
12490
- * @return {object}
12491
- */
12492
- function getCompositionEventType(topLevelType) {
12493
- switch (topLevelType) {
12494
- case topLevelTypes.topCompositionStart:
12495
- return eventTypes.compositionStart;
12496
- case topLevelTypes.topCompositionEnd:
12497
- return eventTypes.compositionEnd;
12498
- case topLevelTypes.topCompositionUpdate:
12499
- return eventTypes.compositionUpdate;
12500
- }
12501
- }
12502
-
12503
- /**
12504
- * Does our fallback best-guess model think this event signifies that
12505
- * composition has begun?
12506
- *
12507
- * @param {string} topLevelType
12508
- * @param {object} nativeEvent
12509
- * @return {boolean}
12510
- */
12511
- function isFallbackCompositionStart(topLevelType, nativeEvent) {
12512
- return topLevelType === topLevelTypes.topKeyDown && nativeEvent.keyCode === START_KEYCODE;
12513
- }
12514
-
12515
- /**
12516
- * Does our fallback mode think that this event is the end of composition?
12517
- *
12518
- * @param {string} topLevelType
12519
- * @param {object} nativeEvent
12520
- * @return {boolean}
12521
- */
12522
- function isFallbackCompositionEnd(topLevelType, nativeEvent) {
12523
- switch (topLevelType) {
12524
- case topLevelTypes.topKeyUp:
12525
- // Command keys insert or clear IME input.
12526
- return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
12527
- case topLevelTypes.topKeyDown:
12528
- // Expect IME keyCode on each keydown. If we get any other
12529
- // code we must have exited earlier.
12530
- return nativeEvent.keyCode !== START_KEYCODE;
12531
- case topLevelTypes.topKeyPress:
12532
- case topLevelTypes.topMouseDown:
12533
- case topLevelTypes.topBlur:
12534
- // Events are not possible without cancelling IME.
12535
- return true;
12536
- default:
12537
- return false;
12538
- }
12539
- }
12540
-
12541
- /**
12542
- * Google Input Tools provides composition data via a CustomEvent,
12543
- * with the `data` property populated in the `detail` object. If this
12544
- * is available on the event object, use it. If not, this is a plain
12545
- * composition event and we have nothing special to extract.
12546
- *
12547
- * @param {object} nativeEvent
12548
- * @return {?string}
12549
- */
12550
- function getDataFromCustomEvent(nativeEvent) {
12551
- var detail = nativeEvent.detail;
12552
- if (typeof detail === 'object' && 'data' in detail) {
12553
- return detail.data;
12554
- }
12555
- return null;
12556
- }
12557
-
12558
- // Track the current IME composition fallback object, if any.
12559
- var currentComposition = null;
12560
-
12561
- /**
12562
- * @param {string} topLevelType Record from `EventConstants`.
12563
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
12564
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
12565
- * @param {object} nativeEvent Native browser event.
12566
- * @return {?object} A SyntheticCompositionEvent.
12567
- */
12568
- function extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
12569
- var eventType;
12570
- var fallbackData;
12571
-
12572
- if (canUseCompositionEvent) {
12573
- eventType = getCompositionEventType(topLevelType);
12574
- } else if (!currentComposition) {
12575
- if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
12576
- eventType = eventTypes.compositionStart;
12577
- }
12578
- } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
12579
- eventType = eventTypes.compositionEnd;
12580
- }
12581
-
12582
- if (!eventType) {
12583
- return null;
12584
- }
12585
-
12586
- if (useFallbackCompositionData) {
12587
- // The current composition is stored statically and must not be
12588
- // overwritten while composition continues.
12589
- if (!currentComposition && eventType === eventTypes.compositionStart) {
12590
- currentComposition = FallbackCompositionState.getPooled(topLevelTarget);
12591
- } else if (eventType === eventTypes.compositionEnd) {
12592
- if (currentComposition) {
12593
- fallbackData = currentComposition.getData();
12594
- }
12595
- }
12596
- }
12597
-
12598
- var event = SyntheticCompositionEvent.getPooled(eventType, topLevelTargetID, nativeEvent, nativeEventTarget);
12599
-
12600
- if (fallbackData) {
12601
- // Inject data generated from fallback path into the synthetic event.
12602
- // This matches the property of native CompositionEventInterface.
12603
- event.data = fallbackData;
12604
- } else {
12605
- var customData = getDataFromCustomEvent(nativeEvent);
12606
- if (customData !== null) {
12607
- event.data = customData;
12608
- }
12609
- }
12610
-
12611
- EventPropagators.accumulateTwoPhaseDispatches(event);
12612
- return event;
12613
- }
12614
-
12615
- /**
12616
- * @param {string} topLevelType Record from `EventConstants`.
12617
- * @param {object} nativeEvent Native browser event.
12618
- * @return {?string} The string corresponding to this `beforeInput` event.
12619
- */
12620
- function getNativeBeforeInputChars(topLevelType, nativeEvent) {
12621
- switch (topLevelType) {
12622
- case topLevelTypes.topCompositionEnd:
12623
- return getDataFromCustomEvent(nativeEvent);
12624
- case topLevelTypes.topKeyPress:
12625
- /**
12626
- * If native `textInput` events are available, our goal is to make
12627
- * use of them. However, there is a special case: the spacebar key.
12628
- * In Webkit, preventing default on a spacebar `textInput` event
12629
- * cancels character insertion, but it *also* causes the browser
12630
- * to fall back to its default spacebar behavior of scrolling the
12631
- * page.
12632
- *
12633
- * Tracking at:
12634
- * https://code.google.com/p/chromium/issues/detail?id=355103
12635
- *
12636
- * To avoid this issue, use the keypress event as if no `textInput`
12637
- * event is available.
12638
- */
12639
- var which = nativeEvent.which;
12640
- if (which !== SPACEBAR_CODE) {
12641
- return null;
12642
- }
12643
-
12644
- hasSpaceKeypress = true;
12645
- return SPACEBAR_CHAR;
12646
-
12647
- case topLevelTypes.topTextInput:
12648
- // Record the characters to be added to the DOM.
12649
- var chars = nativeEvent.data;
12650
-
12651
- // If it's a spacebar character, assume that we have already handled
12652
- // it at the keypress level and bail immediately. Android Chrome
12653
- // doesn't give us keycodes, so we need to blacklist it.
12654
- if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
12655
- return null;
12656
- }
12657
-
12658
- return chars;
12659
-
12660
- default:
12661
- // For other native event types, do nothing.
12662
- return null;
12663
- }
12664
- }
12665
-
12666
- /**
12667
- * For browsers that do not provide the `textInput` event, extract the
12668
- * appropriate string to use for SyntheticInputEvent.
12669
- *
12670
- * @param {string} topLevelType Record from `EventConstants`.
12671
- * @param {object} nativeEvent Native browser event.
12672
- * @return {?string} The fallback string for this `beforeInput` event.
12673
- */
12674
- function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
12675
- // If we are currently composing (IME) and using a fallback to do so,
12676
- // try to extract the composed characters from the fallback object.
12677
- if (currentComposition) {
12678
- if (topLevelType === topLevelTypes.topCompositionEnd || isFallbackCompositionEnd(topLevelType, nativeEvent)) {
12679
- var chars = currentComposition.getData();
12680
- FallbackCompositionState.release(currentComposition);
12681
- currentComposition = null;
12682
- return chars;
12683
- }
12684
- return null;
12685
- }
12686
-
12687
- switch (topLevelType) {
12688
- case topLevelTypes.topPaste:
12689
- // If a paste event occurs after a keypress, throw out the input
12690
- // chars. Paste events should not lead to BeforeInput events.
12691
- return null;
12692
- case topLevelTypes.topKeyPress:
12693
- /**
12694
- * As of v27, Firefox may fire keypress events even when no character
12695
- * will be inserted. A few possibilities:
12696
- *
12697
- * - `which` is `0`. Arrow keys, Esc key, etc.
12698
- *
12699
- * - `which` is the pressed key code, but no char is available.
12700
- * Ex: 'AltGr + d` in Polish. There is no modified character for
12701
- * this key combination and no character is inserted into the
12702
- * document, but FF fires the keypress for char code `100` anyway.
12703
- * No `input` event will occur.
12704
- *
12705
- * - `which` is the pressed key code, but a command combination is
12706
- * being used. Ex: `Cmd+C`. No character is inserted, and no
12707
- * `input` event will occur.
12708
- */
12709
- if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
12710
- return String.fromCharCode(nativeEvent.which);
12711
- }
12712
- return null;
12713
- case topLevelTypes.topCompositionEnd:
12714
- return useFallbackCompositionData ? null : nativeEvent.data;
12715
- default:
12716
- return null;
12717
- }
12718
- }
12719
-
12720
- /**
12721
- * Extract a SyntheticInputEvent for `beforeInput`, based on either native
12722
- * `textInput` or fallback behavior.
12723
- *
12724
- * @param {string} topLevelType Record from `EventConstants`.
12725
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
12726
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
12727
- * @param {object} nativeEvent Native browser event.
12728
- * @return {?object} A SyntheticInputEvent.
12729
- */
12730
- function extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
12731
- var chars;
12732
-
12733
- if (canUseTextInputEvent) {
12734
- chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
12735
- } else {
12736
- chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
12737
- }
12738
-
12739
- // If no characters are being inserted, no BeforeInput event should
12740
- // be fired.
12741
- if (!chars) {
12742
- return null;
12743
- }
12744
-
12745
- var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, topLevelTargetID, nativeEvent, nativeEventTarget);
12746
-
12747
- event.data = chars;
12748
- EventPropagators.accumulateTwoPhaseDispatches(event);
12749
- return event;
12750
- }
12751
-
12752
- /**
12753
- * Create an `onBeforeInput` event to match
12754
- * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
12755
- *
12756
- * This event plugin is based on the native `textInput` event
12757
- * available in Chrome, Safari, Opera, and IE. This event fires after
12758
- * `onKeyPress` and `onCompositionEnd`, but before `onInput`.
12759
- *
12760
- * `beforeInput` is spec'd but not implemented in any browsers, and
12761
- * the `input` event does not provide any useful information about what has
12762
- * actually been added, contrary to the spec. Thus, `textInput` is the best
12763
- * available event to identify the characters that have actually been inserted
12764
- * into the target node.
12765
- *
12766
- * This plugin is also responsible for emitting `composition` events, thus
12767
- * allowing us to share composition fallback code for both `beforeInput` and
12768
- * `composition` event types.
12769
- */
12770
- var BeforeInputEventPlugin = {
12771
-
12772
- eventTypes: eventTypes,
12773
-
12774
- /**
12775
- * @param {string} topLevelType Record from `EventConstants`.
12776
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
12777
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
12778
- * @param {object} nativeEvent Native browser event.
12779
- * @return {*} An accumulation of synthetic events.
12780
- * @see {EventPluginHub.extractEvents}
12781
- */
12782
- extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
12783
- return [extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget)];
12784
- }
12785
- };
12786
-
12787
- module.exports = BeforeInputEventPlugin;
12788
- },{"./EventConstants":46,"./EventPropagators":50,"./FallbackCompositionState":51,"./SyntheticCompositionEvent":122,"./SyntheticInputEvent":126,"fbjs/lib/ExecutionEnvironment":4,"fbjs/lib/keyOf":22}],35:[function(require,module,exports){
12789
- /**
12790
- * Copyright 2013-2015, Facebook, Inc.
12791
- * All rights reserved.
12792
- *
12793
- * This source code is licensed under the BSD-style license found in the
12794
- * LICENSE file in the root directory of this source tree. An additional grant
12795
- * of patent rights can be found in the PATENTS file in the same directory.
12796
- *
12797
- * @providesModule CSSProperty
12798
- */
12799
-
12800
- 'use strict';
12801
-
12802
- /**
12803
- * CSS properties which accept numbers but are not in units of "px".
12804
- */
12805
- var isUnitlessNumber = {
12806
- animationIterationCount: true,
12807
- boxFlex: true,
12808
- boxFlexGroup: true,
12809
- boxOrdinalGroup: true,
12810
- columnCount: true,
12811
- flex: true,
12812
- flexGrow: true,
12813
- flexPositive: true,
12814
- flexShrink: true,
12815
- flexNegative: true,
12816
- flexOrder: true,
12817
- fontWeight: true,
12818
- lineClamp: true,
12819
- lineHeight: true,
12820
- opacity: true,
12821
- order: true,
12822
- orphans: true,
12823
- tabSize: true,
12824
- widows: true,
12825
- zIndex: true,
12826
- zoom: true,
12827
-
12828
- // SVG-related properties
12829
- fillOpacity: true,
12830
- stopOpacity: true,
12831
- strokeDashoffset: true,
12832
- strokeOpacity: true,
12833
- strokeWidth: true
12834
- };
12835
-
12836
- /**
12837
- * @param {string} prefix vendor-specific prefix, eg: Webkit
12838
- * @param {string} key style name, eg: transitionDuration
12839
- * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
12840
- * WebkitTransitionDuration
12841
- */
12842
- function prefixKey(prefix, key) {
12843
- return prefix + key.charAt(0).toUpperCase() + key.substring(1);
12844
- }
12845
-
12846
- /**
12847
- * Support style names that may come passed in prefixed by adding permutations
12848
- * of vendor prefixes.
12849
- */
12850
- var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
12851
-
12852
- // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
12853
- // infinite loop, because it iterates over the newly added props too.
12854
- Object.keys(isUnitlessNumber).forEach(function (prop) {
12855
- prefixes.forEach(function (prefix) {
12856
- isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
12857
- });
12858
- });
12859
-
12860
- /**
12861
- * Most style properties can be unset by doing .style[prop] = '' but IE8
12862
- * doesn't like doing that with shorthand properties so for the properties that
12863
- * IE8 breaks on, which are listed here, we instead unset each of the
12864
- * individual properties. See http://bugs.jquery.com/ticket/12385.
12865
- * The 4-value 'clock' properties like margin, padding, border-width seem to
12866
- * behave without any problems. Curiously, list-style works too without any
12867
- * special prodding.
12868
- */
12869
- var shorthandPropertyExpansions = {
12870
- background: {
12871
- backgroundAttachment: true,
12872
- backgroundColor: true,
12873
- backgroundImage: true,
12874
- backgroundPositionX: true,
12875
- backgroundPositionY: true,
12876
- backgroundRepeat: true
12877
- },
12878
- backgroundPosition: {
12879
- backgroundPositionX: true,
12880
- backgroundPositionY: true
12881
- },
12882
- border: {
12883
- borderWidth: true,
12884
- borderStyle: true,
12885
- borderColor: true
12886
- },
12887
- borderBottom: {
12888
- borderBottomWidth: true,
12889
- borderBottomStyle: true,
12890
- borderBottomColor: true
12891
- },
12892
- borderLeft: {
12893
- borderLeftWidth: true,
12894
- borderLeftStyle: true,
12895
- borderLeftColor: true
12896
- },
12897
- borderRight: {
12898
- borderRightWidth: true,
12899
- borderRightStyle: true,
12900
- borderRightColor: true
12901
- },
12902
- borderTop: {
12903
- borderTopWidth: true,
12904
- borderTopStyle: true,
12905
- borderTopColor: true
12906
- },
12907
- font: {
12908
- fontStyle: true,
12909
- fontVariant: true,
12910
- fontWeight: true,
12911
- fontSize: true,
12912
- lineHeight: true,
12913
- fontFamily: true
12914
- },
12915
- outline: {
12916
- outlineWidth: true,
12917
- outlineStyle: true,
12918
- outlineColor: true
12919
- }
12920
- };
12921
-
12922
- var CSSProperty = {
12923
- isUnitlessNumber: isUnitlessNumber,
12924
- shorthandPropertyExpansions: shorthandPropertyExpansions
12925
- };
12926
-
12927
- module.exports = CSSProperty;
12928
- },{}],36:[function(require,module,exports){
12929
- (function (process){
12930
- /**
12931
- * Copyright 2013-2015, Facebook, Inc.
12932
- * All rights reserved.
12933
- *
12934
- * This source code is licensed under the BSD-style license found in the
12935
- * LICENSE file in the root directory of this source tree. An additional grant
12936
- * of patent rights can be found in the PATENTS file in the same directory.
12937
- *
12938
- * @providesModule CSSPropertyOperations
12939
- * @typechecks static-only
12940
- */
12941
-
12942
- 'use strict';
12943
-
12944
- var CSSProperty = require('./CSSProperty');
12945
- var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
12946
- var ReactPerf = require('./ReactPerf');
12947
-
12948
- var camelizeStyleName = require('fbjs/lib/camelizeStyleName');
12949
- var dangerousStyleValue = require('./dangerousStyleValue');
12950
- var hyphenateStyleName = require('fbjs/lib/hyphenateStyleName');
12951
- var memoizeStringOnly = require('fbjs/lib/memoizeStringOnly');
12952
- var warning = require('fbjs/lib/warning');
12953
-
12954
- var processStyleName = memoizeStringOnly(function (styleName) {
12955
- return hyphenateStyleName(styleName);
12956
- });
12957
-
12958
- var hasShorthandPropertyBug = false;
12959
- var styleFloatAccessor = 'cssFloat';
12960
- if (ExecutionEnvironment.canUseDOM) {
12961
- var tempStyle = document.createElement('div').style;
12962
- try {
12963
- // IE8 throws "Invalid argument." if resetting shorthand style properties.
12964
- tempStyle.font = '';
12965
- } catch (e) {
12966
- hasShorthandPropertyBug = true;
12967
- }
12968
- // IE8 only supports accessing cssFloat (standard) as styleFloat
12969
- if (document.documentElement.style.cssFloat === undefined) {
12970
- styleFloatAccessor = 'styleFloat';
12971
- }
12972
- }
12973
-
12974
- if (process.env.NODE_ENV !== 'production') {
12975
- // 'msTransform' is correct, but the other prefixes should be capitalized
12976
- var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
12977
-
12978
- // style values shouldn't contain a semicolon
12979
- var badStyleValueWithSemicolonPattern = /;\s*$/;
12980
-
12981
- var warnedStyleNames = {};
12982
- var warnedStyleValues = {};
12983
-
12984
- var warnHyphenatedStyleName = function (name) {
12985
- if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
12986
- return;
12987
- }
12988
-
12989
- warnedStyleNames[name] = true;
12990
- process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?', name, camelizeStyleName(name)) : undefined;
12991
- };
12992
-
12993
- var warnBadVendoredStyleName = function (name) {
12994
- if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
12995
- return;
12996
- }
12997
-
12998
- warnedStyleNames[name] = true;
12999
- process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1)) : undefined;
13000
- };
13001
-
13002
- var warnStyleValueWithSemicolon = function (name, value) {
13003
- if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
13004
- return;
13005
- }
13006
-
13007
- warnedStyleValues[value] = true;
13008
- process.env.NODE_ENV !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon. ' + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, '')) : undefined;
13009
- };
13010
-
13011
- /**
13012
- * @param {string} name
13013
- * @param {*} value
13014
- */
13015
- var warnValidStyle = function (name, value) {
13016
- if (name.indexOf('-') > -1) {
13017
- warnHyphenatedStyleName(name);
13018
- } else if (badVendoredStyleNamePattern.test(name)) {
13019
- warnBadVendoredStyleName(name);
13020
- } else if (badStyleValueWithSemicolonPattern.test(value)) {
13021
- warnStyleValueWithSemicolon(name, value);
13022
- }
13023
- };
13024
- }
13025
-
13026
- /**
13027
- * Operations for dealing with CSS properties.
13028
- */
13029
- var CSSPropertyOperations = {
13030
-
13031
- /**
13032
- * Serializes a mapping of style properties for use as inline styles:
13033
- *
13034
- * > createMarkupForStyles({width: '200px', height: 0})
13035
- * "width:200px;height:0;"
13036
- *
13037
- * Undefined values are ignored so that declarative programming is easier.
13038
- * The result should be HTML-escaped before insertion into the DOM.
13039
- *
13040
- * @param {object} styles
13041
- * @return {?string}
13042
- */
13043
- createMarkupForStyles: function (styles) {
13044
- var serialized = '';
13045
- for (var styleName in styles) {
13046
- if (!styles.hasOwnProperty(styleName)) {
13047
- continue;
13048
- }
13049
- var styleValue = styles[styleName];
13050
- if (process.env.NODE_ENV !== 'production') {
13051
- warnValidStyle(styleName, styleValue);
13052
- }
13053
- if (styleValue != null) {
13054
- serialized += processStyleName(styleName) + ':';
13055
- serialized += dangerousStyleValue(styleName, styleValue) + ';';
13056
- }
13057
- }
13058
- return serialized || null;
13059
- },
13060
-
13061
- /**
13062
- * Sets the value for multiple styles on a node. If a value is specified as
13063
- * '' (empty string), the corresponding style property will be unset.
13064
- *
13065
- * @param {DOMElement} node
13066
- * @param {object} styles
13067
- */
13068
- setValueForStyles: function (node, styles) {
13069
- var style = node.style;
13070
- for (var styleName in styles) {
13071
- if (!styles.hasOwnProperty(styleName)) {
13072
- continue;
13073
- }
13074
- if (process.env.NODE_ENV !== 'production') {
13075
- warnValidStyle(styleName, styles[styleName]);
13076
- }
13077
- var styleValue = dangerousStyleValue(styleName, styles[styleName]);
13078
- if (styleName === 'float') {
13079
- styleName = styleFloatAccessor;
13080
- }
13081
- if (styleValue) {
13082
- style[styleName] = styleValue;
13083
- } else {
13084
- var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
13085
- if (expansion) {
13086
- // Shorthand property that IE8 won't like unsetting, so unset each
13087
- // component to placate it
13088
- for (var individualStyleName in expansion) {
13089
- style[individualStyleName] = '';
13090
- }
13091
- } else {
13092
- style[styleName] = '';
13093
- }
13094
- }
13095
- }
13096
- }
13097
-
13098
- };
13099
-
13100
- ReactPerf.measureMethods(CSSPropertyOperations, 'CSSPropertyOperations', {
13101
- setValueForStyles: 'setValueForStyles'
13102
- });
13103
-
13104
- module.exports = CSSPropertyOperations;
13105
- }).call(this,require('_process'))
13106
-
13107
- },{"./CSSProperty":35,"./ReactPerf":103,"./dangerousStyleValue":137,"_process":31,"fbjs/lib/ExecutionEnvironment":4,"fbjs/lib/camelizeStyleName":6,"fbjs/lib/hyphenateStyleName":17,"fbjs/lib/memoizeStringOnly":24,"fbjs/lib/warning":29}],37:[function(require,module,exports){
13108
- (function (process){
13109
- /**
13110
- * Copyright 2013-2015, Facebook, Inc.
13111
- * All rights reserved.
13112
- *
13113
- * This source code is licensed under the BSD-style license found in the
13114
- * LICENSE file in the root directory of this source tree. An additional grant
13115
- * of patent rights can be found in the PATENTS file in the same directory.
13116
- *
13117
- * @providesModule CallbackQueue
13118
- */
13119
-
13120
- 'use strict';
13121
-
13122
- var PooledClass = require('./PooledClass');
13123
-
13124
- var assign = require('./Object.assign');
13125
- var invariant = require('fbjs/lib/invariant');
13126
-
13127
- /**
13128
- * A specialized pseudo-event module to help keep track of components waiting to
13129
- * be notified when their DOM representations are available for use.
13130
- *
13131
- * This implements `PooledClass`, so you should never need to instantiate this.
13132
- * Instead, use `CallbackQueue.getPooled()`.
13133
- *
13134
- * @class ReactMountReady
13135
- * @implements PooledClass
13136
- * @internal
13137
- */
13138
- function CallbackQueue() {
13139
- this._callbacks = null;
13140
- this._contexts = null;
13141
- }
13142
-
13143
- assign(CallbackQueue.prototype, {
13144
-
13145
- /**
13146
- * Enqueues a callback to be invoked when `notifyAll` is invoked.
13147
- *
13148
- * @param {function} callback Invoked when `notifyAll` is invoked.
13149
- * @param {?object} context Context to call `callback` with.
13150
- * @internal
13151
- */
13152
- enqueue: function (callback, context) {
13153
- this._callbacks = this._callbacks || [];
13154
- this._contexts = this._contexts || [];
13155
- this._callbacks.push(callback);
13156
- this._contexts.push(context);
13157
- },
13158
-
13159
- /**
13160
- * Invokes all enqueued callbacks and clears the queue. This is invoked after
13161
- * the DOM representation of a component has been created or updated.
13162
- *
13163
- * @internal
13164
- */
13165
- notifyAll: function () {
13166
- var callbacks = this._callbacks;
13167
- var contexts = this._contexts;
13168
- if (callbacks) {
13169
- !(callbacks.length === contexts.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : invariant(false) : undefined;
13170
- this._callbacks = null;
13171
- this._contexts = null;
13172
- for (var i = 0; i < callbacks.length; i++) {
13173
- callbacks[i].call(contexts[i]);
13174
- }
13175
- callbacks.length = 0;
13176
- contexts.length = 0;
13177
- }
13178
- },
13179
-
13180
- /**
13181
- * Resets the internal queue.
13182
- *
13183
- * @internal
13184
- */
13185
- reset: function () {
13186
- this._callbacks = null;
13187
- this._contexts = null;
13188
- },
13189
-
13190
- /**
13191
- * `PooledClass` looks for this.
13192
- */
13193
- destructor: function () {
13194
- this.reset();
13195
- }
13196
-
13197
- });
13198
-
13199
- PooledClass.addPoolingTo(CallbackQueue);
13200
-
13201
- module.exports = CallbackQueue;
13202
- }).call(this,require('_process'))
13203
-
13204
- },{"./Object.assign":54,"./PooledClass":55,"_process":31,"fbjs/lib/invariant":18}],38:[function(require,module,exports){
13205
- /**
13206
- * Copyright 2013-2015, Facebook, Inc.
13207
- * All rights reserved.
13208
- *
13209
- * This source code is licensed under the BSD-style license found in the
13210
- * LICENSE file in the root directory of this source tree. An additional grant
13211
- * of patent rights can be found in the PATENTS file in the same directory.
13212
- *
13213
- * @providesModule ChangeEventPlugin
13214
- */
13215
-
13216
- 'use strict';
13217
-
13218
- var EventConstants = require('./EventConstants');
13219
- var EventPluginHub = require('./EventPluginHub');
13220
- var EventPropagators = require('./EventPropagators');
13221
- var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
13222
- var ReactUpdates = require('./ReactUpdates');
13223
- var SyntheticEvent = require('./SyntheticEvent');
13224
-
13225
- var getEventTarget = require('./getEventTarget');
13226
- var isEventSupported = require('./isEventSupported');
13227
- var isTextInputElement = require('./isTextInputElement');
13228
- var keyOf = require('fbjs/lib/keyOf');
13229
-
13230
- var topLevelTypes = EventConstants.topLevelTypes;
13231
-
13232
- var eventTypes = {
13233
- change: {
13234
- phasedRegistrationNames: {
13235
- bubbled: keyOf({ onChange: null }),
13236
- captured: keyOf({ onChangeCapture: null })
13237
- },
13238
- dependencies: [topLevelTypes.topBlur, topLevelTypes.topChange, topLevelTypes.topClick, topLevelTypes.topFocus, topLevelTypes.topInput, topLevelTypes.topKeyDown, topLevelTypes.topKeyUp, topLevelTypes.topSelectionChange]
13239
- }
13240
- };
13241
-
13242
- /**
13243
- * For IE shims
13244
- */
13245
- var activeElement = null;
13246
- var activeElementID = null;
13247
- var activeElementValue = null;
13248
- var activeElementValueProp = null;
13249
-
13250
- /**
13251
- * SECTION: handle `change` event
13252
- */
13253
- function shouldUseChangeEvent(elem) {
13254
- var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
13255
- return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
13256
- }
13257
-
13258
- var doesChangeEventBubble = false;
13259
- if (ExecutionEnvironment.canUseDOM) {
13260
- // See `handleChange` comment below
13261
- doesChangeEventBubble = isEventSupported('change') && (!('documentMode' in document) || document.documentMode > 8);
13262
- }
13263
-
13264
- function manualDispatchChangeEvent(nativeEvent) {
13265
- var event = SyntheticEvent.getPooled(eventTypes.change, activeElementID, nativeEvent, getEventTarget(nativeEvent));
13266
- EventPropagators.accumulateTwoPhaseDispatches(event);
13267
-
13268
- // If change and propertychange bubbled, we'd just bind to it like all the
13269
- // other events and have it go through ReactBrowserEventEmitter. Since it
13270
- // doesn't, we manually listen for the events and so we have to enqueue and
13271
- // process the abstract event manually.
13272
- //
13273
- // Batching is necessary here in order to ensure that all event handlers run
13274
- // before the next rerender (including event handlers attached to ancestor
13275
- // elements instead of directly on the input). Without this, controlled
13276
- // components don't work properly in conjunction with event bubbling because
13277
- // the component is rerendered and the value reverted before all the event
13278
- // handlers can run. See https://github.com/facebook/react/issues/708.
13279
- ReactUpdates.batchedUpdates(runEventInBatch, event);
13280
- }
13281
-
13282
- function runEventInBatch(event) {
13283
- EventPluginHub.enqueueEvents(event);
13284
- EventPluginHub.processEventQueue(false);
13285
- }
13286
-
13287
- function startWatchingForChangeEventIE8(target, targetID) {
13288
- activeElement = target;
13289
- activeElementID = targetID;
13290
- activeElement.attachEvent('onchange', manualDispatchChangeEvent);
13291
- }
13292
-
13293
- function stopWatchingForChangeEventIE8() {
13294
- if (!activeElement) {
13295
- return;
13296
- }
13297
- activeElement.detachEvent('onchange', manualDispatchChangeEvent);
13298
- activeElement = null;
13299
- activeElementID = null;
13300
- }
13301
-
13302
- function getTargetIDForChangeEvent(topLevelType, topLevelTarget, topLevelTargetID) {
13303
- if (topLevelType === topLevelTypes.topChange) {
13304
- return topLevelTargetID;
13305
- }
13306
- }
13307
- function handleEventsForChangeEventIE8(topLevelType, topLevelTarget, topLevelTargetID) {
13308
- if (topLevelType === topLevelTypes.topFocus) {
13309
- // stopWatching() should be a noop here but we call it just in case we
13310
- // missed a blur event somehow.
13311
- stopWatchingForChangeEventIE8();
13312
- startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID);
13313
- } else if (topLevelType === topLevelTypes.topBlur) {
13314
- stopWatchingForChangeEventIE8();
13315
- }
13316
- }
13317
-
13318
- /**
13319
- * SECTION: handle `input` event
13320
- */
13321
- var isInputEventSupported = false;
13322
- if (ExecutionEnvironment.canUseDOM) {
13323
- // IE9 claims to support the input event but fails to trigger it when
13324
- // deleting text, so we ignore its input events
13325
- isInputEventSupported = isEventSupported('input') && (!('documentMode' in document) || document.documentMode > 9);
13326
- }
13327
-
13328
- /**
13329
- * (For old IE.) Replacement getter/setter for the `value` property that gets
13330
- * set on the active element.
13331
- */
13332
- var newValueProp = {
13333
- get: function () {
13334
- return activeElementValueProp.get.call(this);
13335
- },
13336
- set: function (val) {
13337
- // Cast to a string so we can do equality checks.
13338
- activeElementValue = '' + val;
13339
- activeElementValueProp.set.call(this, val);
13340
- }
13341
- };
13342
-
13343
- /**
13344
- * (For old IE.) Starts tracking propertychange events on the passed-in element
13345
- * and override the value property so that we can distinguish user events from
13346
- * value changes in JS.
13347
- */
13348
- function startWatchingForValueChange(target, targetID) {
13349
- activeElement = target;
13350
- activeElementID = targetID;
13351
- activeElementValue = target.value;
13352
- activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value');
13353
-
13354
- // Not guarded in a canDefineProperty check: IE8 supports defineProperty only
13355
- // on DOM elements
13356
- Object.defineProperty(activeElement, 'value', newValueProp);
13357
- activeElement.attachEvent('onpropertychange', handlePropertyChange);
13358
- }
13359
-
13360
- /**
13361
- * (For old IE.) Removes the event listeners from the currently-tracked element,
13362
- * if any exists.
13363
- */
13364
- function stopWatchingForValueChange() {
13365
- if (!activeElement) {
13366
- return;
13367
- }
13368
-
13369
- // delete restores the original property definition
13370
- delete activeElement.value;
13371
- activeElement.detachEvent('onpropertychange', handlePropertyChange);
13372
-
13373
- activeElement = null;
13374
- activeElementID = null;
13375
- activeElementValue = null;
13376
- activeElementValueProp = null;
13377
- }
13378
-
13379
- /**
13380
- * (For old IE.) Handles a propertychange event, sending a `change` event if
13381
- * the value of the active element has changed.
13382
- */
13383
- function handlePropertyChange(nativeEvent) {
13384
- if (nativeEvent.propertyName !== 'value') {
13385
- return;
13386
- }
13387
- var value = nativeEvent.srcElement.value;
13388
- if (value === activeElementValue) {
13389
- return;
13390
- }
13391
- activeElementValue = value;
13392
-
13393
- manualDispatchChangeEvent(nativeEvent);
13394
- }
13395
-
13396
- /**
13397
- * If a `change` event should be fired, returns the target's ID.
13398
- */
13399
- function getTargetIDForInputEvent(topLevelType, topLevelTarget, topLevelTargetID) {
13400
- if (topLevelType === topLevelTypes.topInput) {
13401
- // In modern browsers (i.e., not IE8 or IE9), the input event is exactly
13402
- // what we want so fall through here and trigger an abstract event
13403
- return topLevelTargetID;
13404
- }
13405
- }
13406
-
13407
- // For IE8 and IE9.
13408
- function handleEventsForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
13409
- if (topLevelType === topLevelTypes.topFocus) {
13410
- // In IE8, we can capture almost all .value changes by adding a
13411
- // propertychange handler and looking for events with propertyName
13412
- // equal to 'value'
13413
- // In IE9, propertychange fires for most input events but is buggy and
13414
- // doesn't fire when text is deleted, but conveniently, selectionchange
13415
- // appears to fire in all of the remaining cases so we catch those and
13416
- // forward the event if the value has changed
13417
- // In either case, we don't want to call the event handler if the value
13418
- // is changed from JS so we redefine a setter for `.value` that updates
13419
- // our activeElementValue variable, allowing us to ignore those changes
13420
- //
13421
- // stopWatching() should be a noop here but we call it just in case we
13422
- // missed a blur event somehow.
13423
- stopWatchingForValueChange();
13424
- startWatchingForValueChange(topLevelTarget, topLevelTargetID);
13425
- } else if (topLevelType === topLevelTypes.topBlur) {
13426
- stopWatchingForValueChange();
13427
- }
13428
- }
13429
-
13430
- // For IE8 and IE9.
13431
- function getTargetIDForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
13432
- if (topLevelType === topLevelTypes.topSelectionChange || topLevelType === topLevelTypes.topKeyUp || topLevelType === topLevelTypes.topKeyDown) {
13433
- // On the selectionchange event, the target is just document which isn't
13434
- // helpful for us so just check activeElement instead.
13435
- //
13436
- // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
13437
- // propertychange on the first input event after setting `value` from a
13438
- // script and fires only keydown, keypress, keyup. Catching keyup usually
13439
- // gets it and catching keydown lets us fire an event for the first
13440
- // keystroke if user does a key repeat (it'll be a little delayed: right
13441
- // before the second keystroke). Other input methods (e.g., paste) seem to
13442
- // fire selectionchange normally.
13443
- if (activeElement && activeElement.value !== activeElementValue) {
13444
- activeElementValue = activeElement.value;
13445
- return activeElementID;
13446
- }
13447
- }
13448
- }
13449
-
13450
- /**
13451
- * SECTION: handle `click` event
13452
- */
13453
- function shouldUseClickEvent(elem) {
13454
- // Use the `click` event to detect changes to checkbox and radio inputs.
13455
- // This approach works across all browsers, whereas `change` does not fire
13456
- // until `blur` in IE8.
13457
- return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
13458
- }
13459
-
13460
- function getTargetIDForClickEvent(topLevelType, topLevelTarget, topLevelTargetID) {
13461
- if (topLevelType === topLevelTypes.topClick) {
13462
- return topLevelTargetID;
13463
- }
13464
- }
13465
-
13466
- /**
13467
- * This plugin creates an `onChange` event that normalizes change events
13468
- * across form elements. This event fires at a time when it's possible to
13469
- * change the element's value without seeing a flicker.
13470
- *
13471
- * Supported elements are:
13472
- * - input (see `isTextInputElement`)
13473
- * - textarea
13474
- * - select
13475
- */
13476
- var ChangeEventPlugin = {
13477
-
13478
- eventTypes: eventTypes,
13479
-
13480
- /**
13481
- * @param {string} topLevelType Record from `EventConstants`.
13482
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
13483
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
13484
- * @param {object} nativeEvent Native browser event.
13485
- * @return {*} An accumulation of synthetic events.
13486
- * @see {EventPluginHub.extractEvents}
13487
- */
13488
- extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
13489
-
13490
- var getTargetIDFunc, handleEventFunc;
13491
- if (shouldUseChangeEvent(topLevelTarget)) {
13492
- if (doesChangeEventBubble) {
13493
- getTargetIDFunc = getTargetIDForChangeEvent;
13494
- } else {
13495
- handleEventFunc = handleEventsForChangeEventIE8;
13496
- }
13497
- } else if (isTextInputElement(topLevelTarget)) {
13498
- if (isInputEventSupported) {
13499
- getTargetIDFunc = getTargetIDForInputEvent;
13500
- } else {
13501
- getTargetIDFunc = getTargetIDForInputEventIE;
13502
- handleEventFunc = handleEventsForInputEventIE;
13503
- }
13504
- } else if (shouldUseClickEvent(topLevelTarget)) {
13505
- getTargetIDFunc = getTargetIDForClickEvent;
13506
- }
13507
-
13508
- if (getTargetIDFunc) {
13509
- var targetID = getTargetIDFunc(topLevelType, topLevelTarget, topLevelTargetID);
13510
- if (targetID) {
13511
- var event = SyntheticEvent.getPooled(eventTypes.change, targetID, nativeEvent, nativeEventTarget);
13512
- event.type = 'change';
13513
- EventPropagators.accumulateTwoPhaseDispatches(event);
13514
- return event;
13515
- }
13516
- }
13517
-
13518
- if (handleEventFunc) {
13519
- handleEventFunc(topLevelType, topLevelTarget, topLevelTargetID);
13520
- }
13521
- }
13522
-
13523
- };
13524
-
13525
- module.exports = ChangeEventPlugin;
13526
- },{"./EventConstants":46,"./EventPluginHub":47,"./EventPropagators":50,"./ReactUpdates":115,"./SyntheticEvent":124,"./getEventTarget":146,"./isEventSupported":151,"./isTextInputElement":152,"fbjs/lib/ExecutionEnvironment":4,"fbjs/lib/keyOf":22}],39:[function(require,module,exports){
13527
- /**
13528
- * Copyright 2013-2015, Facebook, Inc.
13529
- * All rights reserved.
13530
- *
13531
- * This source code is licensed under the BSD-style license found in the
13532
- * LICENSE file in the root directory of this source tree. An additional grant
13533
- * of patent rights can be found in the PATENTS file in the same directory.
13534
- *
13535
- * @providesModule ClientReactRootIndex
13536
- * @typechecks
13537
- */
13538
-
13539
- 'use strict';
13540
-
13541
- var nextReactRootIndex = 0;
13542
-
13543
- var ClientReactRootIndex = {
13544
- createReactRootIndex: function () {
13545
- return nextReactRootIndex++;
13546
- }
13547
- };
13548
-
13549
- module.exports = ClientReactRootIndex;
13550
- },{}],40:[function(require,module,exports){
13551
- (function (process){
13552
- /**
13553
- * Copyright 2013-2015, Facebook, Inc.
13554
- * All rights reserved.
13555
- *
13556
- * This source code is licensed under the BSD-style license found in the
13557
- * LICENSE file in the root directory of this source tree. An additional grant
13558
- * of patent rights can be found in the PATENTS file in the same directory.
13559
- *
13560
- * @providesModule DOMChildrenOperations
13561
- * @typechecks static-only
13562
- */
13563
-
13564
- 'use strict';
13565
-
13566
- var Danger = require('./Danger');
13567
- var ReactMultiChildUpdateTypes = require('./ReactMultiChildUpdateTypes');
13568
- var ReactPerf = require('./ReactPerf');
13569
-
13570
- var setInnerHTML = require('./setInnerHTML');
13571
- var setTextContent = require('./setTextContent');
13572
- var invariant = require('fbjs/lib/invariant');
13573
-
13574
- /**
13575
- * Inserts `childNode` as a child of `parentNode` at the `index`.
13576
- *
13577
- * @param {DOMElement} parentNode Parent node in which to insert.
13578
- * @param {DOMElement} childNode Child node to insert.
13579
- * @param {number} index Index at which to insert the child.
13580
- * @internal
13581
- */
13582
- function insertChildAt(parentNode, childNode, index) {
13583
- // By exploiting arrays returning `undefined` for an undefined index, we can
13584
- // rely exclusively on `insertBefore(node, null)` instead of also using
13585
- // `appendChild(node)`. However, using `undefined` is not allowed by all
13586
- // browsers so we must replace it with `null`.
13587
-
13588
- // fix render order error in safari
13589
- // IE8 will throw error when index out of list size.
13590
- var beforeChild = index >= parentNode.childNodes.length ? null : parentNode.childNodes.item(index);
13591
-
13592
- parentNode.insertBefore(childNode, beforeChild);
13593
- }
13594
-
13595
- /**
13596
- * Operations for updating with DOM children.
13597
- */
13598
- var DOMChildrenOperations = {
13599
-
13600
- dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup,
13601
-
13602
- updateTextContent: setTextContent,
13603
-
13604
- /**
13605
- * Updates a component's children by processing a series of updates. The
13606
- * update configurations are each expected to have a `parentNode` property.
13607
- *
13608
- * @param {array<object>} updates List of update configurations.
13609
- * @param {array<string>} markupList List of markup strings.
13610
- * @internal
13611
- */
13612
- processUpdates: function (updates, markupList) {
13613
- var update;
13614
- // Mapping from parent IDs to initial child orderings.
13615
- var initialChildren = null;
13616
- // List of children that will be moved or removed.
13617
- var updatedChildren = null;
13618
-
13619
- for (var i = 0; i < updates.length; i++) {
13620
- update = updates[i];
13621
- if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING || update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
13622
- var updatedIndex = update.fromIndex;
13623
- var updatedChild = update.parentNode.childNodes[updatedIndex];
13624
- var parentID = update.parentID;
13625
-
13626
- !updatedChild ? process.env.NODE_ENV !== 'production' ? invariant(false, 'processUpdates(): Unable to find child %s of element. This ' + 'probably means the DOM was unexpectedly mutated (e.g., by the ' + 'browser), usually due to forgetting a <tbody> when using tables, ' + 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' + 'in an <svg> parent. Try inspecting the child nodes of the element ' + 'with React ID `%s`.', updatedIndex, parentID) : invariant(false) : undefined;
13627
-
13628
- initialChildren = initialChildren || {};
13629
- initialChildren[parentID] = initialChildren[parentID] || [];
13630
- initialChildren[parentID][updatedIndex] = updatedChild;
13631
-
13632
- updatedChildren = updatedChildren || [];
13633
- updatedChildren.push(updatedChild);
13634
- }
13635
- }
13636
-
13637
- var renderedMarkup;
13638
- // markupList is either a list of markup or just a list of elements
13639
- if (markupList.length && typeof markupList[0] === 'string') {
13640
- renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
13641
- } else {
13642
- renderedMarkup = markupList;
13643
- }
13644
-
13645
- // Remove updated children first so that `toIndex` is consistent.
13646
- if (updatedChildren) {
13647
- for (var j = 0; j < updatedChildren.length; j++) {
13648
- updatedChildren[j].parentNode.removeChild(updatedChildren[j]);
13649
- }
13650
- }
13651
-
13652
- for (var k = 0; k < updates.length; k++) {
13653
- update = updates[k];
13654
- switch (update.type) {
13655
- case ReactMultiChildUpdateTypes.INSERT_MARKUP:
13656
- insertChildAt(update.parentNode, renderedMarkup[update.markupIndex], update.toIndex);
13657
- break;
13658
- case ReactMultiChildUpdateTypes.MOVE_EXISTING:
13659
- insertChildAt(update.parentNode, initialChildren[update.parentID][update.fromIndex], update.toIndex);
13660
- break;
13661
- case ReactMultiChildUpdateTypes.SET_MARKUP:
13662
- setInnerHTML(update.parentNode, update.content);
13663
- break;
13664
- case ReactMultiChildUpdateTypes.TEXT_CONTENT:
13665
- setTextContent(update.parentNode, update.content);
13666
- break;
13667
- case ReactMultiChildUpdateTypes.REMOVE_NODE:
13668
- // Already removed by the for-loop above.
13669
- break;
13670
- }
13671
- }
13672
- }
13673
-
13674
- };
13675
-
13676
- ReactPerf.measureMethods(DOMChildrenOperations, 'DOMChildrenOperations', {
13677
- updateTextContent: 'updateTextContent'
13678
- });
13679
-
13680
- module.exports = DOMChildrenOperations;
13681
- }).call(this,require('_process'))
13682
-
13683
- },{"./Danger":43,"./ReactMultiChildUpdateTypes":99,"./ReactPerf":103,"./setInnerHTML":156,"./setTextContent":157,"_process":31,"fbjs/lib/invariant":18}],41:[function(require,module,exports){
13684
- (function (process){
13685
- /**
13686
- * Copyright 2013-2015, Facebook, Inc.
13687
- * All rights reserved.
13688
- *
13689
- * This source code is licensed under the BSD-style license found in the
13690
- * LICENSE file in the root directory of this source tree. An additional grant
13691
- * of patent rights can be found in the PATENTS file in the same directory.
13692
- *
13693
- * @providesModule DOMProperty
13694
- * @typechecks static-only
13695
- */
13696
-
13697
- 'use strict';
13698
-
13699
- var invariant = require('fbjs/lib/invariant');
13700
-
13701
- function checkMask(value, bitmask) {
13702
- return (value & bitmask) === bitmask;
13703
- }
13704
-
13705
- var DOMPropertyInjection = {
13706
- /**
13707
- * Mapping from normalized, camelcased property names to a configuration that
13708
- * specifies how the associated DOM property should be accessed or rendered.
13709
- */
13710
- MUST_USE_ATTRIBUTE: 0x1,
13711
- MUST_USE_PROPERTY: 0x2,
13712
- HAS_SIDE_EFFECTS: 0x4,
13713
- HAS_BOOLEAN_VALUE: 0x8,
13714
- HAS_NUMERIC_VALUE: 0x10,
13715
- HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10,
13716
- HAS_OVERLOADED_BOOLEAN_VALUE: 0x40,
13717
-
13718
- /**
13719
- * Inject some specialized knowledge about the DOM. This takes a config object
13720
- * with the following properties:
13721
- *
13722
- * isCustomAttribute: function that given an attribute name will return true
13723
- * if it can be inserted into the DOM verbatim. Useful for data-* or aria-*
13724
- * attributes where it's impossible to enumerate all of the possible
13725
- * attribute names,
13726
- *
13727
- * Properties: object mapping DOM property name to one of the
13728
- * DOMPropertyInjection constants or null. If your attribute isn't in here,
13729
- * it won't get written to the DOM.
13730
- *
13731
- * DOMAttributeNames: object mapping React attribute name to the DOM
13732
- * attribute name. Attribute names not specified use the **lowercase**
13733
- * normalized name.
13734
- *
13735
- * DOMAttributeNamespaces: object mapping React attribute name to the DOM
13736
- * attribute namespace URL. (Attribute names not specified use no namespace.)
13737
- *
13738
- * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
13739
- * Property names not specified use the normalized name.
13740
- *
13741
- * DOMMutationMethods: Properties that require special mutation methods. If
13742
- * `value` is undefined, the mutation method should unset the property.
13743
- *
13744
- * @param {object} domPropertyConfig the config as described above.
13745
- */
13746
- injectDOMPropertyConfig: function (domPropertyConfig) {
13747
- var Injection = DOMPropertyInjection;
13748
- var Properties = domPropertyConfig.Properties || {};
13749
- var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};
13750
- var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
13751
- var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
13752
- var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
13753
-
13754
- if (domPropertyConfig.isCustomAttribute) {
13755
- DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute);
13756
- }
13757
-
13758
- for (var propName in Properties) {
13759
- !!DOMProperty.properties.hasOwnProperty(propName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' + '\'%s\' which has already been injected. You may be accidentally ' + 'injecting the same DOM property config twice, or you may be ' + 'injecting two configs that have conflicting property names.', propName) : invariant(false) : undefined;
13760
-
13761
- var lowerCased = propName.toLowerCase();
13762
- var propConfig = Properties[propName];
13763
-
13764
- var propertyInfo = {
13765
- attributeName: lowerCased,
13766
- attributeNamespace: null,
13767
- propertyName: propName,
13768
- mutationMethod: null,
13769
-
13770
- mustUseAttribute: checkMask(propConfig, Injection.MUST_USE_ATTRIBUTE),
13771
- mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
13772
- hasSideEffects: checkMask(propConfig, Injection.HAS_SIDE_EFFECTS),
13773
- hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
13774
- hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
13775
- hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),
13776
- hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE)
13777
- };
13778
-
13779
- !(!propertyInfo.mustUseAttribute || !propertyInfo.mustUseProperty) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Cannot require using both attribute and property: %s', propName) : invariant(false) : undefined;
13780
- !(propertyInfo.mustUseProperty || !propertyInfo.hasSideEffects) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Properties that have side effects must use property: %s', propName) : invariant(false) : undefined;
13781
- !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' + 'numeric value, but not a combination: %s', propName) : invariant(false) : undefined;
13782
-
13783
- if (process.env.NODE_ENV !== 'production') {
13784
- DOMProperty.getPossibleStandardName[lowerCased] = propName;
13785
- }
13786
-
13787
- if (DOMAttributeNames.hasOwnProperty(propName)) {
13788
- var attributeName = DOMAttributeNames[propName];
13789
- propertyInfo.attributeName = attributeName;
13790
- if (process.env.NODE_ENV !== 'production') {
13791
- DOMProperty.getPossibleStandardName[attributeName] = propName;
13792
- }
13793
- }
13794
-
13795
- if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
13796
- propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
13797
- }
13798
-
13799
- if (DOMPropertyNames.hasOwnProperty(propName)) {
13800
- propertyInfo.propertyName = DOMPropertyNames[propName];
13801
- }
13802
-
13803
- if (DOMMutationMethods.hasOwnProperty(propName)) {
13804
- propertyInfo.mutationMethod = DOMMutationMethods[propName];
13805
- }
13806
-
13807
- DOMProperty.properties[propName] = propertyInfo;
13808
- }
13809
- }
13810
- };
13811
- var defaultValueCache = {};
13812
-
13813
- /**
13814
- * DOMProperty exports lookup objects that can be used like functions:
13815
- *
13816
- * > DOMProperty.isValid['id']
13817
- * true
13818
- * > DOMProperty.isValid['foobar']
13819
- * undefined
13820
- *
13821
- * Although this may be confusing, it performs better in general.
13822
- *
13823
- * @see http://jsperf.com/key-exists
13824
- * @see http://jsperf.com/key-missing
13825
- */
13826
- var DOMProperty = {
13827
-
13828
- ID_ATTRIBUTE_NAME: 'data-reactid',
13829
-
13830
- /**
13831
- * Map from property "standard name" to an object with info about how to set
13832
- * the property in the DOM. Each object contains:
13833
- *
13834
- * attributeName:
13835
- * Used when rendering markup or with `*Attribute()`.
13836
- * attributeNamespace
13837
- * propertyName:
13838
- * Used on DOM node instances. (This includes properties that mutate due to
13839
- * external factors.)
13840
- * mutationMethod:
13841
- * If non-null, used instead of the property or `setAttribute()` after
13842
- * initial render.
13843
- * mustUseAttribute:
13844
- * Whether the property must be accessed and mutated using `*Attribute()`.
13845
- * (This includes anything that fails `<propName> in <element>`.)
13846
- * mustUseProperty:
13847
- * Whether the property must be accessed and mutated as an object property.
13848
- * hasSideEffects:
13849
- * Whether or not setting a value causes side effects such as triggering
13850
- * resources to be loaded or text selection changes. If true, we read from
13851
- * the DOM before updating to ensure that the value is only set if it has
13852
- * changed.
13853
- * hasBooleanValue:
13854
- * Whether the property should be removed when set to a falsey value.
13855
- * hasNumericValue:
13856
- * Whether the property must be numeric or parse as a numeric and should be
13857
- * removed when set to a falsey value.
13858
- * hasPositiveNumericValue:
13859
- * Whether the property must be positive numeric or parse as a positive
13860
- * numeric and should be removed when set to a falsey value.
13861
- * hasOverloadedBooleanValue:
13862
- * Whether the property can be used as a flag as well as with a value.
13863
- * Removed when strictly equal to false; present without a value when
13864
- * strictly equal to true; present with a value otherwise.
13865
- */
13866
- properties: {},
13867
-
13868
- /**
13869
- * Mapping from lowercase property names to the properly cased version, used
13870
- * to warn in the case of missing properties. Available only in __DEV__.
13871
- * @type {Object}
13872
- */
13873
- getPossibleStandardName: process.env.NODE_ENV !== 'production' ? {} : null,
13874
-
13875
- /**
13876
- * All of the isCustomAttribute() functions that have been injected.
13877
- */
13878
- _isCustomAttributeFunctions: [],
13879
-
13880
- /**
13881
- * Checks whether a property name is a custom attribute.
13882
- * @method
13883
- */
13884
- isCustomAttribute: function (attributeName) {
13885
- for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
13886
- var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
13887
- if (isCustomAttributeFn(attributeName)) {
13888
- return true;
13889
- }
13890
- }
13891
- return false;
13892
- },
13893
-
13894
- /**
13895
- * Returns the default property value for a DOM property (i.e., not an
13896
- * attribute). Most default values are '' or false, but not all. Worse yet,
13897
- * some (in particular, `type`) vary depending on the type of element.
13898
- *
13899
- * TODO: Is it better to grab all the possible properties when creating an
13900
- * element to avoid having to create the same element twice?
13901
- */
13902
- getDefaultValueForProperty: function (nodeName, prop) {
13903
- var nodeDefaults = defaultValueCache[nodeName];
13904
- var testElement;
13905
- if (!nodeDefaults) {
13906
- defaultValueCache[nodeName] = nodeDefaults = {};
13907
- }
13908
- if (!(prop in nodeDefaults)) {
13909
- testElement = document.createElement(nodeName);
13910
- nodeDefaults[prop] = testElement[prop];
13911
- }
13912
- return nodeDefaults[prop];
13913
- },
13914
-
13915
- injection: DOMPropertyInjection
13916
- };
13917
-
13918
- module.exports = DOMProperty;
13919
- }).call(this,require('_process'))
13920
-
13921
- },{"_process":31,"fbjs/lib/invariant":18}],42:[function(require,module,exports){
13922
- (function (process){
13923
- /**
13924
- * Copyright 2013-2015, Facebook, Inc.
13925
- * All rights reserved.
13926
- *
13927
- * This source code is licensed under the BSD-style license found in the
13928
- * LICENSE file in the root directory of this source tree. An additional grant
13929
- * of patent rights can be found in the PATENTS file in the same directory.
13930
- *
13931
- * @providesModule DOMPropertyOperations
13932
- * @typechecks static-only
13933
- */
13934
-
13935
- 'use strict';
13936
-
13937
- var DOMProperty = require('./DOMProperty');
13938
- var ReactPerf = require('./ReactPerf');
13939
-
13940
- var quoteAttributeValueForBrowser = require('./quoteAttributeValueForBrowser');
13941
- var warning = require('fbjs/lib/warning');
13942
-
13943
- // Simplified subset
13944
- var VALID_ATTRIBUTE_NAME_REGEX = /^[a-zA-Z_][\w\.\-]*$/;
13945
- var illegalAttributeNameCache = {};
13946
- var validatedAttributeNameCache = {};
13947
-
13948
- function isAttributeNameSafe(attributeName) {
13949
- if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
13950
- return true;
13951
- }
13952
- if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
13953
- return false;
13954
- }
13955
- if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
13956
- validatedAttributeNameCache[attributeName] = true;
13957
- return true;
13958
- }
13959
- illegalAttributeNameCache[attributeName] = true;
13960
- process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : undefined;
13961
- return false;
13962
- }
13963
-
13964
- function shouldIgnoreValue(propertyInfo, value) {
13965
- return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
13966
- }
13967
-
13968
- if (process.env.NODE_ENV !== 'production') {
13969
- var reactProps = {
13970
- children: true,
13971
- dangerouslySetInnerHTML: true,
13972
- key: true,
13973
- ref: true
13974
- };
13975
- var warnedProperties = {};
13976
-
13977
- var warnUnknownProperty = function (name) {
13978
- if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
13979
- return;
13980
- }
13981
-
13982
- warnedProperties[name] = true;
13983
- var lowerCasedName = name.toLowerCase();
13984
-
13985
- // data-* attributes should be lowercase; suggest the lowercase version
13986
- var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null;
13987
-
13988
- // For now, only warn when we have a suggested correction. This prevents
13989
- // logging too much when using transferPropsTo.
13990
- process.env.NODE_ENV !== 'production' ? warning(standardName == null, 'Unknown DOM property %s. Did you mean %s?', name, standardName) : undefined;
13991
- };
13992
- }
13993
-
13994
- /**
13995
- * Operations for dealing with DOM properties.
13996
- */
13997
- var DOMPropertyOperations = {
13998
-
13999
- /**
14000
- * Creates markup for the ID property.
14001
- *
14002
- * @param {string} id Unescaped ID.
14003
- * @return {string} Markup string.
14004
- */
14005
- createMarkupForID: function (id) {
14006
- return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id);
14007
- },
14008
-
14009
- setAttributeForID: function (node, id) {
14010
- node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id);
14011
- },
14012
-
14013
- /**
14014
- * Creates markup for a property.
14015
- *
14016
- * @param {string} name
14017
- * @param {*} value
14018
- * @return {?string} Markup string, or null if the property was invalid.
14019
- */
14020
- createMarkupForProperty: function (name, value) {
14021
- var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
14022
- if (propertyInfo) {
14023
- if (shouldIgnoreValue(propertyInfo, value)) {
14024
- return '';
14025
- }
14026
- var attributeName = propertyInfo.attributeName;
14027
- if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
14028
- return attributeName + '=""';
14029
- }
14030
- return attributeName + '=' + quoteAttributeValueForBrowser(value);
14031
- } else if (DOMProperty.isCustomAttribute(name)) {
14032
- if (value == null) {
14033
- return '';
14034
- }
14035
- return name + '=' + quoteAttributeValueForBrowser(value);
14036
- } else if (process.env.NODE_ENV !== 'production') {
14037
- warnUnknownProperty(name);
14038
- }
14039
- return null;
14040
- },
14041
-
14042
- /**
14043
- * Creates markup for a custom property.
14044
- *
14045
- * @param {string} name
14046
- * @param {*} value
14047
- * @return {string} Markup string, or empty string if the property was invalid.
14048
- */
14049
- createMarkupForCustomAttribute: function (name, value) {
14050
- if (!isAttributeNameSafe(name) || value == null) {
14051
- return '';
14052
- }
14053
- return name + '=' + quoteAttributeValueForBrowser(value);
14054
- },
14055
-
14056
- /**
14057
- * Sets the value for a property on a node.
14058
- *
14059
- * @param {DOMElement} node
14060
- * @param {string} name
14061
- * @param {*} value
14062
- */
14063
- setValueForProperty: function (node, name, value) {
14064
- var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
14065
- if (propertyInfo) {
14066
- var mutationMethod = propertyInfo.mutationMethod;
14067
- if (mutationMethod) {
14068
- mutationMethod(node, value);
14069
- } else if (shouldIgnoreValue(propertyInfo, value)) {
14070
- this.deleteValueForProperty(node, name);
14071
- } else if (propertyInfo.mustUseAttribute) {
14072
- var attributeName = propertyInfo.attributeName;
14073
- var namespace = propertyInfo.attributeNamespace;
14074
- // `setAttribute` with objects becomes only `[object]` in IE8/9,
14075
- // ('' + value) makes it output the correct toString()-value.
14076
- if (namespace) {
14077
- node.setAttributeNS(namespace, attributeName, '' + value);
14078
- } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
14079
- node.setAttribute(attributeName, '');
14080
- } else {
14081
- node.setAttribute(attributeName, '' + value);
14082
- }
14083
- } else {
14084
- var propName = propertyInfo.propertyName;
14085
- // Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
14086
- // property type before comparing; only `value` does and is string.
14087
- if (!propertyInfo.hasSideEffects || '' + node[propName] !== '' + value) {
14088
- // Contrary to `setAttribute`, object properties are properly
14089
- // `toString`ed by IE8/9.
14090
- node[propName] = value;
14091
- }
14092
- }
14093
- } else if (DOMProperty.isCustomAttribute(name)) {
14094
- DOMPropertyOperations.setValueForAttribute(node, name, value);
14095
- } else if (process.env.NODE_ENV !== 'production') {
14096
- warnUnknownProperty(name);
14097
- }
14098
- },
14099
-
14100
- setValueForAttribute: function (node, name, value) {
14101
- if (!isAttributeNameSafe(name)) {
14102
- return;
14103
- }
14104
- if (value == null) {
14105
- node.removeAttribute(name);
14106
- } else {
14107
- node.setAttribute(name, '' + value);
14108
- }
14109
- },
14110
-
14111
- /**
14112
- * Deletes the value for a property on a node.
14113
- *
14114
- * @param {DOMElement} node
14115
- * @param {string} name
14116
- */
14117
- deleteValueForProperty: function (node, name) {
14118
- var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
14119
- if (propertyInfo) {
14120
- var mutationMethod = propertyInfo.mutationMethod;
14121
- if (mutationMethod) {
14122
- mutationMethod(node, undefined);
14123
- } else if (propertyInfo.mustUseAttribute) {
14124
- node.removeAttribute(propertyInfo.attributeName);
14125
- } else {
14126
- var propName = propertyInfo.propertyName;
14127
- var defaultValue = DOMProperty.getDefaultValueForProperty(node.nodeName, propName);
14128
- if (!propertyInfo.hasSideEffects || '' + node[propName] !== defaultValue) {
14129
- node[propName] = defaultValue;
14130
- }
14131
- }
14132
- } else if (DOMProperty.isCustomAttribute(name)) {
14133
- node.removeAttribute(name);
14134
- } else if (process.env.NODE_ENV !== 'production') {
14135
- warnUnknownProperty(name);
14136
- }
14137
- }
14138
-
14139
- };
14140
-
14141
- ReactPerf.measureMethods(DOMPropertyOperations, 'DOMPropertyOperations', {
14142
- setValueForProperty: 'setValueForProperty',
14143
- setValueForAttribute: 'setValueForAttribute',
14144
- deleteValueForProperty: 'deleteValueForProperty'
14145
- });
14146
-
14147
- module.exports = DOMPropertyOperations;
14148
- }).call(this,require('_process'))
14149
-
14150
- },{"./DOMProperty":41,"./ReactPerf":103,"./quoteAttributeValueForBrowser":154,"_process":31,"fbjs/lib/warning":29}],43:[function(require,module,exports){
14151
- (function (process){
14152
- /**
14153
- * Copyright 2013-2015, Facebook, Inc.
14154
- * All rights reserved.
14155
- *
14156
- * This source code is licensed under the BSD-style license found in the
14157
- * LICENSE file in the root directory of this source tree. An additional grant
14158
- * of patent rights can be found in the PATENTS file in the same directory.
14159
- *
14160
- * @providesModule Danger
14161
- * @typechecks static-only
14162
- */
14163
-
14164
- 'use strict';
14165
-
14166
- var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
14167
-
14168
- var createNodesFromMarkup = require('fbjs/lib/createNodesFromMarkup');
14169
- var emptyFunction = require('fbjs/lib/emptyFunction');
14170
- var getMarkupWrap = require('fbjs/lib/getMarkupWrap');
14171
- var invariant = require('fbjs/lib/invariant');
14172
-
14173
- var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/;
14174
- var RESULT_INDEX_ATTR = 'data-danger-index';
14175
-
14176
- /**
14177
- * Extracts the `nodeName` from a string of markup.
14178
- *
14179
- * NOTE: Extracting the `nodeName` does not require a regular expression match
14180
- * because we make assumptions about React-generated markup (i.e. there are no
14181
- * spaces surrounding the opening tag and there is at least one attribute).
14182
- *
14183
- * @param {string} markup String of markup.
14184
- * @return {string} Node name of the supplied markup.
14185
- * @see http://jsperf.com/extract-nodename
14186
- */
14187
- function getNodeName(markup) {
14188
- return markup.substring(1, markup.indexOf(' '));
14189
- }
14190
-
14191
- var Danger = {
14192
-
14193
- /**
14194
- * Renders markup into an array of nodes. The markup is expected to render
14195
- * into a list of root nodes. Also, the length of `resultList` and
14196
- * `markupList` should be the same.
14197
- *
14198
- * @param {array<string>} markupList List of markup strings to render.
14199
- * @return {array<DOMElement>} List of rendered nodes.
14200
- * @internal
14201
- */
14202
- dangerouslyRenderMarkup: function (markupList) {
14203
- !ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' + 'thread. Make sure `window` and `document` are available globally ' + 'before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString for server rendering.') : invariant(false) : undefined;
14204
- var nodeName;
14205
- var markupByNodeName = {};
14206
- // Group markup by `nodeName` if a wrap is necessary, else by '*'.
14207
- for (var i = 0; i < markupList.length; i++) {
14208
- !markupList[i] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : invariant(false) : undefined;
14209
- nodeName = getNodeName(markupList[i]);
14210
- nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
14211
- markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
14212
- markupByNodeName[nodeName][i] = markupList[i];
14213
- }
14214
- var resultList = [];
14215
- var resultListAssignmentCount = 0;
14216
- for (nodeName in markupByNodeName) {
14217
- if (!markupByNodeName.hasOwnProperty(nodeName)) {
14218
- continue;
14219
- }
14220
- var markupListByNodeName = markupByNodeName[nodeName];
14221
-
14222
- // This for-in loop skips the holes of the sparse array. The order of
14223
- // iteration should follow the order of assignment, which happens to match
14224
- // numerical index order, but we don't rely on that.
14225
- var resultIndex;
14226
- for (resultIndex in markupListByNodeName) {
14227
- if (markupListByNodeName.hasOwnProperty(resultIndex)) {
14228
- var markup = markupListByNodeName[resultIndex];
14229
-
14230
- // Push the requested markup with an additional RESULT_INDEX_ATTR
14231
- // attribute. If the markup does not start with a < character, it
14232
- // will be discarded below (with an appropriate console.error).
14233
- markupListByNodeName[resultIndex] = markup.replace(OPEN_TAG_NAME_EXP,
14234
- // This index will be parsed back out below.
14235
- '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" ');
14236
- }
14237
- }
14238
-
14239
- // Render each group of markup with similar wrapping `nodeName`.
14240
- var renderNodes = createNodesFromMarkup(markupListByNodeName.join(''), emptyFunction // Do nothing special with <script> tags.
14241
- );
14242
-
14243
- for (var j = 0; j < renderNodes.length; ++j) {
14244
- var renderNode = renderNodes[j];
14245
- if (renderNode.hasAttribute && renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
14246
-
14247
- resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
14248
- renderNode.removeAttribute(RESULT_INDEX_ATTR);
14249
-
14250
- !!resultList.hasOwnProperty(resultIndex) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Assigning to an already-occupied result index.') : invariant(false) : undefined;
14251
-
14252
- resultList[resultIndex] = renderNode;
14253
-
14254
- // This should match resultList.length and markupList.length when
14255
- // we're done.
14256
- resultListAssignmentCount += 1;
14257
- } else if (process.env.NODE_ENV !== 'production') {
14258
- console.error('Danger: Discarding unexpected node:', renderNode);
14259
- }
14260
- }
14261
- }
14262
-
14263
- // Although resultList was populated out of order, it should now be a dense
14264
- // array.
14265
- !(resultListAssignmentCount === resultList.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Did not assign to every index of resultList.') : invariant(false) : undefined;
14266
-
14267
- !(resultList.length === markupList.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Expected markup to render %s nodes, but rendered %s.', markupList.length, resultList.length) : invariant(false) : undefined;
14268
-
14269
- return resultList;
14270
- },
14271
-
14272
- /**
14273
- * Replaces a node with a string of markup at its current position within its
14274
- * parent. The markup must render into a single root node.
14275
- *
14276
- * @param {DOMElement} oldChild Child node to replace.
14277
- * @param {string} markup Markup to render in place of the child node.
14278
- * @internal
14279
- */
14280
- dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
14281
- !ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' + 'worker thread. Make sure `window` and `document` are available ' + 'globally before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString() for server rendering.') : invariant(false) : undefined;
14282
- !markup ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(false) : undefined;
14283
- !(oldChild.tagName.toLowerCase() !== 'html') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' + '<html> node. This is because browser quirks make this unreliable ' + 'and/or slow. If you want to render to the root you must use ' + 'server rendering. See ReactDOMServer.renderToString().') : invariant(false) : undefined;
14284
-
14285
- var newChild;
14286
- if (typeof markup === 'string') {
14287
- newChild = createNodesFromMarkup(markup, emptyFunction)[0];
14288
- } else {
14289
- newChild = markup;
14290
- }
14291
- oldChild.parentNode.replaceChild(newChild, oldChild);
14292
- }
14293
-
14294
- };
14295
-
14296
- module.exports = Danger;
14297
- }).call(this,require('_process'))
14298
-
14299
- },{"_process":31,"fbjs/lib/ExecutionEnvironment":4,"fbjs/lib/createNodesFromMarkup":9,"fbjs/lib/emptyFunction":10,"fbjs/lib/getMarkupWrap":14,"fbjs/lib/invariant":18}],44:[function(require,module,exports){
14300
- /**
14301
- * Copyright 2013-2015, Facebook, Inc.
14302
- * All rights reserved.
14303
- *
14304
- * This source code is licensed under the BSD-style license found in the
14305
- * LICENSE file in the root directory of this source tree. An additional grant
14306
- * of patent rights can be found in the PATENTS file in the same directory.
14307
- *
14308
- * @providesModule DefaultEventPluginOrder
14309
- */
14310
-
14311
- 'use strict';
14312
-
14313
- var keyOf = require('fbjs/lib/keyOf');
14314
-
14315
- /**
14316
- * Module that is injectable into `EventPluginHub`, that specifies a
14317
- * deterministic ordering of `EventPlugin`s. A convenient way to reason about
14318
- * plugins, without having to package every one of them. This is better than
14319
- * having plugins be ordered in the same order that they are injected because
14320
- * that ordering would be influenced by the packaging order.
14321
- * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
14322
- * preventing default on events is convenient in `SimpleEventPlugin` handlers.
14323
- */
14324
- var DefaultEventPluginOrder = [keyOf({ ResponderEventPlugin: null }), keyOf({ SimpleEventPlugin: null }), keyOf({ TapEventPlugin: null }), keyOf({ EnterLeaveEventPlugin: null }), keyOf({ ChangeEventPlugin: null }), keyOf({ SelectEventPlugin: null }), keyOf({ BeforeInputEventPlugin: null })];
14325
-
14326
- module.exports = DefaultEventPluginOrder;
14327
- },{"fbjs/lib/keyOf":22}],45:[function(require,module,exports){
14328
- /**
14329
- * Copyright 2013-2015, Facebook, Inc.
14330
- * All rights reserved.
14331
- *
14332
- * This source code is licensed under the BSD-style license found in the
14333
- * LICENSE file in the root directory of this source tree. An additional grant
14334
- * of patent rights can be found in the PATENTS file in the same directory.
14335
- *
14336
- * @providesModule EnterLeaveEventPlugin
14337
- * @typechecks static-only
14338
- */
14339
-
14340
- 'use strict';
14341
-
14342
- var EventConstants = require('./EventConstants');
14343
- var EventPropagators = require('./EventPropagators');
14344
- var SyntheticMouseEvent = require('./SyntheticMouseEvent');
14345
-
14346
- var ReactMount = require('./ReactMount');
14347
- var keyOf = require('fbjs/lib/keyOf');
14348
-
14349
- var topLevelTypes = EventConstants.topLevelTypes;
14350
- var getFirstReactDOM = ReactMount.getFirstReactDOM;
14351
-
14352
- var eventTypes = {
14353
- mouseEnter: {
14354
- registrationName: keyOf({ onMouseEnter: null }),
14355
- dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
14356
- },
14357
- mouseLeave: {
14358
- registrationName: keyOf({ onMouseLeave: null }),
14359
- dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
14360
- }
14361
- };
14362
-
14363
- var extractedEvents = [null, null];
14364
-
14365
- var EnterLeaveEventPlugin = {
14366
-
14367
- eventTypes: eventTypes,
14368
-
14369
- /**
14370
- * For almost every interaction we care about, there will be both a top-level
14371
- * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
14372
- * we do not extract duplicate events. However, moving the mouse into the
14373
- * browser from outside will not fire a `mouseout` event. In this case, we use
14374
- * the `mouseover` top-level event.
14375
- *
14376
- * @param {string} topLevelType Record from `EventConstants`.
14377
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
14378
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
14379
- * @param {object} nativeEvent Native browser event.
14380
- * @return {*} An accumulation of synthetic events.
14381
- * @see {EventPluginHub.extractEvents}
14382
- */
14383
- extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
14384
- if (topLevelType === topLevelTypes.topMouseOver && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
14385
- return null;
14386
- }
14387
- if (topLevelType !== topLevelTypes.topMouseOut && topLevelType !== topLevelTypes.topMouseOver) {
14388
- // Must not be a mouse in or mouse out - ignoring.
14389
- return null;
14390
- }
14391
-
14392
- var win;
14393
- if (topLevelTarget.window === topLevelTarget) {
14394
- // `topLevelTarget` is probably a window object.
14395
- win = topLevelTarget;
14396
- } else {
14397
- // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
14398
- var doc = topLevelTarget.ownerDocument;
14399
- if (doc) {
14400
- win = doc.defaultView || doc.parentWindow;
14401
- } else {
14402
- win = window;
14403
- }
14404
- }
14405
-
14406
- var from;
14407
- var to;
14408
- var fromID = '';
14409
- var toID = '';
14410
- if (topLevelType === topLevelTypes.topMouseOut) {
14411
- from = topLevelTarget;
14412
- fromID = topLevelTargetID;
14413
- to = getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement);
14414
- if (to) {
14415
- toID = ReactMount.getID(to);
14416
- } else {
14417
- to = win;
14418
- }
14419
- to = to || win;
14420
- } else {
14421
- from = win;
14422
- to = topLevelTarget;
14423
- toID = topLevelTargetID;
14424
- }
14425
-
14426
- if (from === to) {
14427
- // Nothing pertains to our managed components.
14428
- return null;
14429
- }
14430
-
14431
- var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, fromID, nativeEvent, nativeEventTarget);
14432
- leave.type = 'mouseleave';
14433
- leave.target = from;
14434
- leave.relatedTarget = to;
14435
-
14436
- var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, toID, nativeEvent, nativeEventTarget);
14437
- enter.type = 'mouseenter';
14438
- enter.target = to;
14439
- enter.relatedTarget = from;
14440
-
14441
- EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID);
14442
-
14443
- extractedEvents[0] = leave;
14444
- extractedEvents[1] = enter;
14445
-
14446
- return extractedEvents;
14447
- }
14448
-
14449
- };
14450
-
14451
- module.exports = EnterLeaveEventPlugin;
14452
- },{"./EventConstants":46,"./EventPropagators":50,"./ReactMount":97,"./SyntheticMouseEvent":128,"fbjs/lib/keyOf":22}],46:[function(require,module,exports){
14453
- /**
14454
- * Copyright 2013-2015, Facebook, Inc.
14455
- * All rights reserved.
14456
- *
14457
- * This source code is licensed under the BSD-style license found in the
14458
- * LICENSE file in the root directory of this source tree. An additional grant
14459
- * of patent rights can be found in the PATENTS file in the same directory.
14460
- *
14461
- * @providesModule EventConstants
14462
- */
14463
-
14464
- 'use strict';
14465
-
14466
- var keyMirror = require('fbjs/lib/keyMirror');
14467
-
14468
- var PropagationPhases = keyMirror({ bubbled: null, captured: null });
14469
-
14470
- /**
14471
- * Types of raw signals from the browser caught at the top level.
14472
- */
14473
- var topLevelTypes = keyMirror({
14474
- topAbort: null,
14475
- topBlur: null,
14476
- topCanPlay: null,
14477
- topCanPlayThrough: null,
14478
- topChange: null,
14479
- topClick: null,
14480
- topCompositionEnd: null,
14481
- topCompositionStart: null,
14482
- topCompositionUpdate: null,
14483
- topContextMenu: null,
14484
- topCopy: null,
14485
- topCut: null,
14486
- topDoubleClick: null,
14487
- topDrag: null,
14488
- topDragEnd: null,
14489
- topDragEnter: null,
14490
- topDragExit: null,
14491
- topDragLeave: null,
14492
- topDragOver: null,
14493
- topDragStart: null,
14494
- topDrop: null,
14495
- topDurationChange: null,
14496
- topEmptied: null,
14497
- topEncrypted: null,
14498
- topEnded: null,
14499
- topError: null,
14500
- topFocus: null,
14501
- topInput: null,
14502
- topKeyDown: null,
14503
- topKeyPress: null,
14504
- topKeyUp: null,
14505
- topLoad: null,
14506
- topLoadedData: null,
14507
- topLoadedMetadata: null,
14508
- topLoadStart: null,
14509
- topMouseDown: null,
14510
- topMouseMove: null,
14511
- topMouseOut: null,
14512
- topMouseOver: null,
14513
- topMouseUp: null,
14514
- topPaste: null,
14515
- topPause: null,
14516
- topPlay: null,
14517
- topPlaying: null,
14518
- topProgress: null,
14519
- topRateChange: null,
14520
- topReset: null,
14521
- topScroll: null,
14522
- topSeeked: null,
14523
- topSeeking: null,
14524
- topSelectionChange: null,
14525
- topStalled: null,
14526
- topSubmit: null,
14527
- topSuspend: null,
14528
- topTextInput: null,
14529
- topTimeUpdate: null,
14530
- topTouchCancel: null,
14531
- topTouchEnd: null,
14532
- topTouchMove: null,
14533
- topTouchStart: null,
14534
- topVolumeChange: null,
14535
- topWaiting: null,
14536
- topWheel: null
14537
- });
14538
-
14539
- var EventConstants = {
14540
- topLevelTypes: topLevelTypes,
14541
- PropagationPhases: PropagationPhases
14542
- };
14543
-
14544
- module.exports = EventConstants;
14545
- },{"fbjs/lib/keyMirror":21}],47:[function(require,module,exports){
14546
- (function (process){
14547
- /**
14548
- * Copyright 2013-2015, Facebook, Inc.
14549
- * All rights reserved.
14550
- *
14551
- * This source code is licensed under the BSD-style license found in the
14552
- * LICENSE file in the root directory of this source tree. An additional grant
14553
- * of patent rights can be found in the PATENTS file in the same directory.
14554
- *
14555
- * @providesModule EventPluginHub
14556
- */
14557
-
14558
- 'use strict';
14559
-
14560
- var EventPluginRegistry = require('./EventPluginRegistry');
14561
- var EventPluginUtils = require('./EventPluginUtils');
14562
- var ReactErrorUtils = require('./ReactErrorUtils');
14563
-
14564
- var accumulateInto = require('./accumulateInto');
14565
- var forEachAccumulated = require('./forEachAccumulated');
14566
- var invariant = require('fbjs/lib/invariant');
14567
- var warning = require('fbjs/lib/warning');
14568
-
14569
- /**
14570
- * Internal store for event listeners
14571
- */
14572
- var listenerBank = {};
14573
-
14574
- /**
14575
- * Internal queue of events that have accumulated their dispatches and are
14576
- * waiting to have their dispatches executed.
14577
- */
14578
- var eventQueue = null;
14579
-
14580
- /**
14581
- * Dispatches an event and releases it back into the pool, unless persistent.
14582
- *
14583
- * @param {?object} event Synthetic event to be dispatched.
14584
- * @param {boolean} simulated If the event is simulated (changes exn behavior)
14585
- * @private
14586
- */
14587
- var executeDispatchesAndRelease = function (event, simulated) {
14588
- if (event) {
14589
- EventPluginUtils.executeDispatchesInOrder(event, simulated);
14590
-
14591
- if (!event.isPersistent()) {
14592
- event.constructor.release(event);
14593
- }
14594
- }
14595
- };
14596
- var executeDispatchesAndReleaseSimulated = function (e) {
14597
- return executeDispatchesAndRelease(e, true);
14598
- };
14599
- var executeDispatchesAndReleaseTopLevel = function (e) {
14600
- return executeDispatchesAndRelease(e, false);
14601
- };
14602
-
14603
- /**
14604
- * - `InstanceHandle`: [required] Module that performs logical traversals of DOM
14605
- * hierarchy given ids of the logical DOM elements involved.
14606
- */
14607
- var InstanceHandle = null;
14608
-
14609
- function validateInstanceHandle() {
14610
- var valid = InstanceHandle && InstanceHandle.traverseTwoPhase && InstanceHandle.traverseEnterLeave;
14611
- process.env.NODE_ENV !== 'production' ? warning(valid, 'InstanceHandle not injected before use!') : undefined;
14612
- }
14613
-
14614
- /**
14615
- * This is a unified interface for event plugins to be installed and configured.
14616
- *
14617
- * Event plugins can implement the following properties:
14618
- *
14619
- * `extractEvents` {function(string, DOMEventTarget, string, object): *}
14620
- * Required. When a top-level event is fired, this method is expected to
14621
- * extract synthetic events that will in turn be queued and dispatched.
14622
- *
14623
- * `eventTypes` {object}
14624
- * Optional, plugins that fire events must publish a mapping of registration
14625
- * names that are used to register listeners. Values of this mapping must
14626
- * be objects that contain `registrationName` or `phasedRegistrationNames`.
14627
- *
14628
- * `executeDispatch` {function(object, function, string)}
14629
- * Optional, allows plugins to override how an event gets dispatched. By
14630
- * default, the listener is simply invoked.
14631
- *
14632
- * Each plugin that is injected into `EventsPluginHub` is immediately operable.
14633
- *
14634
- * @public
14635
- */
14636
- var EventPluginHub = {
14637
-
14638
- /**
14639
- * Methods for injecting dependencies.
14640
- */
14641
- injection: {
14642
-
14643
- /**
14644
- * @param {object} InjectedMount
14645
- * @public
14646
- */
14647
- injectMount: EventPluginUtils.injection.injectMount,
14648
-
14649
- /**
14650
- * @param {object} InjectedInstanceHandle
14651
- * @public
14652
- */
14653
- injectInstanceHandle: function (InjectedInstanceHandle) {
14654
- InstanceHandle = InjectedInstanceHandle;
14655
- if (process.env.NODE_ENV !== 'production') {
14656
- validateInstanceHandle();
14657
- }
14658
- },
14659
-
14660
- getInstanceHandle: function () {
14661
- if (process.env.NODE_ENV !== 'production') {
14662
- validateInstanceHandle();
14663
- }
14664
- return InstanceHandle;
14665
- },
14666
-
14667
- /**
14668
- * @param {array} InjectedEventPluginOrder
14669
- * @public
14670
- */
14671
- injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
14672
-
14673
- /**
14674
- * @param {object} injectedNamesToPlugins Map from names to plugin modules.
14675
- */
14676
- injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
14677
-
14678
- },
14679
-
14680
- eventNameDispatchConfigs: EventPluginRegistry.eventNameDispatchConfigs,
14681
-
14682
- registrationNameModules: EventPluginRegistry.registrationNameModules,
14683
-
14684
- /**
14685
- * Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent.
14686
- *
14687
- * @param {string} id ID of the DOM element.
14688
- * @param {string} registrationName Name of listener (e.g. `onClick`).
14689
- * @param {?function} listener The callback to store.
14690
- */
14691
- putListener: function (id, registrationName, listener) {
14692
- !(typeof listener === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : invariant(false) : undefined;
14693
-
14694
- var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {});
14695
- bankForRegistrationName[id] = listener;
14696
-
14697
- var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
14698
- if (PluginModule && PluginModule.didPutListener) {
14699
- PluginModule.didPutListener(id, registrationName, listener);
14700
- }
14701
- },
14702
-
14703
- /**
14704
- * @param {string} id ID of the DOM element.
14705
- * @param {string} registrationName Name of listener (e.g. `onClick`).
14706
- * @return {?function} The stored callback.
14707
- */
14708
- getListener: function (id, registrationName) {
14709
- var bankForRegistrationName = listenerBank[registrationName];
14710
- return bankForRegistrationName && bankForRegistrationName[id];
14711
- },
14712
-
14713
- /**
14714
- * Deletes a listener from the registration bank.
14715
- *
14716
- * @param {string} id ID of the DOM element.
14717
- * @param {string} registrationName Name of listener (e.g. `onClick`).
14718
- */
14719
- deleteListener: function (id, registrationName) {
14720
- var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
14721
- if (PluginModule && PluginModule.willDeleteListener) {
14722
- PluginModule.willDeleteListener(id, registrationName);
14723
- }
14724
-
14725
- var bankForRegistrationName = listenerBank[registrationName];
14726
- // TODO: This should never be null -- when is it?
14727
- if (bankForRegistrationName) {
14728
- delete bankForRegistrationName[id];
14729
- }
14730
- },
14731
-
14732
- /**
14733
- * Deletes all listeners for the DOM element with the supplied ID.
14734
- *
14735
- * @param {string} id ID of the DOM element.
14736
- */
14737
- deleteAllListeners: function (id) {
14738
- for (var registrationName in listenerBank) {
14739
- if (!listenerBank[registrationName][id]) {
14740
- continue;
14741
- }
14742
-
14743
- var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
14744
- if (PluginModule && PluginModule.willDeleteListener) {
14745
- PluginModule.willDeleteListener(id, registrationName);
14746
- }
14747
-
14748
- delete listenerBank[registrationName][id];
14749
- }
14750
- },
14751
-
14752
- /**
14753
- * Allows registered plugins an opportunity to extract events from top-level
14754
- * native browser events.
14755
- *
14756
- * @param {string} topLevelType Record from `EventConstants`.
14757
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
14758
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
14759
- * @param {object} nativeEvent Native browser event.
14760
- * @return {*} An accumulation of synthetic events.
14761
- * @internal
14762
- */
14763
- extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
14764
- var events;
14765
- var plugins = EventPluginRegistry.plugins;
14766
- for (var i = 0; i < plugins.length; i++) {
14767
- // Not every plugin in the ordering may be loaded at runtime.
14768
- var possiblePlugin = plugins[i];
14769
- if (possiblePlugin) {
14770
- var extractedEvents = possiblePlugin.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
14771
- if (extractedEvents) {
14772
- events = accumulateInto(events, extractedEvents);
14773
- }
14774
- }
14775
- }
14776
- return events;
14777
- },
14778
-
14779
- /**
14780
- * Enqueues a synthetic event that should be dispatched when
14781
- * `processEventQueue` is invoked.
14782
- *
14783
- * @param {*} events An accumulation of synthetic events.
14784
- * @internal
14785
- */
14786
- enqueueEvents: function (events) {
14787
- if (events) {
14788
- eventQueue = accumulateInto(eventQueue, events);
14789
- }
14790
- },
14791
-
14792
- /**
14793
- * Dispatches all synthetic events on the event queue.
14794
- *
14795
- * @internal
14796
- */
14797
- processEventQueue: function (simulated) {
14798
- // Set `eventQueue` to null before processing it so that we can tell if more
14799
- // events get enqueued while processing.
14800
- var processingEventQueue = eventQueue;
14801
- eventQueue = null;
14802
- if (simulated) {
14803
- forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated);
14804
- } else {
14805
- forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
14806
- }
14807
- !!eventQueue ? process.env.NODE_ENV !== 'production' ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing ' + 'an event queue. Support for this has not yet been implemented.') : invariant(false) : undefined;
14808
- // This would be a good time to rethrow if any of the event handlers threw.
14809
- ReactErrorUtils.rethrowCaughtError();
14810
- },
14811
-
14812
- /**
14813
- * These are needed for tests only. Do not use!
14814
- */
14815
- __purge: function () {
14816
- listenerBank = {};
14817
- },
14818
-
14819
- __getListenerBank: function () {
14820
- return listenerBank;
14821
- }
14822
-
14823
- };
14824
-
14825
- module.exports = EventPluginHub;
14826
- }).call(this,require('_process'))
14827
-
14828
- },{"./EventPluginRegistry":48,"./EventPluginUtils":49,"./ReactErrorUtils":88,"./accumulateInto":134,"./forEachAccumulated":142,"_process":31,"fbjs/lib/invariant":18,"fbjs/lib/warning":29}],48:[function(require,module,exports){
14829
- (function (process){
14830
- /**
14831
- * Copyright 2013-2015, Facebook, Inc.
14832
- * All rights reserved.
14833
- *
14834
- * This source code is licensed under the BSD-style license found in the
14835
- * LICENSE file in the root directory of this source tree. An additional grant
14836
- * of patent rights can be found in the PATENTS file in the same directory.
14837
- *
14838
- * @providesModule EventPluginRegistry
14839
- * @typechecks static-only
14840
- */
14841
-
14842
- 'use strict';
14843
-
14844
- var invariant = require('fbjs/lib/invariant');
14845
-
14846
- /**
14847
- * Injectable ordering of event plugins.
14848
- */
14849
- var EventPluginOrder = null;
14850
-
14851
- /**
14852
- * Injectable mapping from names to event plugin modules.
14853
- */
14854
- var namesToPlugins = {};
14855
-
14856
- /**
14857
- * Recomputes the plugin list using the injected plugins and plugin ordering.
14858
- *
14859
- * @private
14860
- */
14861
- function recomputePluginOrdering() {
14862
- if (!EventPluginOrder) {
14863
- // Wait until an `EventPluginOrder` is injected.
14864
- return;
14865
- }
14866
- for (var pluginName in namesToPlugins) {
14867
- var PluginModule = namesToPlugins[pluginName];
14868
- var pluginIndex = EventPluginOrder.indexOf(pluginName);
14869
- !(pluginIndex > -1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' + 'the plugin ordering, `%s`.', pluginName) : invariant(false) : undefined;
14870
- if (EventPluginRegistry.plugins[pluginIndex]) {
14871
- continue;
14872
- }
14873
- !PluginModule.extractEvents ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' + 'method, but `%s` does not.', pluginName) : invariant(false) : undefined;
14874
- EventPluginRegistry.plugins[pluginIndex] = PluginModule;
14875
- var publishedEvents = PluginModule.eventTypes;
14876
- for (var eventName in publishedEvents) {
14877
- !publishEventForPlugin(publishedEvents[eventName], PluginModule, eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : invariant(false) : undefined;
14878
- }
14879
- }
14880
- }
14881
-
14882
- /**
14883
- * Publishes an event so that it can be dispatched by the supplied plugin.
14884
- *
14885
- * @param {object} dispatchConfig Dispatch configuration for the event.
14886
- * @param {object} PluginModule Plugin publishing the event.
14887
- * @return {boolean} True if the event was successfully published.
14888
- * @private
14889
- */
14890
- function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
14891
- !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'event name, `%s`.', eventName) : invariant(false) : undefined;
14892
- EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
14893
-
14894
- var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
14895
- if (phasedRegistrationNames) {
14896
- for (var phaseName in phasedRegistrationNames) {
14897
- if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
14898
- var phasedRegistrationName = phasedRegistrationNames[phaseName];
14899
- publishRegistrationName(phasedRegistrationName, PluginModule, eventName);
14900
- }
14901
- }
14902
- return true;
14903
- } else if (dispatchConfig.registrationName) {
14904
- publishRegistrationName(dispatchConfig.registrationName, PluginModule, eventName);
14905
- return true;
14906
- }
14907
- return false;
14908
- }
14909
-
14910
- /**
14911
- * Publishes a registration name that is used to identify dispatched events and
14912
- * can be used with `EventPluginHub.putListener` to register listeners.
14913
- *
14914
- * @param {string} registrationName Registration name to add.
14915
- * @param {object} PluginModule Plugin publishing the event.
14916
- * @private
14917
- */
14918
- function publishRegistrationName(registrationName, PluginModule, eventName) {
14919
- !!EventPluginRegistry.registrationNameModules[registrationName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName) : invariant(false) : undefined;
14920
- EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;
14921
- EventPluginRegistry.registrationNameDependencies[registrationName] = PluginModule.eventTypes[eventName].dependencies;
14922
- }
14923
-
14924
- /**
14925
- * Registers plugins so that they can extract and dispatch events.
14926
- *
14927
- * @see {EventPluginHub}
14928
- */
14929
- var EventPluginRegistry = {
14930
-
14931
- /**
14932
- * Ordered list of injected plugins.
14933
- */
14934
- plugins: [],
14935
-
14936
- /**
14937
- * Mapping from event name to dispatch config
14938
- */
14939
- eventNameDispatchConfigs: {},
14940
-
14941
- /**
14942
- * Mapping from registration name to plugin module
14943
- */
14944
- registrationNameModules: {},
14945
-
14946
- /**
14947
- * Mapping from registration name to event name
14948
- */
14949
- registrationNameDependencies: {},
14950
-
14951
- /**
14952
- * Injects an ordering of plugins (by plugin name). This allows the ordering
14953
- * to be decoupled from injection of the actual plugins so that ordering is
14954
- * always deterministic regardless of packaging, on-the-fly injection, etc.
14955
- *
14956
- * @param {array} InjectedEventPluginOrder
14957
- * @internal
14958
- * @see {EventPluginHub.injection.injectEventPluginOrder}
14959
- */
14960
- injectEventPluginOrder: function (InjectedEventPluginOrder) {
14961
- !!EventPluginOrder ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than ' + 'once. You are likely trying to load more than one copy of React.') : invariant(false) : undefined;
14962
- // Clone the ordering so it cannot be dynamically mutated.
14963
- EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);
14964
- recomputePluginOrdering();
14965
- },
14966
-
14967
- /**
14968
- * Injects plugins to be used by `EventPluginHub`. The plugin names must be
14969
- * in the ordering injected by `injectEventPluginOrder`.
14970
- *
14971
- * Plugins can be injected as part of page initialization or on-the-fly.
14972
- *
14973
- * @param {object} injectedNamesToPlugins Map from names to plugin modules.
14974
- * @internal
14975
- * @see {EventPluginHub.injection.injectEventPluginsByName}
14976
- */
14977
- injectEventPluginsByName: function (injectedNamesToPlugins) {
14978
- var isOrderingDirty = false;
14979
- for (var pluginName in injectedNamesToPlugins) {
14980
- if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
14981
- continue;
14982
- }
14983
- var PluginModule = injectedNamesToPlugins[pluginName];
14984
- if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== PluginModule) {
14985
- !!namesToPlugins[pluginName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins ' + 'using the same name, `%s`.', pluginName) : invariant(false) : undefined;
14986
- namesToPlugins[pluginName] = PluginModule;
14987
- isOrderingDirty = true;
14988
- }
14989
- }
14990
- if (isOrderingDirty) {
14991
- recomputePluginOrdering();
14992
- }
14993
- },
14994
-
14995
- /**
14996
- * Looks up the plugin for the supplied event.
14997
- *
14998
- * @param {object} event A synthetic event.
14999
- * @return {?object} The plugin that created the supplied event.
15000
- * @internal
15001
- */
15002
- getPluginModuleForEvent: function (event) {
15003
- var dispatchConfig = event.dispatchConfig;
15004
- if (dispatchConfig.registrationName) {
15005
- return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null;
15006
- }
15007
- for (var phase in dispatchConfig.phasedRegistrationNames) {
15008
- if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) {
15009
- continue;
15010
- }
15011
- var PluginModule = EventPluginRegistry.registrationNameModules[dispatchConfig.phasedRegistrationNames[phase]];
15012
- if (PluginModule) {
15013
- return PluginModule;
15014
- }
15015
- }
15016
- return null;
15017
- },
15018
-
15019
- /**
15020
- * Exposed for unit testing.
15021
- * @private
15022
- */
15023
- _resetEventPlugins: function () {
15024
- EventPluginOrder = null;
15025
- for (var pluginName in namesToPlugins) {
15026
- if (namesToPlugins.hasOwnProperty(pluginName)) {
15027
- delete namesToPlugins[pluginName];
15028
- }
15029
- }
15030
- EventPluginRegistry.plugins.length = 0;
15031
-
15032
- var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs;
15033
- for (var eventName in eventNameDispatchConfigs) {
15034
- if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {
15035
- delete eventNameDispatchConfigs[eventName];
15036
- }
15037
- }
15038
-
15039
- var registrationNameModules = EventPluginRegistry.registrationNameModules;
15040
- for (var registrationName in registrationNameModules) {
15041
- if (registrationNameModules.hasOwnProperty(registrationName)) {
15042
- delete registrationNameModules[registrationName];
15043
- }
15044
- }
15045
- }
15046
-
15047
- };
15048
-
15049
- module.exports = EventPluginRegistry;
15050
- }).call(this,require('_process'))
15051
-
15052
- },{"_process":31,"fbjs/lib/invariant":18}],49:[function(require,module,exports){
15053
- (function (process){
15054
- /**
15055
- * Copyright 2013-2015, Facebook, Inc.
15056
- * All rights reserved.
15057
- *
15058
- * This source code is licensed under the BSD-style license found in the
15059
- * LICENSE file in the root directory of this source tree. An additional grant
15060
- * of patent rights can be found in the PATENTS file in the same directory.
15061
- *
15062
- * @providesModule EventPluginUtils
15063
- */
15064
-
15065
- 'use strict';
15066
-
15067
- var EventConstants = require('./EventConstants');
15068
- var ReactErrorUtils = require('./ReactErrorUtils');
15069
-
15070
- var invariant = require('fbjs/lib/invariant');
15071
- var warning = require('fbjs/lib/warning');
15072
-
15073
- /**
15074
- * Injected dependencies:
15075
- */
15076
-
15077
- /**
15078
- * - `Mount`: [required] Module that can convert between React dom IDs and
15079
- * actual node references.
15080
- */
15081
- var injection = {
15082
- Mount: null,
15083
- injectMount: function (InjectedMount) {
15084
- injection.Mount = InjectedMount;
15085
- if (process.env.NODE_ENV !== 'production') {
15086
- process.env.NODE_ENV !== 'production' ? warning(InjectedMount && InjectedMount.getNode && InjectedMount.getID, 'EventPluginUtils.injection.injectMount(...): Injected Mount ' + 'module is missing getNode or getID.') : undefined;
15087
- }
15088
- }
15089
- };
15090
-
15091
- var topLevelTypes = EventConstants.topLevelTypes;
15092
-
15093
- function isEndish(topLevelType) {
15094
- return topLevelType === topLevelTypes.topMouseUp || topLevelType === topLevelTypes.topTouchEnd || topLevelType === topLevelTypes.topTouchCancel;
15095
- }
15096
-
15097
- function isMoveish(topLevelType) {
15098
- return topLevelType === topLevelTypes.topMouseMove || topLevelType === topLevelTypes.topTouchMove;
15099
- }
15100
- function isStartish(topLevelType) {
15101
- return topLevelType === topLevelTypes.topMouseDown || topLevelType === topLevelTypes.topTouchStart;
15102
- }
15103
-
15104
- var validateEventDispatches;
15105
- if (process.env.NODE_ENV !== 'production') {
15106
- validateEventDispatches = function (event) {
15107
- var dispatchListeners = event._dispatchListeners;
15108
- var dispatchIDs = event._dispatchIDs;
15109
-
15110
- var listenersIsArr = Array.isArray(dispatchListeners);
15111
- var idsIsArr = Array.isArray(dispatchIDs);
15112
- var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;
15113
- var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
15114
-
15115
- process.env.NODE_ENV !== 'production' ? warning(idsIsArr === listenersIsArr && IDsLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : undefined;
15116
- };
15117
- }
15118
-
15119
- /**
15120
- * Dispatch the event to the listener.
15121
- * @param {SyntheticEvent} event SyntheticEvent to handle
15122
- * @param {boolean} simulated If the event is simulated (changes exn behavior)
15123
- * @param {function} listener Application-level callback
15124
- * @param {string} domID DOM id to pass to the callback.
15125
- */
15126
- function executeDispatch(event, simulated, listener, domID) {
15127
- var type = event.type || 'unknown-event';
15128
- event.currentTarget = injection.Mount.getNode(domID);
15129
- if (simulated) {
15130
- ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event, domID);
15131
- } else {
15132
- ReactErrorUtils.invokeGuardedCallback(type, listener, event, domID);
15133
- }
15134
- event.currentTarget = null;
15135
- }
15136
-
15137
- /**
15138
- * Standard/simple iteration through an event's collected dispatches.
15139
- */
15140
- function executeDispatchesInOrder(event, simulated) {
15141
- var dispatchListeners = event._dispatchListeners;
15142
- var dispatchIDs = event._dispatchIDs;
15143
- if (process.env.NODE_ENV !== 'production') {
15144
- validateEventDispatches(event);
15145
- }
15146
- if (Array.isArray(dispatchListeners)) {
15147
- for (var i = 0; i < dispatchListeners.length; i++) {
15148
- if (event.isPropagationStopped()) {
15149
- break;
15150
- }
15151
- // Listeners and IDs are two parallel arrays that are always in sync.
15152
- executeDispatch(event, simulated, dispatchListeners[i], dispatchIDs[i]);
15153
- }
15154
- } else if (dispatchListeners) {
15155
- executeDispatch(event, simulated, dispatchListeners, dispatchIDs);
15156
- }
15157
- event._dispatchListeners = null;
15158
- event._dispatchIDs = null;
15159
- }
15160
-
15161
- /**
15162
- * Standard/simple iteration through an event's collected dispatches, but stops
15163
- * at the first dispatch execution returning true, and returns that id.
15164
- *
15165
- * @return {?string} id of the first dispatch execution who's listener returns
15166
- * true, or null if no listener returned true.
15167
- */
15168
- function executeDispatchesInOrderStopAtTrueImpl(event) {
15169
- var dispatchListeners = event._dispatchListeners;
15170
- var dispatchIDs = event._dispatchIDs;
15171
- if (process.env.NODE_ENV !== 'production') {
15172
- validateEventDispatches(event);
15173
- }
15174
- if (Array.isArray(dispatchListeners)) {
15175
- for (var i = 0; i < dispatchListeners.length; i++) {
15176
- if (event.isPropagationStopped()) {
15177
- break;
15178
- }
15179
- // Listeners and IDs are two parallel arrays that are always in sync.
15180
- if (dispatchListeners[i](event, dispatchIDs[i])) {
15181
- return dispatchIDs[i];
15182
- }
15183
- }
15184
- } else if (dispatchListeners) {
15185
- if (dispatchListeners(event, dispatchIDs)) {
15186
- return dispatchIDs;
15187
- }
15188
- }
15189
- return null;
15190
- }
15191
-
15192
- /**
15193
- * @see executeDispatchesInOrderStopAtTrueImpl
15194
- */
15195
- function executeDispatchesInOrderStopAtTrue(event) {
15196
- var ret = executeDispatchesInOrderStopAtTrueImpl(event);
15197
- event._dispatchIDs = null;
15198
- event._dispatchListeners = null;
15199
- return ret;
15200
- }
15201
-
15202
- /**
15203
- * Execution of a "direct" dispatch - there must be at most one dispatch
15204
- * accumulated on the event or it is considered an error. It doesn't really make
15205
- * sense for an event with multiple dispatches (bubbled) to keep track of the
15206
- * return values at each dispatch execution, but it does tend to make sense when
15207
- * dealing with "direct" dispatches.
15208
- *
15209
- * @return {*} The return value of executing the single dispatch.
15210
- */
15211
- function executeDirectDispatch(event) {
15212
- if (process.env.NODE_ENV !== 'production') {
15213
- validateEventDispatches(event);
15214
- }
15215
- var dispatchListener = event._dispatchListeners;
15216
- var dispatchID = event._dispatchIDs;
15217
- !!Array.isArray(dispatchListener) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : invariant(false) : undefined;
15218
- var res = dispatchListener ? dispatchListener(event, dispatchID) : null;
15219
- event._dispatchListeners = null;
15220
- event._dispatchIDs = null;
15221
- return res;
15222
- }
15223
-
15224
- /**
15225
- * @param {SyntheticEvent} event
15226
- * @return {boolean} True iff number of dispatches accumulated is greater than 0.
15227
- */
15228
- function hasDispatches(event) {
15229
- return !!event._dispatchListeners;
15230
- }
15231
-
15232
- /**
15233
- * General utilities that are useful in creating custom Event Plugins.
15234
- */
15235
- var EventPluginUtils = {
15236
- isEndish: isEndish,
15237
- isMoveish: isMoveish,
15238
- isStartish: isStartish,
15239
-
15240
- executeDirectDispatch: executeDirectDispatch,
15241
- executeDispatchesInOrder: executeDispatchesInOrder,
15242
- executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
15243
- hasDispatches: hasDispatches,
15244
-
15245
- getNode: function (id) {
15246
- return injection.Mount.getNode(id);
15247
- },
15248
- getID: function (node) {
15249
- return injection.Mount.getID(node);
15250
- },
15251
-
15252
- injection: injection
15253
- };
15254
-
15255
- module.exports = EventPluginUtils;
15256
- }).call(this,require('_process'))
15257
-
15258
- },{"./EventConstants":46,"./ReactErrorUtils":88,"_process":31,"fbjs/lib/invariant":18,"fbjs/lib/warning":29}],50:[function(require,module,exports){
15259
- (function (process){
15260
- /**
15261
- * Copyright 2013-2015, Facebook, Inc.
15262
- * All rights reserved.
15263
- *
15264
- * This source code is licensed under the BSD-style license found in the
15265
- * LICENSE file in the root directory of this source tree. An additional grant
15266
- * of patent rights can be found in the PATENTS file in the same directory.
15267
- *
15268
- * @providesModule EventPropagators
15269
- */
15270
-
15271
- 'use strict';
15272
-
15273
- var EventConstants = require('./EventConstants');
15274
- var EventPluginHub = require('./EventPluginHub');
15275
-
15276
- var warning = require('fbjs/lib/warning');
15277
-
15278
- var accumulateInto = require('./accumulateInto');
15279
- var forEachAccumulated = require('./forEachAccumulated');
15280
-
15281
- var PropagationPhases = EventConstants.PropagationPhases;
15282
- var getListener = EventPluginHub.getListener;
15283
-
15284
- /**
15285
- * Some event types have a notion of different registration names for different
15286
- * "phases" of propagation. This finds listeners by a given phase.
15287
- */
15288
- function listenerAtPhase(id, event, propagationPhase) {
15289
- var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
15290
- return getListener(id, registrationName);
15291
- }
15292
-
15293
- /**
15294
- * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
15295
- * here, allows us to not have to bind or create functions for each event.
15296
- * Mutating the event's members allows us to not have to create a wrapping
15297
- * "dispatch" object that pairs the event with the listener.
15298
- */
15299
- function accumulateDirectionalDispatches(domID, upwards, event) {
15300
- if (process.env.NODE_ENV !== 'production') {
15301
- process.env.NODE_ENV !== 'production' ? warning(domID, 'Dispatching id must not be null') : undefined;
15302
- }
15303
- var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
15304
- var listener = listenerAtPhase(domID, event, phase);
15305
- if (listener) {
15306
- event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
15307
- event._dispatchIDs = accumulateInto(event._dispatchIDs, domID);
15308
- }
15309
- }
15310
-
15311
- /**
15312
- * Collect dispatches (must be entirely collected before dispatching - see unit
15313
- * tests). Lazily allocate the array to conserve memory. We must loop through
15314
- * each event and perform the traversal for each one. We cannot perform a
15315
- * single traversal for the entire collection of events because each event may
15316
- * have a different target.
15317
- */
15318
- function accumulateTwoPhaseDispatchesSingle(event) {
15319
- if (event && event.dispatchConfig.phasedRegistrationNames) {
15320
- EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(event.dispatchMarker, accumulateDirectionalDispatches, event);
15321
- }
15322
- }
15323
-
15324
- /**
15325
- * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
15326
- */
15327
- function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
15328
- if (event && event.dispatchConfig.phasedRegistrationNames) {
15329
- EventPluginHub.injection.getInstanceHandle().traverseTwoPhaseSkipTarget(event.dispatchMarker, accumulateDirectionalDispatches, event);
15330
- }
15331
- }
15332
-
15333
- /**
15334
- * Accumulates without regard to direction, does not look for phased
15335
- * registration names. Same as `accumulateDirectDispatchesSingle` but without
15336
- * requiring that the `dispatchMarker` be the same as the dispatched ID.
15337
- */
15338
- function accumulateDispatches(id, ignoredDirection, event) {
15339
- if (event && event.dispatchConfig.registrationName) {
15340
- var registrationName = event.dispatchConfig.registrationName;
15341
- var listener = getListener(id, registrationName);
15342
- if (listener) {
15343
- event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
15344
- event._dispatchIDs = accumulateInto(event._dispatchIDs, id);
15345
- }
15346
- }
15347
- }
15348
-
15349
- /**
15350
- * Accumulates dispatches on an `SyntheticEvent`, but only for the
15351
- * `dispatchMarker`.
15352
- * @param {SyntheticEvent} event
15353
- */
15354
- function accumulateDirectDispatchesSingle(event) {
15355
- if (event && event.dispatchConfig.registrationName) {
15356
- accumulateDispatches(event.dispatchMarker, null, event);
15357
- }
15358
- }
15359
-
15360
- function accumulateTwoPhaseDispatches(events) {
15361
- forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
15362
- }
15363
-
15364
- function accumulateTwoPhaseDispatchesSkipTarget(events) {
15365
- forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
15366
- }
15367
-
15368
- function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
15369
- EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(fromID, toID, accumulateDispatches, leave, enter);
15370
- }
15371
-
15372
- function accumulateDirectDispatches(events) {
15373
- forEachAccumulated(events, accumulateDirectDispatchesSingle);
15374
- }
15375
-
15376
- /**
15377
- * A small set of propagation patterns, each of which will accept a small amount
15378
- * of information, and generate a set of "dispatch ready event objects" - which
15379
- * are sets of events that have already been annotated with a set of dispatched
15380
- * listener functions/ids. The API is designed this way to discourage these
15381
- * propagation strategies from actually executing the dispatches, since we
15382
- * always want to collect the entire set of dispatches before executing event a
15383
- * single one.
15384
- *
15385
- * @constructor EventPropagators
15386
- */
15387
- var EventPropagators = {
15388
- accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
15389
- accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget,
15390
- accumulateDirectDispatches: accumulateDirectDispatches,
15391
- accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
15392
- };
15393
-
15394
- module.exports = EventPropagators;
15395
- }).call(this,require('_process'))
15396
-
15397
- },{"./EventConstants":46,"./EventPluginHub":47,"./accumulateInto":134,"./forEachAccumulated":142,"_process":31,"fbjs/lib/warning":29}],51:[function(require,module,exports){
15398
- /**
15399
- * Copyright 2013-2015, Facebook, Inc.
15400
- * All rights reserved.
15401
- *
15402
- * This source code is licensed under the BSD-style license found in the
15403
- * LICENSE file in the root directory of this source tree. An additional grant
15404
- * of patent rights can be found in the PATENTS file in the same directory.
15405
- *
15406
- * @providesModule FallbackCompositionState
15407
- * @typechecks static-only
15408
- */
15409
-
15410
- 'use strict';
15411
-
15412
- var PooledClass = require('./PooledClass');
15413
-
15414
- var assign = require('./Object.assign');
15415
- var getTextContentAccessor = require('./getTextContentAccessor');
15416
-
15417
- /**
15418
- * This helper class stores information about text content of a target node,
15419
- * allowing comparison of content before and after a given event.
15420
- *
15421
- * Identify the node where selection currently begins, then observe
15422
- * both its text content and its current position in the DOM. Since the
15423
- * browser may natively replace the target node during composition, we can
15424
- * use its position to find its replacement.
15425
- *
15426
- * @param {DOMEventTarget} root
15427
- */
15428
- function FallbackCompositionState(root) {
15429
- this._root = root;
15430
- this._startText = this.getText();
15431
- this._fallbackText = null;
15432
- }
15433
-
15434
- assign(FallbackCompositionState.prototype, {
15435
- destructor: function () {
15436
- this._root = null;
15437
- this._startText = null;
15438
- this._fallbackText = null;
15439
- },
15440
-
15441
- /**
15442
- * Get current text of input.
15443
- *
15444
- * @return {string}
15445
- */
15446
- getText: function () {
15447
- if ('value' in this._root) {
15448
- return this._root.value;
15449
- }
15450
- return this._root[getTextContentAccessor()];
15451
- },
15452
-
15453
- /**
15454
- * Determine the differing substring between the initially stored
15455
- * text content and the current content.
15456
- *
15457
- * @return {string}
15458
- */
15459
- getData: function () {
15460
- if (this._fallbackText) {
15461
- return this._fallbackText;
15462
- }
15463
-
15464
- var start;
15465
- var startValue = this._startText;
15466
- var startLength = startValue.length;
15467
- var end;
15468
- var endValue = this.getText();
15469
- var endLength = endValue.length;
15470
-
15471
- for (start = 0; start < startLength; start++) {
15472
- if (startValue[start] !== endValue[start]) {
15473
- break;
15474
- }
15475
- }
15476
-
15477
- var minEnd = startLength - start;
15478
- for (end = 1; end <= minEnd; end++) {
15479
- if (startValue[startLength - end] !== endValue[endLength - end]) {
15480
- break;
15481
- }
15482
- }
15483
-
15484
- var sliceTail = end > 1 ? 1 - end : undefined;
15485
- this._fallbackText = endValue.slice(start, sliceTail);
15486
- return this._fallbackText;
15487
- }
15488
- });
15489
-
15490
- PooledClass.addPoolingTo(FallbackCompositionState);
15491
-
15492
- module.exports = FallbackCompositionState;
15493
- },{"./Object.assign":54,"./PooledClass":55,"./getTextContentAccessor":149}],52:[function(require,module,exports){
15494
- /**
15495
- * Copyright 2013-2015, Facebook, Inc.
15496
- * All rights reserved.
15497
- *
15498
- * This source code is licensed under the BSD-style license found in the
15499
- * LICENSE file in the root directory of this source tree. An additional grant
15500
- * of patent rights can be found in the PATENTS file in the same directory.
15501
- *
15502
- * @providesModule HTMLDOMPropertyConfig
15503
- */
15504
-
15505
- 'use strict';
15506
-
15507
- var DOMProperty = require('./DOMProperty');
15508
- var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
15509
-
15510
- var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
15511
- var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
15512
- var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
15513
- var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
15514
- var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
15515
- var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
15516
- var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
15517
-
15518
- var hasSVG;
15519
- if (ExecutionEnvironment.canUseDOM) {
15520
- var implementation = document.implementation;
15521
- hasSVG = implementation && implementation.hasFeature && implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1');
15522
- }
15523
-
15524
- var HTMLDOMPropertyConfig = {
15525
- isCustomAttribute: RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),
15526
- Properties: {
15527
- /**
15528
- * Standard Properties
15529
- */
15530
- accept: null,
15531
- acceptCharset: null,
15532
- accessKey: null,
15533
- action: null,
15534
- allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
15535
- allowTransparency: MUST_USE_ATTRIBUTE,
15536
- alt: null,
15537
- async: HAS_BOOLEAN_VALUE,
15538
- autoComplete: null,
15539
- // autoFocus is polyfilled/normalized by AutoFocusUtils
15540
- // autoFocus: HAS_BOOLEAN_VALUE,
15541
- autoPlay: HAS_BOOLEAN_VALUE,
15542
- capture: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
15543
- cellPadding: null,
15544
- cellSpacing: null,
15545
- charSet: MUST_USE_ATTRIBUTE,
15546
- challenge: MUST_USE_ATTRIBUTE,
15547
- checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
15548
- classID: MUST_USE_ATTRIBUTE,
15549
- // To set className on SVG elements, it's necessary to use .setAttribute;
15550
- // this works on HTML elements too in all browsers except IE8. Conveniently,
15551
- // IE8 doesn't support SVG and so we can simply use the attribute in
15552
- // browsers that support SVG and the property in browsers that don't,
15553
- // regardless of whether the element is HTML or SVG.
15554
- className: hasSVG ? MUST_USE_ATTRIBUTE : MUST_USE_PROPERTY,
15555
- cols: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
15556
- colSpan: null,
15557
- content: null,
15558
- contentEditable: null,
15559
- contextMenu: MUST_USE_ATTRIBUTE,
15560
- controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
15561
- coords: null,
15562
- crossOrigin: null,
15563
- data: null, // For `<object />` acts as `src`.
15564
- dateTime: MUST_USE_ATTRIBUTE,
15565
- 'default': HAS_BOOLEAN_VALUE,
15566
- defer: HAS_BOOLEAN_VALUE,
15567
- dir: null,
15568
- disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
15569
- download: HAS_OVERLOADED_BOOLEAN_VALUE,
15570
- draggable: null,
15571
- encType: null,
15572
- form: MUST_USE_ATTRIBUTE,
15573
- formAction: MUST_USE_ATTRIBUTE,
15574
- formEncType: MUST_USE_ATTRIBUTE,
15575
- formMethod: MUST_USE_ATTRIBUTE,
15576
- formNoValidate: HAS_BOOLEAN_VALUE,
15577
- formTarget: MUST_USE_ATTRIBUTE,
15578
- frameBorder: MUST_USE_ATTRIBUTE,
15579
- headers: null,
15580
- height: MUST_USE_ATTRIBUTE,
15581
- hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
15582
- high: null,
15583
- href: null,
15584
- hrefLang: null,
15585
- htmlFor: null,
15586
- httpEquiv: null,
15587
- icon: null,
15588
- id: MUST_USE_PROPERTY,
15589
- inputMode: MUST_USE_ATTRIBUTE,
15590
- integrity: null,
15591
- is: MUST_USE_ATTRIBUTE,
15592
- keyParams: MUST_USE_ATTRIBUTE,
15593
- keyType: MUST_USE_ATTRIBUTE,
15594
- kind: null,
15595
- label: null,
15596
- lang: null,
15597
- list: MUST_USE_ATTRIBUTE,
15598
- loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
15599
- low: null,
15600
- manifest: MUST_USE_ATTRIBUTE,
15601
- marginHeight: null,
15602
- marginWidth: null,
15603
- max: null,
15604
- maxLength: MUST_USE_ATTRIBUTE,
15605
- media: MUST_USE_ATTRIBUTE,
15606
- mediaGroup: null,
15607
- method: null,
15608
- min: null,
15609
- minLength: MUST_USE_ATTRIBUTE,
15610
- multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
15611
- muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
15612
- name: null,
15613
- nonce: MUST_USE_ATTRIBUTE,
15614
- noValidate: HAS_BOOLEAN_VALUE,
15615
- open: HAS_BOOLEAN_VALUE,
15616
- optimum: null,
15617
- pattern: null,
15618
- placeholder: null,
15619
- poster: null,
15620
- preload: null,
15621
- radioGroup: null,
15622
- readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
15623
- rel: null,
15624
- required: HAS_BOOLEAN_VALUE,
15625
- reversed: HAS_BOOLEAN_VALUE,
15626
- role: MUST_USE_ATTRIBUTE,
15627
- rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
15628
- rowSpan: null,
15629
- sandbox: null,
15630
- scope: null,
15631
- scoped: HAS_BOOLEAN_VALUE,
15632
- scrolling: null,
15633
- seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
15634
- selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
15635
- shape: null,
15636
- size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
15637
- sizes: MUST_USE_ATTRIBUTE,
15638
- span: HAS_POSITIVE_NUMERIC_VALUE,
15639
- spellCheck: null,
15640
- src: null,
15641
- srcDoc: MUST_USE_PROPERTY,
15642
- srcLang: null,
15643
- srcSet: MUST_USE_ATTRIBUTE,
15644
- start: HAS_NUMERIC_VALUE,
15645
- step: null,
15646
- style: null,
15647
- summary: null,
15648
- tabIndex: null,
15649
- target: null,
15650
- title: null,
15651
- type: null,
15652
- useMap: null,
15653
- value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
15654
- width: MUST_USE_ATTRIBUTE,
15655
- wmode: MUST_USE_ATTRIBUTE,
15656
- wrap: null,
15657
-
15658
- /**
15659
- * RDFa Properties
15660
- */
15661
- about: MUST_USE_ATTRIBUTE,
15662
- datatype: MUST_USE_ATTRIBUTE,
15663
- inlist: MUST_USE_ATTRIBUTE,
15664
- prefix: MUST_USE_ATTRIBUTE,
15665
- // property is also supported for OpenGraph in meta tags.
15666
- property: MUST_USE_ATTRIBUTE,
15667
- resource: MUST_USE_ATTRIBUTE,
15668
- 'typeof': MUST_USE_ATTRIBUTE,
15669
- vocab: MUST_USE_ATTRIBUTE,
15670
-
15671
- /**
15672
- * Non-standard Properties
15673
- */
15674
- // autoCapitalize and autoCorrect are supported in Mobile Safari for
15675
- // keyboard hints.
15676
- autoCapitalize: MUST_USE_ATTRIBUTE,
15677
- autoCorrect: MUST_USE_ATTRIBUTE,
15678
- // autoSave allows WebKit/Blink to persist values of input fields on page reloads
15679
- autoSave: null,
15680
- // color is for Safari mask-icon link
15681
- color: null,
15682
- // itemProp, itemScope, itemType are for
15683
- // Microdata support. See http://schema.org/docs/gs.html
15684
- itemProp: MUST_USE_ATTRIBUTE,
15685
- itemScope: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
15686
- itemType: MUST_USE_ATTRIBUTE,
15687
- // itemID and itemRef are for Microdata support as well but
15688
- // only specified in the the WHATWG spec document. See
15689
- // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
15690
- itemID: MUST_USE_ATTRIBUTE,
15691
- itemRef: MUST_USE_ATTRIBUTE,
15692
- // results show looking glass icon and recent searches on input
15693
- // search fields in WebKit/Blink
15694
- results: null,
15695
- // IE-only attribute that specifies security restrictions on an iframe
15696
- // as an alternative to the sandbox attribute on IE<10
15697
- security: MUST_USE_ATTRIBUTE,
15698
- // IE-only attribute that controls focus behavior
15699
- unselectable: MUST_USE_ATTRIBUTE
15700
- },
15701
- DOMAttributeNames: {
15702
- acceptCharset: 'accept-charset',
15703
- className: 'class',
15704
- htmlFor: 'for',
15705
- httpEquiv: 'http-equiv'
15706
- },
15707
- DOMPropertyNames: {
15708
- autoComplete: 'autocomplete',
15709
- autoFocus: 'autofocus',
15710
- autoPlay: 'autoplay',
15711
- autoSave: 'autosave',
15712
- // `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter.
15713
- // http://www.w3.org/TR/html5/forms.html#dom-fs-encoding
15714
- encType: 'encoding',
15715
- hrefLang: 'hreflang',
15716
- radioGroup: 'radiogroup',
15717
- spellCheck: 'spellcheck',
15718
- srcDoc: 'srcdoc',
15719
- srcSet: 'srcset'
15720
- }
15721
- };
15722
-
15723
- module.exports = HTMLDOMPropertyConfig;
15724
- },{"./DOMProperty":41,"fbjs/lib/ExecutionEnvironment":4}],53:[function(require,module,exports){
15725
- (function (process){
15726
- /**
15727
- * Copyright 2013-2015, Facebook, Inc.
15728
- * All rights reserved.
15729
- *
15730
- * This source code is licensed under the BSD-style license found in the
15731
- * LICENSE file in the root directory of this source tree. An additional grant
15732
- * of patent rights can be found in the PATENTS file in the same directory.
15733
- *
15734
- * @providesModule LinkedValueUtils
15735
- * @typechecks static-only
15736
- */
15737
-
15738
- 'use strict';
15739
-
15740
- var ReactPropTypes = require('./ReactPropTypes');
15741
- var ReactPropTypeLocations = require('./ReactPropTypeLocations');
15742
-
15743
- var invariant = require('fbjs/lib/invariant');
15744
- var warning = require('fbjs/lib/warning');
15745
-
15746
- var hasReadOnlyValue = {
15747
- 'button': true,
15748
- 'checkbox': true,
15749
- 'image': true,
15750
- 'hidden': true,
15751
- 'radio': true,
15752
- 'reset': true,
15753
- 'submit': true
15754
- };
15755
-
15756
- function _assertSingleLink(inputProps) {
15757
- !(inputProps.checkedLink == null || inputProps.valueLink == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use ' + 'checkedLink, you probably don\'t want to use valueLink and vice versa.') : invariant(false) : undefined;
15758
- }
15759
- function _assertValueLink(inputProps) {
15760
- _assertSingleLink(inputProps);
15761
- !(inputProps.value == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want ' + 'to use value or onChange, you probably don\'t want to use valueLink.') : invariant(false) : undefined;
15762
- }
15763
-
15764
- function _assertCheckedLink(inputProps) {
15765
- _assertSingleLink(inputProps);
15766
- !(inputProps.checked == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. ' + 'If you want to use checked or onChange, you probably don\'t want to ' + 'use checkedLink') : invariant(false) : undefined;
15767
- }
15768
-
15769
- var propTypes = {
15770
- value: function (props, propName, componentName) {
15771
- if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
15772
- return null;
15773
- }
15774
- return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
15775
- },
15776
- checked: function (props, propName, componentName) {
15777
- if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
15778
- return null;
15779
- }
15780
- return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
15781
- },
15782
- onChange: ReactPropTypes.func
15783
- };
15784
-
15785
- var loggedTypeFailures = {};
15786
- function getDeclarationErrorAddendum(owner) {
15787
- if (owner) {
15788
- var name = owner.getName();
15789
- if (name) {
15790
- return ' Check the render method of `' + name + '`.';
15791
- }
15792
- }
15793
- return '';
15794
- }
15795
-
15796
- /**
15797
- * Provide a linked `value` attribute for controlled forms. You should not use
15798
- * this outside of the ReactDOM controlled form components.
15799
- */
15800
- var LinkedValueUtils = {
15801
- checkPropTypes: function (tagName, props, owner) {
15802
- for (var propName in propTypes) {
15803
- if (propTypes.hasOwnProperty(propName)) {
15804
- var error = propTypes[propName](props, propName, tagName, ReactPropTypeLocations.prop);
15805
- }
15806
- if (error instanceof Error && !(error.message in loggedTypeFailures)) {
15807
- // Only monitor this failure once because there tends to be a lot of the
15808
- // same error.
15809
- loggedTypeFailures[error.message] = true;
15810
-
15811
- var addendum = getDeclarationErrorAddendum(owner);
15812
- process.env.NODE_ENV !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : undefined;
15813
- }
15814
- }
15815
- },
15816
-
15817
- /**
15818
- * @param {object} inputProps Props for form component
15819
- * @return {*} current value of the input either from value prop or link.
15820
- */
15821
- getValue: function (inputProps) {
15822
- if (inputProps.valueLink) {
15823
- _assertValueLink(inputProps);
15824
- return inputProps.valueLink.value;
15825
- }
15826
- return inputProps.value;
15827
- },
15828
-
15829
- /**
15830
- * @param {object} inputProps Props for form component
15831
- * @return {*} current checked status of the input either from checked prop
15832
- * or link.
15833
- */
15834
- getChecked: function (inputProps) {
15835
- if (inputProps.checkedLink) {
15836
- _assertCheckedLink(inputProps);
15837
- return inputProps.checkedLink.value;
15838
- }
15839
- return inputProps.checked;
15840
- },
15841
-
15842
- /**
15843
- * @param {object} inputProps Props for form component
15844
- * @param {SyntheticEvent} event change event to handle
15845
- */
15846
- executeOnChange: function (inputProps, event) {
15847
- if (inputProps.valueLink) {
15848
- _assertValueLink(inputProps);
15849
- return inputProps.valueLink.requestChange(event.target.value);
15850
- } else if (inputProps.checkedLink) {
15851
- _assertCheckedLink(inputProps);
15852
- return inputProps.checkedLink.requestChange(event.target.checked);
15853
- } else if (inputProps.onChange) {
15854
- return inputProps.onChange.call(undefined, event);
15855
- }
15856
- }
15857
- };
15858
-
15859
- module.exports = LinkedValueUtils;
15860
- }).call(this,require('_process'))
15861
-
15862
- },{"./ReactPropTypeLocations":105,"./ReactPropTypes":106,"_process":31,"fbjs/lib/invariant":18,"fbjs/lib/warning":29}],54:[function(require,module,exports){
15863
- /**
15864
- * Copyright 2014-2015, Facebook, Inc.
15865
- * All rights reserved.
15866
- *
15867
- * This source code is licensed under the BSD-style license found in the
15868
- * LICENSE file in the root directory of this source tree. An additional grant
15869
- * of patent rights can be found in the PATENTS file in the same directory.
15870
- *
15871
- * @providesModule Object.assign
15872
- */
15873
-
15874
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign
15875
-
15876
- 'use strict';
15877
-
15878
- function assign(target, sources) {
15879
- if (target == null) {
15880
- throw new TypeError('Object.assign target cannot be null or undefined');
15881
- }
15882
-
15883
- var to = Object(target);
15884
- var hasOwnProperty = Object.prototype.hasOwnProperty;
15885
-
15886
- for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) {
15887
- var nextSource = arguments[nextIndex];
15888
- if (nextSource == null) {
15889
- continue;
15890
- }
15891
-
15892
- var from = Object(nextSource);
15893
-
15894
- // We don't currently support accessors nor proxies. Therefore this
15895
- // copy cannot throw. If we ever supported this then we must handle
15896
- // exceptions and side-effects. We don't support symbols so they won't
15897
- // be transferred.
15898
-
15899
- for (var key in from) {
15900
- if (hasOwnProperty.call(from, key)) {
15901
- to[key] = from[key];
15902
- }
15903
- }
15904
- }
15905
-
15906
- return to;
15907
- }
15908
-
15909
- module.exports = assign;
15910
- },{}],55:[function(require,module,exports){
15911
- (function (process){
15912
- /**
15913
- * Copyright 2013-2015, Facebook, Inc.
15914
- * All rights reserved.
15915
- *
15916
- * This source code is licensed under the BSD-style license found in the
15917
- * LICENSE file in the root directory of this source tree. An additional grant
15918
- * of patent rights can be found in the PATENTS file in the same directory.
15919
- *
15920
- * @providesModule PooledClass
15921
- */
15922
-
15923
- 'use strict';
15924
-
15925
- var invariant = require('fbjs/lib/invariant');
15926
-
15927
- /**
15928
- * Static poolers. Several custom versions for each potential number of
15929
- * arguments. A completely generic pooler is easy to implement, but would
15930
- * require accessing the `arguments` object. In each of these, `this` refers to
15931
- * the Class itself, not an instance. If any others are needed, simply add them
15932
- * here, or in their own files.
15933
- */
15934
- var oneArgumentPooler = function (copyFieldsFrom) {
15935
- var Klass = this;
15936
- if (Klass.instancePool.length) {
15937
- var instance = Klass.instancePool.pop();
15938
- Klass.call(instance, copyFieldsFrom);
15939
- return instance;
15940
- } else {
15941
- return new Klass(copyFieldsFrom);
15942
- }
15943
- };
15944
-
15945
- var twoArgumentPooler = function (a1, a2) {
15946
- var Klass = this;
15947
- if (Klass.instancePool.length) {
15948
- var instance = Klass.instancePool.pop();
15949
- Klass.call(instance, a1, a2);
15950
- return instance;
15951
- } else {
15952
- return new Klass(a1, a2);
15953
- }
15954
- };
15955
-
15956
- var threeArgumentPooler = function (a1, a2, a3) {
15957
- var Klass = this;
15958
- if (Klass.instancePool.length) {
15959
- var instance = Klass.instancePool.pop();
15960
- Klass.call(instance, a1, a2, a3);
15961
- return instance;
15962
- } else {
15963
- return new Klass(a1, a2, a3);
15964
- }
15965
- };
15966
-
15967
- var fourArgumentPooler = function (a1, a2, a3, a4) {
15968
- var Klass = this;
15969
- if (Klass.instancePool.length) {
15970
- var instance = Klass.instancePool.pop();
15971
- Klass.call(instance, a1, a2, a3, a4);
15972
- return instance;
15973
- } else {
15974
- return new Klass(a1, a2, a3, a4);
15975
- }
15976
- };
15977
-
15978
- var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
15979
- var Klass = this;
15980
- if (Klass.instancePool.length) {
15981
- var instance = Klass.instancePool.pop();
15982
- Klass.call(instance, a1, a2, a3, a4, a5);
15983
- return instance;
15984
- } else {
15985
- return new Klass(a1, a2, a3, a4, a5);
15986
- }
15987
- };
15988
-
15989
- var standardReleaser = function (instance) {
15990
- var Klass = this;
15991
- !(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : invariant(false) : undefined;
15992
- instance.destructor();
15993
- if (Klass.instancePool.length < Klass.poolSize) {
15994
- Klass.instancePool.push(instance);
15995
- }
15996
- };
15997
-
15998
- var DEFAULT_POOL_SIZE = 10;
15999
- var DEFAULT_POOLER = oneArgumentPooler;
16000
-
16001
- /**
16002
- * Augments `CopyConstructor` to be a poolable class, augmenting only the class
16003
- * itself (statically) not adding any prototypical fields. Any CopyConstructor
16004
- * you give this may have a `poolSize` property, and will look for a
16005
- * prototypical `destructor` on instances (optional).
16006
- *
16007
- * @param {Function} CopyConstructor Constructor that can be used to reset.
16008
- * @param {Function} pooler Customizable pooler.
16009
- */
16010
- var addPoolingTo = function (CopyConstructor, pooler) {
16011
- var NewKlass = CopyConstructor;
16012
- NewKlass.instancePool = [];
16013
- NewKlass.getPooled = pooler || DEFAULT_POOLER;
16014
- if (!NewKlass.poolSize) {
16015
- NewKlass.poolSize = DEFAULT_POOL_SIZE;
16016
- }
16017
- NewKlass.release = standardReleaser;
16018
- return NewKlass;
16019
- };
16020
-
16021
- var PooledClass = {
16022
- addPoolingTo: addPoolingTo,
16023
- oneArgumentPooler: oneArgumentPooler,
16024
- twoArgumentPooler: twoArgumentPooler,
16025
- threeArgumentPooler: threeArgumentPooler,
16026
- fourArgumentPooler: fourArgumentPooler,
16027
- fiveArgumentPooler: fiveArgumentPooler
16028
- };
16029
-
16030
- module.exports = PooledClass;
16031
- }).call(this,require('_process'))
16032
-
16033
- },{"_process":31,"fbjs/lib/invariant":18}],56:[function(require,module,exports){
16034
- /**
16035
- * Copyright 2013-2015, Facebook, Inc.
16036
- * All rights reserved.
16037
- *
16038
- * This source code is licensed under the BSD-style license found in the
16039
- * LICENSE file in the root directory of this source tree. An additional grant
16040
- * of patent rights can be found in the PATENTS file in the same directory.
16041
- *
16042
- * @providesModule React
16043
- */
16044
-
16045
- 'use strict';
16046
-
16047
- var ReactDOM = require('./ReactDOM');
16048
- var ReactDOMServer = require('./ReactDOMServer');
16049
- var ReactIsomorphic = require('./ReactIsomorphic');
16050
-
16051
- var assign = require('./Object.assign');
16052
- var deprecated = require('./deprecated');
16053
-
16054
- // `version` will be added here by ReactIsomorphic.
16055
- var React = {};
16056
-
16057
- assign(React, ReactIsomorphic);
16058
-
16059
- assign(React, {
16060
- // ReactDOM
16061
- findDOMNode: deprecated('findDOMNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.findDOMNode),
16062
- render: deprecated('render', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.render),
16063
- unmountComponentAtNode: deprecated('unmountComponentAtNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.unmountComponentAtNode),
16064
-
16065
- // ReactDOMServer
16066
- renderToString: deprecated('renderToString', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToString),
16067
- renderToStaticMarkup: deprecated('renderToStaticMarkup', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToStaticMarkup)
16068
- });
16069
-
16070
- React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOM;
16071
- React.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOMServer;
16072
-
16073
- module.exports = React;
16074
- },{"./Object.assign":54,"./ReactDOM":67,"./ReactDOMServer":77,"./ReactIsomorphic":95,"./deprecated":138}],57:[function(require,module,exports){
16075
- (function (process){
16076
- /**
16077
- * Copyright 2013-2015, Facebook, Inc.
16078
- * All rights reserved.
16079
- *
16080
- * This source code is licensed under the BSD-style license found in the
16081
- * LICENSE file in the root directory of this source tree. An additional grant
16082
- * of patent rights can be found in the PATENTS file in the same directory.
16083
- *
16084
- * @providesModule ReactBrowserComponentMixin
16085
- */
16086
-
16087
- 'use strict';
16088
-
16089
- var ReactInstanceMap = require('./ReactInstanceMap');
16090
-
16091
- var findDOMNode = require('./findDOMNode');
16092
- var warning = require('fbjs/lib/warning');
16093
-
16094
- var didWarnKey = '_getDOMNodeDidWarn';
16095
-
16096
- var ReactBrowserComponentMixin = {
16097
- /**
16098
- * Returns the DOM node rendered by this component.
16099
- *
16100
- * @return {DOMElement} The root node of this component.
16101
- * @final
16102
- * @protected
16103
- */
16104
- getDOMNode: function () {
16105
- process.env.NODE_ENV !== 'production' ? warning(this.constructor[didWarnKey], '%s.getDOMNode(...) is deprecated. Please use ' + 'ReactDOM.findDOMNode(instance) instead.', ReactInstanceMap.get(this).getName() || this.tagName || 'Unknown') : undefined;
16106
- this.constructor[didWarnKey] = true;
16107
- return findDOMNode(this);
16108
- }
16109
- };
16110
-
16111
- module.exports = ReactBrowserComponentMixin;
16112
- }).call(this,require('_process'))
16113
-
16114
- },{"./ReactInstanceMap":94,"./findDOMNode":140,"_process":31,"fbjs/lib/warning":29}],58:[function(require,module,exports){
16115
- /**
16116
- * Copyright 2013-2015, Facebook, Inc.
16117
- * All rights reserved.
16118
- *
16119
- * This source code is licensed under the BSD-style license found in the
16120
- * LICENSE file in the root directory of this source tree. An additional grant
16121
- * of patent rights can be found in the PATENTS file in the same directory.
16122
- *
16123
- * @providesModule ReactBrowserEventEmitter
16124
- * @typechecks static-only
16125
- */
16126
-
16127
- 'use strict';
16128
-
16129
- var EventConstants = require('./EventConstants');
16130
- var EventPluginHub = require('./EventPluginHub');
16131
- var EventPluginRegistry = require('./EventPluginRegistry');
16132
- var ReactEventEmitterMixin = require('./ReactEventEmitterMixin');
16133
- var ReactPerf = require('./ReactPerf');
16134
- var ViewportMetrics = require('./ViewportMetrics');
16135
-
16136
- var assign = require('./Object.assign');
16137
- var isEventSupported = require('./isEventSupported');
16138
-
16139
- /**
16140
- * Summary of `ReactBrowserEventEmitter` event handling:
16141
- *
16142
- * - Top-level delegation is used to trap most native browser events. This
16143
- * may only occur in the main thread and is the responsibility of
16144
- * ReactEventListener, which is injected and can therefore support pluggable
16145
- * event sources. This is the only work that occurs in the main thread.
16146
- *
16147
- * - We normalize and de-duplicate events to account for browser quirks. This
16148
- * may be done in the worker thread.
16149
- *
16150
- * - Forward these native events (with the associated top-level type used to
16151
- * trap it) to `EventPluginHub`, which in turn will ask plugins if they want
16152
- * to extract any synthetic events.
16153
- *
16154
- * - The `EventPluginHub` will then process each event by annotating them with
16155
- * "dispatches", a sequence of listeners and IDs that care about that event.
16156
- *
16157
- * - The `EventPluginHub` then dispatches the events.
16158
- *
16159
- * Overview of React and the event system:
16160
- *
16161
- * +------------+ .
16162
- * | DOM | .
16163
- * +------------+ .
16164
- * | .
16165
- * v .
16166
- * +------------+ .
16167
- * | ReactEvent | .
16168
- * | Listener | .
16169
- * +------------+ . +-----------+
16170
- * | . +--------+|SimpleEvent|
16171
- * | . | |Plugin |
16172
- * +-----|------+ . v +-----------+
16173
- * | | | . +--------------+ +------------+
16174
- * | +-----------.--->|EventPluginHub| | Event |
16175
- * | | . | | +-----------+ | Propagators|
16176
- * | ReactEvent | . | | |TapEvent | |------------|
16177
- * | Emitter | . | |<---+|Plugin | |other plugin|
16178
- * | | . | | +-----------+ | utilities |
16179
- * | +-----------.--->| | +------------+
16180
- * | | | . +--------------+
16181
- * +-----|------+ . ^ +-----------+
16182
- * | . | |Enter/Leave|
16183
- * + . +-------+|Plugin |
16184
- * +-------------+ . +-----------+
16185
- * | application | .
16186
- * |-------------| .
16187
- * | | .
16188
- * | | .
16189
- * +-------------+ .
16190
- * .
16191
- * React Core . General Purpose Event Plugin System
16192
- */
16193
-
16194
- var alreadyListeningTo = {};
16195
- var isMonitoringScrollValue = false;
16196
- var reactTopListenersCounter = 0;
16197
-
16198
- // For events like 'submit' which don't consistently bubble (which we trap at a
16199
- // lower node than `document`), binding at `document` would cause duplicate
16200
- // events so we don't include them here
16201
- var topEventMapping = {
16202
- topAbort: 'abort',
16203
- topBlur: 'blur',
16204
- topCanPlay: 'canplay',
16205
- topCanPlayThrough: 'canplaythrough',
16206
- topChange: 'change',
16207
- topClick: 'click',
16208
- topCompositionEnd: 'compositionend',
16209
- topCompositionStart: 'compositionstart',
16210
- topCompositionUpdate: 'compositionupdate',
16211
- topContextMenu: 'contextmenu',
16212
- topCopy: 'copy',
16213
- topCut: 'cut',
16214
- topDoubleClick: 'dblclick',
16215
- topDrag: 'drag',
16216
- topDragEnd: 'dragend',
16217
- topDragEnter: 'dragenter',
16218
- topDragExit: 'dragexit',
16219
- topDragLeave: 'dragleave',
16220
- topDragOver: 'dragover',
16221
- topDragStart: 'dragstart',
16222
- topDrop: 'drop',
16223
- topDurationChange: 'durationchange',
16224
- topEmptied: 'emptied',
16225
- topEncrypted: 'encrypted',
16226
- topEnded: 'ended',
16227
- topError: 'error',
16228
- topFocus: 'focus',
16229
- topInput: 'input',
16230
- topKeyDown: 'keydown',
16231
- topKeyPress: 'keypress',
16232
- topKeyUp: 'keyup',
16233
- topLoadedData: 'loadeddata',
16234
- topLoadedMetadata: 'loadedmetadata',
16235
- topLoadStart: 'loadstart',
16236
- topMouseDown: 'mousedown',
16237
- topMouseMove: 'mousemove',
16238
- topMouseOut: 'mouseout',
16239
- topMouseOver: 'mouseover',
16240
- topMouseUp: 'mouseup',
16241
- topPaste: 'paste',
16242
- topPause: 'pause',
16243
- topPlay: 'play',
16244
- topPlaying: 'playing',
16245
- topProgress: 'progress',
16246
- topRateChange: 'ratechange',
16247
- topScroll: 'scroll',
16248
- topSeeked: 'seeked',
16249
- topSeeking: 'seeking',
16250
- topSelectionChange: 'selectionchange',
16251
- topStalled: 'stalled',
16252
- topSuspend: 'suspend',
16253
- topTextInput: 'textInput',
16254
- topTimeUpdate: 'timeupdate',
16255
- topTouchCancel: 'touchcancel',
16256
- topTouchEnd: 'touchend',
16257
- topTouchMove: 'touchmove',
16258
- topTouchStart: 'touchstart',
16259
- topVolumeChange: 'volumechange',
16260
- topWaiting: 'waiting',
16261
- topWheel: 'wheel'
16262
- };
16263
-
16264
- /**
16265
- * To ensure no conflicts with other potential React instances on the page
16266
- */
16267
- var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2);
16268
-
16269
- function getListeningForDocument(mountAt) {
16270
- // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
16271
- // directly.
16272
- if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
16273
- mountAt[topListenersIDKey] = reactTopListenersCounter++;
16274
- alreadyListeningTo[mountAt[topListenersIDKey]] = {};
16275
- }
16276
- return alreadyListeningTo[mountAt[topListenersIDKey]];
16277
- }
16278
-
16279
- /**
16280
- * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For
16281
- * example:
16282
- *
16283
- * ReactBrowserEventEmitter.putListener('myID', 'onClick', myFunction);
16284
- *
16285
- * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
16286
- *
16287
- * @internal
16288
- */
16289
- var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
16290
-
16291
- /**
16292
- * Injectable event backend
16293
- */
16294
- ReactEventListener: null,
16295
-
16296
- injection: {
16297
- /**
16298
- * @param {object} ReactEventListener
16299
- */
16300
- injectReactEventListener: function (ReactEventListener) {
16301
- ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel);
16302
- ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
16303
- }
16304
- },
16305
-
16306
- /**
16307
- * Sets whether or not any created callbacks should be enabled.
16308
- *
16309
- * @param {boolean} enabled True if callbacks should be enabled.
16310
- */
16311
- setEnabled: function (enabled) {
16312
- if (ReactBrowserEventEmitter.ReactEventListener) {
16313
- ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
16314
- }
16315
- },
16316
-
16317
- /**
16318
- * @return {boolean} True if callbacks are enabled.
16319
- */
16320
- isEnabled: function () {
16321
- return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled());
16322
- },
16323
-
16324
- /**
16325
- * We listen for bubbled touch events on the document object.
16326
- *
16327
- * Firefox v8.01 (and possibly others) exhibited strange behavior when
16328
- * mounting `onmousemove` events at some node that was not the document
16329
- * element. The symptoms were that if your mouse is not moving over something
16330
- * contained within that mount point (for example on the background) the
16331
- * top-level listeners for `onmousemove` won't be called. However, if you
16332
- * register the `mousemove` on the document object, then it will of course
16333
- * catch all `mousemove`s. This along with iOS quirks, justifies restricting
16334
- * top-level listeners to the document object only, at least for these
16335
- * movement types of events and possibly all events.
16336
- *
16337
- * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
16338
- *
16339
- * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
16340
- * they bubble to document.
16341
- *
16342
- * @param {string} registrationName Name of listener (e.g. `onClick`).
16343
- * @param {object} contentDocumentHandle Document which owns the container
16344
- */
16345
- listenTo: function (registrationName, contentDocumentHandle) {
16346
- var mountAt = contentDocumentHandle;
16347
- var isListening = getListeningForDocument(mountAt);
16348
- var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName];
16349
-
16350
- var topLevelTypes = EventConstants.topLevelTypes;
16351
- for (var i = 0; i < dependencies.length; i++) {
16352
- var dependency = dependencies[i];
16353
- if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
16354
- if (dependency === topLevelTypes.topWheel) {
16355
- if (isEventSupported('wheel')) {
16356
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'wheel', mountAt);
16357
- } else if (isEventSupported('mousewheel')) {
16358
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'mousewheel', mountAt);
16359
- } else {
16360
- // Firefox needs to capture a different mouse scroll event.
16361
- // @see http://www.quirksmode.org/dom/events/tests/scroll.html
16362
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'DOMMouseScroll', mountAt);
16363
- }
16364
- } else if (dependency === topLevelTypes.topScroll) {
16365
-
16366
- if (isEventSupported('scroll', true)) {
16367
- ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topScroll, 'scroll', mountAt);
16368
- } else {
16369
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topScroll, 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE);
16370
- }
16371
- } else if (dependency === topLevelTypes.topFocus || dependency === topLevelTypes.topBlur) {
16372
-
16373
- if (isEventSupported('focus', true)) {
16374
- ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topFocus, 'focus', mountAt);
16375
- ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topBlur, 'blur', mountAt);
16376
- } else if (isEventSupported('focusin')) {
16377
- // IE has `focusin` and `focusout` events which bubble.
16378
- // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
16379
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topFocus, 'focusin', mountAt);
16380
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topBlur, 'focusout', mountAt);
16381
- }
16382
-
16383
- // to make sure blur and focus event listeners are only attached once
16384
- isListening[topLevelTypes.topBlur] = true;
16385
- isListening[topLevelTypes.topFocus] = true;
16386
- } else if (topEventMapping.hasOwnProperty(dependency)) {
16387
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt);
16388
- }
16389
-
16390
- isListening[dependency] = true;
16391
- }
16392
- }
16393
- },
16394
-
16395
- trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
16396
- return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle);
16397
- },
16398
-
16399
- trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
16400
- return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle);
16401
- },
16402
-
16403
- /**
16404
- * Listens to window scroll and resize events. We cache scroll values so that
16405
- * application code can access them without triggering reflows.
16406
- *
16407
- * NOTE: Scroll events do not bubble.
16408
- *
16409
- * @see http://www.quirksmode.org/dom/events/scroll.html
16410
- */
16411
- ensureScrollValueMonitoring: function () {
16412
- if (!isMonitoringScrollValue) {
16413
- var refresh = ViewportMetrics.refreshScrollValues;
16414
- ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
16415
- isMonitoringScrollValue = true;
16416
- }
16417
- },
16418
-
16419
- eventNameDispatchConfigs: EventPluginHub.eventNameDispatchConfigs,
16420
-
16421
- registrationNameModules: EventPluginHub.registrationNameModules,
16422
-
16423
- putListener: EventPluginHub.putListener,
16424
-
16425
- getListener: EventPluginHub.getListener,
16426
-
16427
- deleteListener: EventPluginHub.deleteListener,
16428
-
16429
- deleteAllListeners: EventPluginHub.deleteAllListeners
16430
-
16431
- });
16432
-
16433
- ReactPerf.measureMethods(ReactBrowserEventEmitter, 'ReactBrowserEventEmitter', {
16434
- putListener: 'putListener',
16435
- deleteListener: 'deleteListener'
16436
- });
16437
-
16438
- module.exports = ReactBrowserEventEmitter;
16439
- },{"./EventConstants":46,"./EventPluginHub":47,"./EventPluginRegistry":48,"./Object.assign":54,"./ReactEventEmitterMixin":89,"./ReactPerf":103,"./ViewportMetrics":133,"./isEventSupported":151}],59:[function(require,module,exports){
16440
- (function (process){
16441
- /**
16442
- * Copyright 2014-2015, Facebook, Inc.
16443
- * All rights reserved.
16444
- *
16445
- * This source code is licensed under the BSD-style license found in the
16446
- * LICENSE file in the root directory of this source tree. An additional grant
16447
- * of patent rights can be found in the PATENTS file in the same directory.
16448
- *
16449
- * @providesModule ReactChildReconciler
16450
- * @typechecks static-only
16451
- */
16452
-
16453
- 'use strict';
16454
-
16455
- var ReactReconciler = require('./ReactReconciler');
16456
-
16457
- var instantiateReactComponent = require('./instantiateReactComponent');
16458
- var shouldUpdateReactComponent = require('./shouldUpdateReactComponent');
16459
- var traverseAllChildren = require('./traverseAllChildren');
16460
- var warning = require('fbjs/lib/warning');
16461
-
16462
- function instantiateChild(childInstances, child, name) {
16463
- // We found a component instance.
16464
- var keyUnique = childInstances[name] === undefined;
16465
- if (process.env.NODE_ENV !== 'production') {
16466
- process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined;
16467
- }
16468
- if (child != null && keyUnique) {
16469
- childInstances[name] = instantiateReactComponent(child, null);
16470
- }
16471
- }
16472
-
16473
- /**
16474
- * ReactChildReconciler provides helpers for initializing or updating a set of
16475
- * children. Its output is suitable for passing it onto ReactMultiChild which
16476
- * does diffed reordering and insertion.
16477
- */
16478
- var ReactChildReconciler = {
16479
- /**
16480
- * Generates a "mount image" for each of the supplied children. In the case
16481
- * of `ReactDOMComponent`, a mount image is a string of markup.
16482
- *
16483
- * @param {?object} nestedChildNodes Nested child maps.
16484
- * @return {?object} A set of child instances.
16485
- * @internal
16486
- */
16487
- instantiateChildren: function (nestedChildNodes, transaction, context) {
16488
- if (nestedChildNodes == null) {
16489
- return null;
16490
- }
16491
- var childInstances = {};
16492
- traverseAllChildren(nestedChildNodes, instantiateChild, childInstances);
16493
- return childInstances;
16494
- },
16495
-
16496
- /**
16497
- * Updates the rendered children and returns a new set of children.
16498
- *
16499
- * @param {?object} prevChildren Previously initialized set of children.
16500
- * @param {?object} nextChildren Flat child element maps.
16501
- * @param {ReactReconcileTransaction} transaction
16502
- * @param {object} context
16503
- * @return {?object} A new set of child instances.
16504
- * @internal
16505
- */
16506
- updateChildren: function (prevChildren, nextChildren, transaction, context) {
16507
- // We currently don't have a way to track moves here but if we use iterators
16508
- // instead of for..in we can zip the iterators and check if an item has
16509
- // moved.
16510
- // TODO: If nothing has changed, return the prevChildren object so that we
16511
- // can quickly bailout if nothing has changed.
16512
- if (!nextChildren && !prevChildren) {
16513
- return null;
16514
- }
16515
- var name;
16516
- for (name in nextChildren) {
16517
- if (!nextChildren.hasOwnProperty(name)) {
16518
- continue;
16519
- }
16520
- var prevChild = prevChildren && prevChildren[name];
16521
- var prevElement = prevChild && prevChild._currentElement;
16522
- var nextElement = nextChildren[name];
16523
- if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) {
16524
- ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context);
16525
- nextChildren[name] = prevChild;
16526
- } else {
16527
- if (prevChild) {
16528
- ReactReconciler.unmountComponent(prevChild, name);
16529
- }
16530
- // The child must be instantiated before it's mounted.
16531
- var nextChildInstance = instantiateReactComponent(nextElement, null);
16532
- nextChildren[name] = nextChildInstance;
16533
- }
16534
- }
16535
- // Unmount children that are no longer present.
16536
- for (name in prevChildren) {
16537
- if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
16538
- ReactReconciler.unmountComponent(prevChildren[name]);
16539
- }
16540
- }
16541
- return nextChildren;
16542
- },
16543
-
16544
- /**
16545
- * Unmounts all rendered children. This should be used to clean up children
16546
- * when this component is unmounted.
16547
- *
16548
- * @param {?object} renderedChildren Previously initialized set of children.
16549
- * @internal
16550
- */
16551
- unmountChildren: function (renderedChildren) {
16552
- for (var name in renderedChildren) {
16553
- if (renderedChildren.hasOwnProperty(name)) {
16554
- var renderedChild = renderedChildren[name];
16555
- ReactReconciler.unmountComponent(renderedChild);
16556
- }
16557
- }
16558
- }
16559
-
16560
- };
16561
-
16562
- module.exports = ReactChildReconciler;
16563
- }).call(this,require('_process'))
16564
-
16565
- },{"./ReactReconciler":108,"./instantiateReactComponent":150,"./shouldUpdateReactComponent":158,"./traverseAllChildren":159,"_process":31,"fbjs/lib/warning":29}],60:[function(require,module,exports){
16566
- /**
16567
- * Copyright 2013-2015, Facebook, Inc.
16568
- * All rights reserved.
16569
- *
16570
- * This source code is licensed under the BSD-style license found in the
16571
- * LICENSE file in the root directory of this source tree. An additional grant
16572
- * of patent rights can be found in the PATENTS file in the same directory.
16573
- *
16574
- * @providesModule ReactChildren
16575
- */
16576
-
16577
- 'use strict';
16578
-
16579
- var PooledClass = require('./PooledClass');
16580
- var ReactElement = require('./ReactElement');
16581
-
16582
- var emptyFunction = require('fbjs/lib/emptyFunction');
16583
- var traverseAllChildren = require('./traverseAllChildren');
16584
-
16585
- var twoArgumentPooler = PooledClass.twoArgumentPooler;
16586
- var fourArgumentPooler = PooledClass.fourArgumentPooler;
16587
-
16588
- var userProvidedKeyEscapeRegex = /\/(?!\/)/g;
16589
- function escapeUserProvidedKey(text) {
16590
- return ('' + text).replace(userProvidedKeyEscapeRegex, '//');
16591
- }
16592
-
16593
- /**
16594
- * PooledClass representing the bookkeeping associated with performing a child
16595
- * traversal. Allows avoiding binding callbacks.
16596
- *
16597
- * @constructor ForEachBookKeeping
16598
- * @param {!function} forEachFunction Function to perform traversal with.
16599
- * @param {?*} forEachContext Context to perform context with.
16600
- */
16601
- function ForEachBookKeeping(forEachFunction, forEachContext) {
16602
- this.func = forEachFunction;
16603
- this.context = forEachContext;
16604
- this.count = 0;
16605
- }
16606
- ForEachBookKeeping.prototype.destructor = function () {
16607
- this.func = null;
16608
- this.context = null;
16609
- this.count = 0;
16610
- };
16611
- PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
16612
-
16613
- function forEachSingleChild(bookKeeping, child, name) {
16614
- var func = bookKeeping.func;
16615
- var context = bookKeeping.context;
16616
-
16617
- func.call(context, child, bookKeeping.count++);
16618
- }
16619
-
16620
- /**
16621
- * Iterates through children that are typically specified as `props.children`.
16622
- *
16623
- * The provided forEachFunc(child, index) will be called for each
16624
- * leaf child.
16625
- *
16626
- * @param {?*} children Children tree container.
16627
- * @param {function(*, int)} forEachFunc
16628
- * @param {*} forEachContext Context for forEachContext.
16629
- */
16630
- function forEachChildren(children, forEachFunc, forEachContext) {
16631
- if (children == null) {
16632
- return children;
16633
- }
16634
- var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
16635
- traverseAllChildren(children, forEachSingleChild, traverseContext);
16636
- ForEachBookKeeping.release(traverseContext);
16637
- }
16638
-
16639
- /**
16640
- * PooledClass representing the bookkeeping associated with performing a child
16641
- * mapping. Allows avoiding binding callbacks.
16642
- *
16643
- * @constructor MapBookKeeping
16644
- * @param {!*} mapResult Object containing the ordered map of results.
16645
- * @param {!function} mapFunction Function to perform mapping with.
16646
- * @param {?*} mapContext Context to perform mapping with.
16647
- */
16648
- function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
16649
- this.result = mapResult;
16650
- this.keyPrefix = keyPrefix;
16651
- this.func = mapFunction;
16652
- this.context = mapContext;
16653
- this.count = 0;
16654
- }
16655
- MapBookKeeping.prototype.destructor = function () {
16656
- this.result = null;
16657
- this.keyPrefix = null;
16658
- this.func = null;
16659
- this.context = null;
16660
- this.count = 0;
16661
- };
16662
- PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler);
16663
-
16664
- function mapSingleChildIntoContext(bookKeeping, child, childKey) {
16665
- var result = bookKeeping.result;
16666
- var keyPrefix = bookKeeping.keyPrefix;
16667
- var func = bookKeeping.func;
16668
- var context = bookKeeping.context;
16669
-
16670
- var mappedChild = func.call(context, child, bookKeeping.count++);
16671
- if (Array.isArray(mappedChild)) {
16672
- mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
16673
- } else if (mappedChild != null) {
16674
- if (ReactElement.isValidElement(mappedChild)) {
16675
- mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
16676
- // Keep both the (mapped) and old keys if they differ, just as
16677
- // traverseAllChildren used to do for objects as children
16678
- keyPrefix + (mappedChild !== child ? escapeUserProvidedKey(mappedChild.key || '') + '/' : '') + childKey);
16679
- }
16680
- result.push(mappedChild);
16681
- }
16682
- }
16683
-
16684
- function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
16685
- var escapedPrefix = '';
16686
- if (prefix != null) {
16687
- escapedPrefix = escapeUserProvidedKey(prefix) + '/';
16688
- }
16689
- var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
16690
- traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
16691
- MapBookKeeping.release(traverseContext);
16692
- }
16693
-
16694
- /**
16695
- * Maps children that are typically specified as `props.children`.
16696
- *
16697
- * The provided mapFunction(child, key, index) will be called for each
16698
- * leaf child.
16699
- *
16700
- * @param {?*} children Children tree container.
16701
- * @param {function(*, int)} func The map function.
16702
- * @param {*} context Context for mapFunction.
16703
- * @return {object} Object containing the ordered map of results.
16704
- */
16705
- function mapChildren(children, func, context) {
16706
- if (children == null) {
16707
- return children;
16708
- }
16709
- var result = [];
16710
- mapIntoWithKeyPrefixInternal(children, result, null, func, context);
16711
- return result;
16712
- }
16713
-
16714
- function forEachSingleChildDummy(traverseContext, child, name) {
16715
- return null;
16716
- }
16717
-
16718
- /**
16719
- * Count the number of children that are typically specified as
16720
- * `props.children`.
16721
- *
16722
- * @param {?*} children Children tree container.
16723
- * @return {number} The number of children.
16724
- */
16725
- function countChildren(children, context) {
16726
- return traverseAllChildren(children, forEachSingleChildDummy, null);
16727
- }
16728
-
16729
- /**
16730
- * Flatten a children object (typically specified as `props.children`) and
16731
- * return an array with appropriately re-keyed children.
16732
- */
16733
- function toArray(children) {
16734
- var result = [];
16735
- mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
16736
- return result;
16737
- }
16738
-
16739
- var ReactChildren = {
16740
- forEach: forEachChildren,
16741
- map: mapChildren,
16742
- mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
16743
- count: countChildren,
16744
- toArray: toArray
16745
- };
16746
-
16747
- module.exports = ReactChildren;
16748
- },{"./PooledClass":55,"./ReactElement":84,"./traverseAllChildren":159,"fbjs/lib/emptyFunction":10}],61:[function(require,module,exports){
16749
- (function (process){
16750
- /**
16751
- * Copyright 2013-2015, Facebook, Inc.
16752
- * All rights reserved.
16753
- *
16754
- * This source code is licensed under the BSD-style license found in the
16755
- * LICENSE file in the root directory of this source tree. An additional grant
16756
- * of patent rights can be found in the PATENTS file in the same directory.
16757
- *
16758
- * @providesModule ReactClass
16759
- */
16760
-
16761
- 'use strict';
16762
-
16763
- var ReactComponent = require('./ReactComponent');
16764
- var ReactElement = require('./ReactElement');
16765
- var ReactPropTypeLocations = require('./ReactPropTypeLocations');
16766
- var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
16767
- var ReactNoopUpdateQueue = require('./ReactNoopUpdateQueue');
16768
-
16769
- var assign = require('./Object.assign');
16770
- var emptyObject = require('fbjs/lib/emptyObject');
16771
- var invariant = require('fbjs/lib/invariant');
16772
- var keyMirror = require('fbjs/lib/keyMirror');
16773
- var keyOf = require('fbjs/lib/keyOf');
16774
- var warning = require('fbjs/lib/warning');
16775
-
16776
- var MIXINS_KEY = keyOf({ mixins: null });
16777
-
16778
- /**
16779
- * Policies that describe methods in `ReactClassInterface`.
16780
- */
16781
- var SpecPolicy = keyMirror({
16782
- /**
16783
- * These methods may be defined only once by the class specification or mixin.
16784
- */
16785
- DEFINE_ONCE: null,
16786
- /**
16787
- * These methods may be defined by both the class specification and mixins.
16788
- * Subsequent definitions will be chained. These methods must return void.
16789
- */
16790
- DEFINE_MANY: null,
16791
- /**
16792
- * These methods are overriding the base class.
16793
- */
16794
- OVERRIDE_BASE: null,
16795
- /**
16796
- * These methods are similar to DEFINE_MANY, except we assume they return
16797
- * objects. We try to merge the keys of the return values of all the mixed in
16798
- * functions. If there is a key conflict we throw.
16799
- */
16800
- DEFINE_MANY_MERGED: null
16801
- });
16802
-
16803
- var injectedMixins = [];
16804
-
16805
- var warnedSetProps = false;
16806
- function warnSetProps() {
16807
- if (!warnedSetProps) {
16808
- warnedSetProps = true;
16809
- process.env.NODE_ENV !== 'production' ? warning(false, 'setProps(...) and replaceProps(...) are deprecated. ' + 'Instead, call render again at the top level.') : undefined;
16810
- }
16811
- }
16812
-
16813
- /**
16814
- * Composite components are higher-level components that compose other composite
16815
- * or native components.
16816
- *
16817
- * To create a new type of `ReactClass`, pass a specification of
16818
- * your new class to `React.createClass`. The only requirement of your class
16819
- * specification is that you implement a `render` method.
16820
- *
16821
- * var MyComponent = React.createClass({
16822
- * render: function() {
16823
- * return <div>Hello World</div>;
16824
- * }
16825
- * });
16826
- *
16827
- * The class specification supports a specific protocol of methods that have
16828
- * special meaning (e.g. `render`). See `ReactClassInterface` for
16829
- * more the comprehensive protocol. Any other properties and methods in the
16830
- * class specification will be available on the prototype.
16831
- *
16832
- * @interface ReactClassInterface
16833
- * @internal
16834
- */
16835
- var ReactClassInterface = {
16836
-
16837
- /**
16838
- * An array of Mixin objects to include when defining your component.
16839
- *
16840
- * @type {array}
16841
- * @optional
16842
- */
16843
- mixins: SpecPolicy.DEFINE_MANY,
16844
-
16845
- /**
16846
- * An object containing properties and methods that should be defined on
16847
- * the component's constructor instead of its prototype (static methods).
16848
- *
16849
- * @type {object}
16850
- * @optional
16851
- */
16852
- statics: SpecPolicy.DEFINE_MANY,
16853
-
16854
- /**
16855
- * Definition of prop types for this component.
16856
- *
16857
- * @type {object}
16858
- * @optional
16859
- */
16860
- propTypes: SpecPolicy.DEFINE_MANY,
16861
-
16862
- /**
16863
- * Definition of context types for this component.
16864
- *
16865
- * @type {object}
16866
- * @optional
16867
- */
16868
- contextTypes: SpecPolicy.DEFINE_MANY,
16869
-
16870
- /**
16871
- * Definition of context types this component sets for its children.
16872
- *
16873
- * @type {object}
16874
- * @optional
16875
- */
16876
- childContextTypes: SpecPolicy.DEFINE_MANY,
16877
-
16878
- // ==== Definition methods ====
16879
-
16880
- /**
16881
- * Invoked when the component is mounted. Values in the mapping will be set on
16882
- * `this.props` if that prop is not specified (i.e. using an `in` check).
16883
- *
16884
- * This method is invoked before `getInitialState` and therefore cannot rely
16885
- * on `this.state` or use `this.setState`.
16886
- *
16887
- * @return {object}
16888
- * @optional
16889
- */
16890
- getDefaultProps: SpecPolicy.DEFINE_MANY_MERGED,
16891
-
16892
- /**
16893
- * Invoked once before the component is mounted. The return value will be used
16894
- * as the initial value of `this.state`.
16895
- *
16896
- * getInitialState: function() {
16897
- * return {
16898
- * isOn: false,
16899
- * fooBaz: new BazFoo()
16900
- * }
16901
- * }
16902
- *
16903
- * @return {object}
16904
- * @optional
16905
- */
16906
- getInitialState: SpecPolicy.DEFINE_MANY_MERGED,
16907
-
16908
- /**
16909
- * @return {object}
16910
- * @optional
16911
- */
16912
- getChildContext: SpecPolicy.DEFINE_MANY_MERGED,
16913
-
16914
- /**
16915
- * Uses props from `this.props` and state from `this.state` to render the
16916
- * structure of the component.
16917
- *
16918
- * No guarantees are made about when or how often this method is invoked, so
16919
- * it must not have side effects.
16920
- *
16921
- * render: function() {
16922
- * var name = this.props.name;
16923
- * return <div>Hello, {name}!</div>;
16924
- * }
16925
- *
16926
- * @return {ReactComponent}
16927
- * @nosideeffects
16928
- * @required
16929
- */
16930
- render: SpecPolicy.DEFINE_ONCE,
16931
-
16932
- // ==== Delegate methods ====
16933
-
16934
- /**
16935
- * Invoked when the component is initially created and about to be mounted.
16936
- * This may have side effects, but any external subscriptions or data created
16937
- * by this method must be cleaned up in `componentWillUnmount`.
16938
- *
16939
- * @optional
16940
- */
16941
- componentWillMount: SpecPolicy.DEFINE_MANY,
16942
-
16943
- /**
16944
- * Invoked when the component has been mounted and has a DOM representation.
16945
- * However, there is no guarantee that the DOM node is in the document.
16946
- *
16947
- * Use this as an opportunity to operate on the DOM when the component has
16948
- * been mounted (initialized and rendered) for the first time.
16949
- *
16950
- * @param {DOMElement} rootNode DOM element representing the component.
16951
- * @optional
16952
- */
16953
- componentDidMount: SpecPolicy.DEFINE_MANY,
16954
-
16955
- /**
16956
- * Invoked before the component receives new props.
16957
- *
16958
- * Use this as an opportunity to react to a prop transition by updating the
16959
- * state using `this.setState`. Current props are accessed via `this.props`.
16960
- *
16961
- * componentWillReceiveProps: function(nextProps, nextContext) {
16962
- * this.setState({
16963
- * likesIncreasing: nextProps.likeCount > this.props.likeCount
16964
- * });
16965
- * }
16966
- *
16967
- * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
16968
- * transition may cause a state change, but the opposite is not true. If you
16969
- * need it, you are probably looking for `componentWillUpdate`.
16970
- *
16971
- * @param {object} nextProps
16972
- * @optional
16973
- */
16974
- componentWillReceiveProps: SpecPolicy.DEFINE_MANY,
16975
-
16976
- /**
16977
- * Invoked while deciding if the component should be updated as a result of
16978
- * receiving new props, state and/or context.
16979
- *
16980
- * Use this as an opportunity to `return false` when you're certain that the
16981
- * transition to the new props/state/context will not require a component
16982
- * update.
16983
- *
16984
- * shouldComponentUpdate: function(nextProps, nextState, nextContext) {
16985
- * return !equal(nextProps, this.props) ||
16986
- * !equal(nextState, this.state) ||
16987
- * !equal(nextContext, this.context);
16988
- * }
16989
- *
16990
- * @param {object} nextProps
16991
- * @param {?object} nextState
16992
- * @param {?object} nextContext
16993
- * @return {boolean} True if the component should update.
16994
- * @optional
16995
- */
16996
- shouldComponentUpdate: SpecPolicy.DEFINE_ONCE,
16997
-
16998
- /**
16999
- * Invoked when the component is about to update due to a transition from
17000
- * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
17001
- * and `nextContext`.
17002
- *
17003
- * Use this as an opportunity to perform preparation before an update occurs.
17004
- *
17005
- * NOTE: You **cannot** use `this.setState()` in this method.
17006
- *
17007
- * @param {object} nextProps
17008
- * @param {?object} nextState
17009
- * @param {?object} nextContext
17010
- * @param {ReactReconcileTransaction} transaction
17011
- * @optional
17012
- */
17013
- componentWillUpdate: SpecPolicy.DEFINE_MANY,
17014
-
17015
- /**
17016
- * Invoked when the component's DOM representation has been updated.
17017
- *
17018
- * Use this as an opportunity to operate on the DOM when the component has
17019
- * been updated.
17020
- *
17021
- * @param {object} prevProps
17022
- * @param {?object} prevState
17023
- * @param {?object} prevContext
17024
- * @param {DOMElement} rootNode DOM element representing the component.
17025
- * @optional
17026
- */
17027
- componentDidUpdate: SpecPolicy.DEFINE_MANY,
17028
-
17029
- /**
17030
- * Invoked when the component is about to be removed from its parent and have
17031
- * its DOM representation destroyed.
17032
- *
17033
- * Use this as an opportunity to deallocate any external resources.
17034
- *
17035
- * NOTE: There is no `componentDidUnmount` since your component will have been
17036
- * destroyed by that point.
17037
- *
17038
- * @optional
17039
- */
17040
- componentWillUnmount: SpecPolicy.DEFINE_MANY,
17041
-
17042
- // ==== Advanced methods ====
17043
-
17044
- /**
17045
- * Updates the component's currently mounted DOM representation.
17046
- *
17047
- * By default, this implements React's rendering and reconciliation algorithm.
17048
- * Sophisticated clients may wish to override this.
17049
- *
17050
- * @param {ReactReconcileTransaction} transaction
17051
- * @internal
17052
- * @overridable
17053
- */
17054
- updateComponent: SpecPolicy.OVERRIDE_BASE
17055
-
17056
- };
17057
-
17058
- /**
17059
- * Mapping from class specification keys to special processing functions.
17060
- *
17061
- * Although these are declared like instance properties in the specification
17062
- * when defining classes using `React.createClass`, they are actually static
17063
- * and are accessible on the constructor instead of the prototype. Despite
17064
- * being static, they must be defined outside of the "statics" key under
17065
- * which all other static methods are defined.
17066
- */
17067
- var RESERVED_SPEC_KEYS = {
17068
- displayName: function (Constructor, displayName) {
17069
- Constructor.displayName = displayName;
17070
- },
17071
- mixins: function (Constructor, mixins) {
17072
- if (mixins) {
17073
- for (var i = 0; i < mixins.length; i++) {
17074
- mixSpecIntoComponent(Constructor, mixins[i]);
17075
- }
17076
- }
17077
- },
17078
- childContextTypes: function (Constructor, childContextTypes) {
17079
- if (process.env.NODE_ENV !== 'production') {
17080
- validateTypeDef(Constructor, childContextTypes, ReactPropTypeLocations.childContext);
17081
- }
17082
- Constructor.childContextTypes = assign({}, Constructor.childContextTypes, childContextTypes);
17083
- },
17084
- contextTypes: function (Constructor, contextTypes) {
17085
- if (process.env.NODE_ENV !== 'production') {
17086
- validateTypeDef(Constructor, contextTypes, ReactPropTypeLocations.context);
17087
- }
17088
- Constructor.contextTypes = assign({}, Constructor.contextTypes, contextTypes);
17089
- },
17090
- /**
17091
- * Special case getDefaultProps which should move into statics but requires
17092
- * automatic merging.
17093
- */
17094
- getDefaultProps: function (Constructor, getDefaultProps) {
17095
- if (Constructor.getDefaultProps) {
17096
- Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps);
17097
- } else {
17098
- Constructor.getDefaultProps = getDefaultProps;
17099
- }
17100
- },
17101
- propTypes: function (Constructor, propTypes) {
17102
- if (process.env.NODE_ENV !== 'production') {
17103
- validateTypeDef(Constructor, propTypes, ReactPropTypeLocations.prop);
17104
- }
17105
- Constructor.propTypes = assign({}, Constructor.propTypes, propTypes);
17106
- },
17107
- statics: function (Constructor, statics) {
17108
- mixStaticSpecIntoComponent(Constructor, statics);
17109
- },
17110
- autobind: function () {} };
17111
-
17112
- // noop
17113
- function validateTypeDef(Constructor, typeDef, location) {
17114
- for (var propName in typeDef) {
17115
- if (typeDef.hasOwnProperty(propName)) {
17116
- // use a warning instead of an invariant so components
17117
- // don't show up in prod but not in __DEV__
17118
- process.env.NODE_ENV !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : undefined;
17119
- }
17120
- }
17121
- }
17122
-
17123
- function validateMethodOverride(proto, name) {
17124
- var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
17125
-
17126
- // Disallow overriding of base class methods unless explicitly allowed.
17127
- if (ReactClassMixin.hasOwnProperty(name)) {
17128
- !(specPolicy === SpecPolicy.OVERRIDE_BASE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name) : invariant(false) : undefined;
17129
- }
17130
-
17131
- // Disallow defining methods more than once unless explicitly allowed.
17132
- if (proto.hasOwnProperty(name)) {
17133
- !(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name) : invariant(false) : undefined;
17134
- }
17135
- }
17136
-
17137
- /**
17138
- * Mixin helper which handles policy validation and reserved
17139
- * specification keys when building React classses.
17140
- */
17141
- function mixSpecIntoComponent(Constructor, spec) {
17142
- if (!spec) {
17143
- return;
17144
- }
17145
-
17146
- !(typeof spec !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component class as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
17147
- !!ReactElement.isValidElement(spec) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
17148
-
17149
- var proto = Constructor.prototype;
17150
-
17151
- // By handling mixins before any other properties, we ensure the same
17152
- // chaining order is applied to methods with DEFINE_MANY policy, whether
17153
- // mixins are listed before or after these methods in the spec.
17154
- if (spec.hasOwnProperty(MIXINS_KEY)) {
17155
- RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
17156
- }
17157
-
17158
- for (var name in spec) {
17159
- if (!spec.hasOwnProperty(name)) {
17160
- continue;
17161
- }
17162
-
17163
- if (name === MIXINS_KEY) {
17164
- // We have already handled mixins in a special case above.
17165
- continue;
17166
- }
17167
-
17168
- var property = spec[name];
17169
- validateMethodOverride(proto, name);
17170
-
17171
- if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
17172
- RESERVED_SPEC_KEYS[name](Constructor, property);
17173
- } else {
17174
- // Setup methods on prototype:
17175
- // The following member methods should not be automatically bound:
17176
- // 1. Expected ReactClass methods (in the "interface").
17177
- // 2. Overridden methods (that were mixed in).
17178
- var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
17179
- var isAlreadyDefined = proto.hasOwnProperty(name);
17180
- var isFunction = typeof property === 'function';
17181
- var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
17182
-
17183
- if (shouldAutoBind) {
17184
- if (!proto.__reactAutoBindMap) {
17185
- proto.__reactAutoBindMap = {};
17186
- }
17187
- proto.__reactAutoBindMap[name] = property;
17188
- proto[name] = property;
17189
- } else {
17190
- if (isAlreadyDefined) {
17191
- var specPolicy = ReactClassInterface[name];
17192
-
17193
- // These cases should already be caught by validateMethodOverride.
17194
- !(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name) : invariant(false) : undefined;
17195
-
17196
- // For methods which are defined more than once, call the existing
17197
- // methods before calling the new property, merging if appropriate.
17198
- if (specPolicy === SpecPolicy.DEFINE_MANY_MERGED) {
17199
- proto[name] = createMergedResultFunction(proto[name], property);
17200
- } else if (specPolicy === SpecPolicy.DEFINE_MANY) {
17201
- proto[name] = createChainedFunction(proto[name], property);
17202
- }
17203
- } else {
17204
- proto[name] = property;
17205
- if (process.env.NODE_ENV !== 'production') {
17206
- // Add verbose displayName to the function, which helps when looking
17207
- // at profiling tools.
17208
- if (typeof property === 'function' && spec.displayName) {
17209
- proto[name].displayName = spec.displayName + '_' + name;
17210
- }
17211
- }
17212
- }
17213
- }
17214
- }
17215
- }
17216
- }
17217
-
17218
- function mixStaticSpecIntoComponent(Constructor, statics) {
17219
- if (!statics) {
17220
- return;
17221
- }
17222
- for (var name in statics) {
17223
- var property = statics[name];
17224
- if (!statics.hasOwnProperty(name)) {
17225
- continue;
17226
- }
17227
-
17228
- var isReserved = (name in RESERVED_SPEC_KEYS);
17229
- !!isReserved ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name) : invariant(false) : undefined;
17230
-
17231
- var isInherited = (name in Constructor);
17232
- !!isInherited ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name) : invariant(false) : undefined;
17233
- Constructor[name] = property;
17234
- }
17235
- }
17236
-
17237
- /**
17238
- * Merge two objects, but throw if both contain the same key.
17239
- *
17240
- * @param {object} one The first object, which is mutated.
17241
- * @param {object} two The second object
17242
- * @return {object} one after it has been mutated to contain everything in two.
17243
- */
17244
- function mergeIntoWithNoDuplicateKeys(one, two) {
17245
- !(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) : undefined;
17246
-
17247
- for (var key in two) {
17248
- if (two.hasOwnProperty(key)) {
17249
- !(one[key] === undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key) : invariant(false) : undefined;
17250
- one[key] = two[key];
17251
- }
17252
- }
17253
- return one;
17254
- }
17255
-
17256
- /**
17257
- * Creates a function that invokes two functions and merges their return values.
17258
- *
17259
- * @param {function} one Function to invoke first.
17260
- * @param {function} two Function to invoke second.
17261
- * @return {function} Function that invokes the two argument functions.
17262
- * @private
17263
- */
17264
- function createMergedResultFunction(one, two) {
17265
- return function mergedResult() {
17266
- var a = one.apply(this, arguments);
17267
- var b = two.apply(this, arguments);
17268
- if (a == null) {
17269
- return b;
17270
- } else if (b == null) {
17271
- return a;
17272
- }
17273
- var c = {};
17274
- mergeIntoWithNoDuplicateKeys(c, a);
17275
- mergeIntoWithNoDuplicateKeys(c, b);
17276
- return c;
17277
- };
17278
- }
17279
-
17280
- /**
17281
- * Creates a function that invokes two functions and ignores their return vales.
17282
- *
17283
- * @param {function} one Function to invoke first.
17284
- * @param {function} two Function to invoke second.
17285
- * @return {function} Function that invokes the two argument functions.
17286
- * @private
17287
- */
17288
- function createChainedFunction(one, two) {
17289
- return function chainedFunction() {
17290
- one.apply(this, arguments);
17291
- two.apply(this, arguments);
17292
- };
17293
- }
17294
-
17295
- /**
17296
- * Binds a method to the component.
17297
- *
17298
- * @param {object} component Component whose method is going to be bound.
17299
- * @param {function} method Method to be bound.
17300
- * @return {function} The bound method.
17301
- */
17302
- function bindAutoBindMethod(component, method) {
17303
- var boundMethod = method.bind(component);
17304
- if (process.env.NODE_ENV !== 'production') {
17305
- boundMethod.__reactBoundContext = component;
17306
- boundMethod.__reactBoundMethod = method;
17307
- boundMethod.__reactBoundArguments = null;
17308
- var componentName = component.constructor.displayName;
17309
- var _bind = boundMethod.bind;
17310
- /* eslint-disable block-scoped-var, no-undef */
17311
- boundMethod.bind = function (newThis) {
17312
- for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
17313
- args[_key - 1] = arguments[_key];
17314
- }
17315
-
17316
- // User is trying to bind() an autobound method; we effectively will
17317
- // ignore the value of "this" that the user is trying to use, so
17318
- // let's warn.
17319
- if (newThis !== component && newThis !== null) {
17320
- process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : undefined;
17321
- } else if (!args.length) {
17322
- process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : undefined;
17323
- return boundMethod;
17324
- }
17325
- var reboundMethod = _bind.apply(boundMethod, arguments);
17326
- reboundMethod.__reactBoundContext = component;
17327
- reboundMethod.__reactBoundMethod = method;
17328
- reboundMethod.__reactBoundArguments = args;
17329
- return reboundMethod;
17330
- /* eslint-enable */
17331
- };
17332
- }
17333
- return boundMethod;
17334
- }
17335
-
17336
- /**
17337
- * Binds all auto-bound methods in a component.
17338
- *
17339
- * @param {object} component Component whose method is going to be bound.
17340
- */
17341
- function bindAutoBindMethods(component) {
17342
- for (var autoBindKey in component.__reactAutoBindMap) {
17343
- if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) {
17344
- var method = component.__reactAutoBindMap[autoBindKey];
17345
- component[autoBindKey] = bindAutoBindMethod(component, method);
17346
- }
17347
- }
17348
- }
17349
-
17350
- /**
17351
- * Add more to the ReactClass base class. These are all legacy features and
17352
- * therefore not already part of the modern ReactComponent.
17353
- */
17354
- var ReactClassMixin = {
17355
-
17356
- /**
17357
- * TODO: This will be deprecated because state should always keep a consistent
17358
- * type signature and the only use case for this, is to avoid that.
17359
- */
17360
- replaceState: function (newState, callback) {
17361
- this.updater.enqueueReplaceState(this, newState);
17362
- if (callback) {
17363
- this.updater.enqueueCallback(this, callback);
17364
- }
17365
- },
17366
-
17367
- /**
17368
- * Checks whether or not this composite component is mounted.
17369
- * @return {boolean} True if mounted, false otherwise.
17370
- * @protected
17371
- * @final
17372
- */
17373
- isMounted: function () {
17374
- return this.updater.isMounted(this);
17375
- },
17376
-
17377
- /**
17378
- * Sets a subset of the props.
17379
- *
17380
- * @param {object} partialProps Subset of the next props.
17381
- * @param {?function} callback Called after props are updated.
17382
- * @final
17383
- * @public
17384
- * @deprecated
17385
- */
17386
- setProps: function (partialProps, callback) {
17387
- if (process.env.NODE_ENV !== 'production') {
17388
- warnSetProps();
17389
- }
17390
- this.updater.enqueueSetProps(this, partialProps);
17391
- if (callback) {
17392
- this.updater.enqueueCallback(this, callback);
17393
- }
17394
- },
17395
-
17396
- /**
17397
- * Replace all the props.
17398
- *
17399
- * @param {object} newProps Subset of the next props.
17400
- * @param {?function} callback Called after props are updated.
17401
- * @final
17402
- * @public
17403
- * @deprecated
17404
- */
17405
- replaceProps: function (newProps, callback) {
17406
- if (process.env.NODE_ENV !== 'production') {
17407
- warnSetProps();
17408
- }
17409
- this.updater.enqueueReplaceProps(this, newProps);
17410
- if (callback) {
17411
- this.updater.enqueueCallback(this, callback);
17412
- }
17413
- }
17414
- };
17415
-
17416
- var ReactClassComponent = function () {};
17417
- assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
17418
-
17419
- /**
17420
- * Module for creating composite components.
17421
- *
17422
- * @class ReactClass
17423
- */
17424
- var ReactClass = {
17425
-
17426
- /**
17427
- * Creates a composite component class given a class specification.
17428
- *
17429
- * @param {object} spec Class specification (which must define `render`).
17430
- * @return {function} Component constructor function.
17431
- * @public
17432
- */
17433
- createClass: function (spec) {
17434
- var Constructor = function (props, context, updater) {
17435
- // This constructor is overridden by mocks. The argument is used
17436
- // by mocks to assert on what gets mounted.
17437
-
17438
- if (process.env.NODE_ENV !== 'production') {
17439
- process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : undefined;
17440
- }
17441
-
17442
- // Wire up auto-binding
17443
- if (this.__reactAutoBindMap) {
17444
- bindAutoBindMethods(this);
17445
- }
17446
-
17447
- this.props = props;
17448
- this.context = context;
17449
- this.refs = emptyObject;
17450
- this.updater = updater || ReactNoopUpdateQueue;
17451
-
17452
- this.state = null;
17453
-
17454
- // ReactClasses doesn't have constructors. Instead, they use the
17455
- // getInitialState and componentWillMount methods for initialization.
17456
-
17457
- var initialState = this.getInitialState ? this.getInitialState() : null;
17458
- if (process.env.NODE_ENV !== 'production') {
17459
- // We allow auto-mocks to proceed as if they're returning null.
17460
- if (typeof initialState === 'undefined' && this.getInitialState._isMockFunction) {
17461
- // This is probably bad practice. Consider warning here and
17462
- // deprecating this convenience.
17463
- initialState = null;
17464
- }
17465
- }
17466
- !(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) : undefined;
17467
-
17468
- this.state = initialState;
17469
- };
17470
- Constructor.prototype = new ReactClassComponent();
17471
- Constructor.prototype.constructor = Constructor;
17472
-
17473
- injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
17474
-
17475
- mixSpecIntoComponent(Constructor, spec);
17476
-
17477
- // Initialize the defaultProps property after all mixins have been merged.
17478
- if (Constructor.getDefaultProps) {
17479
- Constructor.defaultProps = Constructor.getDefaultProps();
17480
- }
17481
-
17482
- if (process.env.NODE_ENV !== 'production') {
17483
- // This is a tag to indicate that the use of these method names is ok,
17484
- // since it's used with createClass. If it's not, then it's likely a
17485
- // mistake so we'll warn you to use the static property, property
17486
- // initializer or constructor respectively.
17487
- if (Constructor.getDefaultProps) {
17488
- Constructor.getDefaultProps.isReactClassApproved = {};
17489
- }
17490
- if (Constructor.prototype.getInitialState) {
17491
- Constructor.prototype.getInitialState.isReactClassApproved = {};
17492
- }
17493
- }
17494
-
17495
- !Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) : undefined;
17496
-
17497
- if (process.env.NODE_ENV !== 'production') {
17498
- process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : undefined;
17499
- process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : undefined;
17500
- }
17501
-
17502
- // Reduce time spent doing lookups by setting these on the prototype.
17503
- for (var methodName in ReactClassInterface) {
17504
- if (!Constructor.prototype[methodName]) {
17505
- Constructor.prototype[methodName] = null;
17506
- }
17507
- }
17508
-
17509
- return Constructor;
17510
- },
17511
-
17512
- injection: {
17513
- injectMixin: function (mixin) {
17514
- injectedMixins.push(mixin);
17515
- }
17516
- }
17517
-
17518
- };
17519
-
17520
- module.exports = ReactClass;
17521
- }).call(this,require('_process'))
17522
-
17523
- },{"./Object.assign":54,"./ReactComponent":62,"./ReactElement":84,"./ReactNoopUpdateQueue":101,"./ReactPropTypeLocationNames":104,"./ReactPropTypeLocations":105,"_process":31,"fbjs/lib/emptyObject":11,"fbjs/lib/invariant":18,"fbjs/lib/keyMirror":21,"fbjs/lib/keyOf":22,"fbjs/lib/warning":29}],62:[function(require,module,exports){
17524
- (function (process){
17525
- /**
17526
- * Copyright 2013-2015, Facebook, Inc.
17527
- * All rights reserved.
17528
- *
17529
- * This source code is licensed under the BSD-style license found in the
17530
- * LICENSE file in the root directory of this source tree. An additional grant
17531
- * of patent rights can be found in the PATENTS file in the same directory.
17532
- *
17533
- * @providesModule ReactComponent
17534
- */
17535
-
17536
- 'use strict';
17537
-
17538
- var ReactNoopUpdateQueue = require('./ReactNoopUpdateQueue');
17539
-
17540
- var canDefineProperty = require('./canDefineProperty');
17541
- var emptyObject = require('fbjs/lib/emptyObject');
17542
- var invariant = require('fbjs/lib/invariant');
17543
- var warning = require('fbjs/lib/warning');
17544
-
17545
- /**
17546
- * Base class helpers for the updating state of a component.
17547
- */
17548
- function ReactComponent(props, context, updater) {
17549
- this.props = props;
17550
- this.context = context;
17551
- this.refs = emptyObject;
17552
- // We initialize the default updater but the real one gets injected by the
17553
- // renderer.
17554
- this.updater = updater || ReactNoopUpdateQueue;
17555
- }
17556
-
17557
- ReactComponent.prototype.isReactComponent = {};
17558
-
17559
- /**
17560
- * Sets a subset of the state. Always use this to mutate
17561
- * state. You should treat `this.state` as immutable.
17562
- *
17563
- * There is no guarantee that `this.state` will be immediately updated, so
17564
- * accessing `this.state` after calling this method may return the old value.
17565
- *
17566
- * There is no guarantee that calls to `setState` will run synchronously,
17567
- * as they may eventually be batched together. You can provide an optional
17568
- * callback that will be executed when the call to setState is actually
17569
- * completed.
17570
- *
17571
- * When a function is provided to setState, it will be called at some point in
17572
- * the future (not synchronously). It will be called with the up to date
17573
- * component arguments (state, props, context). These values can be different
17574
- * from this.* because your function may be called after receiveProps but before
17575
- * shouldComponentUpdate, and this new state, props, and context will not yet be
17576
- * assigned to this.
17577
- *
17578
- * @param {object|function} partialState Next partial state or function to
17579
- * produce next partial state to be merged with current state.
17580
- * @param {?function} callback Called after state is updated.
17581
- * @final
17582
- * @protected
17583
- */
17584
- ReactComponent.prototype.setState = function (partialState, callback) {
17585
- !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.') : invariant(false) : undefined;
17586
- if (process.env.NODE_ENV !== 'production') {
17587
- process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : undefined;
17588
- }
17589
- this.updater.enqueueSetState(this, partialState);
17590
- if (callback) {
17591
- this.updater.enqueueCallback(this, callback);
17592
- }
17593
- };
17594
-
17595
- /**
17596
- * Forces an update. This should only be invoked when it is known with
17597
- * certainty that we are **not** in a DOM transaction.
17598
- *
17599
- * You may want to call this when you know that some deeper aspect of the
17600
- * component's state has changed but `setState` was not called.
17601
- *
17602
- * This will not invoke `shouldComponentUpdate`, but it will invoke
17603
- * `componentWillUpdate` and `componentDidUpdate`.
17604
- *
17605
- * @param {?function} callback Called after update is complete.
17606
- * @final
17607
- * @protected
17608
- */
17609
- ReactComponent.prototype.forceUpdate = function (callback) {
17610
- this.updater.enqueueForceUpdate(this);
17611
- if (callback) {
17612
- this.updater.enqueueCallback(this, callback);
17613
- }
17614
- };
17615
-
17616
- /**
17617
- * Deprecated APIs. These APIs used to exist on classic React classes but since
17618
- * we would like to deprecate them, we're not going to move them over to this
17619
- * modern base class. Instead, we define a getter that warns if it's accessed.
17620
- */
17621
- if (process.env.NODE_ENV !== 'production') {
17622
- var deprecatedAPIs = {
17623
- getDOMNode: ['getDOMNode', 'Use ReactDOM.findDOMNode(component) instead.'],
17624
- isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
17625
- replaceProps: ['replaceProps', 'Instead, call render again at the top level.'],
17626
- replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'],
17627
- setProps: ['setProps', 'Instead, call render again at the top level.']
17628
- };
17629
- var defineDeprecationWarning = function (methodName, info) {
17630
- if (canDefineProperty) {
17631
- Object.defineProperty(ReactComponent.prototype, methodName, {
17632
- get: function () {
17633
- process.env.NODE_ENV !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : undefined;
17634
- return undefined;
17635
- }
17636
- });
17637
- }
17638
- };
17639
- for (var fnName in deprecatedAPIs) {
17640
- if (deprecatedAPIs.hasOwnProperty(fnName)) {
17641
- defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
17642
- }
17643
- }
17644
- }
17645
-
17646
- module.exports = ReactComponent;
17647
- }).call(this,require('_process'))
17648
-
17649
- },{"./ReactNoopUpdateQueue":101,"./canDefineProperty":136,"_process":31,"fbjs/lib/emptyObject":11,"fbjs/lib/invariant":18,"fbjs/lib/warning":29}],63:[function(require,module,exports){
17650
- /**
17651
- * Copyright 2013-2015, Facebook, Inc.
17652
- * All rights reserved.
17653
- *
17654
- * This source code is licensed under the BSD-style license found in the
17655
- * LICENSE file in the root directory of this source tree. An additional grant
17656
- * of patent rights can be found in the PATENTS file in the same directory.
17657
- *
17658
- * @providesModule ReactComponentBrowserEnvironment
17659
- */
17660
-
17661
- 'use strict';
17662
-
17663
- var ReactDOMIDOperations = require('./ReactDOMIDOperations');
17664
- var ReactMount = require('./ReactMount');
17665
-
17666
- /**
17667
- * Abstracts away all functionality of the reconciler that requires knowledge of
17668
- * the browser context. TODO: These callers should be refactored to avoid the
17669
- * need for this injection.
17670
- */
17671
- var ReactComponentBrowserEnvironment = {
17672
-
17673
- processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
17674
-
17675
- replaceNodeWithMarkupByID: ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
17676
-
17677
- /**
17678
- * If a particular environment requires that some resources be cleaned up,
17679
- * specify this in the injected Mixin. In the DOM, we would likely want to
17680
- * purge any cached node ID lookups.
17681
- *
17682
- * @private
17683
- */
17684
- unmountIDFromEnvironment: function (rootNodeID) {
17685
- ReactMount.purgeID(rootNodeID);
17686
- }
17687
-
17688
- };
17689
-
17690
- module.exports = ReactComponentBrowserEnvironment;
17691
- },{"./ReactDOMIDOperations":72,"./ReactMount":97}],64:[function(require,module,exports){
17692
- (function (process){
17693
- /**
17694
- * Copyright 2014-2015, Facebook, Inc.
17695
- * All rights reserved.
17696
- *
17697
- * This source code is licensed under the BSD-style license found in the
17698
- * LICENSE file in the root directory of this source tree. An additional grant
17699
- * of patent rights can be found in the PATENTS file in the same directory.
17700
- *
17701
- * @providesModule ReactComponentEnvironment
17702
- */
17703
-
17704
- 'use strict';
17705
-
17706
- var invariant = require('fbjs/lib/invariant');
17707
-
17708
- var injected = false;
17709
-
17710
- var ReactComponentEnvironment = {
17711
-
17712
- /**
17713
- * Optionally injectable environment dependent cleanup hook. (server vs.
17714
- * browser etc). Example: A browser system caches DOM nodes based on component
17715
- * ID and must remove that cache entry when this instance is unmounted.
17716
- */
17717
- unmountIDFromEnvironment: null,
17718
-
17719
- /**
17720
- * Optionally injectable hook for swapping out mount images in the middle of
17721
- * the tree.
17722
- */
17723
- replaceNodeWithMarkupByID: null,
17724
-
17725
- /**
17726
- * Optionally injectable hook for processing a queue of child updates. Will
17727
- * later move into MultiChildComponents.
17728
- */
17729
- processChildrenUpdates: null,
17730
-
17731
- injection: {
17732
- injectEnvironment: function (environment) {
17733
- !!injected ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : invariant(false) : undefined;
17734
- ReactComponentEnvironment.unmountIDFromEnvironment = environment.unmountIDFromEnvironment;
17735
- ReactComponentEnvironment.replaceNodeWithMarkupByID = environment.replaceNodeWithMarkupByID;
17736
- ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates;
17737
- injected = true;
17738
- }
17739
- }
17740
-
17741
- };
17742
-
17743
- module.exports = ReactComponentEnvironment;
17744
- }).call(this,require('_process'))
17745
-
17746
- },{"_process":31,"fbjs/lib/invariant":18}],65:[function(require,module,exports){
17747
- (function (process){
17748
- /**
17749
- * Copyright 2013-2015, Facebook, Inc.
17750
- * All rights reserved.
17751
- *
17752
- * This source code is licensed under the BSD-style license found in the
17753
- * LICENSE file in the root directory of this source tree. An additional grant
17754
- * of patent rights can be found in the PATENTS file in the same directory.
17755
- *
17756
- * @providesModule ReactCompositeComponent
17757
- */
17758
-
17759
- 'use strict';
17760
-
17761
- var ReactComponentEnvironment = require('./ReactComponentEnvironment');
17762
- var ReactCurrentOwner = require('./ReactCurrentOwner');
17763
- var ReactElement = require('./ReactElement');
17764
- var ReactInstanceMap = require('./ReactInstanceMap');
17765
- var ReactPerf = require('./ReactPerf');
17766
- var ReactPropTypeLocations = require('./ReactPropTypeLocations');
17767
- var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
17768
- var ReactReconciler = require('./ReactReconciler');
17769
- var ReactUpdateQueue = require('./ReactUpdateQueue');
17770
-
17771
- var assign = require('./Object.assign');
17772
- var emptyObject = require('fbjs/lib/emptyObject');
17773
- var invariant = require('fbjs/lib/invariant');
17774
- var shouldUpdateReactComponent = require('./shouldUpdateReactComponent');
17775
- var warning = require('fbjs/lib/warning');
17776
-
17777
- function getDeclarationErrorAddendum(component) {
17778
- var owner = component._currentElement._owner || null;
17779
- if (owner) {
17780
- var name = owner.getName();
17781
- if (name) {
17782
- return ' Check the render method of `' + name + '`.';
17783
- }
17784
- }
17785
- return '';
17786
- }
17787
-
17788
- function StatelessComponent(Component) {}
17789
- StatelessComponent.prototype.render = function () {
17790
- var Component = ReactInstanceMap.get(this)._currentElement.type;
17791
- return Component(this.props, this.context, this.updater);
17792
- };
17793
-
17794
- /**
17795
- * ------------------ The Life-Cycle of a Composite Component ------------------
17796
- *
17797
- * - constructor: Initialization of state. The instance is now retained.
17798
- * - componentWillMount
17799
- * - render
17800
- * - [children's constructors]
17801
- * - [children's componentWillMount and render]
17802
- * - [children's componentDidMount]
17803
- * - componentDidMount
17804
- *
17805
- * Update Phases:
17806
- * - componentWillReceiveProps (only called if parent updated)
17807
- * - shouldComponentUpdate
17808
- * - componentWillUpdate
17809
- * - render
17810
- * - [children's constructors or receive props phases]
17811
- * - componentDidUpdate
17812
- *
17813
- * - componentWillUnmount
17814
- * - [children's componentWillUnmount]
17815
- * - [children destroyed]
17816
- * - (destroyed): The instance is now blank, released by React and ready for GC.
17817
- *
17818
- * -----------------------------------------------------------------------------
17819
- */
17820
-
17821
- /**
17822
- * An incrementing ID assigned to each component when it is mounted. This is
17823
- * used to enforce the order in which `ReactUpdates` updates dirty components.
17824
- *
17825
- * @private
17826
- */
17827
- var nextMountID = 1;
17828
-
17829
- /**
17830
- * @lends {ReactCompositeComponent.prototype}
17831
- */
17832
- var ReactCompositeComponentMixin = {
17833
-
17834
- /**
17835
- * Base constructor for all composite component.
17836
- *
17837
- * @param {ReactElement} element
17838
- * @final
17839
- * @internal
17840
- */
17841
- construct: function (element) {
17842
- this._currentElement = element;
17843
- this._rootNodeID = null;
17844
- this._instance = null;
17845
-
17846
- // See ReactUpdateQueue
17847
- this._pendingElement = null;
17848
- this._pendingStateQueue = null;
17849
- this._pendingReplaceState = false;
17850
- this._pendingForceUpdate = false;
17851
-
17852
- this._renderedComponent = null;
17853
-
17854
- this._context = null;
17855
- this._mountOrder = 0;
17856
- this._topLevelWrapper = null;
17857
-
17858
- // See ReactUpdates and ReactUpdateQueue.
17859
- this._pendingCallbacks = null;
17860
- },
17861
-
17862
- /**
17863
- * Initializes the component, renders markup, and registers event listeners.
17864
- *
17865
- * @param {string} rootID DOM ID of the root node.
17866
- * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
17867
- * @return {?string} Rendered markup to be inserted into the DOM.
17868
- * @final
17869
- * @internal
17870
- */
17871
- mountComponent: function (rootID, transaction, context) {
17872
- this._context = context;
17873
- this._mountOrder = nextMountID++;
17874
- this._rootNodeID = rootID;
17875
-
17876
- var publicProps = this._processProps(this._currentElement.props);
17877
- var publicContext = this._processContext(context);
17878
-
17879
- var Component = this._currentElement.type;
17880
-
17881
- // Initialize the public class
17882
- var inst;
17883
- var renderedElement;
17884
-
17885
- // This is a way to detect if Component is a stateless arrow function
17886
- // component, which is not newable. It might not be 100% reliable but is
17887
- // something we can do until we start detecting that Component extends
17888
- // React.Component. We already assume that typeof Component === 'function'.
17889
- var canInstantiate = ('prototype' in Component);
17890
-
17891
- if (canInstantiate) {
17892
- if (process.env.NODE_ENV !== 'production') {
17893
- ReactCurrentOwner.current = this;
17894
- try {
17895
- inst = new Component(publicProps, publicContext, ReactUpdateQueue);
17896
- } finally {
17897
- ReactCurrentOwner.current = null;
17898
- }
17899
- } else {
17900
- inst = new Component(publicProps, publicContext, ReactUpdateQueue);
17901
- }
17902
- }
17903
-
17904
- if (!canInstantiate || inst === null || inst === false || ReactElement.isValidElement(inst)) {
17905
- renderedElement = inst;
17906
- inst = new StatelessComponent(Component);
17907
- }
17908
-
17909
- if (process.env.NODE_ENV !== 'production') {
17910
- // This will throw later in _renderValidatedComponent, but add an early
17911
- // warning now to help debugging
17912
- if (inst.render == null) {
17913
- process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`, returned ' + 'null/false from a stateless component, or tried to render an ' + 'element whose type is a function that isn\'t a React component.', Component.displayName || Component.name || 'Component') : undefined;
17914
- } else {
17915
- // We support ES6 inheriting from React.Component, the module pattern,
17916
- // and stateless components, but not ES6 classes that don't extend
17917
- process.env.NODE_ENV !== 'production' ? warning(Component.prototype && Component.prototype.isReactComponent || !canInstantiate || !(inst instanceof Component), '%s(...): React component classes must extend React.Component.', Component.displayName || Component.name || 'Component') : undefined;
17918
- }
17919
- }
17920
-
17921
- // These should be set up in the constructor, but as a convenience for
17922
- // simpler class abstractions, we set them up after the fact.
17923
- inst.props = publicProps;
17924
- inst.context = publicContext;
17925
- inst.refs = emptyObject;
17926
- inst.updater = ReactUpdateQueue;
17927
-
17928
- this._instance = inst;
17929
-
17930
- // Store a reference from the instance back to the internal representation
17931
- ReactInstanceMap.set(inst, this);
17932
-
17933
- if (process.env.NODE_ENV !== 'production') {
17934
- // Since plain JS classes are defined without any special initialization
17935
- // logic, we can not catch common errors early. Therefore, we have to
17936
- // catch them here, at initialization time, instead.
17937
- process.env.NODE_ENV !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : undefined;
17938
- process.env.NODE_ENV !== 'production' ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') : undefined;
17939
- process.env.NODE_ENV !== 'production' ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : undefined;
17940
- process.env.NODE_ENV !== 'production' ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : undefined;
17941
- process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentShouldUpdate !== 'function', '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', this.getName() || 'A component') : undefined;
17942
- process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentDidUnmount !== 'function', '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', this.getName() || 'A component') : undefined;
17943
- process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : undefined;
17944
- }
17945
-
17946
- var initialState = inst.state;
17947
- if (initialState === undefined) {
17948
- inst.state = initialState = null;
17949
- }
17950
- !(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
17951
-
17952
- this._pendingStateQueue = null;
17953
- this._pendingReplaceState = false;
17954
- this._pendingForceUpdate = false;
17955
-
17956
- if (inst.componentWillMount) {
17957
- inst.componentWillMount();
17958
- // When mounting, calls to `setState` by `componentWillMount` will set
17959
- // `this._pendingStateQueue` without triggering a re-render.
17960
- if (this._pendingStateQueue) {
17961
- inst.state = this._processPendingState(inst.props, inst.context);
17962
- }
17963
- }
17964
-
17965
- // If not a stateless component, we now render
17966
- if (renderedElement === undefined) {
17967
- renderedElement = this._renderValidatedComponent();
17968
- }
17969
-
17970
- this._renderedComponent = this._instantiateReactComponent(renderedElement);
17971
-
17972
- var markup = ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, this._processChildContext(context));
17973
- if (inst.componentDidMount) {
17974
- transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
17975
- }
17976
-
17977
- return markup;
17978
- },
17979
-
17980
- /**
17981
- * Releases any resources allocated by `mountComponent`.
17982
- *
17983
- * @final
17984
- * @internal
17985
- */
17986
- unmountComponent: function () {
17987
- var inst = this._instance;
17988
-
17989
- if (inst.componentWillUnmount) {
17990
- inst.componentWillUnmount();
17991
- }
17992
-
17993
- ReactReconciler.unmountComponent(this._renderedComponent);
17994
- this._renderedComponent = null;
17995
- this._instance = null;
17996
-
17997
- // Reset pending fields
17998
- // Even if this component is scheduled for another update in ReactUpdates,
17999
- // it would still be ignored because these fields are reset.
18000
- this._pendingStateQueue = null;
18001
- this._pendingReplaceState = false;
18002
- this._pendingForceUpdate = false;
18003
- this._pendingCallbacks = null;
18004
- this._pendingElement = null;
18005
-
18006
- // These fields do not really need to be reset since this object is no
18007
- // longer accessible.
18008
- this._context = null;
18009
- this._rootNodeID = null;
18010
- this._topLevelWrapper = null;
18011
-
18012
- // Delete the reference from the instance to this internal representation
18013
- // which allow the internals to be properly cleaned up even if the user
18014
- // leaks a reference to the public instance.
18015
- ReactInstanceMap.remove(inst);
18016
-
18017
- // Some existing components rely on inst.props even after they've been
18018
- // destroyed (in event handlers).
18019
- // TODO: inst.props = null;
18020
- // TODO: inst.state = null;
18021
- // TODO: inst.context = null;
18022
- },
18023
-
18024
- /**
18025
- * Filters the context object to only contain keys specified in
18026
- * `contextTypes`
18027
- *
18028
- * @param {object} context
18029
- * @return {?object}
18030
- * @private
18031
- */
18032
- _maskContext: function (context) {
18033
- var maskedContext = null;
18034
- var Component = this._currentElement.type;
18035
- var contextTypes = Component.contextTypes;
18036
- if (!contextTypes) {
18037
- return emptyObject;
18038
- }
18039
- maskedContext = {};
18040
- for (var contextName in contextTypes) {
18041
- maskedContext[contextName] = context[contextName];
18042
- }
18043
- return maskedContext;
18044
- },
18045
-
18046
- /**
18047
- * Filters the context object to only contain keys specified in
18048
- * `contextTypes`, and asserts that they are valid.
18049
- *
18050
- * @param {object} context
18051
- * @return {?object}
18052
- * @private
18053
- */
18054
- _processContext: function (context) {
18055
- var maskedContext = this._maskContext(context);
18056
- if (process.env.NODE_ENV !== 'production') {
18057
- var Component = this._currentElement.type;
18058
- if (Component.contextTypes) {
18059
- this._checkPropTypes(Component.contextTypes, maskedContext, ReactPropTypeLocations.context);
18060
- }
18061
- }
18062
- return maskedContext;
18063
- },
18064
-
18065
- /**
18066
- * @param {object} currentContext
18067
- * @return {object}
18068
- * @private
18069
- */
18070
- _processChildContext: function (currentContext) {
18071
- var Component = this._currentElement.type;
18072
- var inst = this._instance;
18073
- var childContext = inst.getChildContext && inst.getChildContext();
18074
- if (childContext) {
18075
- !(typeof Component.childContextTypes === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
18076
- if (process.env.NODE_ENV !== 'production') {
18077
- this._checkPropTypes(Component.childContextTypes, childContext, ReactPropTypeLocations.childContext);
18078
- }
18079
- for (var name in childContext) {
18080
- !(name in Component.childContextTypes) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : invariant(false) : undefined;
18081
- }
18082
- return assign({}, currentContext, childContext);
18083
- }
18084
- return currentContext;
18085
- },
18086
-
18087
- /**
18088
- * Processes props by setting default values for unspecified props and
18089
- * asserting that the props are valid. Does not mutate its argument; returns
18090
- * a new props object with defaults merged in.
18091
- *
18092
- * @param {object} newProps
18093
- * @return {object}
18094
- * @private
18095
- */
18096
- _processProps: function (newProps) {
18097
- if (process.env.NODE_ENV !== 'production') {
18098
- var Component = this._currentElement.type;
18099
- if (Component.propTypes) {
18100
- this._checkPropTypes(Component.propTypes, newProps, ReactPropTypeLocations.prop);
18101
- }
18102
- }
18103
- return newProps;
18104
- },
18105
-
18106
- /**
18107
- * Assert that the props are valid
18108
- *
18109
- * @param {object} propTypes Map of prop name to a ReactPropType
18110
- * @param {object} props
18111
- * @param {string} location e.g. "prop", "context", "child context"
18112
- * @private
18113
- */
18114
- _checkPropTypes: function (propTypes, props, location) {
18115
- // TODO: Stop validating prop types here and only use the element
18116
- // validation.
18117
- var componentName = this.getName();
18118
- for (var propName in propTypes) {
18119
- if (propTypes.hasOwnProperty(propName)) {
18120
- var error;
18121
- try {
18122
- // This is intentionally an invariant that gets caught. It's the same
18123
- // behavior as without this statement except with a better message.
18124
- !(typeof propTypes[propName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually ' + 'from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
18125
- error = propTypes[propName](props, propName, componentName, location);
18126
- } catch (ex) {
18127
- error = ex;
18128
- }
18129
- if (error instanceof Error) {
18130
- // We may want to extend this logic for similar errors in
18131
- // top-level render calls, so I'm abstracting it away into
18132
- // a function to minimize refactoring in the future
18133
- var addendum = getDeclarationErrorAddendum(this);
18134
-
18135
- if (location === ReactPropTypeLocations.prop) {
18136
- // Preface gives us something to blacklist in warning module
18137
- process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Composite propType: %s%s', error.message, addendum) : undefined;
18138
- } else {
18139
- process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Context Types: %s%s', error.message, addendum) : undefined;
18140
- }
18141
- }
18142
- }
18143
- }
18144
- },
18145
-
18146
- receiveComponent: function (nextElement, transaction, nextContext) {
18147
- var prevElement = this._currentElement;
18148
- var prevContext = this._context;
18149
-
18150
- this._pendingElement = null;
18151
-
18152
- this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext);
18153
- },
18154
-
18155
- /**
18156
- * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate`
18157
- * is set, update the component.
18158
- *
18159
- * @param {ReactReconcileTransaction} transaction
18160
- * @internal
18161
- */
18162
- performUpdateIfNecessary: function (transaction) {
18163
- if (this._pendingElement != null) {
18164
- ReactReconciler.receiveComponent(this, this._pendingElement || this._currentElement, transaction, this._context);
18165
- }
18166
-
18167
- if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
18168
- this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context);
18169
- }
18170
- },
18171
-
18172
- /**
18173
- * Perform an update to a mounted component. The componentWillReceiveProps and
18174
- * shouldComponentUpdate methods are called, then (assuming the update isn't
18175
- * skipped) the remaining update lifecycle methods are called and the DOM
18176
- * representation is updated.
18177
- *
18178
- * By default, this implements React's rendering and reconciliation algorithm.
18179
- * Sophisticated clients may wish to override this.
18180
- *
18181
- * @param {ReactReconcileTransaction} transaction
18182
- * @param {ReactElement} prevParentElement
18183
- * @param {ReactElement} nextParentElement
18184
- * @internal
18185
- * @overridable
18186
- */
18187
- updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) {
18188
- var inst = this._instance;
18189
-
18190
- var nextContext = this._context === nextUnmaskedContext ? inst.context : this._processContext(nextUnmaskedContext);
18191
- var nextProps;
18192
-
18193
- // Distinguish between a props update versus a simple state update
18194
- if (prevParentElement === nextParentElement) {
18195
- // Skip checking prop types again -- we don't read inst.props to avoid
18196
- // warning for DOM component props in this upgrade
18197
- nextProps = nextParentElement.props;
18198
- } else {
18199
- nextProps = this._processProps(nextParentElement.props);
18200
- // An update here will schedule an update but immediately set
18201
- // _pendingStateQueue which will ensure that any state updates gets
18202
- // immediately reconciled instead of waiting for the next batch.
18203
-
18204
- if (inst.componentWillReceiveProps) {
18205
- inst.componentWillReceiveProps(nextProps, nextContext);
18206
- }
18207
- }
18208
-
18209
- var nextState = this._processPendingState(nextProps, nextContext);
18210
-
18211
- var shouldUpdate = this._pendingForceUpdate || !inst.shouldComponentUpdate || inst.shouldComponentUpdate(nextProps, nextState, nextContext);
18212
-
18213
- if (process.env.NODE_ENV !== 'production') {
18214
- process.env.NODE_ENV !== 'production' ? warning(typeof shouldUpdate !== 'undefined', '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : undefined;
18215
- }
18216
-
18217
- if (shouldUpdate) {
18218
- this._pendingForceUpdate = false;
18219
- // Will set `this.props`, `this.state` and `this.context`.
18220
- this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext);
18221
- } else {
18222
- // If it's determined that a component should not update, we still want
18223
- // to set props and state but we shortcut the rest of the update.
18224
- this._currentElement = nextParentElement;
18225
- this._context = nextUnmaskedContext;
18226
- inst.props = nextProps;
18227
- inst.state = nextState;
18228
- inst.context = nextContext;
18229
- }
18230
- },
18231
-
18232
- _processPendingState: function (props, context) {
18233
- var inst = this._instance;
18234
- var queue = this._pendingStateQueue;
18235
- var replace = this._pendingReplaceState;
18236
- this._pendingReplaceState = false;
18237
- this._pendingStateQueue = null;
18238
-
18239
- if (!queue) {
18240
- return inst.state;
18241
- }
18242
-
18243
- if (replace && queue.length === 1) {
18244
- return queue[0];
18245
- }
18246
-
18247
- var nextState = assign({}, replace ? queue[0] : inst.state);
18248
- for (var i = replace ? 1 : 0; i < queue.length; i++) {
18249
- var partial = queue[i];
18250
- assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial);
18251
- }
18252
-
18253
- return nextState;
18254
- },
18255
-
18256
- /**
18257
- * Merges new props and state, notifies delegate methods of update and
18258
- * performs update.
18259
- *
18260
- * @param {ReactElement} nextElement Next element
18261
- * @param {object} nextProps Next public object to set as properties.
18262
- * @param {?object} nextState Next object to set as state.
18263
- * @param {?object} nextContext Next public object to set as context.
18264
- * @param {ReactReconcileTransaction} transaction
18265
- * @param {?object} unmaskedContext
18266
- * @private
18267
- */
18268
- _performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) {
18269
- var inst = this._instance;
18270
-
18271
- var hasComponentDidUpdate = Boolean(inst.componentDidUpdate);
18272
- var prevProps;
18273
- var prevState;
18274
- var prevContext;
18275
- if (hasComponentDidUpdate) {
18276
- prevProps = inst.props;
18277
- prevState = inst.state;
18278
- prevContext = inst.context;
18279
- }
18280
-
18281
- if (inst.componentWillUpdate) {
18282
- inst.componentWillUpdate(nextProps, nextState, nextContext);
18283
- }
18284
-
18285
- this._currentElement = nextElement;
18286
- this._context = unmaskedContext;
18287
- inst.props = nextProps;
18288
- inst.state = nextState;
18289
- inst.context = nextContext;
18290
-
18291
- this._updateRenderedComponent(transaction, unmaskedContext);
18292
-
18293
- if (hasComponentDidUpdate) {
18294
- transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst);
18295
- }
18296
- },
18297
-
18298
- /**
18299
- * Call the component's `render` method and update the DOM accordingly.
18300
- *
18301
- * @param {ReactReconcileTransaction} transaction
18302
- * @internal
18303
- */
18304
- _updateRenderedComponent: function (transaction, context) {
18305
- var prevComponentInstance = this._renderedComponent;
18306
- var prevRenderedElement = prevComponentInstance._currentElement;
18307
- var nextRenderedElement = this._renderValidatedComponent();
18308
- if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
18309
- ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context));
18310
- } else {
18311
- // These two IDs are actually the same! But nothing should rely on that.
18312
- var thisID = this._rootNodeID;
18313
- var prevComponentID = prevComponentInstance._rootNodeID;
18314
- ReactReconciler.unmountComponent(prevComponentInstance);
18315
-
18316
- this._renderedComponent = this._instantiateReactComponent(nextRenderedElement);
18317
- var nextMarkup = ReactReconciler.mountComponent(this._renderedComponent, thisID, transaction, this._processChildContext(context));
18318
- this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
18319
- }
18320
- },
18321
-
18322
- /**
18323
- * @protected
18324
- */
18325
- _replaceNodeWithMarkupByID: function (prevComponentID, nextMarkup) {
18326
- ReactComponentEnvironment.replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
18327
- },
18328
-
18329
- /**
18330
- * @protected
18331
- */
18332
- _renderValidatedComponentWithoutOwnerOrContext: function () {
18333
- var inst = this._instance;
18334
- var renderedComponent = inst.render();
18335
- if (process.env.NODE_ENV !== 'production') {
18336
- // We allow auto-mocks to proceed as if they're returning null.
18337
- if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) {
18338
- // This is probably bad practice. Consider warning here and
18339
- // deprecating this convenience.
18340
- renderedComponent = null;
18341
- }
18342
- }
18343
-
18344
- return renderedComponent;
18345
- },
18346
-
18347
- /**
18348
- * @private
18349
- */
18350
- _renderValidatedComponent: function () {
18351
- var renderedComponent;
18352
- ReactCurrentOwner.current = this;
18353
- try {
18354
- renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext();
18355
- } finally {
18356
- ReactCurrentOwner.current = null;
18357
- }
18358
- !(
18359
- // TODO: An `isValidNode` function would probably be more appropriate
18360
- renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.render(): A valid ReactComponent must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
18361
- return renderedComponent;
18362
- },
18363
-
18364
- /**
18365
- * Lazily allocates the refs object and stores `component` as `ref`.
18366
- *
18367
- * @param {string} ref Reference name.
18368
- * @param {component} component Component to store as `ref`.
18369
- * @final
18370
- * @private
18371
- */
18372
- attachRef: function (ref, component) {
18373
- var inst = this.getPublicInstance();
18374
- !(inst != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : invariant(false) : undefined;
18375
- var publicComponentInstance = component.getPublicInstance();
18376
- if (process.env.NODE_ENV !== 'production') {
18377
- var componentName = component && component.getName ? component.getName() : 'a component';
18378
- process.env.NODE_ENV !== 'production' ? warning(publicComponentInstance != null, 'Stateless function components cannot be given refs ' + '(See ref "%s" in %s created by %s). ' + 'Attempts to access this ref will fail.', ref, componentName, this.getName()) : undefined;
18379
- }
18380
- var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
18381
- refs[ref] = publicComponentInstance;
18382
- },
18383
-
18384
- /**
18385
- * Detaches a reference name.
18386
- *
18387
- * @param {string} ref Name to dereference.
18388
- * @final
18389
- * @private
18390
- */
18391
- detachRef: function (ref) {
18392
- var refs = this.getPublicInstance().refs;
18393
- delete refs[ref];
18394
- },
18395
-
18396
- /**
18397
- * Get a text description of the component that can be used to identify it
18398
- * in error messages.
18399
- * @return {string} The name or null.
18400
- * @internal
18401
- */
18402
- getName: function () {
18403
- var type = this._currentElement.type;
18404
- var constructor = this._instance && this._instance.constructor;
18405
- return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null;
18406
- },
18407
-
18408
- /**
18409
- * Get the publicly accessible representation of this component - i.e. what
18410
- * is exposed by refs and returned by render. Can be null for stateless
18411
- * components.
18412
- *
18413
- * @return {ReactComponent} the public component instance.
18414
- * @internal
18415
- */
18416
- getPublicInstance: function () {
18417
- var inst = this._instance;
18418
- if (inst instanceof StatelessComponent) {
18419
- return null;
18420
- }
18421
- return inst;
18422
- },
18423
-
18424
- // Stub
18425
- _instantiateReactComponent: null
18426
-
18427
- };
18428
-
18429
- ReactPerf.measureMethods(ReactCompositeComponentMixin, 'ReactCompositeComponent', {
18430
- mountComponent: 'mountComponent',
18431
- updateComponent: 'updateComponent',
18432
- _renderValidatedComponent: '_renderValidatedComponent'
18433
- });
18434
-
18435
- var ReactCompositeComponent = {
18436
-
18437
- Mixin: ReactCompositeComponentMixin
18438
-
18439
- };
18440
-
18441
- module.exports = ReactCompositeComponent;
18442
- }).call(this,require('_process'))
18443
-
18444
- },{"./Object.assign":54,"./ReactComponentEnvironment":64,"./ReactCurrentOwner":66,"./ReactElement":84,"./ReactInstanceMap":94,"./ReactPerf":103,"./ReactPropTypeLocationNames":104,"./ReactPropTypeLocations":105,"./ReactReconciler":108,"./ReactUpdateQueue":114,"./shouldUpdateReactComponent":158,"_process":31,"fbjs/lib/emptyObject":11,"fbjs/lib/invariant":18,"fbjs/lib/warning":29}],66:[function(require,module,exports){
18445
- /**
18446
- * Copyright 2013-2015, Facebook, Inc.
18447
- * All rights reserved.
18448
- *
18449
- * This source code is licensed under the BSD-style license found in the
18450
- * LICENSE file in the root directory of this source tree. An additional grant
18451
- * of patent rights can be found in the PATENTS file in the same directory.
18452
- *
18453
- * @providesModule ReactCurrentOwner
18454
- */
18455
-
18456
- 'use strict';
18457
-
18458
- /**
18459
- * Keeps track of the current owner.
18460
- *
18461
- * The current owner is the component who should own any components that are
18462
- * currently being constructed.
18463
- */
18464
- var ReactCurrentOwner = {
18465
-
18466
- /**
18467
- * @internal
18468
- * @type {ReactComponent}
18469
- */
18470
- current: null
18471
-
18472
- };
18473
-
18474
- module.exports = ReactCurrentOwner;
18475
- },{}],67:[function(require,module,exports){
18476
- (function (process){
18477
- /**
18478
- * Copyright 2013-2015, Facebook, Inc.
18479
- * All rights reserved.
18480
- *
18481
- * This source code is licensed under the BSD-style license found in the
18482
- * LICENSE file in the root directory of this source tree. An additional grant
18483
- * of patent rights can be found in the PATENTS file in the same directory.
18484
- *
18485
- * @providesModule ReactDOM
18486
- */
18487
-
18488
- /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
18489
-
18490
- 'use strict';
18491
-
18492
- var ReactCurrentOwner = require('./ReactCurrentOwner');
18493
- var ReactDOMTextComponent = require('./ReactDOMTextComponent');
18494
- var ReactDefaultInjection = require('./ReactDefaultInjection');
18495
- var ReactInstanceHandles = require('./ReactInstanceHandles');
18496
- var ReactMount = require('./ReactMount');
18497
- var ReactPerf = require('./ReactPerf');
18498
- var ReactReconciler = require('./ReactReconciler');
18499
- var ReactUpdates = require('./ReactUpdates');
18500
- var ReactVersion = require('./ReactVersion');
18501
-
18502
- var findDOMNode = require('./findDOMNode');
18503
- var renderSubtreeIntoContainer = require('./renderSubtreeIntoContainer');
18504
- var warning = require('fbjs/lib/warning');
18505
-
18506
- ReactDefaultInjection.inject();
18507
-
18508
- var render = ReactPerf.measure('React', 'render', ReactMount.render);
18509
-
18510
- var React = {
18511
- findDOMNode: findDOMNode,
18512
- render: render,
18513
- unmountComponentAtNode: ReactMount.unmountComponentAtNode,
18514
- version: ReactVersion,
18515
-
18516
- /* eslint-disable camelcase */
18517
- unstable_batchedUpdates: ReactUpdates.batchedUpdates,
18518
- unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer
18519
- };
18520
-
18521
- // Inject the runtime into a devtools global hook regardless of browser.
18522
- // Allows for debugging when the hook is injected on the page.
18523
- /* eslint-enable camelcase */
18524
- if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
18525
- __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
18526
- CurrentOwner: ReactCurrentOwner,
18527
- InstanceHandles: ReactInstanceHandles,
18528
- Mount: ReactMount,
18529
- Reconciler: ReactReconciler,
18530
- TextComponent: ReactDOMTextComponent
18531
- });
18532
- }
18533
-
18534
- if (process.env.NODE_ENV !== 'production') {
18535
- var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
18536
- if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
18537
-
18538
- // First check if devtools is not installed
18539
- if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
18540
- // If we're in Chrome or Firefox, provide a download link if not installed.
18541
- if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
18542
- console.debug('Download the React DevTools for a better development experience: ' + 'https://fb.me/react-devtools');
18543
- }
18544
- }
18545
-
18546
- // If we're in IE8, check to see if we are in compatibility mode and provide
18547
- // information on preventing compatibility mode
18548
- var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
18549
-
18550
- process.env.NODE_ENV !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : undefined;
18551
-
18552
- var expectedFeatures = [
18553
- // shims
18554
- Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim,
18555
-
18556
- // shams
18557
- Object.create, Object.freeze];
18558
-
18559
- for (var i = 0; i < expectedFeatures.length; i++) {
18560
- if (!expectedFeatures[i]) {
18561
- console.error('One or more ES5 shim/shams expected by React are not available: ' + 'https://fb.me/react-warning-polyfills');
18562
- break;
18563
- }
18564
- }
18565
- }
18566
- }
18567
-
18568
- module.exports = React;
18569
- }).call(this,require('_process'))
18570
-
18571
- },{"./ReactCurrentOwner":66,"./ReactDOMTextComponent":78,"./ReactDefaultInjection":81,"./ReactInstanceHandles":93,"./ReactMount":97,"./ReactPerf":103,"./ReactReconciler":108,"./ReactUpdates":115,"./ReactVersion":116,"./findDOMNode":140,"./renderSubtreeIntoContainer":155,"_process":31,"fbjs/lib/ExecutionEnvironment":4,"fbjs/lib/warning":29}],68:[function(require,module,exports){
18572
- /**
18573
- * Copyright 2013-2015, Facebook, Inc.
18574
- * All rights reserved.
18575
- *
18576
- * This source code is licensed under the BSD-style license found in the
18577
- * LICENSE file in the root directory of this source tree. An additional grant
18578
- * of patent rights can be found in the PATENTS file in the same directory.
18579
- *
18580
- * @providesModule ReactDOMButton
18581
- */
18582
-
18583
- 'use strict';
18584
-
18585
- var mouseListenerNames = {
18586
- onClick: true,
18587
- onDoubleClick: true,
18588
- onMouseDown: true,
18589
- onMouseMove: true,
18590
- onMouseUp: true,
18591
-
18592
- onClickCapture: true,
18593
- onDoubleClickCapture: true,
18594
- onMouseDownCapture: true,
18595
- onMouseMoveCapture: true,
18596
- onMouseUpCapture: true
18597
- };
18598
-
18599
- /**
18600
- * Implements a <button> native component that does not receive mouse events
18601
- * when `disabled` is set.
18602
- */
18603
- var ReactDOMButton = {
18604
- getNativeProps: function (inst, props, context) {
18605
- if (!props.disabled) {
18606
- return props;
18607
- }
18608
-
18609
- // Copy the props, except the mouse listeners
18610
- var nativeProps = {};
18611
- for (var key in props) {
18612
- if (props.hasOwnProperty(key) && !mouseListenerNames[key]) {
18613
- nativeProps[key] = props[key];
18614
- }
18615
- }
18616
-
18617
- return nativeProps;
18618
- }
18619
- };
18620
-
18621
- module.exports = ReactDOMButton;
18622
- },{}],69:[function(require,module,exports){
18623
- (function (process){
18624
- /**
18625
- * Copyright 2013-2015, Facebook, Inc.
18626
- * All rights reserved.
18627
- *
18628
- * This source code is licensed under the BSD-style license found in the
18629
- * LICENSE file in the root directory of this source tree. An additional grant
18630
- * of patent rights can be found in the PATENTS file in the same directory.
18631
- *
18632
- * @providesModule ReactDOMComponent
18633
- * @typechecks static-only
18634
- */
18635
-
18636
- /* global hasOwnProperty:true */
18637
-
18638
- 'use strict';
18639
-
18640
- var AutoFocusUtils = require('./AutoFocusUtils');
18641
- var CSSPropertyOperations = require('./CSSPropertyOperations');
18642
- var DOMProperty = require('./DOMProperty');
18643
- var DOMPropertyOperations = require('./DOMPropertyOperations');
18644
- var EventConstants = require('./EventConstants');
18645
- var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
18646
- var ReactComponentBrowserEnvironment = require('./ReactComponentBrowserEnvironment');
18647
- var ReactDOMButton = require('./ReactDOMButton');
18648
- var ReactDOMInput = require('./ReactDOMInput');
18649
- var ReactDOMOption = require('./ReactDOMOption');
18650
- var ReactDOMSelect = require('./ReactDOMSelect');
18651
- var ReactDOMTextarea = require('./ReactDOMTextarea');
18652
- var ReactMount = require('./ReactMount');
18653
- var ReactMultiChild = require('./ReactMultiChild');
18654
- var ReactPerf = require('./ReactPerf');
18655
- var ReactUpdateQueue = require('./ReactUpdateQueue');
18656
-
18657
- var assign = require('./Object.assign');
18658
- var canDefineProperty = require('./canDefineProperty');
18659
- var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
18660
- var invariant = require('fbjs/lib/invariant');
18661
- var isEventSupported = require('./isEventSupported');
18662
- var keyOf = require('fbjs/lib/keyOf');
18663
- var setInnerHTML = require('./setInnerHTML');
18664
- var setTextContent = require('./setTextContent');
18665
- var shallowEqual = require('fbjs/lib/shallowEqual');
18666
- var validateDOMNesting = require('./validateDOMNesting');
18667
- var warning = require('fbjs/lib/warning');
18668
-
18669
- var deleteListener = ReactBrowserEventEmitter.deleteListener;
18670
- var listenTo = ReactBrowserEventEmitter.listenTo;
18671
- var registrationNameModules = ReactBrowserEventEmitter.registrationNameModules;
18672
-
18673
- // For quickly matching children type, to test if can be treated as content.
18674
- var CONTENT_TYPES = { 'string': true, 'number': true };
18675
-
18676
- var CHILDREN = keyOf({ children: null });
18677
- var STYLE = keyOf({ style: null });
18678
- var HTML = keyOf({ __html: null });
18679
-
18680
- var ELEMENT_NODE_TYPE = 1;
18681
-
18682
- function getDeclarationErrorAddendum(internalInstance) {
18683
- if (internalInstance) {
18684
- var owner = internalInstance._currentElement._owner || null;
18685
- if (owner) {
18686
- var name = owner.getName();
18687
- if (name) {
18688
- return ' This DOM node was rendered by `' + name + '`.';
18689
- }
18690
- }
18691
- }
18692
- return '';
18693
- }
18694
-
18695
- var legacyPropsDescriptor;
18696
- if (process.env.NODE_ENV !== 'production') {
18697
- legacyPropsDescriptor = {
18698
- props: {
18699
- enumerable: false,
18700
- get: function () {
18701
- var component = this._reactInternalComponent;
18702
- process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .props of a DOM node; instead, ' + 'recreate the props as `render` did originally or read the DOM ' + 'properties/attributes directly from this node (e.g., ' + 'this.refs.box.className).%s', getDeclarationErrorAddendum(component)) : undefined;
18703
- return component._currentElement.props;
18704
- }
18705
- }
18706
- };
18707
- }
18708
-
18709
- function legacyGetDOMNode() {
18710
- if (process.env.NODE_ENV !== 'production') {
18711
- var component = this._reactInternalComponent;
18712
- process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .getDOMNode() of a DOM node; ' + 'instead, use the node directly.%s', getDeclarationErrorAddendum(component)) : undefined;
18713
- }
18714
- return this;
18715
- }
18716
-
18717
- function legacyIsMounted() {
18718
- var component = this._reactInternalComponent;
18719
- if (process.env.NODE_ENV !== 'production') {
18720
- process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .isMounted() of a DOM node.%s', getDeclarationErrorAddendum(component)) : undefined;
18721
- }
18722
- return !!component;
18723
- }
18724
-
18725
- function legacySetStateEtc() {
18726
- if (process.env.NODE_ENV !== 'production') {
18727
- var component = this._reactInternalComponent;
18728
- process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setState(), .replaceState(), or ' + '.forceUpdate() of a DOM node. This is a no-op.%s', getDeclarationErrorAddendum(component)) : undefined;
18729
- }
18730
- }
18731
-
18732
- function legacySetProps(partialProps, callback) {
18733
- var component = this._reactInternalComponent;
18734
- if (process.env.NODE_ENV !== 'production') {
18735
- process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
18736
- }
18737
- if (!component) {
18738
- return;
18739
- }
18740
- ReactUpdateQueue.enqueueSetPropsInternal(component, partialProps);
18741
- if (callback) {
18742
- ReactUpdateQueue.enqueueCallbackInternal(component, callback);
18743
- }
18744
- }
18745
-
18746
- function legacyReplaceProps(partialProps, callback) {
18747
- var component = this._reactInternalComponent;
18748
- if (process.env.NODE_ENV !== 'production') {
18749
- process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .replaceProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
18750
- }
18751
- if (!component) {
18752
- return;
18753
- }
18754
- ReactUpdateQueue.enqueueReplacePropsInternal(component, partialProps);
18755
- if (callback) {
18756
- ReactUpdateQueue.enqueueCallbackInternal(component, callback);
18757
- }
18758
- }
18759
-
18760
- function friendlyStringify(obj) {
18761
- if (typeof obj === 'object') {
18762
- if (Array.isArray(obj)) {
18763
- return '[' + obj.map(friendlyStringify).join(', ') + ']';
18764
- } else {
18765
- var pairs = [];
18766
- for (var key in obj) {
18767
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
18768
- var keyEscaped = /^[a-z$_][\w$_]*$/i.test(key) ? key : JSON.stringify(key);
18769
- pairs.push(keyEscaped + ': ' + friendlyStringify(obj[key]));
18770
- }
18771
- }
18772
- return '{' + pairs.join(', ') + '}';
18773
- }
18774
- } else if (typeof obj === 'string') {
18775
- return JSON.stringify(obj);
18776
- } else if (typeof obj === 'function') {
18777
- return '[function object]';
18778
- }
18779
- // Differs from JSON.stringify in that undefined becauses undefined and that
18780
- // inf and nan don't become null
18781
- return String(obj);
18782
- }
18783
-
18784
- var styleMutationWarning = {};
18785
-
18786
- function checkAndWarnForMutatedStyle(style1, style2, component) {
18787
- if (style1 == null || style2 == null) {
18788
- return;
18789
- }
18790
- if (shallowEqual(style1, style2)) {
18791
- return;
18792
- }
18793
-
18794
- var componentName = component._tag;
18795
- var owner = component._currentElement._owner;
18796
- var ownerName;
18797
- if (owner) {
18798
- ownerName = owner.getName();
18799
- }
18800
-
18801
- var hash = ownerName + '|' + componentName;
18802
-
18803
- if (styleMutationWarning.hasOwnProperty(hash)) {
18804
- return;
18805
- }
18806
-
18807
- styleMutationWarning[hash] = true;
18808
-
18809
- process.env.NODE_ENV !== 'production' ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', friendlyStringify(style1), friendlyStringify(style2)) : undefined;
18810
- }
18811
-
18812
- /**
18813
- * @param {object} component
18814
- * @param {?object} props
18815
- */
18816
- function assertValidProps(component, props) {
18817
- if (!props) {
18818
- return;
18819
- }
18820
- // Note the use of `==` which checks for null or undefined.
18821
- if (process.env.NODE_ENV !== 'production') {
18822
- if (voidElementTags[component._tag]) {
18823
- process.env.NODE_ENV !== 'production' ? warning(props.children == null && props.dangerouslySetInnerHTML == null, '%s is a void element tag and must not have `children` or ' + 'use `props.dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : undefined;
18824
- }
18825
- }
18826
- if (props.dangerouslySetInnerHTML != null) {
18827
- !(props.children == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : invariant(false) : undefined;
18828
- !(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' + 'for more information.') : invariant(false) : undefined;
18829
- }
18830
- if (process.env.NODE_ENV !== 'production') {
18831
- process.env.NODE_ENV !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : undefined;
18832
- process.env.NODE_ENV !== 'production' ? warning(!props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : undefined;
18833
- }
18834
- !(props.style == null || typeof props.style === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'The `style` prop expects a mapping from style properties to values, ' + 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' + 'using JSX.%s', getDeclarationErrorAddendum(component)) : invariant(false) : undefined;
18835
- }
18836
-
18837
- function enqueuePutListener(id, registrationName, listener, transaction) {
18838
- if (process.env.NODE_ENV !== 'production') {
18839
- // IE8 has no API for event capturing and the `onScroll` event doesn't
18840
- // bubble.
18841
- process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : undefined;
18842
- }
18843
- var container = ReactMount.findReactContainerForID(id);
18844
- if (container) {
18845
- var doc = container.nodeType === ELEMENT_NODE_TYPE ? container.ownerDocument : container;
18846
- listenTo(registrationName, doc);
18847
- }
18848
- transaction.getReactMountReady().enqueue(putListener, {
18849
- id: id,
18850
- registrationName: registrationName,
18851
- listener: listener
18852
- });
18853
- }
18854
-
18855
- function putListener() {
18856
- var listenerToPut = this;
18857
- ReactBrowserEventEmitter.putListener(listenerToPut.id, listenerToPut.registrationName, listenerToPut.listener);
18858
- }
18859
-
18860
- // There are so many media events, it makes sense to just
18861
- // maintain a list rather than create a `trapBubbledEvent` for each
18862
- var mediaEvents = {
18863
- topAbort: 'abort',
18864
- topCanPlay: 'canplay',
18865
- topCanPlayThrough: 'canplaythrough',
18866
- topDurationChange: 'durationchange',
18867
- topEmptied: 'emptied',
18868
- topEncrypted: 'encrypted',
18869
- topEnded: 'ended',
18870
- topError: 'error',
18871
- topLoadedData: 'loadeddata',
18872
- topLoadedMetadata: 'loadedmetadata',
18873
- topLoadStart: 'loadstart',
18874
- topPause: 'pause',
18875
- topPlay: 'play',
18876
- topPlaying: 'playing',
18877
- topProgress: 'progress',
18878
- topRateChange: 'ratechange',
18879
- topSeeked: 'seeked',
18880
- topSeeking: 'seeking',
18881
- topStalled: 'stalled',
18882
- topSuspend: 'suspend',
18883
- topTimeUpdate: 'timeupdate',
18884
- topVolumeChange: 'volumechange',
18885
- topWaiting: 'waiting'
18886
- };
18887
-
18888
- function trapBubbledEventsLocal() {
18889
- var inst = this;
18890
- // If a component renders to null or if another component fatals and causes
18891
- // the state of the tree to be corrupted, `node` here can be null.
18892
- !inst._rootNodeID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Must be mounted to trap events') : invariant(false) : undefined;
18893
- var node = ReactMount.getNode(inst._rootNodeID);
18894
- !node ? process.env.NODE_ENV !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : invariant(false) : undefined;
18895
-
18896
- switch (inst._tag) {
18897
- case 'iframe':
18898
- inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
18899
- break;
18900
- case 'video':
18901
- case 'audio':
18902
-
18903
- inst._wrapperState.listeners = [];
18904
- // create listener for each media event
18905
- for (var event in mediaEvents) {
18906
- if (mediaEvents.hasOwnProperty(event)) {
18907
- inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes[event], mediaEvents[event], node));
18908
- }
18909
- }
18910
-
18911
- break;
18912
- case 'img':
18913
- inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
18914
- break;
18915
- case 'form':
18916
- inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit', node)];
18917
- break;
18918
- }
18919
- }
18920
-
18921
- function mountReadyInputWrapper() {
18922
- ReactDOMInput.mountReadyWrapper(this);
18923
- }
18924
-
18925
- function postUpdateSelectWrapper() {
18926
- ReactDOMSelect.postUpdateWrapper(this);
18927
- }
18928
-
18929
- // For HTML, certain tags should omit their close tag. We keep a whitelist for
18930
- // those special cased tags.
18931
-
18932
- var omittedCloseTags = {
18933
- 'area': true,
18934
- 'base': true,
18935
- 'br': true,
18936
- 'col': true,
18937
- 'embed': true,
18938
- 'hr': true,
18939
- 'img': true,
18940
- 'input': true,
18941
- 'keygen': true,
18942
- 'link': true,
18943
- 'meta': true,
18944
- 'param': true,
18945
- 'source': true,
18946
- 'track': true,
18947
- 'wbr': true
18948
- };
18949
-
18950
- // NOTE: menuitem's close tag should be omitted, but that causes problems.
18951
- var newlineEatingTags = {
18952
- 'listing': true,
18953
- 'pre': true,
18954
- 'textarea': true
18955
- };
18956
-
18957
- // For HTML, certain tags cannot have children. This has the same purpose as
18958
- // `omittedCloseTags` except that `menuitem` should still have its closing tag.
18959
-
18960
- var voidElementTags = assign({
18961
- 'menuitem': true
18962
- }, omittedCloseTags);
18963
-
18964
- // We accept any tag to be rendered but since this gets injected into arbitrary
18965
- // HTML, we want to make sure that it's a safe tag.
18966
- // http://www.w3.org/TR/REC-xml/#NT-Name
18967
-
18968
- var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
18969
- var validatedTagCache = {};
18970
- var hasOwnProperty = ({}).hasOwnProperty;
18971
-
18972
- function validateDangerousTag(tag) {
18973
- if (!hasOwnProperty.call(validatedTagCache, tag)) {
18974
- !VALID_TAG_REGEX.test(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : invariant(false) : undefined;
18975
- validatedTagCache[tag] = true;
18976
- }
18977
- }
18978
-
18979
- function processChildContextDev(context, inst) {
18980
- // Pass down our tag name to child components for validation purposes
18981
- context = assign({}, context);
18982
- var info = context[validateDOMNesting.ancestorInfoContextKey];
18983
- context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(info, inst._tag, inst);
18984
- return context;
18985
- }
18986
-
18987
- function isCustomComponent(tagName, props) {
18988
- return tagName.indexOf('-') >= 0 || props.is != null;
18989
- }
18990
-
18991
- /**
18992
- * Creates a new React class that is idempotent and capable of containing other
18993
- * React components. It accepts event listeners and DOM properties that are
18994
- * valid according to `DOMProperty`.
18995
- *
18996
- * - Event listeners: `onClick`, `onMouseDown`, etc.
18997
- * - DOM properties: `className`, `name`, `title`, etc.
18998
- *
18999
- * The `style` property functions differently from the DOM API. It accepts an
19000
- * object mapping of style properties to values.
19001
- *
19002
- * @constructor ReactDOMComponent
19003
- * @extends ReactMultiChild
19004
- */
19005
- function ReactDOMComponent(tag) {
19006
- validateDangerousTag(tag);
19007
- this._tag = tag.toLowerCase();
19008
- this._renderedChildren = null;
19009
- this._previousStyle = null;
19010
- this._previousStyleCopy = null;
19011
- this._rootNodeID = null;
19012
- this._wrapperState = null;
19013
- this._topLevelWrapper = null;
19014
- this._nodeWithLegacyProperties = null;
19015
- if (process.env.NODE_ENV !== 'production') {
19016
- this._unprocessedContextDev = null;
19017
- this._processedContextDev = null;
19018
- }
19019
- }
19020
-
19021
- ReactDOMComponent.displayName = 'ReactDOMComponent';
19022
-
19023
- ReactDOMComponent.Mixin = {
19024
-
19025
- construct: function (element) {
19026
- this._currentElement = element;
19027
- },
19028
-
19029
- /**
19030
- * Generates root tag markup then recurses. This method has side effects and
19031
- * is not idempotent.
19032
- *
19033
- * @internal
19034
- * @param {string} rootID The root DOM ID for this node.
19035
- * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
19036
- * @param {object} context
19037
- * @return {string} The computed markup.
19038
- */
19039
- mountComponent: function (rootID, transaction, context) {
19040
- this._rootNodeID = rootID;
19041
-
19042
- var props = this._currentElement.props;
19043
-
19044
- switch (this._tag) {
19045
- case 'iframe':
19046
- case 'img':
19047
- case 'form':
19048
- case 'video':
19049
- case 'audio':
19050
- this._wrapperState = {
19051
- listeners: null
19052
- };
19053
- transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
19054
- break;
19055
- case 'button':
19056
- props = ReactDOMButton.getNativeProps(this, props, context);
19057
- break;
19058
- case 'input':
19059
- ReactDOMInput.mountWrapper(this, props, context);
19060
- props = ReactDOMInput.getNativeProps(this, props, context);
19061
- break;
19062
- case 'option':
19063
- ReactDOMOption.mountWrapper(this, props, context);
19064
- props = ReactDOMOption.getNativeProps(this, props, context);
19065
- break;
19066
- case 'select':
19067
- ReactDOMSelect.mountWrapper(this, props, context);
19068
- props = ReactDOMSelect.getNativeProps(this, props, context);
19069
- context = ReactDOMSelect.processChildContext(this, props, context);
19070
- break;
19071
- case 'textarea':
19072
- ReactDOMTextarea.mountWrapper(this, props, context);
19073
- props = ReactDOMTextarea.getNativeProps(this, props, context);
19074
- break;
19075
- }
19076
-
19077
- assertValidProps(this, props);
19078
- if (process.env.NODE_ENV !== 'production') {
19079
- if (context[validateDOMNesting.ancestorInfoContextKey]) {
19080
- validateDOMNesting(this._tag, this, context[validateDOMNesting.ancestorInfoContextKey]);
19081
- }
19082
- }
19083
-
19084
- if (process.env.NODE_ENV !== 'production') {
19085
- this._unprocessedContextDev = context;
19086
- this._processedContextDev = processChildContextDev(context, this);
19087
- context = this._processedContextDev;
19088
- }
19089
-
19090
- var mountImage;
19091
- if (transaction.useCreateElement) {
19092
- var ownerDocument = context[ReactMount.ownerDocumentContextKey];
19093
- var el = ownerDocument.createElement(this._currentElement.type);
19094
- DOMPropertyOperations.setAttributeForID(el, this._rootNodeID);
19095
- // Populate node cache
19096
- ReactMount.getID(el);
19097
- this._updateDOMProperties({}, props, transaction, el);
19098
- this._createInitialChildren(transaction, props, context, el);
19099
- mountImage = el;
19100
- } else {
19101
- var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props);
19102
- var tagContent = this._createContentMarkup(transaction, props, context);
19103
- if (!tagContent && omittedCloseTags[this._tag]) {
19104
- mountImage = tagOpen + '/>';
19105
- } else {
19106
- mountImage = tagOpen + '>' + tagContent + '</' + this._currentElement.type + '>';
19107
- }
19108
- }
19109
-
19110
- switch (this._tag) {
19111
- case 'input':
19112
- transaction.getReactMountReady().enqueue(mountReadyInputWrapper, this);
19113
- // falls through
19114
- case 'button':
19115
- case 'select':
19116
- case 'textarea':
19117
- if (props.autoFocus) {
19118
- transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
19119
- }
19120
- break;
19121
- }
19122
-
19123
- return mountImage;
19124
- },
19125
-
19126
- /**
19127
- * Creates markup for the open tag and all attributes.
19128
- *
19129
- * This method has side effects because events get registered.
19130
- *
19131
- * Iterating over object properties is faster than iterating over arrays.
19132
- * @see http://jsperf.com/obj-vs-arr-iteration
19133
- *
19134
- * @private
19135
- * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
19136
- * @param {object} props
19137
- * @return {string} Markup of opening tag.
19138
- */
19139
- _createOpenTagMarkupAndPutListeners: function (transaction, props) {
19140
- var ret = '<' + this._currentElement.type;
19141
-
19142
- for (var propKey in props) {
19143
- if (!props.hasOwnProperty(propKey)) {
19144
- continue;
19145
- }
19146
- var propValue = props[propKey];
19147
- if (propValue == null) {
19148
- continue;
19149
- }
19150
- if (registrationNameModules.hasOwnProperty(propKey)) {
19151
- if (propValue) {
19152
- enqueuePutListener(this._rootNodeID, propKey, propValue, transaction);
19153
- }
19154
- } else {
19155
- if (propKey === STYLE) {
19156
- if (propValue) {
19157
- if (process.env.NODE_ENV !== 'production') {
19158
- // See `_updateDOMProperties`. style block
19159
- this._previousStyle = propValue;
19160
- }
19161
- propValue = this._previousStyleCopy = assign({}, props.style);
19162
- }
19163
- propValue = CSSPropertyOperations.createMarkupForStyles(propValue);
19164
- }
19165
- var markup = null;
19166
- if (this._tag != null && isCustomComponent(this._tag, props)) {
19167
- if (propKey !== CHILDREN) {
19168
- markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue);
19169
- }
19170
- } else {
19171
- markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
19172
- }
19173
- if (markup) {
19174
- ret += ' ' + markup;
19175
- }
19176
- }
19177
- }
19178
-
19179
- // For static pages, no need to put React ID and checksum. Saves lots of
19180
- // bytes.
19181
- if (transaction.renderToStaticMarkup) {
19182
- return ret;
19183
- }
19184
-
19185
- var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID);
19186
- return ret + ' ' + markupForID;
19187
- },
19188
-
19189
- /**
19190
- * Creates markup for the content between the tags.
19191
- *
19192
- * @private
19193
- * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
19194
- * @param {object} props
19195
- * @param {object} context
19196
- * @return {string} Content markup.
19197
- */
19198
- _createContentMarkup: function (transaction, props, context) {
19199
- var ret = '';
19200
-
19201
- // Intentional use of != to avoid catching zero/false.
19202
- var innerHTML = props.dangerouslySetInnerHTML;
19203
- if (innerHTML != null) {
19204
- if (innerHTML.__html != null) {
19205
- ret = innerHTML.__html;
19206
- }
19207
- } else {
19208
- var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
19209
- var childrenToUse = contentToUse != null ? null : props.children;
19210
- if (contentToUse != null) {
19211
- // TODO: Validate that text is allowed as a child of this node
19212
- ret = escapeTextContentForBrowser(contentToUse);
19213
- } else if (childrenToUse != null) {
19214
- var mountImages = this.mountChildren(childrenToUse, transaction, context);
19215
- ret = mountImages.join('');
19216
- }
19217
- }
19218
- if (newlineEatingTags[this._tag] && ret.charAt(0) === '\n') {
19219
- // text/html ignores the first character in these tags if it's a newline
19220
- // Prefer to break application/xml over text/html (for now) by adding
19221
- // a newline specifically to get eaten by the parser. (Alternately for
19222
- // textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first
19223
- // \r is normalized out by HTMLTextAreaElement#value.)
19224
- // See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre>
19225
- // See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions>
19226
- // See: <http://www.w3.org/TR/html5/syntax.html#newlines>
19227
- // See: Parsing of "textarea" "listing" and "pre" elements
19228
- // from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody>
19229
- return '\n' + ret;
19230
- } else {
19231
- return ret;
19232
- }
19233
- },
19234
-
19235
- _createInitialChildren: function (transaction, props, context, el) {
19236
- // Intentional use of != to avoid catching zero/false.
19237
- var innerHTML = props.dangerouslySetInnerHTML;
19238
- if (innerHTML != null) {
19239
- if (innerHTML.__html != null) {
19240
- setInnerHTML(el, innerHTML.__html);
19241
- }
19242
- } else {
19243
- var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
19244
- var childrenToUse = contentToUse != null ? null : props.children;
19245
- if (contentToUse != null) {
19246
- // TODO: Validate that text is allowed as a child of this node
19247
- setTextContent(el, contentToUse);
19248
- } else if (childrenToUse != null) {
19249
- var mountImages = this.mountChildren(childrenToUse, transaction, context);
19250
- for (var i = 0; i < mountImages.length; i++) {
19251
- el.appendChild(mountImages[i]);
19252
- }
19253
- }
19254
- }
19255
- },
19256
-
19257
- /**
19258
- * Receives a next element and updates the component.
19259
- *
19260
- * @internal
19261
- * @param {ReactElement} nextElement
19262
- * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
19263
- * @param {object} context
19264
- */
19265
- receiveComponent: function (nextElement, transaction, context) {
19266
- var prevElement = this._currentElement;
19267
- this._currentElement = nextElement;
19268
- this.updateComponent(transaction, prevElement, nextElement, context);
19269
- },
19270
-
19271
- /**
19272
- * Updates a native DOM component after it has already been allocated and
19273
- * attached to the DOM. Reconciles the root DOM node, then recurses.
19274
- *
19275
- * @param {ReactReconcileTransaction} transaction
19276
- * @param {ReactElement} prevElement
19277
- * @param {ReactElement} nextElement
19278
- * @internal
19279
- * @overridable
19280
- */
19281
- updateComponent: function (transaction, prevElement, nextElement, context) {
19282
- var lastProps = prevElement.props;
19283
- var nextProps = this._currentElement.props;
19284
-
19285
- switch (this._tag) {
19286
- case 'button':
19287
- lastProps = ReactDOMButton.getNativeProps(this, lastProps);
19288
- nextProps = ReactDOMButton.getNativeProps(this, nextProps);
19289
- break;
19290
- case 'input':
19291
- ReactDOMInput.updateWrapper(this);
19292
- lastProps = ReactDOMInput.getNativeProps(this, lastProps);
19293
- nextProps = ReactDOMInput.getNativeProps(this, nextProps);
19294
- break;
19295
- case 'option':
19296
- lastProps = ReactDOMOption.getNativeProps(this, lastProps);
19297
- nextProps = ReactDOMOption.getNativeProps(this, nextProps);
19298
- break;
19299
- case 'select':
19300
- lastProps = ReactDOMSelect.getNativeProps(this, lastProps);
19301
- nextProps = ReactDOMSelect.getNativeProps(this, nextProps);
19302
- break;
19303
- case 'textarea':
19304
- ReactDOMTextarea.updateWrapper(this);
19305
- lastProps = ReactDOMTextarea.getNativeProps(this, lastProps);
19306
- nextProps = ReactDOMTextarea.getNativeProps(this, nextProps);
19307
- break;
19308
- }
19309
-
19310
- if (process.env.NODE_ENV !== 'production') {
19311
- // If the context is reference-equal to the old one, pass down the same
19312
- // processed object so the update bailout in ReactReconciler behaves
19313
- // correctly (and identically in dev and prod). See #5005.
19314
- if (this._unprocessedContextDev !== context) {
19315
- this._unprocessedContextDev = context;
19316
- this._processedContextDev = processChildContextDev(context, this);
19317
- }
19318
- context = this._processedContextDev;
19319
- }
19320
-
19321
- assertValidProps(this, nextProps);
19322
- this._updateDOMProperties(lastProps, nextProps, transaction, null);
19323
- this._updateDOMChildren(lastProps, nextProps, transaction, context);
19324
-
19325
- if (!canDefineProperty && this._nodeWithLegacyProperties) {
19326
- this._nodeWithLegacyProperties.props = nextProps;
19327
- }
19328
-
19329
- if (this._tag === 'select') {
19330
- // <select> value update needs to occur after <option> children
19331
- // reconciliation
19332
- transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this);
19333
- }
19334
- },
19335
-
19336
- /**
19337
- * Reconciles the properties by detecting differences in property values and
19338
- * updating the DOM as necessary. This function is probably the single most
19339
- * critical path for performance optimization.
19340
- *
19341
- * TODO: Benchmark whether checking for changed values in memory actually
19342
- * improves performance (especially statically positioned elements).
19343
- * TODO: Benchmark the effects of putting this at the top since 99% of props
19344
- * do not change for a given reconciliation.
19345
- * TODO: Benchmark areas that can be improved with caching.
19346
- *
19347
- * @private
19348
- * @param {object} lastProps
19349
- * @param {object} nextProps
19350
- * @param {ReactReconcileTransaction} transaction
19351
- * @param {?DOMElement} node
19352
- */
19353
- _updateDOMProperties: function (lastProps, nextProps, transaction, node) {
19354
- var propKey;
19355
- var styleName;
19356
- var styleUpdates;
19357
- for (propKey in lastProps) {
19358
- if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey)) {
19359
- continue;
19360
- }
19361
- if (propKey === STYLE) {
19362
- var lastStyle = this._previousStyleCopy;
19363
- for (styleName in lastStyle) {
19364
- if (lastStyle.hasOwnProperty(styleName)) {
19365
- styleUpdates = styleUpdates || {};
19366
- styleUpdates[styleName] = '';
19367
- }
19368
- }
19369
- this._previousStyleCopy = null;
19370
- } else if (registrationNameModules.hasOwnProperty(propKey)) {
19371
- if (lastProps[propKey]) {
19372
- // Only call deleteListener if there was a listener previously or
19373
- // else willDeleteListener gets called when there wasn't actually a
19374
- // listener (e.g., onClick={null})
19375
- deleteListener(this._rootNodeID, propKey);
19376
- }
19377
- } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
19378
- if (!node) {
19379
- node = ReactMount.getNode(this._rootNodeID);
19380
- }
19381
- DOMPropertyOperations.deleteValueForProperty(node, propKey);
19382
- }
19383
- }
19384
- for (propKey in nextProps) {
19385
- var nextProp = nextProps[propKey];
19386
- var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps[propKey];
19387
- if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) {
19388
- continue;
19389
- }
19390
- if (propKey === STYLE) {
19391
- if (nextProp) {
19392
- if (process.env.NODE_ENV !== 'production') {
19393
- checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this);
19394
- this._previousStyle = nextProp;
19395
- }
19396
- nextProp = this._previousStyleCopy = assign({}, nextProp);
19397
- } else {
19398
- this._previousStyleCopy = null;
19399
- }
19400
- if (lastProp) {
19401
- // Unset styles on `lastProp` but not on `nextProp`.
19402
- for (styleName in lastProp) {
19403
- if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
19404
- styleUpdates = styleUpdates || {};
19405
- styleUpdates[styleName] = '';
19406
- }
19407
- }
19408
- // Update styles that changed since `lastProp`.
19409
- for (styleName in nextProp) {
19410
- if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
19411
- styleUpdates = styleUpdates || {};
19412
- styleUpdates[styleName] = nextProp[styleName];
19413
- }
19414
- }
19415
- } else {
19416
- // Relies on `updateStylesByID` not mutating `styleUpdates`.
19417
- styleUpdates = nextProp;
19418
- }
19419
- } else if (registrationNameModules.hasOwnProperty(propKey)) {
19420
- if (nextProp) {
19421
- enqueuePutListener(this._rootNodeID, propKey, nextProp, transaction);
19422
- } else if (lastProp) {
19423
- deleteListener(this._rootNodeID, propKey);
19424
- }
19425
- } else if (isCustomComponent(this._tag, nextProps)) {
19426
- if (!node) {
19427
- node = ReactMount.getNode(this._rootNodeID);
19428
- }
19429
- if (propKey === CHILDREN) {
19430
- nextProp = null;
19431
- }
19432
- DOMPropertyOperations.setValueForAttribute(node, propKey, nextProp);
19433
- } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
19434
- if (!node) {
19435
- node = ReactMount.getNode(this._rootNodeID);
19436
- }
19437
- // If we're updating to null or undefined, we should remove the property
19438
- // from the DOM node instead of inadvertantly setting to a string. This
19439
- // brings us in line with the same behavior we have on initial render.
19440
- if (nextProp != null) {
19441
- DOMPropertyOperations.setValueForProperty(node, propKey, nextProp);
19442
- } else {
19443
- DOMPropertyOperations.deleteValueForProperty(node, propKey);
19444
- }
19445
- }
19446
- }
19447
- if (styleUpdates) {
19448
- if (!node) {
19449
- node = ReactMount.getNode(this._rootNodeID);
19450
- }
19451
- CSSPropertyOperations.setValueForStyles(node, styleUpdates);
19452
- }
19453
- },
19454
-
19455
- /**
19456
- * Reconciles the children with the various properties that affect the
19457
- * children content.
19458
- *
19459
- * @param {object} lastProps
19460
- * @param {object} nextProps
19461
- * @param {ReactReconcileTransaction} transaction
19462
- * @param {object} context
19463
- */
19464
- _updateDOMChildren: function (lastProps, nextProps, transaction, context) {
19465
- var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
19466
- var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
19467
-
19468
- var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html;
19469
- var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html;
19470
-
19471
- // Note the use of `!=` which checks for null or undefined.
19472
- var lastChildren = lastContent != null ? null : lastProps.children;
19473
- var nextChildren = nextContent != null ? null : nextProps.children;
19474
-
19475
- // If we're switching from children to content/html or vice versa, remove
19476
- // the old content
19477
- var lastHasContentOrHtml = lastContent != null || lastHtml != null;
19478
- var nextHasContentOrHtml = nextContent != null || nextHtml != null;
19479
- if (lastChildren != null && nextChildren == null) {
19480
- this.updateChildren(null, transaction, context);
19481
- } else if (lastHasContentOrHtml && !nextHasContentOrHtml) {
19482
- this.updateTextContent('');
19483
- }
19484
-
19485
- if (nextContent != null) {
19486
- if (lastContent !== nextContent) {
19487
- this.updateTextContent('' + nextContent);
19488
- }
19489
- } else if (nextHtml != null) {
19490
- if (lastHtml !== nextHtml) {
19491
- this.updateMarkup('' + nextHtml);
19492
- }
19493
- } else if (nextChildren != null) {
19494
- this.updateChildren(nextChildren, transaction, context);
19495
- }
19496
- },
19497
-
19498
- /**
19499
- * Destroys all event registrations for this instance. Does not remove from
19500
- * the DOM. That must be done by the parent.
19501
- *
19502
- * @internal
19503
- */
19504
- unmountComponent: function () {
19505
- switch (this._tag) {
19506
- case 'iframe':
19507
- case 'img':
19508
- case 'form':
19509
- case 'video':
19510
- case 'audio':
19511
- var listeners = this._wrapperState.listeners;
19512
- if (listeners) {
19513
- for (var i = 0; i < listeners.length; i++) {
19514
- listeners[i].remove();
19515
- }
19516
- }
19517
- break;
19518
- case 'input':
19519
- ReactDOMInput.unmountWrapper(this);
19520
- break;
19521
- case 'html':
19522
- case 'head':
19523
- case 'body':
19524
- /**
19525
- * Components like <html> <head> and <body> can't be removed or added
19526
- * easily in a cross-browser way, however it's valuable to be able to
19527
- * take advantage of React's reconciliation for styling and <title>
19528
- * management. So we just document it and throw in dangerous cases.
19529
- */
19530
- !false ? process.env.NODE_ENV !== 'production' ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is ' + 'impossible to unmount some top-level components (eg <html>, ' + '<head>, and <body>) reliably and efficiently. To fix this, have a ' + 'single top-level component that never unmounts render these ' + 'elements.', this._tag) : invariant(false) : undefined;
19531
- break;
19532
- }
19533
-
19534
- this.unmountChildren();
19535
- ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID);
19536
- ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
19537
- this._rootNodeID = null;
19538
- this._wrapperState = null;
19539
- if (this._nodeWithLegacyProperties) {
19540
- var node = this._nodeWithLegacyProperties;
19541
- node._reactInternalComponent = null;
19542
- this._nodeWithLegacyProperties = null;
19543
- }
19544
- },
19545
-
19546
- getPublicInstance: function () {
19547
- if (!this._nodeWithLegacyProperties) {
19548
- var node = ReactMount.getNode(this._rootNodeID);
19549
-
19550
- node._reactInternalComponent = this;
19551
- node.getDOMNode = legacyGetDOMNode;
19552
- node.isMounted = legacyIsMounted;
19553
- node.setState = legacySetStateEtc;
19554
- node.replaceState = legacySetStateEtc;
19555
- node.forceUpdate = legacySetStateEtc;
19556
- node.setProps = legacySetProps;
19557
- node.replaceProps = legacyReplaceProps;
19558
-
19559
- if (process.env.NODE_ENV !== 'production') {
19560
- if (canDefineProperty) {
19561
- Object.defineProperties(node, legacyPropsDescriptor);
19562
- } else {
19563
- // updateComponent will update this property on subsequent renders
19564
- node.props = this._currentElement.props;
19565
- }
19566
- } else {
19567
- // updateComponent will update this property on subsequent renders
19568
- node.props = this._currentElement.props;
19569
- }
19570
-
19571
- this._nodeWithLegacyProperties = node;
19572
- }
19573
- return this._nodeWithLegacyProperties;
19574
- }
19575
-
19576
- };
19577
-
19578
- ReactPerf.measureMethods(ReactDOMComponent, 'ReactDOMComponent', {
19579
- mountComponent: 'mountComponent',
19580
- updateComponent: 'updateComponent'
19581
- });
19582
-
19583
- assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin);
19584
-
19585
- module.exports = ReactDOMComponent;
19586
- }).call(this,require('_process'))
19587
-
19588
- },{"./AutoFocusUtils":33,"./CSSPropertyOperations":36,"./DOMProperty":41,"./DOMPropertyOperations":42,"./EventConstants":46,"./Object.assign":54,"./ReactBrowserEventEmitter":58,"./ReactComponentBrowserEnvironment":63,"./ReactDOMButton":68,"./ReactDOMInput":73,"./ReactDOMOption":74,"./ReactDOMSelect":75,"./ReactDOMTextarea":79,"./ReactMount":97,"./ReactMultiChild":98,"./ReactPerf":103,"./ReactUpdateQueue":114,"./canDefineProperty":136,"./escapeTextContentForBrowser":139,"./isEventSupported":151,"./setInnerHTML":156,"./setTextContent":157,"./validateDOMNesting":160,"_process":31,"fbjs/lib/invariant":18,"fbjs/lib/keyOf":22,"fbjs/lib/shallowEqual":27,"fbjs/lib/warning":29}],70:[function(require,module,exports){
19589
- (function (process){
19590
- /**
19591
- * Copyright 2013-2015, Facebook, Inc.
19592
- * All rights reserved.
19593
- *
19594
- * This source code is licensed under the BSD-style license found in the
19595
- * LICENSE file in the root directory of this source tree. An additional grant
19596
- * of patent rights can be found in the PATENTS file in the same directory.
19597
- *
19598
- * @providesModule ReactDOMFactories
19599
- * @typechecks static-only
19600
- */
19601
-
19602
- 'use strict';
19603
-
19604
- var ReactElement = require('./ReactElement');
19605
- var ReactElementValidator = require('./ReactElementValidator');
19606
-
19607
- var mapObject = require('fbjs/lib/mapObject');
19608
-
19609
- /**
19610
- * Create a factory that creates HTML tag elements.
19611
- *
19612
- * @param {string} tag Tag name (e.g. `div`).
19613
- * @private
19614
- */
19615
- function createDOMFactory(tag) {
19616
- if (process.env.NODE_ENV !== 'production') {
19617
- return ReactElementValidator.createFactory(tag);
19618
- }
19619
- return ReactElement.createFactory(tag);
19620
- }
19621
-
19622
- /**
19623
- * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
19624
- * This is also accessible via `React.DOM`.
19625
- *
19626
- * @public
19627
- */
19628
- var ReactDOMFactories = mapObject({
19629
- a: 'a',
19630
- abbr: 'abbr',
19631
- address: 'address',
19632
- area: 'area',
19633
- article: 'article',
19634
- aside: 'aside',
19635
- audio: 'audio',
19636
- b: 'b',
19637
- base: 'base',
19638
- bdi: 'bdi',
19639
- bdo: 'bdo',
19640
- big: 'big',
19641
- blockquote: 'blockquote',
19642
- body: 'body',
19643
- br: 'br',
19644
- button: 'button',
19645
- canvas: 'canvas',
19646
- caption: 'caption',
19647
- cite: 'cite',
19648
- code: 'code',
19649
- col: 'col',
19650
- colgroup: 'colgroup',
19651
- data: 'data',
19652
- datalist: 'datalist',
19653
- dd: 'dd',
19654
- del: 'del',
19655
- details: 'details',
19656
- dfn: 'dfn',
19657
- dialog: 'dialog',
19658
- div: 'div',
19659
- dl: 'dl',
19660
- dt: 'dt',
19661
- em: 'em',
19662
- embed: 'embed',
19663
- fieldset: 'fieldset',
19664
- figcaption: 'figcaption',
19665
- figure: 'figure',
19666
- footer: 'footer',
19667
- form: 'form',
19668
- h1: 'h1',
19669
- h2: 'h2',
19670
- h3: 'h3',
19671
- h4: 'h4',
19672
- h5: 'h5',
19673
- h6: 'h6',
19674
- head: 'head',
19675
- header: 'header',
19676
- hgroup: 'hgroup',
19677
- hr: 'hr',
19678
- html: 'html',
19679
- i: 'i',
19680
- iframe: 'iframe',
19681
- img: 'img',
19682
- input: 'input',
19683
- ins: 'ins',
19684
- kbd: 'kbd',
19685
- keygen: 'keygen',
19686
- label: 'label',
19687
- legend: 'legend',
19688
- li: 'li',
19689
- link: 'link',
19690
- main: 'main',
19691
- map: 'map',
19692
- mark: 'mark',
19693
- menu: 'menu',
19694
- menuitem: 'menuitem',
19695
- meta: 'meta',
19696
- meter: 'meter',
19697
- nav: 'nav',
19698
- noscript: 'noscript',
19699
- object: 'object',
19700
- ol: 'ol',
19701
- optgroup: 'optgroup',
19702
- option: 'option',
19703
- output: 'output',
19704
- p: 'p',
19705
- param: 'param',
19706
- picture: 'picture',
19707
- pre: 'pre',
19708
- progress: 'progress',
19709
- q: 'q',
19710
- rp: 'rp',
19711
- rt: 'rt',
19712
- ruby: 'ruby',
19713
- s: 's',
19714
- samp: 'samp',
19715
- script: 'script',
19716
- section: 'section',
19717
- select: 'select',
19718
- small: 'small',
19719
- source: 'source',
19720
- span: 'span',
19721
- strong: 'strong',
19722
- style: 'style',
19723
- sub: 'sub',
19724
- summary: 'summary',
19725
- sup: 'sup',
19726
- table: 'table',
19727
- tbody: 'tbody',
19728
- td: 'td',
19729
- textarea: 'textarea',
19730
- tfoot: 'tfoot',
19731
- th: 'th',
19732
- thead: 'thead',
19733
- time: 'time',
19734
- title: 'title',
19735
- tr: 'tr',
19736
- track: 'track',
19737
- u: 'u',
19738
- ul: 'ul',
19739
- 'var': 'var',
19740
- video: 'video',
19741
- wbr: 'wbr',
19742
-
19743
- // SVG
19744
- circle: 'circle',
19745
- clipPath: 'clipPath',
19746
- defs: 'defs',
19747
- ellipse: 'ellipse',
19748
- g: 'g',
19749
- image: 'image',
19750
- line: 'line',
19751
- linearGradient: 'linearGradient',
19752
- mask: 'mask',
19753
- path: 'path',
19754
- pattern: 'pattern',
19755
- polygon: 'polygon',
19756
- polyline: 'polyline',
19757
- radialGradient: 'radialGradient',
19758
- rect: 'rect',
19759
- stop: 'stop',
19760
- svg: 'svg',
19761
- text: 'text',
19762
- tspan: 'tspan'
19763
-
19764
- }, createDOMFactory);
19765
-
19766
- module.exports = ReactDOMFactories;
19767
- }).call(this,require('_process'))
19768
-
19769
- },{"./ReactElement":84,"./ReactElementValidator":85,"_process":31,"fbjs/lib/mapObject":23}],71:[function(require,module,exports){
19770
- /**
19771
- * Copyright 2013-2015, Facebook, Inc.
19772
- * All rights reserved.
19773
- *
19774
- * This source code is licensed under the BSD-style license found in the
19775
- * LICENSE file in the root directory of this source tree. An additional grant
19776
- * of patent rights can be found in the PATENTS file in the same directory.
19777
- *
19778
- * @providesModule ReactDOMFeatureFlags
19779
- */
19780
-
19781
- 'use strict';
19782
-
19783
- var ReactDOMFeatureFlags = {
19784
- useCreateElement: false
19785
- };
19786
-
19787
- module.exports = ReactDOMFeatureFlags;
19788
- },{}],72:[function(require,module,exports){
19789
- (function (process){
19790
- /**
19791
- * Copyright 2013-2015, Facebook, Inc.
19792
- * All rights reserved.
19793
- *
19794
- * This source code is licensed under the BSD-style license found in the
19795
- * LICENSE file in the root directory of this source tree. An additional grant
19796
- * of patent rights can be found in the PATENTS file in the same directory.
19797
- *
19798
- * @providesModule ReactDOMIDOperations
19799
- * @typechecks static-only
19800
- */
19801
-
19802
- 'use strict';
19803
-
19804
- var DOMChildrenOperations = require('./DOMChildrenOperations');
19805
- var DOMPropertyOperations = require('./DOMPropertyOperations');
19806
- var ReactMount = require('./ReactMount');
19807
- var ReactPerf = require('./ReactPerf');
19808
-
19809
- var invariant = require('fbjs/lib/invariant');
19810
-
19811
- /**
19812
- * Errors for properties that should not be updated with `updatePropertyByID()`.
19813
- *
19814
- * @type {object}
19815
- * @private
19816
- */
19817
- var INVALID_PROPERTY_ERRORS = {
19818
- dangerouslySetInnerHTML: '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',
19819
- style: '`style` must be set using `updateStylesByID()`.'
19820
- };
19821
-
19822
- /**
19823
- * Operations used to process updates to DOM nodes.
19824
- */
19825
- var ReactDOMIDOperations = {
19826
-
19827
- /**
19828
- * Updates a DOM node with new property values. This should only be used to
19829
- * update DOM properties in `DOMProperty`.
19830
- *
19831
- * @param {string} id ID of the node to update.
19832
- * @param {string} name A valid property name, see `DOMProperty`.
19833
- * @param {*} value New value of the property.
19834
- * @internal
19835
- */
19836
- updatePropertyByID: function (id, name, value) {
19837
- var node = ReactMount.getNode(id);
19838
- !!INVALID_PROPERTY_ERRORS.hasOwnProperty(name) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name]) : invariant(false) : undefined;
19839
-
19840
- // If we're updating to null or undefined, we should remove the property
19841
- // from the DOM node instead of inadvertantly setting to a string. This
19842
- // brings us in line with the same behavior we have on initial render.
19843
- if (value != null) {
19844
- DOMPropertyOperations.setValueForProperty(node, name, value);
19845
- } else {
19846
- DOMPropertyOperations.deleteValueForProperty(node, name);
19847
- }
19848
- },
19849
-
19850
- /**
19851
- * Replaces a DOM node that exists in the document with markup.
19852
- *
19853
- * @param {string} id ID of child to be replaced.
19854
- * @param {string} markup Dangerous markup to inject in place of child.
19855
- * @internal
19856
- * @see {Danger.dangerouslyReplaceNodeWithMarkup}
19857
- */
19858
- dangerouslyReplaceNodeWithMarkupByID: function (id, markup) {
19859
- var node = ReactMount.getNode(id);
19860
- DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);
19861
- },
19862
-
19863
- /**
19864
- * Updates a component's children by processing a series of updates.
19865
- *
19866
- * @param {array<object>} updates List of update configurations.
19867
- * @param {array<string>} markup List of markup strings.
19868
- * @internal
19869
- */
19870
- dangerouslyProcessChildrenUpdates: function (updates, markup) {
19871
- for (var i = 0; i < updates.length; i++) {
19872
- updates[i].parentNode = ReactMount.getNode(updates[i].parentID);
19873
- }
19874
- DOMChildrenOperations.processUpdates(updates, markup);
19875
- }
19876
- };
19877
-
19878
- ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', {
19879
- dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID',
19880
- dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates'
19881
- });
19882
-
19883
- module.exports = ReactDOMIDOperations;
19884
- }).call(this,require('_process'))
19885
-
19886
- },{"./DOMChildrenOperations":40,"./DOMPropertyOperations":42,"./ReactMount":97,"./ReactPerf":103,"_process":31,"fbjs/lib/invariant":18}],73:[function(require,module,exports){
19887
- (function (process){
19888
- /**
19889
- * Copyright 2013-2015, Facebook, Inc.
19890
- * All rights reserved.
19891
- *
19892
- * This source code is licensed under the BSD-style license found in the
19893
- * LICENSE file in the root directory of this source tree. An additional grant
19894
- * of patent rights can be found in the PATENTS file in the same directory.
19895
- *
19896
- * @providesModule ReactDOMInput
19897
- */
19898
-
19899
- 'use strict';
19900
-
19901
- var ReactDOMIDOperations = require('./ReactDOMIDOperations');
19902
- var LinkedValueUtils = require('./LinkedValueUtils');
19903
- var ReactMount = require('./ReactMount');
19904
- var ReactUpdates = require('./ReactUpdates');
19905
-
19906
- var assign = require('./Object.assign');
19907
- var invariant = require('fbjs/lib/invariant');
19908
-
19909
- var instancesByReactID = {};
19910
-
19911
- function forceUpdateIfMounted() {
19912
- if (this._rootNodeID) {
19913
- // DOM component is still mounted; update
19914
- ReactDOMInput.updateWrapper(this);
19915
- }
19916
- }
19917
-
19918
- /**
19919
- * Implements an <input> native component that allows setting these optional
19920
- * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
19921
- *
19922
- * If `checked` or `value` are not supplied (or null/undefined), user actions
19923
- * that affect the checked state or value will trigger updates to the element.
19924
- *
19925
- * If they are supplied (and not null/undefined), the rendered element will not
19926
- * trigger updates to the element. Instead, the props must change in order for
19927
- * the rendered element to be updated.
19928
- *
19929
- * The rendered element will be initialized as unchecked (or `defaultChecked`)
19930
- * with an empty value (or `defaultValue`).
19931
- *
19932
- * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
19933
- */
19934
- var ReactDOMInput = {
19935
- getNativeProps: function (inst, props, context) {
19936
- var value = LinkedValueUtils.getValue(props);
19937
- var checked = LinkedValueUtils.getChecked(props);
19938
-
19939
- var nativeProps = assign({}, props, {
19940
- defaultChecked: undefined,
19941
- defaultValue: undefined,
19942
- value: value != null ? value : inst._wrapperState.initialValue,
19943
- checked: checked != null ? checked : inst._wrapperState.initialChecked,
19944
- onChange: inst._wrapperState.onChange
19945
- });
19946
-
19947
- return nativeProps;
19948
- },
19949
-
19950
- mountWrapper: function (inst, props) {
19951
- if (process.env.NODE_ENV !== 'production') {
19952
- LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner);
19953
- }
19954
-
19955
- var defaultValue = props.defaultValue;
19956
- inst._wrapperState = {
19957
- initialChecked: props.defaultChecked || false,
19958
- initialValue: defaultValue != null ? defaultValue : null,
19959
- onChange: _handleChange.bind(inst)
19960
- };
19961
- },
19962
-
19963
- mountReadyWrapper: function (inst) {
19964
- // Can't be in mountWrapper or else server rendering leaks.
19965
- instancesByReactID[inst._rootNodeID] = inst;
19966
- },
19967
-
19968
- unmountWrapper: function (inst) {
19969
- delete instancesByReactID[inst._rootNodeID];
19970
- },
19971
-
19972
- updateWrapper: function (inst) {
19973
- var props = inst._currentElement.props;
19974
-
19975
- // TODO: Shouldn't this be getChecked(props)?
19976
- var checked = props.checked;
19977
- if (checked != null) {
19978
- ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'checked', checked || false);
19979
- }
19980
-
19981
- var value = LinkedValueUtils.getValue(props);
19982
- if (value != null) {
19983
- // Cast `value` to a string to ensure the value is set correctly. While
19984
- // browsers typically do this as necessary, jsdom doesn't.
19985
- ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
19986
- }
19987
- }
19988
- };
19989
-
19990
- function _handleChange(event) {
19991
- var props = this._currentElement.props;
19992
-
19993
- var returnValue = LinkedValueUtils.executeOnChange(props, event);
19994
-
19995
- // Here we use asap to wait until all updates have propagated, which
19996
- // is important when using controlled components within layers:
19997
- // https://github.com/facebook/react/issues/1698
19998
- ReactUpdates.asap(forceUpdateIfMounted, this);
19999
-
20000
- var name = props.name;
20001
- if (props.type === 'radio' && name != null) {
20002
- var rootNode = ReactMount.getNode(this._rootNodeID);
20003
- var queryRoot = rootNode;
20004
-
20005
- while (queryRoot.parentNode) {
20006
- queryRoot = queryRoot.parentNode;
20007
- }
20008
-
20009
- // If `rootNode.form` was non-null, then we could try `form.elements`,
20010
- // but that sometimes behaves strangely in IE8. We could also try using
20011
- // `form.getElementsByName`, but that will only return direct children
20012
- // and won't include inputs that use the HTML5 `form=` attribute. Since
20013
- // the input might not even be in a form, let's just use the global
20014
- // `querySelectorAll` to ensure we don't miss anything.
20015
- var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
20016
-
20017
- for (var i = 0; i < group.length; i++) {
20018
- var otherNode = group[i];
20019
- if (otherNode === rootNode || otherNode.form !== rootNode.form) {
20020
- continue;
20021
- }
20022
- // This will throw if radio buttons rendered by different copies of React
20023
- // and the same name are rendered into the same form (same as #1939).
20024
- // That's probably okay; we don't support it just as we don't support
20025
- // mixing React with non-React.
20026
- var otherID = ReactMount.getID(otherNode);
20027
- !otherID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the ' + 'same `name` is not supported.') : invariant(false) : undefined;
20028
- var otherInstance = instancesByReactID[otherID];
20029
- !otherInstance ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOMInput: Unknown radio button ID %s.', otherID) : invariant(false) : undefined;
20030
- // If this is a controlled radio button group, forcing the input that
20031
- // was previously checked to update will cause it to be come re-checked
20032
- // as appropriate.
20033
- ReactUpdates.asap(forceUpdateIfMounted, otherInstance);
20034
- }
20035
- }
20036
-
20037
- return returnValue;
20038
- }
20039
-
20040
- module.exports = ReactDOMInput;
20041
- }).call(this,require('_process'))
20042
-
20043
- },{"./LinkedValueUtils":53,"./Object.assign":54,"./ReactDOMIDOperations":72,"./ReactMount":97,"./ReactUpdates":115,"_process":31,"fbjs/lib/invariant":18}],74:[function(require,module,exports){
20044
- (function (process){
20045
- /**
20046
- * Copyright 2013-2015, Facebook, Inc.
20047
- * All rights reserved.
20048
- *
20049
- * This source code is licensed under the BSD-style license found in the
20050
- * LICENSE file in the root directory of this source tree. An additional grant
20051
- * of patent rights can be found in the PATENTS file in the same directory.
20052
- *
20053
- * @providesModule ReactDOMOption
20054
- */
20055
-
20056
- 'use strict';
20057
-
20058
- var ReactChildren = require('./ReactChildren');
20059
- var ReactDOMSelect = require('./ReactDOMSelect');
20060
-
20061
- var assign = require('./Object.assign');
20062
- var warning = require('fbjs/lib/warning');
20063
-
20064
- var valueContextKey = ReactDOMSelect.valueContextKey;
20065
-
20066
- /**
20067
- * Implements an <option> native component that warns when `selected` is set.
20068
- */
20069
- var ReactDOMOption = {
20070
- mountWrapper: function (inst, props, context) {
20071
- // TODO (yungsters): Remove support for `selected` in <option>.
20072
- if (process.env.NODE_ENV !== 'production') {
20073
- process.env.NODE_ENV !== 'production' ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : undefined;
20074
- }
20075
-
20076
- // Look up whether this option is 'selected' via context
20077
- var selectValue = context[valueContextKey];
20078
-
20079
- // If context key is null (e.g., no specified value or after initial mount)
20080
- // or missing (e.g., for <datalist>), we don't change props.selected
20081
- var selected = null;
20082
- if (selectValue != null) {
20083
- selected = false;
20084
- if (Array.isArray(selectValue)) {
20085
- // multiple
20086
- for (var i = 0; i < selectValue.length; i++) {
20087
- if ('' + selectValue[i] === '' + props.value) {
20088
- selected = true;
20089
- break;
20090
- }
20091
- }
20092
- } else {
20093
- selected = '' + selectValue === '' + props.value;
20094
- }
20095
- }
20096
-
20097
- inst._wrapperState = { selected: selected };
20098
- },
20099
-
20100
- getNativeProps: function (inst, props, context) {
20101
- var nativeProps = assign({ selected: undefined, children: undefined }, props);
20102
-
20103
- // Read state only from initial mount because <select> updates value
20104
- // manually; we need the initial state only for server rendering
20105
- if (inst._wrapperState.selected != null) {
20106
- nativeProps.selected = inst._wrapperState.selected;
20107
- }
20108
-
20109
- var content = '';
20110
-
20111
- // Flatten children and warn if they aren't strings or numbers;
20112
- // invalid types are ignored.
20113
- ReactChildren.forEach(props.children, function (child) {
20114
- if (child == null) {
20115
- return;
20116
- }
20117
- if (typeof child === 'string' || typeof child === 'number') {
20118
- content += child;
20119
- } else {
20120
- process.env.NODE_ENV !== 'production' ? warning(false, 'Only strings and numbers are supported as <option> children.') : undefined;
20121
- }
20122
- });
20123
-
20124
- if (content) {
20125
- nativeProps.children = content;
20126
- }
20127
-
20128
- return nativeProps;
20129
- }
20130
-
20131
- };
20132
-
20133
- module.exports = ReactDOMOption;
20134
- }).call(this,require('_process'))
20135
-
20136
- },{"./Object.assign":54,"./ReactChildren":60,"./ReactDOMSelect":75,"_process":31,"fbjs/lib/warning":29}],75:[function(require,module,exports){
20137
- (function (process){
20138
- /**
20139
- * Copyright 2013-2015, Facebook, Inc.
20140
- * All rights reserved.
20141
- *
20142
- * This source code is licensed under the BSD-style license found in the
20143
- * LICENSE file in the root directory of this source tree. An additional grant
20144
- * of patent rights can be found in the PATENTS file in the same directory.
20145
- *
20146
- * @providesModule ReactDOMSelect
20147
- */
20148
-
20149
- 'use strict';
20150
-
20151
- var LinkedValueUtils = require('./LinkedValueUtils');
20152
- var ReactMount = require('./ReactMount');
20153
- var ReactUpdates = require('./ReactUpdates');
20154
-
20155
- var assign = require('./Object.assign');
20156
- var warning = require('fbjs/lib/warning');
20157
-
20158
- var valueContextKey = '__ReactDOMSelect_value$' + Math.random().toString(36).slice(2);
20159
-
20160
- function updateOptionsIfPendingUpdateAndMounted() {
20161
- if (this._rootNodeID && this._wrapperState.pendingUpdate) {
20162
- this._wrapperState.pendingUpdate = false;
20163
-
20164
- var props = this._currentElement.props;
20165
- var value = LinkedValueUtils.getValue(props);
20166
-
20167
- if (value != null) {
20168
- updateOptions(this, Boolean(props.multiple), value);
20169
- }
20170
- }
20171
- }
20172
-
20173
- function getDeclarationErrorAddendum(owner) {
20174
- if (owner) {
20175
- var name = owner.getName();
20176
- if (name) {
20177
- return ' Check the render method of `' + name + '`.';
20178
- }
20179
- }
20180
- return '';
20181
- }
20182
-
20183
- var valuePropNames = ['value', 'defaultValue'];
20184
-
20185
- /**
20186
- * Validation function for `value` and `defaultValue`.
20187
- * @private
20188
- */
20189
- function checkSelectPropTypes(inst, props) {
20190
- var owner = inst._currentElement._owner;
20191
- LinkedValueUtils.checkPropTypes('select', props, owner);
20192
-
20193
- for (var i = 0; i < valuePropNames.length; i++) {
20194
- var propName = valuePropNames[i];
20195
- if (props[propName] == null) {
20196
- continue;
20197
- }
20198
- if (props.multiple) {
20199
- process.env.NODE_ENV !== 'production' ? warning(Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : undefined;
20200
- } else {
20201
- process.env.NODE_ENV !== 'production' ? warning(!Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : undefined;
20202
- }
20203
- }
20204
- }
20205
-
20206
- /**
20207
- * @param {ReactDOMComponent} inst
20208
- * @param {boolean} multiple
20209
- * @param {*} propValue A stringable (with `multiple`, a list of stringables).
20210
- * @private
20211
- */
20212
- function updateOptions(inst, multiple, propValue) {
20213
- var selectedValue, i;
20214
- var options = ReactMount.getNode(inst._rootNodeID).options;
20215
-
20216
- if (multiple) {
20217
- selectedValue = {};
20218
- for (i = 0; i < propValue.length; i++) {
20219
- selectedValue['' + propValue[i]] = true;
20220
- }
20221
- for (i = 0; i < options.length; i++) {
20222
- var selected = selectedValue.hasOwnProperty(options[i].value);
20223
- if (options[i].selected !== selected) {
20224
- options[i].selected = selected;
20225
- }
20226
- }
20227
- } else {
20228
- // Do not set `select.value` as exact behavior isn't consistent across all
20229
- // browsers for all cases.
20230
- selectedValue = '' + propValue;
20231
- for (i = 0; i < options.length; i++) {
20232
- if (options[i].value === selectedValue) {
20233
- options[i].selected = true;
20234
- return;
20235
- }
20236
- }
20237
- if (options.length) {
20238
- options[0].selected = true;
20239
- }
20240
- }
20241
- }
20242
-
20243
- /**
20244
- * Implements a <select> native component that allows optionally setting the
20245
- * props `value` and `defaultValue`. If `multiple` is false, the prop must be a
20246
- * stringable. If `multiple` is true, the prop must be an array of stringables.
20247
- *
20248
- * If `value` is not supplied (or null/undefined), user actions that change the
20249
- * selected option will trigger updates to the rendered options.
20250
- *
20251
- * If it is supplied (and not null/undefined), the rendered options will not
20252
- * update in response to user actions. Instead, the `value` prop must change in
20253
- * order for the rendered options to update.
20254
- *
20255
- * If `defaultValue` is provided, any options with the supplied values will be
20256
- * selected.
20257
- */
20258
- var ReactDOMSelect = {
20259
- valueContextKey: valueContextKey,
20260
-
20261
- getNativeProps: function (inst, props, context) {
20262
- return assign({}, props, {
20263
- onChange: inst._wrapperState.onChange,
20264
- value: undefined
20265
- });
20266
- },
20267
-
20268
- mountWrapper: function (inst, props) {
20269
- if (process.env.NODE_ENV !== 'production') {
20270
- checkSelectPropTypes(inst, props);
20271
- }
20272
-
20273
- var value = LinkedValueUtils.getValue(props);
20274
- inst._wrapperState = {
20275
- pendingUpdate: false,
20276
- initialValue: value != null ? value : props.defaultValue,
20277
- onChange: _handleChange.bind(inst),
20278
- wasMultiple: Boolean(props.multiple)
20279
- };
20280
- },
20281
-
20282
- processChildContext: function (inst, props, context) {
20283
- // Pass down initial value so initial generated markup has correct
20284
- // `selected` attributes
20285
- var childContext = assign({}, context);
20286
- childContext[valueContextKey] = inst._wrapperState.initialValue;
20287
- return childContext;
20288
- },
20289
-
20290
- postUpdateWrapper: function (inst) {
20291
- var props = inst._currentElement.props;
20292
-
20293
- // After the initial mount, we control selected-ness manually so don't pass
20294
- // the context value down
20295
- inst._wrapperState.initialValue = undefined;
20296
-
20297
- var wasMultiple = inst._wrapperState.wasMultiple;
20298
- inst._wrapperState.wasMultiple = Boolean(props.multiple);
20299
-
20300
- var value = LinkedValueUtils.getValue(props);
20301
- if (value != null) {
20302
- inst._wrapperState.pendingUpdate = false;
20303
- updateOptions(inst, Boolean(props.multiple), value);
20304
- } else if (wasMultiple !== Boolean(props.multiple)) {
20305
- // For simplicity, reapply `defaultValue` if `multiple` is toggled.
20306
- if (props.defaultValue != null) {
20307
- updateOptions(inst, Boolean(props.multiple), props.defaultValue);
20308
- } else {
20309
- // Revert the select back to its default unselected state.
20310
- updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : '');
20311
- }
20312
- }
20313
- }
20314
- };
20315
-
20316
- function _handleChange(event) {
20317
- var props = this._currentElement.props;
20318
- var returnValue = LinkedValueUtils.executeOnChange(props, event);
20319
-
20320
- this._wrapperState.pendingUpdate = true;
20321
- ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
20322
- return returnValue;
20323
- }
20324
-
20325
- module.exports = ReactDOMSelect;
20326
- }).call(this,require('_process'))
20327
-
20328
- },{"./LinkedValueUtils":53,"./Object.assign":54,"./ReactMount":97,"./ReactUpdates":115,"_process":31,"fbjs/lib/warning":29}],76:[function(require,module,exports){
20329
- /**
20330
- * Copyright 2013-2015, Facebook, Inc.
20331
- * All rights reserved.
20332
- *
20333
- * This source code is licensed under the BSD-style license found in the
20334
- * LICENSE file in the root directory of this source tree. An additional grant
20335
- * of patent rights can be found in the PATENTS file in the same directory.
20336
- *
20337
- * @providesModule ReactDOMSelection
20338
- */
20339
-
20340
- 'use strict';
20341
-
20342
- var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
20343
-
20344
- var getNodeForCharacterOffset = require('./getNodeForCharacterOffset');
20345
- var getTextContentAccessor = require('./getTextContentAccessor');
20346
-
20347
- /**
20348
- * While `isCollapsed` is available on the Selection object and `collapsed`
20349
- * is available on the Range object, IE11 sometimes gets them wrong.
20350
- * If the anchor/focus nodes and offsets are the same, the range is collapsed.
20351
- */
20352
- function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) {
20353
- return anchorNode === focusNode && anchorOffset === focusOffset;
20354
- }
20355
-
20356
- /**
20357
- * Get the appropriate anchor and focus node/offset pairs for IE.
20358
- *
20359
- * The catch here is that IE's selection API doesn't provide information
20360
- * about whether the selection is forward or backward, so we have to
20361
- * behave as though it's always forward.
20362
- *
20363
- * IE text differs from modern selection in that it behaves as though
20364
- * block elements end with a new line. This means character offsets will
20365
- * differ between the two APIs.
20366
- *
20367
- * @param {DOMElement} node
20368
- * @return {object}
20369
- */
20370
- function getIEOffsets(node) {
20371
- var selection = document.selection;
20372
- var selectedRange = selection.createRange();
20373
- var selectedLength = selectedRange.text.length;
20374
-
20375
- // Duplicate selection so we can move range without breaking user selection.
20376
- var fromStart = selectedRange.duplicate();
20377
- fromStart.moveToElementText(node);
20378
- fromStart.setEndPoint('EndToStart', selectedRange);
20379
-
20380
- var startOffset = fromStart.text.length;
20381
- var endOffset = startOffset + selectedLength;
20382
-
20383
- return {
20384
- start: startOffset,
20385
- end: endOffset
20386
- };
20387
- }
20388
-
20389
- /**
20390
- * @param {DOMElement} node
20391
- * @return {?object}
20392
- */
20393
- function getModernOffsets(node) {
20394
- var selection = window.getSelection && window.getSelection();
20395
-
20396
- if (!selection || selection.rangeCount === 0) {
20397
- return null;
20398
- }
20399
-
20400
- var anchorNode = selection.anchorNode;
20401
- var anchorOffset = selection.anchorOffset;
20402
- var focusNode = selection.focusNode;
20403
- var focusOffset = selection.focusOffset;
20404
-
20405
- var currentRange = selection.getRangeAt(0);
20406
-
20407
- // In Firefox, range.startContainer and range.endContainer can be "anonymous
20408
- // divs", e.g. the up/down buttons on an <input type="number">. Anonymous
20409
- // divs do not seem to expose properties, triggering a "Permission denied
20410
- // error" if any of its properties are accessed. The only seemingly possible
20411
- // way to avoid erroring is to access a property that typically works for
20412
- // non-anonymous divs and catch any error that may otherwise arise. See
20413
- // https://bugzilla.mozilla.org/show_bug.cgi?id=208427
20414
- try {
20415
- /* eslint-disable no-unused-expressions */
20416
- currentRange.startContainer.nodeType;
20417
- currentRange.endContainer.nodeType;
20418
- /* eslint-enable no-unused-expressions */
20419
- } catch (e) {
20420
- return null;
20421
- }
20422
-
20423
- // If the node and offset values are the same, the selection is collapsed.
20424
- // `Selection.isCollapsed` is available natively, but IE sometimes gets
20425
- // this value wrong.
20426
- var isSelectionCollapsed = isCollapsed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);
20427
-
20428
- var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
20429
-
20430
- var tempRange = currentRange.cloneRange();
20431
- tempRange.selectNodeContents(node);
20432
- tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
20433
-
20434
- var isTempRangeCollapsed = isCollapsed(tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset);
20435
-
20436
- var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
20437
- var end = start + rangeLength;
20438
-
20439
- // Detect whether the selection is backward.
20440
- var detectionRange = document.createRange();
20441
- detectionRange.setStart(anchorNode, anchorOffset);
20442
- detectionRange.setEnd(focusNode, focusOffset);
20443
- var isBackward = detectionRange.collapsed;
20444
-
20445
- return {
20446
- start: isBackward ? end : start,
20447
- end: isBackward ? start : end
20448
- };
20449
- }
20450
-
20451
- /**
20452
- * @param {DOMElement|DOMTextNode} node
20453
- * @param {object} offsets
20454
- */
20455
- function setIEOffsets(node, offsets) {
20456
- var range = document.selection.createRange().duplicate();
20457
- var start, end;
20458
-
20459
- if (typeof offsets.end === 'undefined') {
20460
- start = offsets.start;
20461
- end = start;
20462
- } else if (offsets.start > offsets.end) {
20463
- start = offsets.end;
20464
- end = offsets.start;
20465
- } else {
20466
- start = offsets.start;
20467
- end = offsets.end;
20468
- }
20469
-
20470
- range.moveToElementText(node);
20471
- range.moveStart('character', start);
20472
- range.setEndPoint('EndToStart', range);
20473
- range.moveEnd('character', end - start);
20474
- range.select();
20475
- }
20476
-
20477
- /**
20478
- * In modern non-IE browsers, we can support both forward and backward
20479
- * selections.
20480
- *
20481
- * Note: IE10+ supports the Selection object, but it does not support
20482
- * the `extend` method, which means that even in modern IE, it's not possible
20483
- * to programatically create a backward selection. Thus, for all IE
20484
- * versions, we use the old IE API to create our selections.
20485
- *
20486
- * @param {DOMElement|DOMTextNode} node
20487
- * @param {object} offsets
20488
- */
20489
- function setModernOffsets(node, offsets) {
20490
- if (!window.getSelection) {
20491
- return;
20492
- }
20493
-
20494
- var selection = window.getSelection();
20495
- var length = node[getTextContentAccessor()].length;
20496
- var start = Math.min(offsets.start, length);
20497
- var end = typeof offsets.end === 'undefined' ? start : Math.min(offsets.end, length);
20498
-
20499
- // IE 11 uses modern selection, but doesn't support the extend method.
20500
- // Flip backward selections, so we can set with a single range.
20501
- if (!selection.extend && start > end) {
20502
- var temp = end;
20503
- end = start;
20504
- start = temp;
20505
- }
20506
-
20507
- var startMarker = getNodeForCharacterOffset(node, start);
20508
- var endMarker = getNodeForCharacterOffset(node, end);
20509
-
20510
- if (startMarker && endMarker) {
20511
- var range = document.createRange();
20512
- range.setStart(startMarker.node, startMarker.offset);
20513
- selection.removeAllRanges();
20514
-
20515
- if (start > end) {
20516
- selection.addRange(range);
20517
- selection.extend(endMarker.node, endMarker.offset);
20518
- } else {
20519
- range.setEnd(endMarker.node, endMarker.offset);
20520
- selection.addRange(range);
20521
- }
20522
- }
20523
- }
20524
-
20525
- var useIEOffsets = ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window);
20526
-
20527
- var ReactDOMSelection = {
20528
- /**
20529
- * @param {DOMElement} node
20530
- */
20531
- getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets,
20532
-
20533
- /**
20534
- * @param {DOMElement|DOMTextNode} node
20535
- * @param {object} offsets
20536
- */
20537
- setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets
20538
- };
20539
-
20540
- module.exports = ReactDOMSelection;
20541
- },{"./getNodeForCharacterOffset":148,"./getTextContentAccessor":149,"fbjs/lib/ExecutionEnvironment":4}],77:[function(require,module,exports){
20542
- /**
20543
- * Copyright 2013-2015, Facebook, Inc.
20544
- * All rights reserved.
20545
- *
20546
- * This source code is licensed under the BSD-style license found in the
20547
- * LICENSE file in the root directory of this source tree. An additional grant
20548
- * of patent rights can be found in the PATENTS file in the same directory.
20549
- *
20550
- * @providesModule ReactDOMServer
20551
- */
20552
-
20553
- 'use strict';
20554
-
20555
- var ReactDefaultInjection = require('./ReactDefaultInjection');
20556
- var ReactServerRendering = require('./ReactServerRendering');
20557
- var ReactVersion = require('./ReactVersion');
20558
-
20559
- ReactDefaultInjection.inject();
20560
-
20561
- var ReactDOMServer = {
20562
- renderToString: ReactServerRendering.renderToString,
20563
- renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
20564
- version: ReactVersion
20565
- };
20566
-
20567
- module.exports = ReactDOMServer;
20568
- },{"./ReactDefaultInjection":81,"./ReactServerRendering":112,"./ReactVersion":116}],78:[function(require,module,exports){
20569
- (function (process){
20570
- /**
20571
- * Copyright 2013-2015, Facebook, Inc.
20572
- * All rights reserved.
20573
- *
20574
- * This source code is licensed under the BSD-style license found in the
20575
- * LICENSE file in the root directory of this source tree. An additional grant
20576
- * of patent rights can be found in the PATENTS file in the same directory.
20577
- *
20578
- * @providesModule ReactDOMTextComponent
20579
- * @typechecks static-only
20580
- */
20581
-
20582
- 'use strict';
20583
-
20584
- var DOMChildrenOperations = require('./DOMChildrenOperations');
20585
- var DOMPropertyOperations = require('./DOMPropertyOperations');
20586
- var ReactComponentBrowserEnvironment = require('./ReactComponentBrowserEnvironment');
20587
- var ReactMount = require('./ReactMount');
20588
-
20589
- var assign = require('./Object.assign');
20590
- var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
20591
- var setTextContent = require('./setTextContent');
20592
- var validateDOMNesting = require('./validateDOMNesting');
20593
-
20594
- /**
20595
- * Text nodes violate a couple assumptions that React makes about components:
20596
- *
20597
- * - When mounting text into the DOM, adjacent text nodes are merged.
20598
- * - Text nodes cannot be assigned a React root ID.
20599
- *
20600
- * This component is used to wrap strings in elements so that they can undergo
20601
- * the same reconciliation that is applied to elements.
20602
- *
20603
- * TODO: Investigate representing React components in the DOM with text nodes.
20604
- *
20605
- * @class ReactDOMTextComponent
20606
- * @extends ReactComponent
20607
- * @internal
20608
- */
20609
- var ReactDOMTextComponent = function (props) {
20610
- // This constructor and its argument is currently used by mocks.
20611
- };
20612
-
20613
- assign(ReactDOMTextComponent.prototype, {
20614
-
20615
- /**
20616
- * @param {ReactText} text
20617
- * @internal
20618
- */
20619
- construct: function (text) {
20620
- // TODO: This is really a ReactText (ReactNode), not a ReactElement
20621
- this._currentElement = text;
20622
- this._stringText = '' + text;
20623
-
20624
- // Properties
20625
- this._rootNodeID = null;
20626
- this._mountIndex = 0;
20627
- },
20628
-
20629
- /**
20630
- * Creates the markup for this text node. This node is not intended to have
20631
- * any features besides containing text content.
20632
- *
20633
- * @param {string} rootID DOM ID of the root node.
20634
- * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
20635
- * @return {string} Markup for this text node.
20636
- * @internal
20637
- */
20638
- mountComponent: function (rootID, transaction, context) {
20639
- if (process.env.NODE_ENV !== 'production') {
20640
- if (context[validateDOMNesting.ancestorInfoContextKey]) {
20641
- validateDOMNesting('span', null, context[validateDOMNesting.ancestorInfoContextKey]);
20642
- }
20643
- }
20644
-
20645
- this._rootNodeID = rootID;
20646
- if (transaction.useCreateElement) {
20647
- var ownerDocument = context[ReactMount.ownerDocumentContextKey];
20648
- var el = ownerDocument.createElement('span');
20649
- DOMPropertyOperations.setAttributeForID(el, rootID);
20650
- // Populate node cache
20651
- ReactMount.getID(el);
20652
- setTextContent(el, this._stringText);
20653
- return el;
20654
- } else {
20655
- var escapedText = escapeTextContentForBrowser(this._stringText);
20656
-
20657
- if (transaction.renderToStaticMarkup) {
20658
- // Normally we'd wrap this in a `span` for the reasons stated above, but
20659
- // since this is a situation where React won't take over (static pages),
20660
- // we can simply return the text as it is.
20661
- return escapedText;
20662
- }
20663
-
20664
- return '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' + escapedText + '</span>';
20665
- }
20666
- },
20667
-
20668
- /**
20669
- * Updates this component by updating the text content.
20670
- *
20671
- * @param {ReactText} nextText The next text content
20672
- * @param {ReactReconcileTransaction} transaction
20673
- * @internal
20674
- */
20675
- receiveComponent: function (nextText, transaction) {
20676
- if (nextText !== this._currentElement) {
20677
- this._currentElement = nextText;
20678
- var nextStringText = '' + nextText;
20679
- if (nextStringText !== this._stringText) {
20680
- // TODO: Save this as pending props and use performUpdateIfNecessary
20681
- // and/or updateComponent to do the actual update for consistency with
20682
- // other component types?
20683
- this._stringText = nextStringText;
20684
- var node = ReactMount.getNode(this._rootNodeID);
20685
- DOMChildrenOperations.updateTextContent(node, nextStringText);
20686
- }
20687
- }
20688
- },
20689
-
20690
- unmountComponent: function () {
20691
- ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
20692
- }
20693
-
20694
- });
20695
-
20696
- module.exports = ReactDOMTextComponent;
20697
- }).call(this,require('_process'))
20698
-
20699
- },{"./DOMChildrenOperations":40,"./DOMPropertyOperations":42,"./Object.assign":54,"./ReactComponentBrowserEnvironment":63,"./ReactMount":97,"./escapeTextContentForBrowser":139,"./setTextContent":157,"./validateDOMNesting":160,"_process":31}],79:[function(require,module,exports){
20700
- (function (process){
20701
- /**
20702
- * Copyright 2013-2015, Facebook, Inc.
20703
- * All rights reserved.
20704
- *
20705
- * This source code is licensed under the BSD-style license found in the
20706
- * LICENSE file in the root directory of this source tree. An additional grant
20707
- * of patent rights can be found in the PATENTS file in the same directory.
20708
- *
20709
- * @providesModule ReactDOMTextarea
20710
- */
20711
-
20712
- 'use strict';
20713
-
20714
- var LinkedValueUtils = require('./LinkedValueUtils');
20715
- var ReactDOMIDOperations = require('./ReactDOMIDOperations');
20716
- var ReactUpdates = require('./ReactUpdates');
20717
-
20718
- var assign = require('./Object.assign');
20719
- var invariant = require('fbjs/lib/invariant');
20720
- var warning = require('fbjs/lib/warning');
20721
-
20722
- function forceUpdateIfMounted() {
20723
- if (this._rootNodeID) {
20724
- // DOM component is still mounted; update
20725
- ReactDOMTextarea.updateWrapper(this);
20726
- }
20727
- }
20728
-
20729
- /**
20730
- * Implements a <textarea> native component that allows setting `value`, and
20731
- * `defaultValue`. This differs from the traditional DOM API because value is
20732
- * usually set as PCDATA children.
20733
- *
20734
- * If `value` is not supplied (or null/undefined), user actions that affect the
20735
- * value will trigger updates to the element.
20736
- *
20737
- * If `value` is supplied (and not null/undefined), the rendered element will
20738
- * not trigger updates to the element. Instead, the `value` prop must change in
20739
- * order for the rendered element to be updated.
20740
- *
20741
- * The rendered element will be initialized with an empty value, the prop
20742
- * `defaultValue` if specified, or the children content (deprecated).
20743
- */
20744
- var ReactDOMTextarea = {
20745
- getNativeProps: function (inst, props, context) {
20746
- !(props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : invariant(false) : undefined;
20747
-
20748
- // Always set children to the same thing. In IE9, the selection range will
20749
- // get reset if `textContent` is mutated.
20750
- var nativeProps = assign({}, props, {
20751
- defaultValue: undefined,
20752
- value: undefined,
20753
- children: inst._wrapperState.initialValue,
20754
- onChange: inst._wrapperState.onChange
20755
- });
20756
-
20757
- return nativeProps;
20758
- },
20759
-
20760
- mountWrapper: function (inst, props) {
20761
- if (process.env.NODE_ENV !== 'production') {
20762
- LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner);
20763
- }
20764
-
20765
- var defaultValue = props.defaultValue;
20766
- // TODO (yungsters): Remove support for children content in <textarea>.
20767
- var children = props.children;
20768
- if (children != null) {
20769
- if (process.env.NODE_ENV !== 'production') {
20770
- process.env.NODE_ENV !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : undefined;
20771
- }
20772
- !(defaultValue == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : invariant(false) : undefined;
20773
- if (Array.isArray(children)) {
20774
- !(children.length <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, '<textarea> can only have at most one child.') : invariant(false) : undefined;
20775
- children = children[0];
20776
- }
20777
-
20778
- defaultValue = '' + children;
20779
- }
20780
- if (defaultValue == null) {
20781
- defaultValue = '';
20782
- }
20783
- var value = LinkedValueUtils.getValue(props);
20784
-
20785
- inst._wrapperState = {
20786
- // We save the initial value so that `ReactDOMComponent` doesn't update
20787
- // `textContent` (unnecessary since we update value).
20788
- // The initial value can be a boolean or object so that's why it's
20789
- // forced to be a string.
20790
- initialValue: '' + (value != null ? value : defaultValue),
20791
- onChange: _handleChange.bind(inst)
20792
- };
20793
- },
20794
-
20795
- updateWrapper: function (inst) {
20796
- var props = inst._currentElement.props;
20797
- var value = LinkedValueUtils.getValue(props);
20798
- if (value != null) {
20799
- // Cast `value` to a string to ensure the value is set correctly. While
20800
- // browsers typically do this as necessary, jsdom doesn't.
20801
- ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
20802
- }
20803
- }
20804
- };
20805
-
20806
- function _handleChange(event) {
20807
- var props = this._currentElement.props;
20808
- var returnValue = LinkedValueUtils.executeOnChange(props, event);
20809
- ReactUpdates.asap(forceUpdateIfMounted, this);
20810
- return returnValue;
20811
- }
20812
-
20813
- module.exports = ReactDOMTextarea;
20814
- }).call(this,require('_process'))
20815
-
20816
- },{"./LinkedValueUtils":53,"./Object.assign":54,"./ReactDOMIDOperations":72,"./ReactUpdates":115,"_process":31,"fbjs/lib/invariant":18,"fbjs/lib/warning":29}],80:[function(require,module,exports){
20817
- /**
20818
- * Copyright 2013-2015, Facebook, Inc.
20819
- * All rights reserved.
20820
- *
20821
- * This source code is licensed under the BSD-style license found in the
20822
- * LICENSE file in the root directory of this source tree. An additional grant
20823
- * of patent rights can be found in the PATENTS file in the same directory.
20824
- *
20825
- * @providesModule ReactDefaultBatchingStrategy
20826
- */
20827
-
20828
- 'use strict';
20829
-
20830
- var ReactUpdates = require('./ReactUpdates');
20831
- var Transaction = require('./Transaction');
20832
-
20833
- var assign = require('./Object.assign');
20834
- var emptyFunction = require('fbjs/lib/emptyFunction');
20835
-
20836
- var RESET_BATCHED_UPDATES = {
20837
- initialize: emptyFunction,
20838
- close: function () {
20839
- ReactDefaultBatchingStrategy.isBatchingUpdates = false;
20840
- }
20841
- };
20842
-
20843
- var FLUSH_BATCHED_UPDATES = {
20844
- initialize: emptyFunction,
20845
- close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)
20846
- };
20847
-
20848
- var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES];
20849
-
20850
- function ReactDefaultBatchingStrategyTransaction() {
20851
- this.reinitializeTransaction();
20852
- }
20853
-
20854
- assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction.Mixin, {
20855
- getTransactionWrappers: function () {
20856
- return TRANSACTION_WRAPPERS;
20857
- }
20858
- });
20859
-
20860
- var transaction = new ReactDefaultBatchingStrategyTransaction();
20861
-
20862
- var ReactDefaultBatchingStrategy = {
20863
- isBatchingUpdates: false,
20864
-
20865
- /**
20866
- * Call the provided function in a context within which calls to `setState`
20867
- * and friends are batched such that components aren't updated unnecessarily.
20868
- */
20869
- batchedUpdates: function (callback, a, b, c, d, e) {
20870
- var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
20871
-
20872
- ReactDefaultBatchingStrategy.isBatchingUpdates = true;
20873
-
20874
- // The code is written this way to avoid extra allocations
20875
- if (alreadyBatchingUpdates) {
20876
- callback(a, b, c, d, e);
20877
- } else {
20878
- transaction.perform(callback, null, a, b, c, d, e);
20879
- }
20880
- }
20881
- };
20882
-
20883
- module.exports = ReactDefaultBatchingStrategy;
20884
- },{"./Object.assign":54,"./ReactUpdates":115,"./Transaction":132,"fbjs/lib/emptyFunction":10}],81:[function(require,module,exports){
20885
- (function (process){
20886
- /**
20887
- * Copyright 2013-2015, Facebook, Inc.
20888
- * All rights reserved.
20889
- *
20890
- * This source code is licensed under the BSD-style license found in the
20891
- * LICENSE file in the root directory of this source tree. An additional grant
20892
- * of patent rights can be found in the PATENTS file in the same directory.
20893
- *
20894
- * @providesModule ReactDefaultInjection
20895
- */
20896
-
20897
- 'use strict';
20898
-
20899
- var BeforeInputEventPlugin = require('./BeforeInputEventPlugin');
20900
- var ChangeEventPlugin = require('./ChangeEventPlugin');
20901
- var ClientReactRootIndex = require('./ClientReactRootIndex');
20902
- var DefaultEventPluginOrder = require('./DefaultEventPluginOrder');
20903
- var EnterLeaveEventPlugin = require('./EnterLeaveEventPlugin');
20904
- var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
20905
- var HTMLDOMPropertyConfig = require('./HTMLDOMPropertyConfig');
20906
- var ReactBrowserComponentMixin = require('./ReactBrowserComponentMixin');
20907
- var ReactComponentBrowserEnvironment = require('./ReactComponentBrowserEnvironment');
20908
- var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
20909
- var ReactDOMComponent = require('./ReactDOMComponent');
20910
- var ReactDOMTextComponent = require('./ReactDOMTextComponent');
20911
- var ReactEventListener = require('./ReactEventListener');
20912
- var ReactInjection = require('./ReactInjection');
20913
- var ReactInstanceHandles = require('./ReactInstanceHandles');
20914
- var ReactMount = require('./ReactMount');
20915
- var ReactReconcileTransaction = require('./ReactReconcileTransaction');
20916
- var SelectEventPlugin = require('./SelectEventPlugin');
20917
- var ServerReactRootIndex = require('./ServerReactRootIndex');
20918
- var SimpleEventPlugin = require('./SimpleEventPlugin');
20919
- var SVGDOMPropertyConfig = require('./SVGDOMPropertyConfig');
20920
-
20921
- var alreadyInjected = false;
20922
-
20923
- function inject() {
20924
- if (alreadyInjected) {
20925
- // TODO: This is currently true because these injections are shared between
20926
- // the client and the server package. They should be built independently
20927
- // and not share any injection state. Then this problem will be solved.
20928
- return;
20929
- }
20930
- alreadyInjected = true;
20931
-
20932
- ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener);
20933
-
20934
- /**
20935
- * Inject modules for resolving DOM hierarchy and plugin ordering.
20936
- */
20937
- ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
20938
- ReactInjection.EventPluginHub.injectInstanceHandle(ReactInstanceHandles);
20939
- ReactInjection.EventPluginHub.injectMount(ReactMount);
20940
-
20941
- /**
20942
- * Some important event plugins included by default (without having to require
20943
- * them).
20944
- */
20945
- ReactInjection.EventPluginHub.injectEventPluginsByName({
20946
- SimpleEventPlugin: SimpleEventPlugin,
20947
- EnterLeaveEventPlugin: EnterLeaveEventPlugin,
20948
- ChangeEventPlugin: ChangeEventPlugin,
20949
- SelectEventPlugin: SelectEventPlugin,
20950
- BeforeInputEventPlugin: BeforeInputEventPlugin
20951
- });
20952
-
20953
- ReactInjection.NativeComponent.injectGenericComponentClass(ReactDOMComponent);
20954
-
20955
- ReactInjection.NativeComponent.injectTextComponentClass(ReactDOMTextComponent);
20956
-
20957
- ReactInjection.Class.injectMixin(ReactBrowserComponentMixin);
20958
-
20959
- ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
20960
- ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
20961
-
20962
- ReactInjection.EmptyComponent.injectEmptyComponent('noscript');
20963
-
20964
- ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction);
20965
- ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy);
20966
-
20967
- ReactInjection.RootIndex.injectCreateReactRootIndex(ExecutionEnvironment.canUseDOM ? ClientReactRootIndex.createReactRootIndex : ServerReactRootIndex.createReactRootIndex);
20968
-
20969
- ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
20970
-
20971
- if (process.env.NODE_ENV !== 'production') {
20972
- var url = ExecutionEnvironment.canUseDOM && window.location.href || '';
20973
- if (/[?&]react_perf\b/.test(url)) {
20974
- var ReactDefaultPerf = require('./ReactDefaultPerf');
20975
- ReactDefaultPerf.start();
20976
- }
20977
- }
20978
- }
20979
-
20980
- module.exports = {
20981
- inject: inject
20982
- };
20983
- }).call(this,require('_process'))
20984
-
20985
- },{"./BeforeInputEventPlugin":34,"./ChangeEventPlugin":38,"./ClientReactRootIndex":39,"./DefaultEventPluginOrder":44,"./EnterLeaveEventPlugin":45,"./HTMLDOMPropertyConfig":52,"./ReactBrowserComponentMixin":57,"./ReactComponentBrowserEnvironment":63,"./ReactDOMComponent":69,"./ReactDOMTextComponent":78,"./ReactDefaultBatchingStrategy":80,"./ReactDefaultPerf":82,"./ReactEventListener":90,"./ReactInjection":91,"./ReactInstanceHandles":93,"./ReactMount":97,"./ReactReconcileTransaction":107,"./SVGDOMPropertyConfig":117,"./SelectEventPlugin":118,"./ServerReactRootIndex":119,"./SimpleEventPlugin":120,"_process":31,"fbjs/lib/ExecutionEnvironment":4}],82:[function(require,module,exports){
20986
- /**
20987
- * Copyright 2013-2015, Facebook, Inc.
20988
- * All rights reserved.
20989
- *
20990
- * This source code is licensed under the BSD-style license found in the
20991
- * LICENSE file in the root directory of this source tree. An additional grant
20992
- * of patent rights can be found in the PATENTS file in the same directory.
20993
- *
20994
- * @providesModule ReactDefaultPerf
20995
- * @typechecks static-only
20996
- */
20997
-
20998
- 'use strict';
20999
-
21000
- var DOMProperty = require('./DOMProperty');
21001
- var ReactDefaultPerfAnalysis = require('./ReactDefaultPerfAnalysis');
21002
- var ReactMount = require('./ReactMount');
21003
- var ReactPerf = require('./ReactPerf');
21004
-
21005
- var performanceNow = require('fbjs/lib/performanceNow');
21006
-
21007
- function roundFloat(val) {
21008
- return Math.floor(val * 100) / 100;
21009
- }
21010
-
21011
- function addValue(obj, key, val) {
21012
- obj[key] = (obj[key] || 0) + val;
21013
- }
21014
-
21015
- var ReactDefaultPerf = {
21016
- _allMeasurements: [], // last item in the list is the current one
21017
- _mountStack: [0],
21018
- _injected: false,
21019
-
21020
- start: function () {
21021
- if (!ReactDefaultPerf._injected) {
21022
- ReactPerf.injection.injectMeasure(ReactDefaultPerf.measure);
21023
- }
21024
-
21025
- ReactDefaultPerf._allMeasurements.length = 0;
21026
- ReactPerf.enableMeasure = true;
21027
- },
21028
-
21029
- stop: function () {
21030
- ReactPerf.enableMeasure = false;
21031
- },
21032
-
21033
- getLastMeasurements: function () {
21034
- return ReactDefaultPerf._allMeasurements;
21035
- },
21036
-
21037
- printExclusive: function (measurements) {
21038
- measurements = measurements || ReactDefaultPerf._allMeasurements;
21039
- var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements);
21040
- console.table(summary.map(function (item) {
21041
- return {
21042
- 'Component class name': item.componentName,
21043
- 'Total inclusive time (ms)': roundFloat(item.inclusive),
21044
- 'Exclusive mount time (ms)': roundFloat(item.exclusive),
21045
- 'Exclusive render time (ms)': roundFloat(item.render),
21046
- 'Mount time per instance (ms)': roundFloat(item.exclusive / item.count),
21047
- 'Render time per instance (ms)': roundFloat(item.render / item.count),
21048
- 'Instances': item.count
21049
- };
21050
- }));
21051
- // TODO: ReactDefaultPerfAnalysis.getTotalTime() does not return the correct
21052
- // number.
21053
- },
21054
-
21055
- printInclusive: function (measurements) {
21056
- measurements = measurements || ReactDefaultPerf._allMeasurements;
21057
- var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements);
21058
- console.table(summary.map(function (item) {
21059
- return {
21060
- 'Owner > component': item.componentName,
21061
- 'Inclusive time (ms)': roundFloat(item.time),
21062
- 'Instances': item.count
21063
- };
21064
- }));
21065
- console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
21066
- },
21067
-
21068
- getMeasurementsSummaryMap: function (measurements) {
21069
- var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements, true);
21070
- return summary.map(function (item) {
21071
- return {
21072
- 'Owner > component': item.componentName,
21073
- 'Wasted time (ms)': item.time,
21074
- 'Instances': item.count
21075
- };
21076
- });
21077
- },
21078
-
21079
- printWasted: function (measurements) {
21080
- measurements = measurements || ReactDefaultPerf._allMeasurements;
21081
- console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements));
21082
- console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
21083
- },
21084
-
21085
- printDOM: function (measurements) {
21086
- measurements = measurements || ReactDefaultPerf._allMeasurements;
21087
- var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements);
21088
- console.table(summary.map(function (item) {
21089
- var result = {};
21090
- result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id;
21091
- result.type = item.type;
21092
- result.args = JSON.stringify(item.args);
21093
- return result;
21094
- }));
21095
- console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
21096
- },
21097
-
21098
- _recordWrite: function (id, fnName, totalTime, args) {
21099
- // TODO: totalTime isn't that useful since it doesn't count paints/reflows
21100
- var writes = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].writes;
21101
- writes[id] = writes[id] || [];
21102
- writes[id].push({
21103
- type: fnName,
21104
- time: totalTime,
21105
- args: args
21106
- });
21107
- },
21108
-
21109
- measure: function (moduleName, fnName, func) {
21110
- return function () {
21111
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
21112
- args[_key] = arguments[_key];
21113
- }
21114
-
21115
- var totalTime;
21116
- var rv;
21117
- var start;
21118
-
21119
- if (fnName === '_renderNewRootComponent' || fnName === 'flushBatchedUpdates') {
21120
- // A "measurement" is a set of metrics recorded for each flush. We want
21121
- // to group the metrics for a given flush together so we can look at the
21122
- // components that rendered and the DOM operations that actually
21123
- // happened to determine the amount of "wasted work" performed.
21124
- ReactDefaultPerf._allMeasurements.push({
21125
- exclusive: {},
21126
- inclusive: {},
21127
- render: {},
21128
- counts: {},
21129
- writes: {},
21130
- displayNames: {},
21131
- totalTime: 0,
21132
- created: {}
21133
- });
21134
- start = performanceNow();
21135
- rv = func.apply(this, args);
21136
- ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].totalTime = performanceNow() - start;
21137
- return rv;
21138
- } else if (fnName === '_mountImageIntoNode' || moduleName === 'ReactBrowserEventEmitter' || moduleName === 'ReactDOMIDOperations' || moduleName === 'CSSPropertyOperations' || moduleName === 'DOMChildrenOperations' || moduleName === 'DOMPropertyOperations') {
21139
- start = performanceNow();
21140
- rv = func.apply(this, args);
21141
- totalTime = performanceNow() - start;
21142
-
21143
- if (fnName === '_mountImageIntoNode') {
21144
- var mountID = ReactMount.getID(args[1]);
21145
- ReactDefaultPerf._recordWrite(mountID, fnName, totalTime, args[0]);
21146
- } else if (fnName === 'dangerouslyProcessChildrenUpdates') {
21147
- // special format
21148
- args[0].forEach(function (update) {
21149
- var writeArgs = {};
21150
- if (update.fromIndex !== null) {
21151
- writeArgs.fromIndex = update.fromIndex;
21152
- }
21153
- if (update.toIndex !== null) {
21154
- writeArgs.toIndex = update.toIndex;
21155
- }
21156
- if (update.textContent !== null) {
21157
- writeArgs.textContent = update.textContent;
21158
- }
21159
- if (update.markupIndex !== null) {
21160
- writeArgs.markup = args[1][update.markupIndex];
21161
- }
21162
- ReactDefaultPerf._recordWrite(update.parentID, update.type, totalTime, writeArgs);
21163
- });
21164
- } else {
21165
- // basic format
21166
- var id = args[0];
21167
- if (typeof id === 'object') {
21168
- id = ReactMount.getID(args[0]);
21169
- }
21170
- ReactDefaultPerf._recordWrite(id, fnName, totalTime, Array.prototype.slice.call(args, 1));
21171
- }
21172
- return rv;
21173
- } else if (moduleName === 'ReactCompositeComponent' && (fnName === 'mountComponent' || fnName === 'updateComponent' || // TODO: receiveComponent()?
21174
- fnName === '_renderValidatedComponent')) {
21175
-
21176
- if (this._currentElement.type === ReactMount.TopLevelWrapper) {
21177
- return func.apply(this, args);
21178
- }
21179
-
21180
- var rootNodeID = fnName === 'mountComponent' ? args[0] : this._rootNodeID;
21181
- var isRender = fnName === '_renderValidatedComponent';
21182
- var isMount = fnName === 'mountComponent';
21183
-
21184
- var mountStack = ReactDefaultPerf._mountStack;
21185
- var entry = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1];
21186
-
21187
- if (isRender) {
21188
- addValue(entry.counts, rootNodeID, 1);
21189
- } else if (isMount) {
21190
- entry.created[rootNodeID] = true;
21191
- mountStack.push(0);
21192
- }
21193
-
21194
- start = performanceNow();
21195
- rv = func.apply(this, args);
21196
- totalTime = performanceNow() - start;
21197
-
21198
- if (isRender) {
21199
- addValue(entry.render, rootNodeID, totalTime);
21200
- } else if (isMount) {
21201
- var subMountTime = mountStack.pop();
21202
- mountStack[mountStack.length - 1] += totalTime;
21203
- addValue(entry.exclusive, rootNodeID, totalTime - subMountTime);
21204
- addValue(entry.inclusive, rootNodeID, totalTime);
21205
- } else {
21206
- addValue(entry.inclusive, rootNodeID, totalTime);
21207
- }
21208
-
21209
- entry.displayNames[rootNodeID] = {
21210
- current: this.getName(),
21211
- owner: this._currentElement._owner ? this._currentElement._owner.getName() : '<root>'
21212
- };
21213
-
21214
- return rv;
21215
- } else {
21216
- return func.apply(this, args);
21217
- }
21218
- };
21219
- }
21220
- };
21221
-
21222
- module.exports = ReactDefaultPerf;
21223
- },{"./DOMProperty":41,"./ReactDefaultPerfAnalysis":83,"./ReactMount":97,"./ReactPerf":103,"fbjs/lib/performanceNow":26}],83:[function(require,module,exports){
21224
- /**
21225
- * Copyright 2013-2015, Facebook, Inc.
21226
- * All rights reserved.
21227
- *
21228
- * This source code is licensed under the BSD-style license found in the
21229
- * LICENSE file in the root directory of this source tree. An additional grant
21230
- * of patent rights can be found in the PATENTS file in the same directory.
21231
- *
21232
- * @providesModule ReactDefaultPerfAnalysis
21233
- */
21234
-
21235
- 'use strict';
21236
-
21237
- var assign = require('./Object.assign');
21238
-
21239
- // Don't try to save users less than 1.2ms (a number I made up)
21240
- var DONT_CARE_THRESHOLD = 1.2;
21241
- var DOM_OPERATION_TYPES = {
21242
- '_mountImageIntoNode': 'set innerHTML',
21243
- INSERT_MARKUP: 'set innerHTML',
21244
- MOVE_EXISTING: 'move',
21245
- REMOVE_NODE: 'remove',
21246
- SET_MARKUP: 'set innerHTML',
21247
- TEXT_CONTENT: 'set textContent',
21248
- 'setValueForProperty': 'update attribute',
21249
- 'setValueForAttribute': 'update attribute',
21250
- 'deleteValueForProperty': 'remove attribute',
21251
- 'setValueForStyles': 'update styles',
21252
- 'replaceNodeWithMarkup': 'replace',
21253
- 'updateTextContent': 'set textContent'
21254
- };
21255
-
21256
- function getTotalTime(measurements) {
21257
- // TODO: return number of DOM ops? could be misleading.
21258
- // TODO: measure dropped frames after reconcile?
21259
- // TODO: log total time of each reconcile and the top-level component
21260
- // class that triggered it.
21261
- var totalTime = 0;
21262
- for (var i = 0; i < measurements.length; i++) {
21263
- var measurement = measurements[i];
21264
- totalTime += measurement.totalTime;
21265
- }
21266
- return totalTime;
21267
- }
21268
-
21269
- function getDOMSummary(measurements) {
21270
- var items = [];
21271
- measurements.forEach(function (measurement) {
21272
- Object.keys(measurement.writes).forEach(function (id) {
21273
- measurement.writes[id].forEach(function (write) {
21274
- items.push({
21275
- id: id,
21276
- type: DOM_OPERATION_TYPES[write.type] || write.type,
21277
- args: write.args
21278
- });
21279
- });
21280
- });
21281
- });
21282
- return items;
21283
- }
21284
-
21285
- function getExclusiveSummary(measurements) {
21286
- var candidates = {};
21287
- var displayName;
21288
-
21289
- for (var i = 0; i < measurements.length; i++) {
21290
- var measurement = measurements[i];
21291
- var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
21292
-
21293
- for (var id in allIDs) {
21294
- displayName = measurement.displayNames[id].current;
21295
-
21296
- candidates[displayName] = candidates[displayName] || {
21297
- componentName: displayName,
21298
- inclusive: 0,
21299
- exclusive: 0,
21300
- render: 0,
21301
- count: 0
21302
- };
21303
- if (measurement.render[id]) {
21304
- candidates[displayName].render += measurement.render[id];
21305
- }
21306
- if (measurement.exclusive[id]) {
21307
- candidates[displayName].exclusive += measurement.exclusive[id];
21308
- }
21309
- if (measurement.inclusive[id]) {
21310
- candidates[displayName].inclusive += measurement.inclusive[id];
21311
- }
21312
- if (measurement.counts[id]) {
21313
- candidates[displayName].count += measurement.counts[id];
21314
- }
21315
- }
21316
- }
21317
-
21318
- // Now make a sorted array with the results.
21319
- var arr = [];
21320
- for (displayName in candidates) {
21321
- if (candidates[displayName].exclusive >= DONT_CARE_THRESHOLD) {
21322
- arr.push(candidates[displayName]);
21323
- }
21324
- }
21325
-
21326
- arr.sort(function (a, b) {
21327
- return b.exclusive - a.exclusive;
21328
- });
21329
-
21330
- return arr;
21331
- }
21332
-
21333
- function getInclusiveSummary(measurements, onlyClean) {
21334
- var candidates = {};
21335
- var inclusiveKey;
21336
-
21337
- for (var i = 0; i < measurements.length; i++) {
21338
- var measurement = measurements[i];
21339
- var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
21340
- var cleanComponents;
21341
-
21342
- if (onlyClean) {
21343
- cleanComponents = getUnchangedComponents(measurement);
21344
- }
21345
-
21346
- for (var id in allIDs) {
21347
- if (onlyClean && !cleanComponents[id]) {
21348
- continue;
21349
- }
21350
-
21351
- var displayName = measurement.displayNames[id];
21352
-
21353
- // Inclusive time is not useful for many components without knowing where
21354
- // they are instantiated. So we aggregate inclusive time with both the
21355
- // owner and current displayName as the key.
21356
- inclusiveKey = displayName.owner + ' > ' + displayName.current;
21357
-
21358
- candidates[inclusiveKey] = candidates[inclusiveKey] || {
21359
- componentName: inclusiveKey,
21360
- time: 0,
21361
- count: 0
21362
- };
21363
-
21364
- if (measurement.inclusive[id]) {
21365
- candidates[inclusiveKey].time += measurement.inclusive[id];
21366
- }
21367
- if (measurement.counts[id]) {
21368
- candidates[inclusiveKey].count += measurement.counts[id];
21369
- }
21370
- }
21371
- }
21372
-
21373
- // Now make a sorted array with the results.
21374
- var arr = [];
21375
- for (inclusiveKey in candidates) {
21376
- if (candidates[inclusiveKey].time >= DONT_CARE_THRESHOLD) {
21377
- arr.push(candidates[inclusiveKey]);
21378
- }
21379
- }
21380
-
21381
- arr.sort(function (a, b) {
21382
- return b.time - a.time;
21383
- });
21384
-
21385
- return arr;
21386
- }
21387
-
21388
- function getUnchangedComponents(measurement) {
21389
- // For a given reconcile, look at which components did not actually
21390
- // render anything to the DOM and return a mapping of their ID to
21391
- // the amount of time it took to render the entire subtree.
21392
- var cleanComponents = {};
21393
- var dirtyLeafIDs = Object.keys(measurement.writes);
21394
- var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
21395
-
21396
- for (var id in allIDs) {
21397
- var isDirty = false;
21398
- // For each component that rendered, see if a component that triggered
21399
- // a DOM op is in its subtree.
21400
- for (var i = 0; i < dirtyLeafIDs.length; i++) {
21401
- if (dirtyLeafIDs[i].indexOf(id) === 0) {
21402
- isDirty = true;
21403
- break;
21404
- }
21405
- }
21406
- // check if component newly created
21407
- if (measurement.created[id]) {
21408
- isDirty = true;
21409
- }
21410
- if (!isDirty && measurement.counts[id] > 0) {
21411
- cleanComponents[id] = true;
21412
- }
21413
- }
21414
- return cleanComponents;
21415
- }
21416
-
21417
- var ReactDefaultPerfAnalysis = {
21418
- getExclusiveSummary: getExclusiveSummary,
21419
- getInclusiveSummary: getInclusiveSummary,
21420
- getDOMSummary: getDOMSummary,
21421
- getTotalTime: getTotalTime
21422
- };
21423
-
21424
- module.exports = ReactDefaultPerfAnalysis;
21425
- },{"./Object.assign":54}],84:[function(require,module,exports){
21426
- (function (process){
21427
- /**
21428
- * Copyright 2014-2015, Facebook, Inc.
21429
- * All rights reserved.
21430
- *
21431
- * This source code is licensed under the BSD-style license found in the
21432
- * LICENSE file in the root directory of this source tree. An additional grant
21433
- * of patent rights can be found in the PATENTS file in the same directory.
21434
- *
21435
- * @providesModule ReactElement
21436
- */
21437
-
21438
- 'use strict';
21439
-
21440
- var ReactCurrentOwner = require('./ReactCurrentOwner');
21441
-
21442
- var assign = require('./Object.assign');
21443
- var canDefineProperty = require('./canDefineProperty');
21444
-
21445
- // The Symbol used to tag the ReactElement type. If there is no native Symbol
21446
- // nor polyfill, then a plain number is used for performance.
21447
- var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
21448
-
21449
- var RESERVED_PROPS = {
21450
- key: true,
21451
- ref: true,
21452
- __self: true,
21453
- __source: true
21454
- };
21455
-
21456
- /**
21457
- * Base constructor for all React elements. This is only used to make this
21458
- * work with a dynamic instanceof check. Nothing should live on this prototype.
21459
- *
21460
- * @param {*} type
21461
- * @param {*} key
21462
- * @param {string|object} ref
21463
- * @param {*} self A *temporary* helper to detect places where `this` is
21464
- * different from the `owner` when React.createElement is called, so that we
21465
- * can warn. We want to get rid of owner and replace string `ref`s with arrow
21466
- * functions, and as long as `this` and owner are the same, there will be no
21467
- * change in behavior.
21468
- * @param {*} source An annotation object (added by a transpiler or otherwise)
21469
- * indicating filename, line number, and/or other information.
21470
- * @param {*} owner
21471
- * @param {*} props
21472
- * @internal
21473
- */
21474
- var ReactElement = function (type, key, ref, self, source, owner, props) {
21475
- var element = {
21476
- // This tag allow us to uniquely identify this as a React Element
21477
- $$typeof: REACT_ELEMENT_TYPE,
21478
-
21479
- // Built-in properties that belong on the element
21480
- type: type,
21481
- key: key,
21482
- ref: ref,
21483
- props: props,
21484
-
21485
- // Record the component responsible for creating this element.
21486
- _owner: owner
21487
- };
21488
-
21489
- if (process.env.NODE_ENV !== 'production') {
21490
- // The validation flag is currently mutative. We put it on
21491
- // an external backing store so that we can freeze the whole object.
21492
- // This can be replaced with a WeakMap once they are implemented in
21493
- // commonly used development environments.
21494
- element._store = {};
21495
-
21496
- // To make comparing ReactElements easier for testing purposes, we make
21497
- // the validation flag non-enumerable (where possible, which should
21498
- // include every environment we run tests in), so the test framework
21499
- // ignores it.
21500
- if (canDefineProperty) {
21501
- Object.defineProperty(element._store, 'validated', {
21502
- configurable: false,
21503
- enumerable: false,
21504
- writable: true,
21505
- value: false
21506
- });
21507
- // self and source are DEV only properties.
21508
- Object.defineProperty(element, '_self', {
21509
- configurable: false,
21510
- enumerable: false,
21511
- writable: false,
21512
- value: self
21513
- });
21514
- // Two elements created in two different places should be considered
21515
- // equal for testing purposes and therefore we hide it from enumeration.
21516
- Object.defineProperty(element, '_source', {
21517
- configurable: false,
21518
- enumerable: false,
21519
- writable: false,
21520
- value: source
21521
- });
21522
- } else {
21523
- element._store.validated = false;
21524
- element._self = self;
21525
- element._source = source;
21526
- }
21527
- Object.freeze(element.props);
21528
- Object.freeze(element);
21529
- }
21530
-
21531
- return element;
21532
- };
21533
-
21534
- ReactElement.createElement = function (type, config, children) {
21535
- var propName;
21536
-
21537
- // Reserved names are extracted
21538
- var props = {};
21539
-
21540
- var key = null;
21541
- var ref = null;
21542
- var self = null;
21543
- var source = null;
21544
-
21545
- if (config != null) {
21546
- ref = config.ref === undefined ? null : config.ref;
21547
- key = config.key === undefined ? null : '' + config.key;
21548
- self = config.__self === undefined ? null : config.__self;
21549
- source = config.__source === undefined ? null : config.__source;
21550
- // Remaining properties are added to a new props object
21551
- for (propName in config) {
21552
- if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
21553
- props[propName] = config[propName];
21554
- }
21555
- }
21556
- }
21557
-
21558
- // Children can be more than one argument, and those are transferred onto
21559
- // the newly allocated props object.
21560
- var childrenLength = arguments.length - 2;
21561
- if (childrenLength === 1) {
21562
- props.children = children;
21563
- } else if (childrenLength > 1) {
21564
- var childArray = Array(childrenLength);
21565
- for (var i = 0; i < childrenLength; i++) {
21566
- childArray[i] = arguments[i + 2];
21567
- }
21568
- props.children = childArray;
21569
- }
21570
-
21571
- // Resolve default props
21572
- if (type && type.defaultProps) {
21573
- var defaultProps = type.defaultProps;
21574
- for (propName in defaultProps) {
21575
- if (typeof props[propName] === 'undefined') {
21576
- props[propName] = defaultProps[propName];
21577
- }
21578
- }
21579
- }
21580
-
21581
- return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
21582
- };
21583
-
21584
- ReactElement.createFactory = function (type) {
21585
- var factory = ReactElement.createElement.bind(null, type);
21586
- // Expose the type on the factory and the prototype so that it can be
21587
- // easily accessed on elements. E.g. `<Foo />.type === Foo`.
21588
- // This should not be named `constructor` since this may not be the function
21589
- // that created the element, and it may not even be a constructor.
21590
- // Legacy hook TODO: Warn if this is accessed
21591
- factory.type = type;
21592
- return factory;
21593
- };
21594
-
21595
- ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
21596
- var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
21597
-
21598
- return newElement;
21599
- };
21600
-
21601
- ReactElement.cloneAndReplaceProps = function (oldElement, newProps) {
21602
- var newElement = ReactElement(oldElement.type, oldElement.key, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, newProps);
21603
-
21604
- if (process.env.NODE_ENV !== 'production') {
21605
- // If the key on the original is valid, then the clone is valid
21606
- newElement._store.validated = oldElement._store.validated;
21607
- }
21608
-
21609
- return newElement;
21610
- };
21611
-
21612
- ReactElement.cloneElement = function (element, config, children) {
21613
- var propName;
21614
-
21615
- // Original props are copied
21616
- var props = assign({}, element.props);
21617
-
21618
- // Reserved names are extracted
21619
- var key = element.key;
21620
- var ref = element.ref;
21621
- // Self is preserved since the owner is preserved.
21622
- var self = element._self;
21623
- // Source is preserved since cloneElement is unlikely to be targeted by a
21624
- // transpiler, and the original source is probably a better indicator of the
21625
- // true owner.
21626
- var source = element._source;
21627
-
21628
- // Owner will be preserved, unless ref is overridden
21629
- var owner = element._owner;
21630
-
21631
- if (config != null) {
21632
- if (config.ref !== undefined) {
21633
- // Silently steal the ref from the parent.
21634
- ref = config.ref;
21635
- owner = ReactCurrentOwner.current;
21636
- }
21637
- if (config.key !== undefined) {
21638
- key = '' + config.key;
21639
- }
21640
- // Remaining properties override existing props
21641
- for (propName in config) {
21642
- if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
21643
- props[propName] = config[propName];
21644
- }
21645
- }
21646
- }
21647
-
21648
- // Children can be more than one argument, and those are transferred onto
21649
- // the newly allocated props object.
21650
- var childrenLength = arguments.length - 2;
21651
- if (childrenLength === 1) {
21652
- props.children = children;
21653
- } else if (childrenLength > 1) {
21654
- var childArray = Array(childrenLength);
21655
- for (var i = 0; i < childrenLength; i++) {
21656
- childArray[i] = arguments[i + 2];
21657
- }
21658
- props.children = childArray;
21659
- }
21660
-
21661
- return ReactElement(element.type, key, ref, self, source, owner, props);
21662
- };
21663
-
21664
- /**
21665
- * @param {?object} object
21666
- * @return {boolean} True if `object` is a valid component.
21667
- * @final
21668
- */
21669
- ReactElement.isValidElement = function (object) {
21670
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
21671
- };
21672
-
21673
- module.exports = ReactElement;
21674
- }).call(this,require('_process'))
21675
-
21676
- },{"./Object.assign":54,"./ReactCurrentOwner":66,"./canDefineProperty":136,"_process":31}],85:[function(require,module,exports){
21677
- (function (process){
21678
- /**
21679
- * Copyright 2014-2015, Facebook, Inc.
21680
- * All rights reserved.
21681
- *
21682
- * This source code is licensed under the BSD-style license found in the
21683
- * LICENSE file in the root directory of this source tree. An additional grant
21684
- * of patent rights can be found in the PATENTS file in the same directory.
21685
- *
21686
- * @providesModule ReactElementValidator
21687
- */
21688
-
21689
- /**
21690
- * ReactElementValidator provides a wrapper around a element factory
21691
- * which validates the props passed to the element. This is intended to be
21692
- * used only in DEV and could be replaced by a static type checker for languages
21693
- * that support it.
21694
- */
21695
-
21696
- 'use strict';
21697
-
21698
- var ReactElement = require('./ReactElement');
21699
- var ReactPropTypeLocations = require('./ReactPropTypeLocations');
21700
- var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
21701
- var ReactCurrentOwner = require('./ReactCurrentOwner');
21702
-
21703
- var canDefineProperty = require('./canDefineProperty');
21704
- var getIteratorFn = require('./getIteratorFn');
21705
- var invariant = require('fbjs/lib/invariant');
21706
- var warning = require('fbjs/lib/warning');
21707
-
21708
- function getDeclarationErrorAddendum() {
21709
- if (ReactCurrentOwner.current) {
21710
- var name = ReactCurrentOwner.current.getName();
21711
- if (name) {
21712
- return ' Check the render method of `' + name + '`.';
21713
- }
21714
- }
21715
- return '';
21716
- }
21717
-
21718
- /**
21719
- * Warn if there's no key explicitly set on dynamic arrays of children or
21720
- * object keys are not valid. This allows us to keep track of children between
21721
- * updates.
21722
- */
21723
- var ownerHasKeyUseWarning = {};
21724
-
21725
- var loggedTypeFailures = {};
21726
-
21727
- /**
21728
- * Warn if the element doesn't have an explicit key assigned to it.
21729
- * This element is in an array. The array could grow and shrink or be
21730
- * reordered. All children that haven't already been validated are required to
21731
- * have a "key" property assigned to it.
21732
- *
21733
- * @internal
21734
- * @param {ReactElement} element Element that requires a key.
21735
- * @param {*} parentType element's parent's type.
21736
- */
21737
- function validateExplicitKey(element, parentType) {
21738
- if (!element._store || element._store.validated || element.key != null) {
21739
- return;
21740
- }
21741
- element._store.validated = true;
21742
-
21743
- var addenda = getAddendaForKeyUse('uniqueKey', element, parentType);
21744
- if (addenda === null) {
21745
- // we already showed the warning
21746
- return;
21747
- }
21748
- process.env.NODE_ENV !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s%s', addenda.parentOrOwner || '', addenda.childOwner || '', addenda.url || '') : undefined;
21749
- }
21750
-
21751
- /**
21752
- * Shared warning and monitoring code for the key warnings.
21753
- *
21754
- * @internal
21755
- * @param {string} messageType A key used for de-duping warnings.
21756
- * @param {ReactElement} element Component that requires a key.
21757
- * @param {*} parentType element's parent's type.
21758
- * @returns {?object} A set of addenda to use in the warning message, or null
21759
- * if the warning has already been shown before (and shouldn't be shown again).
21760
- */
21761
- function getAddendaForKeyUse(messageType, element, parentType) {
21762
- var addendum = getDeclarationErrorAddendum();
21763
- if (!addendum) {
21764
- var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
21765
- if (parentName) {
21766
- addendum = ' Check the top-level render call using <' + parentName + '>.';
21767
- }
21768
- }
21769
-
21770
- var memoizer = ownerHasKeyUseWarning[messageType] || (ownerHasKeyUseWarning[messageType] = {});
21771
- if (memoizer[addendum]) {
21772
- return null;
21773
- }
21774
- memoizer[addendum] = true;
21775
-
21776
- var addenda = {
21777
- parentOrOwner: addendum,
21778
- url: ' See https://fb.me/react-warning-keys for more information.',
21779
- childOwner: null
21780
- };
21781
-
21782
- // Usually the current owner is the offender, but if it accepts children as a
21783
- // property, it may be the creator of the child that's responsible for
21784
- // assigning it a key.
21785
- if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
21786
- // Give the component that originally created this child.
21787
- addenda.childOwner = ' It was passed a child from ' + element._owner.getName() + '.';
21788
- }
21789
-
21790
- return addenda;
21791
- }
21792
-
21793
- /**
21794
- * Ensure that every element either is passed in a static location, in an
21795
- * array with an explicit keys property defined, or in an object literal
21796
- * with valid key property.
21797
- *
21798
- * @internal
21799
- * @param {ReactNode} node Statically passed child of any type.
21800
- * @param {*} parentType node's parent's type.
21801
- */
21802
- function validateChildKeys(node, parentType) {
21803
- if (typeof node !== 'object') {
21804
- return;
21805
- }
21806
- if (Array.isArray(node)) {
21807
- for (var i = 0; i < node.length; i++) {
21808
- var child = node[i];
21809
- if (ReactElement.isValidElement(child)) {
21810
- validateExplicitKey(child, parentType);
21811
- }
21812
- }
21813
- } else if (ReactElement.isValidElement(node)) {
21814
- // This element was passed in a valid location.
21815
- if (node._store) {
21816
- node._store.validated = true;
21817
- }
21818
- } else if (node) {
21819
- var iteratorFn = getIteratorFn(node);
21820
- // Entry iterators provide implicit keys.
21821
- if (iteratorFn) {
21822
- if (iteratorFn !== node.entries) {
21823
- var iterator = iteratorFn.call(node);
21824
- var step;
21825
- while (!(step = iterator.next()).done) {
21826
- if (ReactElement.isValidElement(step.value)) {
21827
- validateExplicitKey(step.value, parentType);
21828
- }
21829
- }
21830
- }
21831
- }
21832
- }
21833
- }
21834
-
21835
- /**
21836
- * Assert that the props are valid
21837
- *
21838
- * @param {string} componentName Name of the component for error messages.
21839
- * @param {object} propTypes Map of prop name to a ReactPropType
21840
- * @param {object} props
21841
- * @param {string} location e.g. "prop", "context", "child context"
21842
- * @private
21843
- */
21844
- function checkPropTypes(componentName, propTypes, props, location) {
21845
- for (var propName in propTypes) {
21846
- if (propTypes.hasOwnProperty(propName)) {
21847
- var error;
21848
- // Prop type validation may throw. In case they do, we don't want to
21849
- // fail the render phase where it didn't fail before. So we log it.
21850
- // After these have been cleaned up, we'll let them throw.
21851
- try {
21852
- // This is intentionally an invariant that gets caught. It's the same
21853
- // behavior as without this statement except with a better message.
21854
- !(typeof propTypes[propName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
21855
- error = propTypes[propName](props, propName, componentName, location);
21856
- } catch (ex) {
21857
- error = ex;
21858
- }
21859
- process.env.NODE_ENV !== 'production' ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], propName, typeof error) : undefined;
21860
- if (error instanceof Error && !(error.message in loggedTypeFailures)) {
21861
- // Only monitor this failure once because there tends to be a lot of the
21862
- // same error.
21863
- loggedTypeFailures[error.message] = true;
21864
-
21865
- var addendum = getDeclarationErrorAddendum();
21866
- process.env.NODE_ENV !== 'production' ? warning(false, 'Failed propType: %s%s', error.message, addendum) : undefined;
21867
- }
21868
- }
21869
- }
21870
- }
21871
-
21872
- /**
21873
- * Given an element, validate that its props follow the propTypes definition,
21874
- * provided by the type.
21875
- *
21876
- * @param {ReactElement} element
21877
- */
21878
- function validatePropTypes(element) {
21879
- var componentClass = element.type;
21880
- if (typeof componentClass !== 'function') {
21881
- return;
21882
- }
21883
- var name = componentClass.displayName || componentClass.name;
21884
- if (componentClass.propTypes) {
21885
- checkPropTypes(name, componentClass.propTypes, element.props, ReactPropTypeLocations.prop);
21886
- }
21887
- if (typeof componentClass.getDefaultProps === 'function') {
21888
- process.env.NODE_ENV !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : undefined;
21889
- }
21890
- }
21891
-
21892
- var ReactElementValidator = {
21893
-
21894
- createElement: function (type, props, children) {
21895
- var validType = typeof type === 'string' || typeof type === 'function';
21896
- // We warn in this case but don't throw. We expect the element creation to
21897
- // succeed and there will likely be errors in render.
21898
- process.env.NODE_ENV !== 'production' ? warning(validType, 'React.createElement: type should not be null, undefined, boolean, or ' + 'number. It should be a string (for DOM elements) or a ReactClass ' + '(for composite components).%s', getDeclarationErrorAddendum()) : undefined;
21899
-
21900
- var element = ReactElement.createElement.apply(this, arguments);
21901
-
21902
- // The result can be nullish if a mock or a custom function is used.
21903
- // TODO: Drop this when these are no longer allowed as the type argument.
21904
- if (element == null) {
21905
- return element;
21906
- }
21907
-
21908
- // Skip key warning if the type isn't valid since our key validation logic
21909
- // doesn't expect a non-string/function type and can throw confusing errors.
21910
- // We don't want exception behavior to differ between dev and prod.
21911
- // (Rendering will throw with a helpful message and as soon as the type is
21912
- // fixed, the key warnings will appear.)
21913
- if (validType) {
21914
- for (var i = 2; i < arguments.length; i++) {
21915
- validateChildKeys(arguments[i], type);
21916
- }
21917
- }
21918
-
21919
- validatePropTypes(element);
21920
-
21921
- return element;
21922
- },
21923
-
21924
- createFactory: function (type) {
21925
- var validatedFactory = ReactElementValidator.createElement.bind(null, type);
21926
- // Legacy hook TODO: Warn if this is accessed
21927
- validatedFactory.type = type;
21928
-
21929
- if (process.env.NODE_ENV !== 'production') {
21930
- if (canDefineProperty) {
21931
- Object.defineProperty(validatedFactory, 'type', {
21932
- enumerable: false,
21933
- get: function () {
21934
- process.env.NODE_ENV !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : undefined;
21935
- Object.defineProperty(this, 'type', {
21936
- value: type
21937
- });
21938
- return type;
21939
- }
21940
- });
21941
- }
21942
- }
21943
-
21944
- return validatedFactory;
21945
- },
21946
-
21947
- cloneElement: function (element, props, children) {
21948
- var newElement = ReactElement.cloneElement.apply(this, arguments);
21949
- for (var i = 2; i < arguments.length; i++) {
21950
- validateChildKeys(arguments[i], newElement.type);
21951
- }
21952
- validatePropTypes(newElement);
21953
- return newElement;
21954
- }
21955
-
21956
- };
21957
-
21958
- module.exports = ReactElementValidator;
21959
- }).call(this,require('_process'))
21960
-
21961
- },{"./ReactCurrentOwner":66,"./ReactElement":84,"./ReactPropTypeLocationNames":104,"./ReactPropTypeLocations":105,"./canDefineProperty":136,"./getIteratorFn":147,"_process":31,"fbjs/lib/invariant":18,"fbjs/lib/warning":29}],86:[function(require,module,exports){
21962
- /**
21963
- * Copyright 2014-2015, Facebook, Inc.
21964
- * All rights reserved.
21965
- *
21966
- * This source code is licensed under the BSD-style license found in the
21967
- * LICENSE file in the root directory of this source tree. An additional grant
21968
- * of patent rights can be found in the PATENTS file in the same directory.
21969
- *
21970
- * @providesModule ReactEmptyComponent
21971
- */
21972
-
21973
- 'use strict';
21974
-
21975
- var ReactElement = require('./ReactElement');
21976
- var ReactEmptyComponentRegistry = require('./ReactEmptyComponentRegistry');
21977
- var ReactReconciler = require('./ReactReconciler');
21978
-
21979
- var assign = require('./Object.assign');
21980
-
21981
- var placeholderElement;
21982
-
21983
- var ReactEmptyComponentInjection = {
21984
- injectEmptyComponent: function (component) {
21985
- placeholderElement = ReactElement.createElement(component);
21986
- }
21987
- };
21988
-
21989
- function registerNullComponentID() {
21990
- ReactEmptyComponentRegistry.registerNullComponentID(this._rootNodeID);
21991
- }
21992
-
21993
- var ReactEmptyComponent = function (instantiate) {
21994
- this._currentElement = null;
21995
- this._rootNodeID = null;
21996
- this._renderedComponent = instantiate(placeholderElement);
21997
- };
21998
- assign(ReactEmptyComponent.prototype, {
21999
- construct: function (element) {},
22000
- mountComponent: function (rootID, transaction, context) {
22001
- transaction.getReactMountReady().enqueue(registerNullComponentID, this);
22002
- this._rootNodeID = rootID;
22003
- return ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, context);
22004
- },
22005
- receiveComponent: function () {},
22006
- unmountComponent: function (rootID, transaction, context) {
22007
- ReactReconciler.unmountComponent(this._renderedComponent);
22008
- ReactEmptyComponentRegistry.deregisterNullComponentID(this._rootNodeID);
22009
- this._rootNodeID = null;
22010
- this._renderedComponent = null;
22011
- }
22012
- });
22013
-
22014
- ReactEmptyComponent.injection = ReactEmptyComponentInjection;
22015
-
22016
- module.exports = ReactEmptyComponent;
22017
- },{"./Object.assign":54,"./ReactElement":84,"./ReactEmptyComponentRegistry":87,"./ReactReconciler":108}],87:[function(require,module,exports){
22018
- /**
22019
- * Copyright 2014-2015, Facebook, Inc.
22020
- * All rights reserved.
22021
- *
22022
- * This source code is licensed under the BSD-style license found in the
22023
- * LICENSE file in the root directory of this source tree. An additional grant
22024
- * of patent rights can be found in the PATENTS file in the same directory.
22025
- *
22026
- * @providesModule ReactEmptyComponentRegistry
22027
- */
22028
-
22029
- 'use strict';
22030
-
22031
- // This registry keeps track of the React IDs of the components that rendered to
22032
- // `null` (in reality a placeholder such as `noscript`)
22033
- var nullComponentIDsRegistry = {};
22034
-
22035
- /**
22036
- * @param {string} id Component's `_rootNodeID`.
22037
- * @return {boolean} True if the component is rendered to null.
22038
- */
22039
- function isNullComponentID(id) {
22040
- return !!nullComponentIDsRegistry[id];
22041
- }
22042
-
22043
- /**
22044
- * Mark the component as having rendered to null.
22045
- * @param {string} id Component's `_rootNodeID`.
22046
- */
22047
- function registerNullComponentID(id) {
22048
- nullComponentIDsRegistry[id] = true;
22049
- }
22050
-
22051
- /**
22052
- * Unmark the component as having rendered to null: it renders to something now.
22053
- * @param {string} id Component's `_rootNodeID`.
22054
- */
22055
- function deregisterNullComponentID(id) {
22056
- delete nullComponentIDsRegistry[id];
22057
- }
22058
-
22059
- var ReactEmptyComponentRegistry = {
22060
- isNullComponentID: isNullComponentID,
22061
- registerNullComponentID: registerNullComponentID,
22062
- deregisterNullComponentID: deregisterNullComponentID
22063
- };
22064
-
22065
- module.exports = ReactEmptyComponentRegistry;
22066
- },{}],88:[function(require,module,exports){
22067
- (function (process){
22068
- /**
22069
- * Copyright 2013-2015, Facebook, Inc.
22070
- * All rights reserved.
22071
- *
22072
- * This source code is licensed under the BSD-style license found in the
22073
- * LICENSE file in the root directory of this source tree. An additional grant
22074
- * of patent rights can be found in the PATENTS file in the same directory.
22075
- *
22076
- * @providesModule ReactErrorUtils
22077
- * @typechecks
22078
- */
22079
-
22080
- 'use strict';
22081
-
22082
- var caughtError = null;
22083
-
22084
- /**
22085
- * Call a function while guarding against errors that happens within it.
22086
- *
22087
- * @param {?String} name of the guard to use for logging or debugging
22088
- * @param {Function} func The function to invoke
22089
- * @param {*} a First argument
22090
- * @param {*} b Second argument
22091
- */
22092
- function invokeGuardedCallback(name, func, a, b) {
22093
- try {
22094
- return func(a, b);
22095
- } catch (x) {
22096
- if (caughtError === null) {
22097
- caughtError = x;
22098
- }
22099
- return undefined;
22100
- }
22101
- }
22102
-
22103
- var ReactErrorUtils = {
22104
- invokeGuardedCallback: invokeGuardedCallback,
22105
-
22106
- /**
22107
- * Invoked by ReactTestUtils.Simulate so that any errors thrown by the event
22108
- * handler are sure to be rethrown by rethrowCaughtError.
22109
- */
22110
- invokeGuardedCallbackWithCatch: invokeGuardedCallback,
22111
-
22112
- /**
22113
- * During execution of guarded functions we will capture the first error which
22114
- * we will rethrow to be handled by the top level error handler.
22115
- */
22116
- rethrowCaughtError: function () {
22117
- if (caughtError) {
22118
- var error = caughtError;
22119
- caughtError = null;
22120
- throw error;
22121
- }
22122
- }
22123
- };
22124
-
22125
- if (process.env.NODE_ENV !== 'production') {
22126
- /**
22127
- * To help development we can get better devtools integration by simulating a
22128
- * real browser event.
22129
- */
22130
- if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
22131
- var fakeNode = document.createElement('react');
22132
- ReactErrorUtils.invokeGuardedCallback = function (name, func, a, b) {
22133
- var boundFunc = func.bind(null, a, b);
22134
- var evtType = 'react-' + name;
22135
- fakeNode.addEventListener(evtType, boundFunc, false);
22136
- var evt = document.createEvent('Event');
22137
- evt.initEvent(evtType, false, false);
22138
- fakeNode.dispatchEvent(evt);
22139
- fakeNode.removeEventListener(evtType, boundFunc, false);
22140
- };
22141
- }
22142
- }
22143
-
22144
- module.exports = ReactErrorUtils;
22145
- }).call(this,require('_process'))
22146
-
22147
- },{"_process":31}],89:[function(require,module,exports){
22148
- /**
22149
- * Copyright 2013-2015, Facebook, Inc.
22150
- * All rights reserved.
22151
- *
22152
- * This source code is licensed under the BSD-style license found in the
22153
- * LICENSE file in the root directory of this source tree. An additional grant
22154
- * of patent rights can be found in the PATENTS file in the same directory.
22155
- *
22156
- * @providesModule ReactEventEmitterMixin
22157
- */
22158
-
22159
- 'use strict';
22160
-
22161
- var EventPluginHub = require('./EventPluginHub');
22162
-
22163
- function runEventQueueInBatch(events) {
22164
- EventPluginHub.enqueueEvents(events);
22165
- EventPluginHub.processEventQueue(false);
22166
- }
22167
-
22168
- var ReactEventEmitterMixin = {
22169
-
22170
- /**
22171
- * Streams a fired top-level event to `EventPluginHub` where plugins have the
22172
- * opportunity to create `ReactEvent`s to be dispatched.
22173
- *
22174
- * @param {string} topLevelType Record from `EventConstants`.
22175
- * @param {object} topLevelTarget The listening component root node.
22176
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
22177
- * @param {object} nativeEvent Native environment event.
22178
- */
22179
- handleTopLevel: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
22180
- var events = EventPluginHub.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
22181
- runEventQueueInBatch(events);
22182
- }
22183
- };
22184
-
22185
- module.exports = ReactEventEmitterMixin;
22186
- },{"./EventPluginHub":47}],90:[function(require,module,exports){
22187
- /**
22188
- * Copyright 2013-2015, Facebook, Inc.
22189
- * All rights reserved.
22190
- *
22191
- * This source code is licensed under the BSD-style license found in the
22192
- * LICENSE file in the root directory of this source tree. An additional grant
22193
- * of patent rights can be found in the PATENTS file in the same directory.
22194
- *
22195
- * @providesModule ReactEventListener
22196
- * @typechecks static-only
22197
- */
22198
-
22199
- 'use strict';
22200
-
22201
- var EventListener = require('fbjs/lib/EventListener');
22202
- var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
22203
- var PooledClass = require('./PooledClass');
22204
- var ReactInstanceHandles = require('./ReactInstanceHandles');
22205
- var ReactMount = require('./ReactMount');
22206
- var ReactUpdates = require('./ReactUpdates');
22207
-
22208
- var assign = require('./Object.assign');
22209
- var getEventTarget = require('./getEventTarget');
22210
- var getUnboundedScrollPosition = require('fbjs/lib/getUnboundedScrollPosition');
22211
-
22212
- var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
22213
-
22214
- /**
22215
- * Finds the parent React component of `node`.
22216
- *
22217
- * @param {*} node
22218
- * @return {?DOMEventTarget} Parent container, or `null` if the specified node
22219
- * is not nested.
22220
- */
22221
- function findParent(node) {
22222
- // TODO: It may be a good idea to cache this to prevent unnecessary DOM
22223
- // traversal, but caching is difficult to do correctly without using a
22224
- // mutation observer to listen for all DOM changes.
22225
- var nodeID = ReactMount.getID(node);
22226
- var rootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
22227
- var container = ReactMount.findReactContainerForID(rootID);
22228
- var parent = ReactMount.getFirstReactDOM(container);
22229
- return parent;
22230
- }
22231
-
22232
- // Used to store ancestor hierarchy in top level callback
22233
- function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
22234
- this.topLevelType = topLevelType;
22235
- this.nativeEvent = nativeEvent;
22236
- this.ancestors = [];
22237
- }
22238
- assign(TopLevelCallbackBookKeeping.prototype, {
22239
- destructor: function () {
22240
- this.topLevelType = null;
22241
- this.nativeEvent = null;
22242
- this.ancestors.length = 0;
22243
- }
22244
- });
22245
- PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
22246
-
22247
- function handleTopLevelImpl(bookKeeping) {
22248
- // TODO: Re-enable event.path handling
22249
- //
22250
- // if (bookKeeping.nativeEvent.path && bookKeeping.nativeEvent.path.length > 1) {
22251
- // // New browsers have a path attribute on native events
22252
- // handleTopLevelWithPath(bookKeeping);
22253
- // } else {
22254
- // // Legacy browsers don't have a path attribute on native events
22255
- // handleTopLevelWithoutPath(bookKeeping);
22256
- // }
22257
-
22258
- void handleTopLevelWithPath; // temporarily unused
22259
- handleTopLevelWithoutPath(bookKeeping);
22260
- }
22261
-
22262
- // Legacy browsers don't have a path attribute on native events
22263
- function handleTopLevelWithoutPath(bookKeeping) {
22264
- var topLevelTarget = ReactMount.getFirstReactDOM(getEventTarget(bookKeeping.nativeEvent)) || window;
22265
-
22266
- // Loop through the hierarchy, in case there's any nested components.
22267
- // It's important that we build the array of ancestors before calling any
22268
- // event handlers, because event handlers can modify the DOM, leading to
22269
- // inconsistencies with ReactMount's node cache. See #1105.
22270
- var ancestor = topLevelTarget;
22271
- while (ancestor) {
22272
- bookKeeping.ancestors.push(ancestor);
22273
- ancestor = findParent(ancestor);
22274
- }
22275
-
22276
- for (var i = 0; i < bookKeeping.ancestors.length; i++) {
22277
- topLevelTarget = bookKeeping.ancestors[i];
22278
- var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
22279
- ReactEventListener._handleTopLevel(bookKeeping.topLevelType, topLevelTarget, topLevelTargetID, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
22280
- }
22281
- }
22282
-
22283
- // New browsers have a path attribute on native events
22284
- function handleTopLevelWithPath(bookKeeping) {
22285
- var path = bookKeeping.nativeEvent.path;
22286
- var currentNativeTarget = path[0];
22287
- var eventsFired = 0;
22288
- for (var i = 0; i < path.length; i++) {
22289
- var currentPathElement = path[i];
22290
- if (currentPathElement.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE) {
22291
- currentNativeTarget = path[i + 1];
22292
- }
22293
- // TODO: slow
22294
- var reactParent = ReactMount.getFirstReactDOM(currentPathElement);
22295
- if (reactParent === currentPathElement) {
22296
- var currentPathElementID = ReactMount.getID(currentPathElement);
22297
- var newRootID = ReactInstanceHandles.getReactRootIDFromNodeID(currentPathElementID);
22298
- bookKeeping.ancestors.push(currentPathElement);
22299
-
22300
- var topLevelTargetID = ReactMount.getID(currentPathElement) || '';
22301
- eventsFired++;
22302
- ReactEventListener._handleTopLevel(bookKeeping.topLevelType, currentPathElement, topLevelTargetID, bookKeeping.nativeEvent, currentNativeTarget);
22303
-
22304
- // Jump to the root of this React render tree
22305
- while (currentPathElementID !== newRootID) {
22306
- i++;
22307
- currentPathElement = path[i];
22308
- currentPathElementID = ReactMount.getID(currentPathElement);
22309
- }
22310
- }
22311
- }
22312
- if (eventsFired === 0) {
22313
- ReactEventListener._handleTopLevel(bookKeeping.topLevelType, window, '', bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
22314
- }
22315
- }
22316
-
22317
- function scrollValueMonitor(cb) {
22318
- var scrollPosition = getUnboundedScrollPosition(window);
22319
- cb(scrollPosition);
22320
- }
22321
-
22322
- var ReactEventListener = {
22323
- _enabled: true,
22324
- _handleTopLevel: null,
22325
-
22326
- WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
22327
-
22328
- setHandleTopLevel: function (handleTopLevel) {
22329
- ReactEventListener._handleTopLevel = handleTopLevel;
22330
- },
22331
-
22332
- setEnabled: function (enabled) {
22333
- ReactEventListener._enabled = !!enabled;
22334
- },
22335
-
22336
- isEnabled: function () {
22337
- return ReactEventListener._enabled;
22338
- },
22339
-
22340
- /**
22341
- * Traps top-level events by using event bubbling.
22342
- *
22343
- * @param {string} topLevelType Record from `EventConstants`.
22344
- * @param {string} handlerBaseName Event name (e.g. "click").
22345
- * @param {object} handle Element on which to attach listener.
22346
- * @return {?object} An object with a remove function which will forcefully
22347
- * remove the listener.
22348
- * @internal
22349
- */
22350
- trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
22351
- var element = handle;
22352
- if (!element) {
22353
- return null;
22354
- }
22355
- return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
22356
- },
22357
-
22358
- /**
22359
- * Traps a top-level event by using event capturing.
22360
- *
22361
- * @param {string} topLevelType Record from `EventConstants`.
22362
- * @param {string} handlerBaseName Event name (e.g. "click").
22363
- * @param {object} handle Element on which to attach listener.
22364
- * @return {?object} An object with a remove function which will forcefully
22365
- * remove the listener.
22366
- * @internal
22367
- */
22368
- trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
22369
- var element = handle;
22370
- if (!element) {
22371
- return null;
22372
- }
22373
- return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
22374
- },
22375
-
22376
- monitorScrollValue: function (refresh) {
22377
- var callback = scrollValueMonitor.bind(null, refresh);
22378
- EventListener.listen(window, 'scroll', callback);
22379
- },
22380
-
22381
- dispatchEvent: function (topLevelType, nativeEvent) {
22382
- if (!ReactEventListener._enabled) {
22383
- return;
22384
- }
22385
-
22386
- var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent);
22387
- try {
22388
- // Event queue being processed in the same cycle allows
22389
- // `preventDefault`.
22390
- ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping);
22391
- } finally {
22392
- TopLevelCallbackBookKeeping.release(bookKeeping);
22393
- }
22394
- }
22395
- };
22396
-
22397
- module.exports = ReactEventListener;
22398
- },{"./Object.assign":54,"./PooledClass":55,"./ReactInstanceHandles":93,"./ReactMount":97,"./ReactUpdates":115,"./getEventTarget":146,"fbjs/lib/EventListener":3,"fbjs/lib/ExecutionEnvironment":4,"fbjs/lib/getUnboundedScrollPosition":15}],91:[function(require,module,exports){
22399
- /**
22400
- * Copyright 2013-2015, Facebook, Inc.
22401
- * All rights reserved.
22402
- *
22403
- * This source code is licensed under the BSD-style license found in the
22404
- * LICENSE file in the root directory of this source tree. An additional grant
22405
- * of patent rights can be found in the PATENTS file in the same directory.
22406
- *
22407
- * @providesModule ReactInjection
22408
- */
22409
-
22410
- 'use strict';
22411
-
22412
- var DOMProperty = require('./DOMProperty');
22413
- var EventPluginHub = require('./EventPluginHub');
22414
- var ReactComponentEnvironment = require('./ReactComponentEnvironment');
22415
- var ReactClass = require('./ReactClass');
22416
- var ReactEmptyComponent = require('./ReactEmptyComponent');
22417
- var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
22418
- var ReactNativeComponent = require('./ReactNativeComponent');
22419
- var ReactPerf = require('./ReactPerf');
22420
- var ReactRootIndex = require('./ReactRootIndex');
22421
- var ReactUpdates = require('./ReactUpdates');
22422
-
22423
- var ReactInjection = {
22424
- Component: ReactComponentEnvironment.injection,
22425
- Class: ReactClass.injection,
22426
- DOMProperty: DOMProperty.injection,
22427
- EmptyComponent: ReactEmptyComponent.injection,
22428
- EventPluginHub: EventPluginHub.injection,
22429
- EventEmitter: ReactBrowserEventEmitter.injection,
22430
- NativeComponent: ReactNativeComponent.injection,
22431
- Perf: ReactPerf.injection,
22432
- RootIndex: ReactRootIndex.injection,
22433
- Updates: ReactUpdates.injection
22434
- };
22435
-
22436
- module.exports = ReactInjection;
22437
- },{"./DOMProperty":41,"./EventPluginHub":47,"./ReactBrowserEventEmitter":58,"./ReactClass":61,"./ReactComponentEnvironment":64,"./ReactEmptyComponent":86,"./ReactNativeComponent":100,"./ReactPerf":103,"./ReactRootIndex":110,"./ReactUpdates":115}],92:[function(require,module,exports){
22438
- /**
22439
- * Copyright 2013-2015, Facebook, Inc.
22440
- * All rights reserved.
22441
- *
22442
- * This source code is licensed under the BSD-style license found in the
22443
- * LICENSE file in the root directory of this source tree. An additional grant
22444
- * of patent rights can be found in the PATENTS file in the same directory.
22445
- *
22446
- * @providesModule ReactInputSelection
22447
- */
22448
-
22449
- 'use strict';
22450
-
22451
- var ReactDOMSelection = require('./ReactDOMSelection');
22452
-
22453
- var containsNode = require('fbjs/lib/containsNode');
22454
- var focusNode = require('fbjs/lib/focusNode');
22455
- var getActiveElement = require('fbjs/lib/getActiveElement');
22456
-
22457
- function isInDocument(node) {
22458
- return containsNode(document.documentElement, node);
22459
- }
22460
-
22461
- /**
22462
- * @ReactInputSelection: React input selection module. Based on Selection.js,
22463
- * but modified to be suitable for react and has a couple of bug fixes (doesn't
22464
- * assume buttons have range selections allowed).
22465
- * Input selection module for React.
22466
- */
22467
- var ReactInputSelection = {
22468
-
22469
- hasSelectionCapabilities: function (elem) {
22470
- var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
22471
- return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true');
22472
- },
22473
-
22474
- getSelectionInformation: function () {
22475
- var focusedElem = getActiveElement();
22476
- return {
22477
- focusedElem: focusedElem,
22478
- selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null
22479
- };
22480
- },
22481
-
22482
- /**
22483
- * @restoreSelection: If any selection information was potentially lost,
22484
- * restore it. This is useful when performing operations that could remove dom
22485
- * nodes and place them back in, resulting in focus being lost.
22486
- */
22487
- restoreSelection: function (priorSelectionInformation) {
22488
- var curFocusedElem = getActiveElement();
22489
- var priorFocusedElem = priorSelectionInformation.focusedElem;
22490
- var priorSelectionRange = priorSelectionInformation.selectionRange;
22491
- if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
22492
- if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {
22493
- ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange);
22494
- }
22495
- focusNode(priorFocusedElem);
22496
- }
22497
- },
22498
-
22499
- /**
22500
- * @getSelection: Gets the selection bounds of a focused textarea, input or
22501
- * contentEditable node.
22502
- * -@input: Look up selection bounds of this input
22503
- * -@return {start: selectionStart, end: selectionEnd}
22504
- */
22505
- getSelection: function (input) {
22506
- var selection;
22507
-
22508
- if ('selectionStart' in input) {
22509
- // Modern browser with input or textarea.
22510
- selection = {
22511
- start: input.selectionStart,
22512
- end: input.selectionEnd
22513
- };
22514
- } else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
22515
- // IE8 input.
22516
- var range = document.selection.createRange();
22517
- // There can only be one selection per document in IE, so it must
22518
- // be in our element.
22519
- if (range.parentElement() === input) {
22520
- selection = {
22521
- start: -range.moveStart('character', -input.value.length),
22522
- end: -range.moveEnd('character', -input.value.length)
22523
- };
22524
- }
22525
- } else {
22526
- // Content editable or old IE textarea.
22527
- selection = ReactDOMSelection.getOffsets(input);
22528
- }
22529
-
22530
- return selection || { start: 0, end: 0 };
22531
- },
22532
-
22533
- /**
22534
- * @setSelection: Sets the selection bounds of a textarea or input and focuses
22535
- * the input.
22536
- * -@input Set selection bounds of this input or textarea
22537
- * -@offsets Object of same form that is returned from get*
22538
- */
22539
- setSelection: function (input, offsets) {
22540
- var start = offsets.start;
22541
- var end = offsets.end;
22542
- if (typeof end === 'undefined') {
22543
- end = start;
22544
- }
22545
-
22546
- if ('selectionStart' in input) {
22547
- input.selectionStart = start;
22548
- input.selectionEnd = Math.min(end, input.value.length);
22549
- } else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
22550
- var range = input.createTextRange();
22551
- range.collapse(true);
22552
- range.moveStart('character', start);
22553
- range.moveEnd('character', end - start);
22554
- range.select();
22555
- } else {
22556
- ReactDOMSelection.setOffsets(input, offsets);
22557
- }
22558
- }
22559
- };
22560
-
22561
- module.exports = ReactInputSelection;
22562
- },{"./ReactDOMSelection":76,"fbjs/lib/containsNode":7,"fbjs/lib/focusNode":12,"fbjs/lib/getActiveElement":13}],93:[function(require,module,exports){
22563
- (function (process){
22564
- /**
22565
- * Copyright 2013-2015, Facebook, Inc.
22566
- * All rights reserved.
22567
- *
22568
- * This source code is licensed under the BSD-style license found in the
22569
- * LICENSE file in the root directory of this source tree. An additional grant
22570
- * of patent rights can be found in the PATENTS file in the same directory.
22571
- *
22572
- * @providesModule ReactInstanceHandles
22573
- * @typechecks static-only
22574
- */
22575
-
22576
- 'use strict';
22577
-
22578
- var ReactRootIndex = require('./ReactRootIndex');
22579
-
22580
- var invariant = require('fbjs/lib/invariant');
22581
-
22582
- var SEPARATOR = '.';
22583
- var SEPARATOR_LENGTH = SEPARATOR.length;
22584
-
22585
- /**
22586
- * Maximum depth of traversals before we consider the possibility of a bad ID.
22587
- */
22588
- var MAX_TREE_DEPTH = 10000;
22589
-
22590
- /**
22591
- * Creates a DOM ID prefix to use when mounting React components.
22592
- *
22593
- * @param {number} index A unique integer
22594
- * @return {string} React root ID.
22595
- * @internal
22596
- */
22597
- function getReactRootIDString(index) {
22598
- return SEPARATOR + index.toString(36);
22599
- }
22600
-
22601
- /**
22602
- * Checks if a character in the supplied ID is a separator or the end.
22603
- *
22604
- * @param {string} id A React DOM ID.
22605
- * @param {number} index Index of the character to check.
22606
- * @return {boolean} True if the character is a separator or end of the ID.
22607
- * @private
22608
- */
22609
- function isBoundary(id, index) {
22610
- return id.charAt(index) === SEPARATOR || index === id.length;
22611
- }
22612
-
22613
- /**
22614
- * Checks if the supplied string is a valid React DOM ID.
22615
- *
22616
- * @param {string} id A React DOM ID, maybe.
22617
- * @return {boolean} True if the string is a valid React DOM ID.
22618
- * @private
22619
- */
22620
- function isValidID(id) {
22621
- return id === '' || id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR;
22622
- }
22623
-
22624
- /**
22625
- * Checks if the first ID is an ancestor of or equal to the second ID.
22626
- *
22627
- * @param {string} ancestorID
22628
- * @param {string} descendantID
22629
- * @return {boolean} True if `ancestorID` is an ancestor of `descendantID`.
22630
- * @internal
22631
- */
22632
- function isAncestorIDOf(ancestorID, descendantID) {
22633
- return descendantID.indexOf(ancestorID) === 0 && isBoundary(descendantID, ancestorID.length);
22634
- }
22635
-
22636
- /**
22637
- * Gets the parent ID of the supplied React DOM ID, `id`.
22638
- *
22639
- * @param {string} id ID of a component.
22640
- * @return {string} ID of the parent, or an empty string.
22641
- * @private
22642
- */
22643
- function getParentID(id) {
22644
- return id ? id.substr(0, id.lastIndexOf(SEPARATOR)) : '';
22645
- }
22646
-
22647
- /**
22648
- * Gets the next DOM ID on the tree path from the supplied `ancestorID` to the
22649
- * supplied `destinationID`. If they are equal, the ID is returned.
22650
- *
22651
- * @param {string} ancestorID ID of an ancestor node of `destinationID`.
22652
- * @param {string} destinationID ID of the destination node.
22653
- * @return {string} Next ID on the path from `ancestorID` to `destinationID`.
22654
- * @private
22655
- */
22656
- function getNextDescendantID(ancestorID, destinationID) {
22657
- !(isValidID(ancestorID) && isValidID(destinationID)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.', ancestorID, destinationID) : invariant(false) : undefined;
22658
- !isAncestorIDOf(ancestorID, destinationID) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNextDescendantID(...): React has made an invalid assumption about ' + 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.', ancestorID, destinationID) : invariant(false) : undefined;
22659
- if (ancestorID === destinationID) {
22660
- return ancestorID;
22661
- }
22662
- // Skip over the ancestor and the immediate separator. Traverse until we hit
22663
- // another separator or we reach the end of `destinationID`.
22664
- var start = ancestorID.length + SEPARATOR_LENGTH;
22665
- var i;
22666
- for (i = start; i < destinationID.length; i++) {
22667
- if (isBoundary(destinationID, i)) {
22668
- break;
22669
- }
22670
- }
22671
- return destinationID.substr(0, i);
22672
- }
22673
-
22674
- /**
22675
- * Gets the nearest common ancestor ID of two IDs.
22676
- *
22677
- * Using this ID scheme, the nearest common ancestor ID is the longest common
22678
- * prefix of the two IDs that immediately preceded a "marker" in both strings.
22679
- *
22680
- * @param {string} oneID
22681
- * @param {string} twoID
22682
- * @return {string} Nearest common ancestor ID, or the empty string if none.
22683
- * @private
22684
- */
22685
- function getFirstCommonAncestorID(oneID, twoID) {
22686
- var minLength = Math.min(oneID.length, twoID.length);
22687
- if (minLength === 0) {
22688
- return '';
22689
- }
22690
- var lastCommonMarkerIndex = 0;
22691
- // Use `<=` to traverse until the "EOL" of the shorter string.
22692
- for (var i = 0; i <= minLength; i++) {
22693
- if (isBoundary(oneID, i) && isBoundary(twoID, i)) {
22694
- lastCommonMarkerIndex = i;
22695
- } else if (oneID.charAt(i) !== twoID.charAt(i)) {
22696
- break;
22697
- }
22698
- }
22699
- var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);
22700
- !isValidID(longestCommonID) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s', oneID, twoID, longestCommonID) : invariant(false) : undefined;
22701
- return longestCommonID;
22702
- }
22703
-
22704
- /**
22705
- * Traverses the parent path between two IDs (either up or down). The IDs must
22706
- * not be the same, and there must exist a parent path between them. If the
22707
- * callback returns `false`, traversal is stopped.
22708
- *
22709
- * @param {?string} start ID at which to start traversal.
22710
- * @param {?string} stop ID at which to end traversal.
22711
- * @param {function} cb Callback to invoke each ID with.
22712
- * @param {*} arg Argument to invoke the callback with.
22713
- * @param {?boolean} skipFirst Whether or not to skip the first node.
22714
- * @param {?boolean} skipLast Whether or not to skip the last node.
22715
- * @private
22716
- */
22717
- function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
22718
- start = start || '';
22719
- stop = stop || '';
22720
- !(start !== stop) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.', start) : invariant(false) : undefined;
22721
- var traverseUp = isAncestorIDOf(stop, start);
22722
- !(traverseUp || isAncestorIDOf(start, stop)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' + 'not have a parent path.', start, stop) : invariant(false) : undefined;
22723
- // Traverse from `start` to `stop` one depth at a time.
22724
- var depth = 0;
22725
- var traverse = traverseUp ? getParentID : getNextDescendantID;
22726
- for (var id = start;; /* until break */id = traverse(id, stop)) {
22727
- var ret;
22728
- if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) {
22729
- ret = cb(id, traverseUp, arg);
22730
- }
22731
- if (ret === false || id === stop) {
22732
- // Only break //after// visiting `stop`.
22733
- break;
22734
- }
22735
- !(depth++ < MAX_TREE_DEPTH) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' + 'traversing the React DOM ID tree. This may be due to malformed IDs: %s', start, stop, id) : invariant(false) : undefined;
22736
- }
22737
- }
22738
-
22739
- /**
22740
- * Manages the IDs assigned to DOM representations of React components. This
22741
- * uses a specific scheme in order to traverse the DOM efficiently (e.g. in
22742
- * order to simulate events).
22743
- *
22744
- * @internal
22745
- */
22746
- var ReactInstanceHandles = {
22747
-
22748
- /**
22749
- * Constructs a React root ID
22750
- * @return {string} A React root ID.
22751
- */
22752
- createReactRootID: function () {
22753
- return getReactRootIDString(ReactRootIndex.createReactRootIndex());
22754
- },
22755
-
22756
- /**
22757
- * Constructs a React ID by joining a root ID with a name.
22758
- *
22759
- * @param {string} rootID Root ID of a parent component.
22760
- * @param {string} name A component's name (as flattened children).
22761
- * @return {string} A React ID.
22762
- * @internal
22763
- */
22764
- createReactID: function (rootID, name) {
22765
- return rootID + name;
22766
- },
22767
-
22768
- /**
22769
- * Gets the DOM ID of the React component that is the root of the tree that
22770
- * contains the React component with the supplied DOM ID.
22771
- *
22772
- * @param {string} id DOM ID of a React component.
22773
- * @return {?string} DOM ID of the React component that is the root.
22774
- * @internal
22775
- */
22776
- getReactRootIDFromNodeID: function (id) {
22777
- if (id && id.charAt(0) === SEPARATOR && id.length > 1) {
22778
- var index = id.indexOf(SEPARATOR, 1);
22779
- return index > -1 ? id.substr(0, index) : id;
22780
- }
22781
- return null;
22782
- },
22783
-
22784
- /**
22785
- * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
22786
- * should would receive a `mouseEnter` or `mouseLeave` event.
22787
- *
22788
- * NOTE: Does not invoke the callback on the nearest common ancestor because
22789
- * nothing "entered" or "left" that element.
22790
- *
22791
- * @param {string} leaveID ID being left.
22792
- * @param {string} enterID ID being entered.
22793
- * @param {function} cb Callback to invoke on each entered/left ID.
22794
- * @param {*} upArg Argument to invoke the callback with on left IDs.
22795
- * @param {*} downArg Argument to invoke the callback with on entered IDs.
22796
- * @internal
22797
- */
22798
- traverseEnterLeave: function (leaveID, enterID, cb, upArg, downArg) {
22799
- var ancestorID = getFirstCommonAncestorID(leaveID, enterID);
22800
- if (ancestorID !== leaveID) {
22801
- traverseParentPath(leaveID, ancestorID, cb, upArg, false, true);
22802
- }
22803
- if (ancestorID !== enterID) {
22804
- traverseParentPath(ancestorID, enterID, cb, downArg, true, false);
22805
- }
22806
- },
22807
-
22808
- /**
22809
- * Simulates the traversal of a two-phase, capture/bubble event dispatch.
22810
- *
22811
- * NOTE: This traversal happens on IDs without touching the DOM.
22812
- *
22813
- * @param {string} targetID ID of the target node.
22814
- * @param {function} cb Callback to invoke.
22815
- * @param {*} arg Argument to invoke the callback with.
22816
- * @internal
22817
- */
22818
- traverseTwoPhase: function (targetID, cb, arg) {
22819
- if (targetID) {
22820
- traverseParentPath('', targetID, cb, arg, true, false);
22821
- traverseParentPath(targetID, '', cb, arg, false, true);
22822
- }
22823
- },
22824
-
22825
- /**
22826
- * Same as `traverseTwoPhase` but skips the `targetID`.
22827
- */
22828
- traverseTwoPhaseSkipTarget: function (targetID, cb, arg) {
22829
- if (targetID) {
22830
- traverseParentPath('', targetID, cb, arg, true, true);
22831
- traverseParentPath(targetID, '', cb, arg, true, true);
22832
- }
22833
- },
22834
-
22835
- /**
22836
- * Traverse a node ID, calling the supplied `cb` for each ancestor ID. For
22837
- * example, passing `.0.$row-0.1` would result in `cb` getting called
22838
- * with `.0`, `.0.$row-0`, and `.0.$row-0.1`.
22839
- *
22840
- * NOTE: This traversal happens on IDs without touching the DOM.
22841
- *
22842
- * @param {string} targetID ID of the target node.
22843
- * @param {function} cb Callback to invoke.
22844
- * @param {*} arg Argument to invoke the callback with.
22845
- * @internal
22846
- */
22847
- traverseAncestors: function (targetID, cb, arg) {
22848
- traverseParentPath('', targetID, cb, arg, true, false);
22849
- },
22850
-
22851
- getFirstCommonAncestorID: getFirstCommonAncestorID,
22852
-
22853
- /**
22854
- * Exposed for unit testing.
22855
- * @private
22856
- */
22857
- _getNextDescendantID: getNextDescendantID,
22858
-
22859
- isAncestorIDOf: isAncestorIDOf,
22860
-
22861
- SEPARATOR: SEPARATOR
22862
-
22863
- };
22864
-
22865
- module.exports = ReactInstanceHandles;
22866
- }).call(this,require('_process'))
22867
-
22868
- },{"./ReactRootIndex":110,"_process":31,"fbjs/lib/invariant":18}],94:[function(require,module,exports){
22869
- /**
22870
- * Copyright 2013-2015, Facebook, Inc.
22871
- * All rights reserved.
22872
- *
22873
- * This source code is licensed under the BSD-style license found in the
22874
- * LICENSE file in the root directory of this source tree. An additional grant
22875
- * of patent rights can be found in the PATENTS file in the same directory.
22876
- *
22877
- * @providesModule ReactInstanceMap
22878
- */
22879
-
22880
- 'use strict';
22881
-
22882
- /**
22883
- * `ReactInstanceMap` maintains a mapping from a public facing stateful
22884
- * instance (key) and the internal representation (value). This allows public
22885
- * methods to accept the user facing instance as an argument and map them back
22886
- * to internal methods.
22887
- */
22888
-
22889
- // TODO: Replace this with ES6: var ReactInstanceMap = new Map();
22890
- var ReactInstanceMap = {
22891
-
22892
- /**
22893
- * This API should be called `delete` but we'd have to make sure to always
22894
- * transform these to strings for IE support. When this transform is fully
22895
- * supported we can rename it.
22896
- */
22897
- remove: function (key) {
22898
- key._reactInternalInstance = undefined;
22899
- },
22900
-
22901
- get: function (key) {
22902
- return key._reactInternalInstance;
22903
- },
22904
-
22905
- has: function (key) {
22906
- return key._reactInternalInstance !== undefined;
22907
- },
22908
-
22909
- set: function (key, value) {
22910
- key._reactInternalInstance = value;
22911
- }
22912
-
22913
- };
22914
-
22915
- module.exports = ReactInstanceMap;
22916
- },{}],95:[function(require,module,exports){
22917
- (function (process){
22918
- /**
22919
- * Copyright 2013-2015, Facebook, Inc.
22920
- * All rights reserved.
22921
- *
22922
- * This source code is licensed under the BSD-style license found in the
22923
- * LICENSE file in the root directory of this source tree. An additional grant
22924
- * of patent rights can be found in the PATENTS file in the same directory.
22925
- *
22926
- * @providesModule ReactIsomorphic
22927
- */
22928
-
22929
- 'use strict';
22930
-
22931
- var ReactChildren = require('./ReactChildren');
22932
- var ReactComponent = require('./ReactComponent');
22933
- var ReactClass = require('./ReactClass');
22934
- var ReactDOMFactories = require('./ReactDOMFactories');
22935
- var ReactElement = require('./ReactElement');
22936
- var ReactElementValidator = require('./ReactElementValidator');
22937
- var ReactPropTypes = require('./ReactPropTypes');
22938
- var ReactVersion = require('./ReactVersion');
22939
-
22940
- var assign = require('./Object.assign');
22941
- var onlyChild = require('./onlyChild');
22942
-
22943
- var createElement = ReactElement.createElement;
22944
- var createFactory = ReactElement.createFactory;
22945
- var cloneElement = ReactElement.cloneElement;
22946
-
22947
- if (process.env.NODE_ENV !== 'production') {
22948
- createElement = ReactElementValidator.createElement;
22949
- createFactory = ReactElementValidator.createFactory;
22950
- cloneElement = ReactElementValidator.cloneElement;
22951
- }
22952
-
22953
- var React = {
22954
-
22955
- // Modern
22956
-
22957
- Children: {
22958
- map: ReactChildren.map,
22959
- forEach: ReactChildren.forEach,
22960
- count: ReactChildren.count,
22961
- toArray: ReactChildren.toArray,
22962
- only: onlyChild
22963
- },
22964
-
22965
- Component: ReactComponent,
22966
-
22967
- createElement: createElement,
22968
- cloneElement: cloneElement,
22969
- isValidElement: ReactElement.isValidElement,
22970
-
22971
- // Classic
22972
-
22973
- PropTypes: ReactPropTypes,
22974
- createClass: ReactClass.createClass,
22975
- createFactory: createFactory,
22976
- createMixin: function (mixin) {
22977
- // Currently a noop. Will be used to validate and trace mixins.
22978
- return mixin;
22979
- },
22980
-
22981
- // This looks DOM specific but these are actually isomorphic helpers
22982
- // since they are just generating DOM strings.
22983
- DOM: ReactDOMFactories,
22984
-
22985
- version: ReactVersion,
22986
-
22987
- // Hook for JSX spread, don't use this for anything else.
22988
- __spread: assign
22989
- };
22990
-
22991
- module.exports = React;
22992
- }).call(this,require('_process'))
22993
-
22994
- },{"./Object.assign":54,"./ReactChildren":60,"./ReactClass":61,"./ReactComponent":62,"./ReactDOMFactories":70,"./ReactElement":84,"./ReactElementValidator":85,"./ReactPropTypes":106,"./ReactVersion":116,"./onlyChild":153,"_process":31}],96:[function(require,module,exports){
22995
- /**
22996
- * Copyright 2013-2015, Facebook, Inc.
22997
- * All rights reserved.
22998
- *
22999
- * This source code is licensed under the BSD-style license found in the
23000
- * LICENSE file in the root directory of this source tree. An additional grant
23001
- * of patent rights can be found in the PATENTS file in the same directory.
23002
- *
23003
- * @providesModule ReactMarkupChecksum
23004
- */
23005
-
23006
- 'use strict';
23007
-
23008
- var adler32 = require('./adler32');
23009
-
23010
- var TAG_END = /\/?>/;
23011
-
23012
- var ReactMarkupChecksum = {
23013
- CHECKSUM_ATTR_NAME: 'data-react-checksum',
23014
-
23015
- /**
23016
- * @param {string} markup Markup string
23017
- * @return {string} Markup string with checksum attribute attached
23018
- */
23019
- addChecksumToMarkup: function (markup) {
23020
- var checksum = adler32(markup);
23021
-
23022
- // Add checksum (handle both parent tags and self-closing tags)
23023
- return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&');
23024
- },
23025
-
23026
- /**
23027
- * @param {string} markup to use
23028
- * @param {DOMElement} element root React element
23029
- * @returns {boolean} whether or not the markup is the same
23030
- */
23031
- canReuseMarkup: function (markup, element) {
23032
- var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
23033
- existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
23034
- var markupChecksum = adler32(markup);
23035
- return markupChecksum === existingChecksum;
23036
- }
23037
- };
23038
-
23039
- module.exports = ReactMarkupChecksum;
23040
- },{"./adler32":135}],97:[function(require,module,exports){
23041
- (function (process){
23042
- /**
23043
- * Copyright 2013-2015, Facebook, Inc.
23044
- * All rights reserved.
23045
- *
23046
- * This source code is licensed under the BSD-style license found in the
23047
- * LICENSE file in the root directory of this source tree. An additional grant
23048
- * of patent rights can be found in the PATENTS file in the same directory.
23049
- *
23050
- * @providesModule ReactMount
23051
- */
23052
-
23053
- 'use strict';
23054
-
23055
- var DOMProperty = require('./DOMProperty');
23056
- var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
23057
- var ReactCurrentOwner = require('./ReactCurrentOwner');
23058
- var ReactDOMFeatureFlags = require('./ReactDOMFeatureFlags');
23059
- var ReactElement = require('./ReactElement');
23060
- var ReactEmptyComponentRegistry = require('./ReactEmptyComponentRegistry');
23061
- var ReactInstanceHandles = require('./ReactInstanceHandles');
23062
- var ReactInstanceMap = require('./ReactInstanceMap');
23063
- var ReactMarkupChecksum = require('./ReactMarkupChecksum');
23064
- var ReactPerf = require('./ReactPerf');
23065
- var ReactReconciler = require('./ReactReconciler');
23066
- var ReactUpdateQueue = require('./ReactUpdateQueue');
23067
- var ReactUpdates = require('./ReactUpdates');
23068
-
23069
- var assign = require('./Object.assign');
23070
- var emptyObject = require('fbjs/lib/emptyObject');
23071
- var containsNode = require('fbjs/lib/containsNode');
23072
- var instantiateReactComponent = require('./instantiateReactComponent');
23073
- var invariant = require('fbjs/lib/invariant');
23074
- var setInnerHTML = require('./setInnerHTML');
23075
- var shouldUpdateReactComponent = require('./shouldUpdateReactComponent');
23076
- var validateDOMNesting = require('./validateDOMNesting');
23077
- var warning = require('fbjs/lib/warning');
23078
-
23079
- var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
23080
- var nodeCache = {};
23081
-
23082
- var ELEMENT_NODE_TYPE = 1;
23083
- var DOC_NODE_TYPE = 9;
23084
- var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
23085
-
23086
- var ownerDocumentContextKey = '__ReactMount_ownerDocument$' + Math.random().toString(36).slice(2);
23087
-
23088
- /** Mapping from reactRootID to React component instance. */
23089
- var instancesByReactRootID = {};
23090
-
23091
- /** Mapping from reactRootID to `container` nodes. */
23092
- var containersByReactRootID = {};
23093
-
23094
- if (process.env.NODE_ENV !== 'production') {
23095
- /** __DEV__-only mapping from reactRootID to root elements. */
23096
- var rootElementsByReactRootID = {};
23097
- }
23098
-
23099
- // Used to store breadth-first search state in findComponentRoot.
23100
- var findComponentRootReusableArray = [];
23101
-
23102
- /**
23103
- * Finds the index of the first character
23104
- * that's not common between the two given strings.
23105
- *
23106
- * @return {number} the index of the character where the strings diverge
23107
- */
23108
- function firstDifferenceIndex(string1, string2) {
23109
- var minLen = Math.min(string1.length, string2.length);
23110
- for (var i = 0; i < minLen; i++) {
23111
- if (string1.charAt(i) !== string2.charAt(i)) {
23112
- return i;
23113
- }
23114
- }
23115
- return string1.length === string2.length ? -1 : minLen;
23116
- }
23117
-
23118
- /**
23119
- * @param {DOMElement|DOMDocument} container DOM element that may contain
23120
- * a React component
23121
- * @return {?*} DOM element that may have the reactRoot ID, or null.
23122
- */
23123
- function getReactRootElementInContainer(container) {
23124
- if (!container) {
23125
- return null;
23126
- }
23127
-
23128
- if (container.nodeType === DOC_NODE_TYPE) {
23129
- return container.documentElement;
23130
- } else {
23131
- return container.firstChild;
23132
- }
23133
- }
23134
-
23135
- /**
23136
- * @param {DOMElement} container DOM element that may contain a React component.
23137
- * @return {?string} A "reactRoot" ID, if a React component is rendered.
23138
- */
23139
- function getReactRootID(container) {
23140
- var rootElement = getReactRootElementInContainer(container);
23141
- return rootElement && ReactMount.getID(rootElement);
23142
- }
23143
-
23144
- /**
23145
- * Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form
23146
- * element can return its control whose name or ID equals ATTR_NAME. All
23147
- * DOM nodes support `getAttributeNode` but this can also get called on
23148
- * other objects so just return '' if we're given something other than a
23149
- * DOM node (such as window).
23150
- *
23151
- * @param {?DOMElement|DOMWindow|DOMDocument|DOMTextNode} node DOM node.
23152
- * @return {string} ID of the supplied `domNode`.
23153
- */
23154
- function getID(node) {
23155
- var id = internalGetID(node);
23156
- if (id) {
23157
- if (nodeCache.hasOwnProperty(id)) {
23158
- var cached = nodeCache[id];
23159
- if (cached !== node) {
23160
- !!isValid(cached, id) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactMount: Two valid but unequal nodes with the same `%s`: %s', ATTR_NAME, id) : invariant(false) : undefined;
23161
-
23162
- nodeCache[id] = node;
23163
- }
23164
- } else {
23165
- nodeCache[id] = node;
23166
- }
23167
- }
23168
-
23169
- return id;
23170
- }
23171
-
23172
- function internalGetID(node) {
23173
- // If node is something like a window, document, or text node, none of
23174
- // which support attributes or a .getAttribute method, gracefully return
23175
- // the empty string, as if the attribute were missing.
23176
- return node && node.getAttribute && node.getAttribute(ATTR_NAME) || '';
23177
- }
23178
-
23179
- /**
23180
- * Sets the React-specific ID of the given node.
23181
- *
23182
- * @param {DOMElement} node The DOM node whose ID will be set.
23183
- * @param {string} id The value of the ID attribute.
23184
- */
23185
- function setID(node, id) {
23186
- var oldID = internalGetID(node);
23187
- if (oldID !== id) {
23188
- delete nodeCache[oldID];
23189
- }
23190
- node.setAttribute(ATTR_NAME, id);
23191
- nodeCache[id] = node;
23192
- }
23193
-
23194
- /**
23195
- * Finds the node with the supplied React-generated DOM ID.
23196
- *
23197
- * @param {string} id A React-generated DOM ID.
23198
- * @return {DOMElement} DOM node with the suppled `id`.
23199
- * @internal
23200
- */
23201
- function getNode(id) {
23202
- if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
23203
- nodeCache[id] = ReactMount.findReactNodeByID(id);
23204
- }
23205
- return nodeCache[id];
23206
- }
23207
-
23208
- /**
23209
- * Finds the node with the supplied public React instance.
23210
- *
23211
- * @param {*} instance A public React instance.
23212
- * @return {?DOMElement} DOM node with the suppled `id`.
23213
- * @internal
23214
- */
23215
- function getNodeFromInstance(instance) {
23216
- var id = ReactInstanceMap.get(instance)._rootNodeID;
23217
- if (ReactEmptyComponentRegistry.isNullComponentID(id)) {
23218
- return null;
23219
- }
23220
- if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
23221
- nodeCache[id] = ReactMount.findReactNodeByID(id);
23222
- }
23223
- return nodeCache[id];
23224
- }
23225
-
23226
- /**
23227
- * A node is "valid" if it is contained by a currently mounted container.
23228
- *
23229
- * This means that the node does not have to be contained by a document in
23230
- * order to be considered valid.
23231
- *
23232
- * @param {?DOMElement} node The candidate DOM node.
23233
- * @param {string} id The expected ID of the node.
23234
- * @return {boolean} Whether the node is contained by a mounted container.
23235
- */
23236
- function isValid(node, id) {
23237
- if (node) {
23238
- !(internalGetID(node) === id) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactMount: Unexpected modification of `%s`', ATTR_NAME) : invariant(false) : undefined;
23239
-
23240
- var container = ReactMount.findReactContainerForID(id);
23241
- if (container && containsNode(container, node)) {
23242
- return true;
23243
- }
23244
- }
23245
-
23246
- return false;
23247
- }
23248
-
23249
- /**
23250
- * Causes the cache to forget about one React-specific ID.
23251
- *
23252
- * @param {string} id The ID to forget.
23253
- */
23254
- function purgeID(id) {
23255
- delete nodeCache[id];
23256
- }
23257
-
23258
- var deepestNodeSoFar = null;
23259
- function findDeepestCachedAncestorImpl(ancestorID) {
23260
- var ancestor = nodeCache[ancestorID];
23261
- if (ancestor && isValid(ancestor, ancestorID)) {
23262
- deepestNodeSoFar = ancestor;
23263
- } else {
23264
- // This node isn't populated in the cache, so presumably none of its
23265
- // descendants are. Break out of the loop.
23266
- return false;
23267
- }
23268
- }
23269
-
23270
- /**
23271
- * Return the deepest cached node whose ID is a prefix of `targetID`.
23272
- */
23273
- function findDeepestCachedAncestor(targetID) {
23274
- deepestNodeSoFar = null;
23275
- ReactInstanceHandles.traverseAncestors(targetID, findDeepestCachedAncestorImpl);
23276
-
23277
- var foundNode = deepestNodeSoFar;
23278
- deepestNodeSoFar = null;
23279
- return foundNode;
23280
- }
23281
-
23282
- /**
23283
- * Mounts this component and inserts it into the DOM.
23284
- *
23285
- * @param {ReactComponent} componentInstance The instance to mount.
23286
- * @param {string} rootID DOM ID of the root node.
23287
- * @param {DOMElement} container DOM element to mount into.
23288
- * @param {ReactReconcileTransaction} transaction
23289
- * @param {boolean} shouldReuseMarkup If true, do not insert markup
23290
- */
23291
- function mountComponentIntoNode(componentInstance, rootID, container, transaction, shouldReuseMarkup, context) {
23292
- if (ReactDOMFeatureFlags.useCreateElement) {
23293
- context = assign({}, context);
23294
- if (container.nodeType === DOC_NODE_TYPE) {
23295
- context[ownerDocumentContextKey] = container;
23296
- } else {
23297
- context[ownerDocumentContextKey] = container.ownerDocument;
23298
- }
23299
- }
23300
- if (process.env.NODE_ENV !== 'production') {
23301
- if (context === emptyObject) {
23302
- context = {};
23303
- }
23304
- var tag = container.nodeName.toLowerCase();
23305
- context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(null, tag, null);
23306
- }
23307
- var markup = ReactReconciler.mountComponent(componentInstance, rootID, transaction, context);
23308
- componentInstance._renderedComponent._topLevelWrapper = componentInstance;
23309
- ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup, transaction);
23310
- }
23311
-
23312
- /**
23313
- * Batched mount.
23314
- *
23315
- * @param {ReactComponent} componentInstance The instance to mount.
23316
- * @param {string} rootID DOM ID of the root node.
23317
- * @param {DOMElement} container DOM element to mount into.
23318
- * @param {boolean} shouldReuseMarkup If true, do not insert markup
23319
- */
23320
- function batchedMountComponentIntoNode(componentInstance, rootID, container, shouldReuseMarkup, context) {
23321
- var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(
23322
- /* forceHTML */shouldReuseMarkup);
23323
- transaction.perform(mountComponentIntoNode, null, componentInstance, rootID, container, transaction, shouldReuseMarkup, context);
23324
- ReactUpdates.ReactReconcileTransaction.release(transaction);
23325
- }
23326
-
23327
- /**
23328
- * Unmounts a component and removes it from the DOM.
23329
- *
23330
- * @param {ReactComponent} instance React component instance.
23331
- * @param {DOMElement} container DOM element to unmount from.
23332
- * @final
23333
- * @internal
23334
- * @see {ReactMount.unmountComponentAtNode}
23335
- */
23336
- function unmountComponentFromNode(instance, container) {
23337
- ReactReconciler.unmountComponent(instance);
23338
-
23339
- if (container.nodeType === DOC_NODE_TYPE) {
23340
- container = container.documentElement;
23341
- }
23342
-
23343
- // http://jsperf.com/emptying-a-node
23344
- while (container.lastChild) {
23345
- container.removeChild(container.lastChild);
23346
- }
23347
- }
23348
-
23349
- /**
23350
- * True if the supplied DOM node has a direct React-rendered child that is
23351
- * not a React root element. Useful for warning in `render`,
23352
- * `unmountComponentAtNode`, etc.
23353
- *
23354
- * @param {?DOMElement} node The candidate DOM node.
23355
- * @return {boolean} True if the DOM element contains a direct child that was
23356
- * rendered by React but is not a root element.
23357
- * @internal
23358
- */
23359
- function hasNonRootReactChild(node) {
23360
- var reactRootID = getReactRootID(node);
23361
- return reactRootID ? reactRootID !== ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID) : false;
23362
- }
23363
-
23364
- /**
23365
- * Returns the first (deepest) ancestor of a node which is rendered by this copy
23366
- * of React.
23367
- */
23368
- function findFirstReactDOMImpl(node) {
23369
- // This node might be from another React instance, so we make sure not to
23370
- // examine the node cache here
23371
- for (; node && node.parentNode !== node; node = node.parentNode) {
23372
- if (node.nodeType !== 1) {
23373
- // Not a DOMElement, therefore not a React component
23374
- continue;
23375
- }
23376
- var nodeID = internalGetID(node);
23377
- if (!nodeID) {
23378
- continue;
23379
- }
23380
- var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
23381
-
23382
- // If containersByReactRootID contains the container we find by crawling up
23383
- // the tree, we know that this instance of React rendered the node.
23384
- // nb. isValid's strategy (with containsNode) does not work because render
23385
- // trees may be nested and we don't want a false positive in that case.
23386
- var current = node;
23387
- var lastID;
23388
- do {
23389
- lastID = internalGetID(current);
23390
- current = current.parentNode;
23391
- if (current == null) {
23392
- // The passed-in node has been detached from the container it was
23393
- // originally rendered into.
23394
- return null;
23395
- }
23396
- } while (lastID !== reactRootID);
23397
-
23398
- if (current === containersByReactRootID[reactRootID]) {
23399
- return node;
23400
- }
23401
- }
23402
- return null;
23403
- }
23404
-
23405
- /**
23406
- * Temporary (?) hack so that we can store all top-level pending updates on
23407
- * composites instead of having to worry about different types of components
23408
- * here.
23409
- */
23410
- var TopLevelWrapper = function () {};
23411
- TopLevelWrapper.prototype.isReactComponent = {};
23412
- if (process.env.NODE_ENV !== 'production') {
23413
- TopLevelWrapper.displayName = 'TopLevelWrapper';
23414
- }
23415
- TopLevelWrapper.prototype.render = function () {
23416
- // this.props is actually a ReactElement
23417
- return this.props;
23418
- };
23419
-
23420
- /**
23421
- * Mounting is the process of initializing a React component by creating its
23422
- * representative DOM elements and inserting them into a supplied `container`.
23423
- * Any prior content inside `container` is destroyed in the process.
23424
- *
23425
- * ReactMount.render(
23426
- * component,
23427
- * document.getElementById('container')
23428
- * );
23429
- *
23430
- * <div id="container"> <-- Supplied `container`.
23431
- * <div data-reactid=".3"> <-- Rendered reactRoot of React
23432
- * // ... component.
23433
- * </div>
23434
- * </div>
23435
- *
23436
- * Inside of `container`, the first element rendered is the "reactRoot".
23437
- */
23438
- var ReactMount = {
23439
-
23440
- TopLevelWrapper: TopLevelWrapper,
23441
-
23442
- /** Exposed for debugging purposes **/
23443
- _instancesByReactRootID: instancesByReactRootID,
23444
-
23445
- /**
23446
- * This is a hook provided to support rendering React components while
23447
- * ensuring that the apparent scroll position of its `container` does not
23448
- * change.
23449
- *
23450
- * @param {DOMElement} container The `container` being rendered into.
23451
- * @param {function} renderCallback This must be called once to do the render.
23452
- */
23453
- scrollMonitor: function (container, renderCallback) {
23454
- renderCallback();
23455
- },
23456
-
23457
- /**
23458
- * Take a component that's already mounted into the DOM and replace its props
23459
- * @param {ReactComponent} prevComponent component instance already in the DOM
23460
- * @param {ReactElement} nextElement component instance to render
23461
- * @param {DOMElement} container container to render into
23462
- * @param {?function} callback function triggered on completion
23463
- */
23464
- _updateRootComponent: function (prevComponent, nextElement, container, callback) {
23465
- ReactMount.scrollMonitor(container, function () {
23466
- ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement);
23467
- if (callback) {
23468
- ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
23469
- }
23470
- });
23471
-
23472
- if (process.env.NODE_ENV !== 'production') {
23473
- // Record the root element in case it later gets transplanted.
23474
- rootElementsByReactRootID[getReactRootID(container)] = getReactRootElementInContainer(container);
23475
- }
23476
-
23477
- return prevComponent;
23478
- },
23479
-
23480
- /**
23481
- * Register a component into the instance map and starts scroll value
23482
- * monitoring
23483
- * @param {ReactComponent} nextComponent component instance to render
23484
- * @param {DOMElement} container container to render into
23485
- * @return {string} reactRoot ID prefix
23486
- */
23487
- _registerComponent: function (nextComponent, container) {
23488
- !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : invariant(false) : undefined;
23489
-
23490
- ReactBrowserEventEmitter.ensureScrollValueMonitoring();
23491
-
23492
- var reactRootID = ReactMount.registerContainer(container);
23493
- instancesByReactRootID[reactRootID] = nextComponent;
23494
- return reactRootID;
23495
- },
23496
-
23497
- /**
23498
- * Render a new component into the DOM.
23499
- * @param {ReactElement} nextElement element to render
23500
- * @param {DOMElement} container container to render into
23501
- * @param {boolean} shouldReuseMarkup if we should skip the markup insertion
23502
- * @return {ReactComponent} nextComponent
23503
- */
23504
- _renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) {
23505
- // Various parts of our code (such as ReactCompositeComponent's
23506
- // _renderValidatedComponent) assume that calls to render aren't nested;
23507
- // verify that that's the case.
23508
- process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined;
23509
-
23510
- var componentInstance = instantiateReactComponent(nextElement, null);
23511
- var reactRootID = ReactMount._registerComponent(componentInstance, container);
23512
-
23513
- // The initial render is synchronous but any updates that happen during
23514
- // rendering, in componentWillMount or componentDidMount, will be batched
23515
- // according to the current batching strategy.
23516
-
23517
- ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, reactRootID, container, shouldReuseMarkup, context);
23518
-
23519
- if (process.env.NODE_ENV !== 'production') {
23520
- // Record the root element in case it later gets transplanted.
23521
- rootElementsByReactRootID[reactRootID] = getReactRootElementInContainer(container);
23522
- }
23523
-
23524
- return componentInstance;
23525
- },
23526
-
23527
- /**
23528
- * Renders a React component into the DOM in the supplied `container`.
23529
- *
23530
- * If the React component was previously rendered into `container`, this will
23531
- * perform an update on it and only mutate the DOM as necessary to reflect the
23532
- * latest React component.
23533
- *
23534
- * @param {ReactComponent} parentComponent The conceptual parent of this render tree.
23535
- * @param {ReactElement} nextElement Component element to render.
23536
- * @param {DOMElement} container DOM element to render into.
23537
- * @param {?function} callback function triggered on completion
23538
- * @return {ReactComponent} Component instance rendered in `container`.
23539
- */
23540
- renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
23541
- !(parentComponent != null && parentComponent._reactInternalInstance != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : invariant(false) : undefined;
23542
- return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback);
23543
- },
23544
-
23545
- _renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
23546
- !ReactElement.isValidElement(nextElement) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing an element string, make sure to instantiate ' + 'it by passing it to React.createElement.' : typeof nextElement === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' :
23547
- // Check if it quacks like an element
23548
- nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : invariant(false) : undefined;
23549
-
23550
- process.env.NODE_ENV !== 'production' ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : undefined;
23551
-
23552
- var nextWrappedElement = new ReactElement(TopLevelWrapper, null, null, null, null, null, nextElement);
23553
-
23554
- var prevComponent = instancesByReactRootID[getReactRootID(container)];
23555
-
23556
- if (prevComponent) {
23557
- var prevWrappedElement = prevComponent._currentElement;
23558
- var prevElement = prevWrappedElement.props;
23559
- if (shouldUpdateReactComponent(prevElement, nextElement)) {
23560
- var publicInst = prevComponent._renderedComponent.getPublicInstance();
23561
- var updatedCallback = callback && function () {
23562
- callback.call(publicInst);
23563
- };
23564
- ReactMount._updateRootComponent(prevComponent, nextWrappedElement, container, updatedCallback);
23565
- return publicInst;
23566
- } else {
23567
- ReactMount.unmountComponentAtNode(container);
23568
- }
23569
- }
23570
-
23571
- var reactRootElement = getReactRootElementInContainer(container);
23572
- var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement);
23573
- var containerHasNonRootReactChild = hasNonRootReactChild(container);
23574
-
23575
- if (process.env.NODE_ENV !== 'production') {
23576
- process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : undefined;
23577
-
23578
- if (!containerHasReactMarkup || reactRootElement.nextSibling) {
23579
- var rootElementSibling = reactRootElement;
23580
- while (rootElementSibling) {
23581
- if (internalGetID(rootElementSibling)) {
23582
- process.env.NODE_ENV !== 'production' ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') : undefined;
23583
- break;
23584
- }
23585
- rootElementSibling = rootElementSibling.nextSibling;
23586
- }
23587
- }
23588
- }
23589
-
23590
- var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild;
23591
- var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, parentComponent != null ? parentComponent._reactInternalInstance._processChildContext(parentComponent._reactInternalInstance._context) : emptyObject)._renderedComponent.getPublicInstance();
23592
- if (callback) {
23593
- callback.call(component);
23594
- }
23595
- return component;
23596
- },
23597
-
23598
- /**
23599
- * Renders a React component into the DOM in the supplied `container`.
23600
- *
23601
- * If the React component was previously rendered into `container`, this will
23602
- * perform an update on it and only mutate the DOM as necessary to reflect the
23603
- * latest React component.
23604
- *
23605
- * @param {ReactElement} nextElement Component element to render.
23606
- * @param {DOMElement} container DOM element to render into.
23607
- * @param {?function} callback function triggered on completion
23608
- * @return {ReactComponent} Component instance rendered in `container`.
23609
- */
23610
- render: function (nextElement, container, callback) {
23611
- return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback);
23612
- },
23613
-
23614
- /**
23615
- * Registers a container node into which React components will be rendered.
23616
- * This also creates the "reactRoot" ID that will be assigned to the element
23617
- * rendered within.
23618
- *
23619
- * @param {DOMElement} container DOM element to register as a container.
23620
- * @return {string} The "reactRoot" ID of elements rendered within.
23621
- */
23622
- registerContainer: function (container) {
23623
- var reactRootID = getReactRootID(container);
23624
- if (reactRootID) {
23625
- // If one exists, make sure it is a valid "reactRoot" ID.
23626
- reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID);
23627
- }
23628
- if (!reactRootID) {
23629
- // No valid "reactRoot" ID found, create one.
23630
- reactRootID = ReactInstanceHandles.createReactRootID();
23631
- }
23632
- containersByReactRootID[reactRootID] = container;
23633
- return reactRootID;
23634
- },
23635
-
23636
- /**
23637
- * Unmounts and destroys the React component rendered in the `container`.
23638
- *
23639
- * @param {DOMElement} container DOM element containing a React component.
23640
- * @return {boolean} True if a component was found in and unmounted from
23641
- * `container`
23642
- */
23643
- unmountComponentAtNode: function (container) {
23644
- // Various parts of our code (such as ReactCompositeComponent's
23645
- // _renderValidatedComponent) assume that calls to render aren't nested;
23646
- // verify that that's the case. (Strictly speaking, unmounting won't cause a
23647
- // render but we still don't expect to be in a render call here.)
23648
- process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined;
23649
-
23650
- !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : invariant(false) : undefined;
23651
-
23652
- var reactRootID = getReactRootID(container);
23653
- var component = instancesByReactRootID[reactRootID];
23654
- if (!component) {
23655
- // Check if the node being unmounted was rendered by React, but isn't a
23656
- // root node.
23657
- var containerHasNonRootReactChild = hasNonRootReactChild(container);
23658
-
23659
- // Check if the container itself is a React root node.
23660
- var containerID = internalGetID(container);
23661
- var isContainerReactRoot = containerID && containerID === ReactInstanceHandles.getReactRootIDFromNodeID(containerID);
23662
-
23663
- if (process.env.NODE_ENV !== 'production') {
23664
- process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : undefined;
23665
- }
23666
-
23667
- return false;
23668
- }
23669
- ReactUpdates.batchedUpdates(unmountComponentFromNode, component, container);
23670
- delete instancesByReactRootID[reactRootID];
23671
- delete containersByReactRootID[reactRootID];
23672
- if (process.env.NODE_ENV !== 'production') {
23673
- delete rootElementsByReactRootID[reactRootID];
23674
- }
23675
- return true;
23676
- },
23677
-
23678
- /**
23679
- * Finds the container DOM element that contains React component to which the
23680
- * supplied DOM `id` belongs.
23681
- *
23682
- * @param {string} id The ID of an element rendered by a React component.
23683
- * @return {?DOMElement} DOM element that contains the `id`.
23684
- */
23685
- findReactContainerForID: function (id) {
23686
- var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);
23687
- var container = containersByReactRootID[reactRootID];
23688
-
23689
- if (process.env.NODE_ENV !== 'production') {
23690
- var rootElement = rootElementsByReactRootID[reactRootID];
23691
- if (rootElement && rootElement.parentNode !== container) {
23692
- process.env.NODE_ENV !== 'production' ? warning(
23693
- // Call internalGetID here because getID calls isValid which calls
23694
- // findReactContainerForID (this function).
23695
- internalGetID(rootElement) === reactRootID, 'ReactMount: Root element ID differed from reactRootID.') : undefined;
23696
- var containerChild = container.firstChild;
23697
- if (containerChild && reactRootID === internalGetID(containerChild)) {
23698
- // If the container has a new child with the same ID as the old
23699
- // root element, then rootElementsByReactRootID[reactRootID] is
23700
- // just stale and needs to be updated. The case that deserves a
23701
- // warning is when the container is empty.
23702
- rootElementsByReactRootID[reactRootID] = containerChild;
23703
- } else {
23704
- process.env.NODE_ENV !== 'production' ? warning(false, 'ReactMount: Root element has been removed from its original ' + 'container. New container: %s', rootElement.parentNode) : undefined;
23705
- }
23706
- }
23707
- }
23708
-
23709
- return container;
23710
- },
23711
-
23712
- /**
23713
- * Finds an element rendered by React with the supplied ID.
23714
- *
23715
- * @param {string} id ID of a DOM node in the React component.
23716
- * @return {DOMElement} Root DOM node of the React component.
23717
- */
23718
- findReactNodeByID: function (id) {
23719
- var reactRoot = ReactMount.findReactContainerForID(id);
23720
- return ReactMount.findComponentRoot(reactRoot, id);
23721
- },
23722
-
23723
- /**
23724
- * Traverses up the ancestors of the supplied node to find a node that is a
23725
- * DOM representation of a React component rendered by this copy of React.
23726
- *
23727
- * @param {*} node
23728
- * @return {?DOMEventTarget}
23729
- * @internal
23730
- */
23731
- getFirstReactDOM: function (node) {
23732
- return findFirstReactDOMImpl(node);
23733
- },
23734
-
23735
- /**
23736
- * Finds a node with the supplied `targetID` inside of the supplied
23737
- * `ancestorNode`. Exploits the ID naming scheme to perform the search
23738
- * quickly.
23739
- *
23740
- * @param {DOMEventTarget} ancestorNode Search from this root.
23741
- * @pararm {string} targetID ID of the DOM representation of the component.
23742
- * @return {DOMEventTarget} DOM node with the supplied `targetID`.
23743
- * @internal
23744
- */
23745
- findComponentRoot: function (ancestorNode, targetID) {
23746
- var firstChildren = findComponentRootReusableArray;
23747
- var childIndex = 0;
23748
-
23749
- var deepestAncestor = findDeepestCachedAncestor(targetID) || ancestorNode;
23750
-
23751
- if (process.env.NODE_ENV !== 'production') {
23752
- // This will throw on the next line; give an early warning
23753
- process.env.NODE_ENV !== 'production' ? warning(deepestAncestor != null, 'React can\'t find the root component node for data-reactid value ' + '`%s`. If you\'re seeing this message, it probably means that ' + 'you\'ve loaded two copies of React on the page. At this time, only ' + 'a single copy of React can be loaded at a time.', targetID) : undefined;
23754
- }
23755
-
23756
- firstChildren[0] = deepestAncestor.firstChild;
23757
- firstChildren.length = 1;
23758
-
23759
- while (childIndex < firstChildren.length) {
23760
- var child = firstChildren[childIndex++];
23761
- var targetChild;
23762
-
23763
- while (child) {
23764
- var childID = ReactMount.getID(child);
23765
- if (childID) {
23766
- // Even if we find the node we're looking for, we finish looping
23767
- // through its siblings to ensure they're cached so that we don't have
23768
- // to revisit this node again. Otherwise, we make n^2 calls to getID
23769
- // when visiting the many children of a single node in order.
23770
-
23771
- if (targetID === childID) {
23772
- targetChild = child;
23773
- } else if (ReactInstanceHandles.isAncestorIDOf(childID, targetID)) {
23774
- // If we find a child whose ID is an ancestor of the given ID,
23775
- // then we can be sure that we only want to search the subtree
23776
- // rooted at this child, so we can throw out the rest of the
23777
- // search state.
23778
- firstChildren.length = childIndex = 0;
23779
- firstChildren.push(child.firstChild);
23780
- }
23781
- } else {
23782
- // If this child had no ID, then there's a chance that it was
23783
- // injected automatically by the browser, as when a `<table>`
23784
- // element sprouts an extra `<tbody>` child as a side effect of
23785
- // `.innerHTML` parsing. Optimistically continue down this
23786
- // branch, but not before examining the other siblings.
23787
- firstChildren.push(child.firstChild);
23788
- }
23789
-
23790
- child = child.nextSibling;
23791
- }
23792
-
23793
- if (targetChild) {
23794
- // Emptying firstChildren/findComponentRootReusableArray is
23795
- // not necessary for correctness, but it helps the GC reclaim
23796
- // any nodes that were left at the end of the search.
23797
- firstChildren.length = 0;
23798
-
23799
- return targetChild;
23800
- }
23801
- }
23802
-
23803
- firstChildren.length = 0;
23804
-
23805
- !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findComponentRoot(..., %s): Unable to find element. This probably ' + 'means the DOM was unexpectedly mutated (e.g., by the browser), ' + 'usually due to forgetting a <tbody> when using tables, nesting tags ' + 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' + 'parent. ' + 'Try inspecting the child nodes of the element with React ID `%s`.', targetID, ReactMount.getID(ancestorNode)) : invariant(false) : undefined;
23806
- },
23807
-
23808
- _mountImageIntoNode: function (markup, container, shouldReuseMarkup, transaction) {
23809
- !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : invariant(false) : undefined;
23810
-
23811
- if (shouldReuseMarkup) {
23812
- var rootElement = getReactRootElementInContainer(container);
23813
- if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {
23814
- return;
23815
- } else {
23816
- var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
23817
- rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
23818
-
23819
- var rootMarkup = rootElement.outerHTML;
23820
- rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum);
23821
-
23822
- var normalizedMarkup = markup;
23823
- if (process.env.NODE_ENV !== 'production') {
23824
- // because rootMarkup is retrieved from the DOM, various normalizations
23825
- // will have occurred which will not be present in `markup`. Here,
23826
- // insert markup into a <div> or <iframe> depending on the container
23827
- // type to perform the same normalizations before comparing.
23828
- var normalizer;
23829
- if (container.nodeType === ELEMENT_NODE_TYPE) {
23830
- normalizer = document.createElement('div');
23831
- normalizer.innerHTML = markup;
23832
- normalizedMarkup = normalizer.innerHTML;
23833
- } else {
23834
- normalizer = document.createElement('iframe');
23835
- document.body.appendChild(normalizer);
23836
- normalizer.contentDocument.write(markup);
23837
- normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML;
23838
- document.body.removeChild(normalizer);
23839
- }
23840
- }
23841
-
23842
- var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup);
23843
- var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
23844
-
23845
- !(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document using ' + 'server rendering but the checksum was invalid. This usually ' + 'means you rendered a different component type or props on ' + 'the client from the one on the server, or your render() ' + 'methods are impure. React cannot handle this case due to ' + 'cross-browser quirks by rendering at the document root. You ' + 'should look for environment dependent code in your components ' + 'and ensure the props are the same client and server side:\n%s', difference) : invariant(false) : undefined;
23846
-
23847
- if (process.env.NODE_ENV !== 'production') {
23848
- process.env.NODE_ENV !== 'production' ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : undefined;
23849
- }
23850
- }
23851
- }
23852
-
23853
- !(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document but ' + 'you didn\'t use server rendering. We can\'t do this ' + 'without using server rendering due to cross-browser quirks. ' + 'See ReactDOMServer.renderToString() for server rendering.') : invariant(false) : undefined;
23854
-
23855
- if (transaction.useCreateElement) {
23856
- while (container.lastChild) {
23857
- container.removeChild(container.lastChild);
23858
- }
23859
- container.appendChild(markup);
23860
- } else {
23861
- setInnerHTML(container, markup);
23862
- }
23863
- },
23864
-
23865
- ownerDocumentContextKey: ownerDocumentContextKey,
23866
-
23867
- /**
23868
- * React ID utilities.
23869
- */
23870
-
23871
- getReactRootID: getReactRootID,
23872
-
23873
- getID: getID,
23874
-
23875
- setID: setID,
23876
-
23877
- getNode: getNode,
23878
-
23879
- getNodeFromInstance: getNodeFromInstance,
23880
-
23881
- isValid: isValid,
23882
-
23883
- purgeID: purgeID
23884
- };
23885
-
23886
- ReactPerf.measureMethods(ReactMount, 'ReactMount', {
23887
- _renderNewRootComponent: '_renderNewRootComponent',
23888
- _mountImageIntoNode: '_mountImageIntoNode'
23889
- });
23890
-
23891
- module.exports = ReactMount;
23892
- }).call(this,require('_process'))
23893
-
23894
- },{"./DOMProperty":41,"./Object.assign":54,"./ReactBrowserEventEmitter":58,"./ReactCurrentOwner":66,"./ReactDOMFeatureFlags":71,"./ReactElement":84,"./ReactEmptyComponentRegistry":87,"./ReactInstanceHandles":93,"./ReactInstanceMap":94,"./ReactMarkupChecksum":96,"./ReactPerf":103,"./ReactReconciler":108,"./ReactUpdateQueue":114,"./ReactUpdates":115,"./instantiateReactComponent":150,"./setInnerHTML":156,"./shouldUpdateReactComponent":158,"./validateDOMNesting":160,"_process":31,"fbjs/lib/containsNode":7,"fbjs/lib/emptyObject":11,"fbjs/lib/invariant":18,"fbjs/lib/warning":29}],98:[function(require,module,exports){
23895
- (function (process){
23896
- /**
23897
- * Copyright 2013-2015, Facebook, Inc.
23898
- * All rights reserved.
23899
- *
23900
- * This source code is licensed under the BSD-style license found in the
23901
- * LICENSE file in the root directory of this source tree. An additional grant
23902
- * of patent rights can be found in the PATENTS file in the same directory.
23903
- *
23904
- * @providesModule ReactMultiChild
23905
- * @typechecks static-only
23906
- */
23907
-
23908
- 'use strict';
23909
-
23910
- var ReactComponentEnvironment = require('./ReactComponentEnvironment');
23911
- var ReactMultiChildUpdateTypes = require('./ReactMultiChildUpdateTypes');
23912
-
23913
- var ReactCurrentOwner = require('./ReactCurrentOwner');
23914
- var ReactReconciler = require('./ReactReconciler');
23915
- var ReactChildReconciler = require('./ReactChildReconciler');
23916
-
23917
- var flattenChildren = require('./flattenChildren');
23918
-
23919
- /**
23920
- * Updating children of a component may trigger recursive updates. The depth is
23921
- * used to batch recursive updates to render markup more efficiently.
23922
- *
23923
- * @type {number}
23924
- * @private
23925
- */
23926
- var updateDepth = 0;
23927
-
23928
- /**
23929
- * Queue of update configuration objects.
23930
- *
23931
- * Each object has a `type` property that is in `ReactMultiChildUpdateTypes`.
23932
- *
23933
- * @type {array<object>}
23934
- * @private
23935
- */
23936
- var updateQueue = [];
23937
-
23938
- /**
23939
- * Queue of markup to be rendered.
23940
- *
23941
- * @type {array<string>}
23942
- * @private
23943
- */
23944
- var markupQueue = [];
23945
-
23946
- /**
23947
- * Enqueues markup to be rendered and inserted at a supplied index.
23948
- *
23949
- * @param {string} parentID ID of the parent component.
23950
- * @param {string} markup Markup that renders into an element.
23951
- * @param {number} toIndex Destination index.
23952
- * @private
23953
- */
23954
- function enqueueInsertMarkup(parentID, markup, toIndex) {
23955
- // NOTE: Null values reduce hidden classes.
23956
- updateQueue.push({
23957
- parentID: parentID,
23958
- parentNode: null,
23959
- type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
23960
- markupIndex: markupQueue.push(markup) - 1,
23961
- content: null,
23962
- fromIndex: null,
23963
- toIndex: toIndex
23964
- });
23965
- }
23966
-
23967
- /**
23968
- * Enqueues moving an existing element to another index.
23969
- *
23970
- * @param {string} parentID ID of the parent component.
23971
- * @param {number} fromIndex Source index of the existing element.
23972
- * @param {number} toIndex Destination index of the element.
23973
- * @private
23974
- */
23975
- function enqueueMove(parentID, fromIndex, toIndex) {
23976
- // NOTE: Null values reduce hidden classes.
23977
- updateQueue.push({
23978
- parentID: parentID,
23979
- parentNode: null,
23980
- type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
23981
- markupIndex: null,
23982
- content: null,
23983
- fromIndex: fromIndex,
23984
- toIndex: toIndex
23985
- });
23986
- }
23987
-
23988
- /**
23989
- * Enqueues removing an element at an index.
23990
- *
23991
- * @param {string} parentID ID of the parent component.
23992
- * @param {number} fromIndex Index of the element to remove.
23993
- * @private
23994
- */
23995
- function enqueueRemove(parentID, fromIndex) {
23996
- // NOTE: Null values reduce hidden classes.
23997
- updateQueue.push({
23998
- parentID: parentID,
23999
- parentNode: null,
24000
- type: ReactMultiChildUpdateTypes.REMOVE_NODE,
24001
- markupIndex: null,
24002
- content: null,
24003
- fromIndex: fromIndex,
24004
- toIndex: null
24005
- });
24006
- }
24007
-
24008
- /**
24009
- * Enqueues setting the markup of a node.
24010
- *
24011
- * @param {string} parentID ID of the parent component.
24012
- * @param {string} markup Markup that renders into an element.
24013
- * @private
24014
- */
24015
- function enqueueSetMarkup(parentID, markup) {
24016
- // NOTE: Null values reduce hidden classes.
24017
- updateQueue.push({
24018
- parentID: parentID,
24019
- parentNode: null,
24020
- type: ReactMultiChildUpdateTypes.SET_MARKUP,
24021
- markupIndex: null,
24022
- content: markup,
24023
- fromIndex: null,
24024
- toIndex: null
24025
- });
24026
- }
24027
-
24028
- /**
24029
- * Enqueues setting the text content.
24030
- *
24031
- * @param {string} parentID ID of the parent component.
24032
- * @param {string} textContent Text content to set.
24033
- * @private
24034
- */
24035
- function enqueueTextContent(parentID, textContent) {
24036
- // NOTE: Null values reduce hidden classes.
24037
- updateQueue.push({
24038
- parentID: parentID,
24039
- parentNode: null,
24040
- type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
24041
- markupIndex: null,
24042
- content: textContent,
24043
- fromIndex: null,
24044
- toIndex: null
24045
- });
24046
- }
24047
-
24048
- /**
24049
- * Processes any enqueued updates.
24050
- *
24051
- * @private
24052
- */
24053
- function processQueue() {
24054
- if (updateQueue.length) {
24055
- ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);
24056
- clearQueue();
24057
- }
24058
- }
24059
-
24060
- /**
24061
- * Clears any enqueued updates.
24062
- *
24063
- * @private
24064
- */
24065
- function clearQueue() {
24066
- updateQueue.length = 0;
24067
- markupQueue.length = 0;
24068
- }
24069
-
24070
- /**
24071
- * ReactMultiChild are capable of reconciling multiple children.
24072
- *
24073
- * @class ReactMultiChild
24074
- * @internal
24075
- */
24076
- var ReactMultiChild = {
24077
-
24078
- /**
24079
- * Provides common functionality for components that must reconcile multiple
24080
- * children. This is used by `ReactDOMComponent` to mount, update, and
24081
- * unmount child components.
24082
- *
24083
- * @lends {ReactMultiChild.prototype}
24084
- */
24085
- Mixin: {
24086
-
24087
- _reconcilerInstantiateChildren: function (nestedChildren, transaction, context) {
24088
- if (process.env.NODE_ENV !== 'production') {
24089
- if (this._currentElement) {
24090
- try {
24091
- ReactCurrentOwner.current = this._currentElement._owner;
24092
- return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
24093
- } finally {
24094
- ReactCurrentOwner.current = null;
24095
- }
24096
- }
24097
- }
24098
- return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
24099
- },
24100
-
24101
- _reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, transaction, context) {
24102
- var nextChildren;
24103
- if (process.env.NODE_ENV !== 'production') {
24104
- if (this._currentElement) {
24105
- try {
24106
- ReactCurrentOwner.current = this._currentElement._owner;
24107
- nextChildren = flattenChildren(nextNestedChildrenElements);
24108
- } finally {
24109
- ReactCurrentOwner.current = null;
24110
- }
24111
- return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
24112
- }
24113
- }
24114
- nextChildren = flattenChildren(nextNestedChildrenElements);
24115
- return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
24116
- },
24117
-
24118
- /**
24119
- * Generates a "mount image" for each of the supplied children. In the case
24120
- * of `ReactDOMComponent`, a mount image is a string of markup.
24121
- *
24122
- * @param {?object} nestedChildren Nested child maps.
24123
- * @return {array} An array of mounted representations.
24124
- * @internal
24125
- */
24126
- mountChildren: function (nestedChildren, transaction, context) {
24127
- var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context);
24128
- this._renderedChildren = children;
24129
- var mountImages = [];
24130
- var index = 0;
24131
- for (var name in children) {
24132
- if (children.hasOwnProperty(name)) {
24133
- var child = children[name];
24134
- // Inlined for performance, see `ReactInstanceHandles.createReactID`.
24135
- var rootID = this._rootNodeID + name;
24136
- var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
24137
- child._mountIndex = index++;
24138
- mountImages.push(mountImage);
24139
- }
24140
- }
24141
- return mountImages;
24142
- },
24143
-
24144
- /**
24145
- * Replaces any rendered children with a text content string.
24146
- *
24147
- * @param {string} nextContent String of content.
24148
- * @internal
24149
- */
24150
- updateTextContent: function (nextContent) {
24151
- updateDepth++;
24152
- var errorThrown = true;
24153
- try {
24154
- var prevChildren = this._renderedChildren;
24155
- // Remove any rendered children.
24156
- ReactChildReconciler.unmountChildren(prevChildren);
24157
- // TODO: The setTextContent operation should be enough
24158
- for (var name in prevChildren) {
24159
- if (prevChildren.hasOwnProperty(name)) {
24160
- this._unmountChild(prevChildren[name]);
24161
- }
24162
- }
24163
- // Set new text content.
24164
- this.setTextContent(nextContent);
24165
- errorThrown = false;
24166
- } finally {
24167
- updateDepth--;
24168
- if (!updateDepth) {
24169
- if (errorThrown) {
24170
- clearQueue();
24171
- } else {
24172
- processQueue();
24173
- }
24174
- }
24175
- }
24176
- },
24177
-
24178
- /**
24179
- * Replaces any rendered children with a markup string.
24180
- *
24181
- * @param {string} nextMarkup String of markup.
24182
- * @internal
24183
- */
24184
- updateMarkup: function (nextMarkup) {
24185
- updateDepth++;
24186
- var errorThrown = true;
24187
- try {
24188
- var prevChildren = this._renderedChildren;
24189
- // Remove any rendered children.
24190
- ReactChildReconciler.unmountChildren(prevChildren);
24191
- for (var name in prevChildren) {
24192
- if (prevChildren.hasOwnProperty(name)) {
24193
- this._unmountChildByName(prevChildren[name], name);
24194
- }
24195
- }
24196
- this.setMarkup(nextMarkup);
24197
- errorThrown = false;
24198
- } finally {
24199
- updateDepth--;
24200
- if (!updateDepth) {
24201
- if (errorThrown) {
24202
- clearQueue();
24203
- } else {
24204
- processQueue();
24205
- }
24206
- }
24207
- }
24208
- },
24209
-
24210
- /**
24211
- * Updates the rendered children with new children.
24212
- *
24213
- * @param {?object} nextNestedChildrenElements Nested child element maps.
24214
- * @param {ReactReconcileTransaction} transaction
24215
- * @internal
24216
- */
24217
- updateChildren: function (nextNestedChildrenElements, transaction, context) {
24218
- updateDepth++;
24219
- var errorThrown = true;
24220
- try {
24221
- this._updateChildren(nextNestedChildrenElements, transaction, context);
24222
- errorThrown = false;
24223
- } finally {
24224
- updateDepth--;
24225
- if (!updateDepth) {
24226
- if (errorThrown) {
24227
- clearQueue();
24228
- } else {
24229
- processQueue();
24230
- }
24231
- }
24232
- }
24233
- },
24234
-
24235
- /**
24236
- * Improve performance by isolating this hot code path from the try/catch
24237
- * block in `updateChildren`.
24238
- *
24239
- * @param {?object} nextNestedChildrenElements Nested child element maps.
24240
- * @param {ReactReconcileTransaction} transaction
24241
- * @final
24242
- * @protected
24243
- */
24244
- _updateChildren: function (nextNestedChildrenElements, transaction, context) {
24245
- var prevChildren = this._renderedChildren;
24246
- var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, transaction, context);
24247
- this._renderedChildren = nextChildren;
24248
- if (!nextChildren && !prevChildren) {
24249
- return;
24250
- }
24251
- var name;
24252
- // `nextIndex` will increment for each child in `nextChildren`, but
24253
- // `lastIndex` will be the last index visited in `prevChildren`.
24254
- var lastIndex = 0;
24255
- var nextIndex = 0;
24256
- for (name in nextChildren) {
24257
- if (!nextChildren.hasOwnProperty(name)) {
24258
- continue;
24259
- }
24260
- var prevChild = prevChildren && prevChildren[name];
24261
- var nextChild = nextChildren[name];
24262
- if (prevChild === nextChild) {
24263
- this.moveChild(prevChild, nextIndex, lastIndex);
24264
- lastIndex = Math.max(prevChild._mountIndex, lastIndex);
24265
- prevChild._mountIndex = nextIndex;
24266
- } else {
24267
- if (prevChild) {
24268
- // Update `lastIndex` before `_mountIndex` gets unset by unmounting.
24269
- lastIndex = Math.max(prevChild._mountIndex, lastIndex);
24270
- this._unmountChild(prevChild);
24271
- }
24272
- // The child must be instantiated before it's mounted.
24273
- this._mountChildByNameAtIndex(nextChild, name, nextIndex, transaction, context);
24274
- }
24275
- nextIndex++;
24276
- }
24277
- // Remove children that are no longer present.
24278
- for (name in prevChildren) {
24279
- if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
24280
- this._unmountChild(prevChildren[name]);
24281
- }
24282
- }
24283
- },
24284
-
24285
- /**
24286
- * Unmounts all rendered children. This should be used to clean up children
24287
- * when this component is unmounted.
24288
- *
24289
- * @internal
24290
- */
24291
- unmountChildren: function () {
24292
- var renderedChildren = this._renderedChildren;
24293
- ReactChildReconciler.unmountChildren(renderedChildren);
24294
- this._renderedChildren = null;
24295
- },
24296
-
24297
- /**
24298
- * Moves a child component to the supplied index.
24299
- *
24300
- * @param {ReactComponent} child Component to move.
24301
- * @param {number} toIndex Destination index of the element.
24302
- * @param {number} lastIndex Last index visited of the siblings of `child`.
24303
- * @protected
24304
- */
24305
- moveChild: function (child, toIndex, lastIndex) {
24306
- // If the index of `child` is less than `lastIndex`, then it needs to
24307
- // be moved. Otherwise, we do not need to move it because a child will be
24308
- // inserted or moved before `child`.
24309
- if (child._mountIndex < lastIndex) {
24310
- enqueueMove(this._rootNodeID, child._mountIndex, toIndex);
24311
- }
24312
- },
24313
-
24314
- /**
24315
- * Creates a child component.
24316
- *
24317
- * @param {ReactComponent} child Component to create.
24318
- * @param {string} mountImage Markup to insert.
24319
- * @protected
24320
- */
24321
- createChild: function (child, mountImage) {
24322
- enqueueInsertMarkup(this._rootNodeID, mountImage, child._mountIndex);
24323
- },
24324
-
24325
- /**
24326
- * Removes a child component.
24327
- *
24328
- * @param {ReactComponent} child Child to remove.
24329
- * @protected
24330
- */
24331
- removeChild: function (child) {
24332
- enqueueRemove(this._rootNodeID, child._mountIndex);
24333
- },
24334
-
24335
- /**
24336
- * Sets this text content string.
24337
- *
24338
- * @param {string} textContent Text content to set.
24339
- * @protected
24340
- */
24341
- setTextContent: function (textContent) {
24342
- enqueueTextContent(this._rootNodeID, textContent);
24343
- },
24344
-
24345
- /**
24346
- * Sets this markup string.
24347
- *
24348
- * @param {string} markup Markup to set.
24349
- * @protected
24350
- */
24351
- setMarkup: function (markup) {
24352
- enqueueSetMarkup(this._rootNodeID, markup);
24353
- },
24354
-
24355
- /**
24356
- * Mounts a child with the supplied name.
24357
- *
24358
- * NOTE: This is part of `updateChildren` and is here for readability.
24359
- *
24360
- * @param {ReactComponent} child Component to mount.
24361
- * @param {string} name Name of the child.
24362
- * @param {number} index Index at which to insert the child.
24363
- * @param {ReactReconcileTransaction} transaction
24364
- * @private
24365
- */
24366
- _mountChildByNameAtIndex: function (child, name, index, transaction, context) {
24367
- // Inlined for performance, see `ReactInstanceHandles.createReactID`.
24368
- var rootID = this._rootNodeID + name;
24369
- var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
24370
- child._mountIndex = index;
24371
- this.createChild(child, mountImage);
24372
- },
24373
-
24374
- /**
24375
- * Unmounts a rendered child.
24376
- *
24377
- * NOTE: This is part of `updateChildren` and is here for readability.
24378
- *
24379
- * @param {ReactComponent} child Component to unmount.
24380
- * @private
24381
- */
24382
- _unmountChild: function (child) {
24383
- this.removeChild(child);
24384
- child._mountIndex = null;
24385
- }
24386
-
24387
- }
24388
-
24389
- };
24390
-
24391
- module.exports = ReactMultiChild;
24392
- }).call(this,require('_process'))
24393
-
24394
- },{"./ReactChildReconciler":59,"./ReactComponentEnvironment":64,"./ReactCurrentOwner":66,"./ReactMultiChildUpdateTypes":99,"./ReactReconciler":108,"./flattenChildren":141,"_process":31}],99:[function(require,module,exports){
24395
- /**
24396
- * Copyright 2013-2015, Facebook, Inc.
24397
- * All rights reserved.
24398
- *
24399
- * This source code is licensed under the BSD-style license found in the
24400
- * LICENSE file in the root directory of this source tree. An additional grant
24401
- * of patent rights can be found in the PATENTS file in the same directory.
24402
- *
24403
- * @providesModule ReactMultiChildUpdateTypes
24404
- */
24405
-
24406
- 'use strict';
24407
-
24408
- var keyMirror = require('fbjs/lib/keyMirror');
24409
-
24410
- /**
24411
- * When a component's children are updated, a series of update configuration
24412
- * objects are created in order to batch and serialize the required changes.
24413
- *
24414
- * Enumerates all the possible types of update configurations.
24415
- *
24416
- * @internal
24417
- */
24418
- var ReactMultiChildUpdateTypes = keyMirror({
24419
- INSERT_MARKUP: null,
24420
- MOVE_EXISTING: null,
24421
- REMOVE_NODE: null,
24422
- SET_MARKUP: null,
24423
- TEXT_CONTENT: null
24424
- });
24425
-
24426
- module.exports = ReactMultiChildUpdateTypes;
24427
- },{"fbjs/lib/keyMirror":21}],100:[function(require,module,exports){
24428
- (function (process){
24429
- /**
24430
- * Copyright 2014-2015, Facebook, Inc.
24431
- * All rights reserved.
24432
- *
24433
- * This source code is licensed under the BSD-style license found in the
24434
- * LICENSE file in the root directory of this source tree. An additional grant
24435
- * of patent rights can be found in the PATENTS file in the same directory.
24436
- *
24437
- * @providesModule ReactNativeComponent
24438
- */
24439
-
24440
- 'use strict';
24441
-
24442
- var assign = require('./Object.assign');
24443
- var invariant = require('fbjs/lib/invariant');
24444
-
24445
- var autoGenerateWrapperClass = null;
24446
- var genericComponentClass = null;
24447
- // This registry keeps track of wrapper classes around native tags.
24448
- var tagToComponentClass = {};
24449
- var textComponentClass = null;
24450
-
24451
- var ReactNativeComponentInjection = {
24452
- // This accepts a class that receives the tag string. This is a catch all
24453
- // that can render any kind of tag.
24454
- injectGenericComponentClass: function (componentClass) {
24455
- genericComponentClass = componentClass;
24456
- },
24457
- // This accepts a text component class that takes the text string to be
24458
- // rendered as props.
24459
- injectTextComponentClass: function (componentClass) {
24460
- textComponentClass = componentClass;
24461
- },
24462
- // This accepts a keyed object with classes as values. Each key represents a
24463
- // tag. That particular tag will use this class instead of the generic one.
24464
- injectComponentClasses: function (componentClasses) {
24465
- assign(tagToComponentClass, componentClasses);
24466
- }
24467
- };
24468
-
24469
- /**
24470
- * Get a composite component wrapper class for a specific tag.
24471
- *
24472
- * @param {ReactElement} element The tag for which to get the class.
24473
- * @return {function} The React class constructor function.
24474
- */
24475
- function getComponentClassForElement(element) {
24476
- if (typeof element.type === 'function') {
24477
- return element.type;
24478
- }
24479
- var tag = element.type;
24480
- var componentClass = tagToComponentClass[tag];
24481
- if (componentClass == null) {
24482
- tagToComponentClass[tag] = componentClass = autoGenerateWrapperClass(tag);
24483
- }
24484
- return componentClass;
24485
- }
24486
-
24487
- /**
24488
- * Get a native internal component class for a specific tag.
24489
- *
24490
- * @param {ReactElement} element The element to create.
24491
- * @return {function} The internal class constructor function.
24492
- */
24493
- function createInternalComponent(element) {
24494
- !genericComponentClass ? process.env.NODE_ENV !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : invariant(false) : undefined;
24495
- return new genericComponentClass(element.type, element.props);
24496
- }
24497
-
24498
- /**
24499
- * @param {ReactText} text
24500
- * @return {ReactComponent}
24501
- */
24502
- function createInstanceForText(text) {
24503
- return new textComponentClass(text);
24504
- }
24505
-
24506
- /**
24507
- * @param {ReactComponent} component
24508
- * @return {boolean}
24509
- */
24510
- function isTextComponent(component) {
24511
- return component instanceof textComponentClass;
24512
- }
24513
-
24514
- var ReactNativeComponent = {
24515
- getComponentClassForElement: getComponentClassForElement,
24516
- createInternalComponent: createInternalComponent,
24517
- createInstanceForText: createInstanceForText,
24518
- isTextComponent: isTextComponent,
24519
- injection: ReactNativeComponentInjection
24520
- };
24521
-
24522
- module.exports = ReactNativeComponent;
24523
- }).call(this,require('_process'))
24524
-
24525
- },{"./Object.assign":54,"_process":31,"fbjs/lib/invariant":18}],101:[function(require,module,exports){
24526
- (function (process){
24527
- /**
24528
- * Copyright 2015, Facebook, Inc.
24529
- * All rights reserved.
24530
- *
24531
- * This source code is licensed under the BSD-style license found in the
24532
- * LICENSE file in the root directory of this source tree. An additional grant
24533
- * of patent rights can be found in the PATENTS file in the same directory.
24534
- *
24535
- * @providesModule ReactNoopUpdateQueue
24536
- */
24537
-
24538
- 'use strict';
24539
-
24540
- var warning = require('fbjs/lib/warning');
24541
-
24542
- function warnTDZ(publicInstance, callerName) {
24543
- if (process.env.NODE_ENV !== 'production') {
24544
- process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor && publicInstance.constructor.displayName || '') : undefined;
24545
- }
24546
- }
24547
-
24548
- /**
24549
- * This is the abstract API for an update queue.
24550
- */
24551
- var ReactNoopUpdateQueue = {
24552
-
24553
- /**
24554
- * Checks whether or not this composite component is mounted.
24555
- * @param {ReactClass} publicInstance The instance we want to test.
24556
- * @return {boolean} True if mounted, false otherwise.
24557
- * @protected
24558
- * @final
24559
- */
24560
- isMounted: function (publicInstance) {
24561
- return false;
24562
- },
24563
-
24564
- /**
24565
- * Enqueue a callback that will be executed after all the pending updates
24566
- * have processed.
24567
- *
24568
- * @param {ReactClass} publicInstance The instance to use as `this` context.
24569
- * @param {?function} callback Called after state is updated.
24570
- * @internal
24571
- */
24572
- enqueueCallback: function (publicInstance, callback) {},
24573
-
24574
- /**
24575
- * Forces an update. This should only be invoked when it is known with
24576
- * certainty that we are **not** in a DOM transaction.
24577
- *
24578
- * You may want to call this when you know that some deeper aspect of the
24579
- * component's state has changed but `setState` was not called.
24580
- *
24581
- * This will not invoke `shouldComponentUpdate`, but it will invoke
24582
- * `componentWillUpdate` and `componentDidUpdate`.
24583
- *
24584
- * @param {ReactClass} publicInstance The instance that should rerender.
24585
- * @internal
24586
- */
24587
- enqueueForceUpdate: function (publicInstance) {
24588
- warnTDZ(publicInstance, 'forceUpdate');
24589
- },
24590
-
24591
- /**
24592
- * Replaces all of the state. Always use this or `setState` to mutate state.
24593
- * You should treat `this.state` as immutable.
24594
- *
24595
- * There is no guarantee that `this.state` will be immediately updated, so
24596
- * accessing `this.state` after calling this method may return the old value.
24597
- *
24598
- * @param {ReactClass} publicInstance The instance that should rerender.
24599
- * @param {object} completeState Next state.
24600
- * @internal
24601
- */
24602
- enqueueReplaceState: function (publicInstance, completeState) {
24603
- warnTDZ(publicInstance, 'replaceState');
24604
- },
24605
-
24606
- /**
24607
- * Sets a subset of the state. This only exists because _pendingState is
24608
- * internal. This provides a merging strategy that is not available to deep
24609
- * properties which is confusing. TODO: Expose pendingState or don't use it
24610
- * during the merge.
24611
- *
24612
- * @param {ReactClass} publicInstance The instance that should rerender.
24613
- * @param {object} partialState Next partial state to be merged with state.
24614
- * @internal
24615
- */
24616
- enqueueSetState: function (publicInstance, partialState) {
24617
- warnTDZ(publicInstance, 'setState');
24618
- },
24619
-
24620
- /**
24621
- * Sets a subset of the props.
24622
- *
24623
- * @param {ReactClass} publicInstance The instance that should rerender.
24624
- * @param {object} partialProps Subset of the next props.
24625
- * @internal
24626
- */
24627
- enqueueSetProps: function (publicInstance, partialProps) {
24628
- warnTDZ(publicInstance, 'setProps');
24629
- },
24630
-
24631
- /**
24632
- * Replaces all of the props.
24633
- *
24634
- * @param {ReactClass} publicInstance The instance that should rerender.
24635
- * @param {object} props New props.
24636
- * @internal
24637
- */
24638
- enqueueReplaceProps: function (publicInstance, props) {
24639
- warnTDZ(publicInstance, 'replaceProps');
24640
- }
24641
-
24642
- };
24643
-
24644
- module.exports = ReactNoopUpdateQueue;
24645
- }).call(this,require('_process'))
24646
-
24647
- },{"_process":31,"fbjs/lib/warning":29}],102:[function(require,module,exports){
24648
- (function (process){
24649
- /**
24650
- * Copyright 2013-2015, Facebook, Inc.
24651
- * All rights reserved.
24652
- *
24653
- * This source code is licensed under the BSD-style license found in the
24654
- * LICENSE file in the root directory of this source tree. An additional grant
24655
- * of patent rights can be found in the PATENTS file in the same directory.
24656
- *
24657
- * @providesModule ReactOwner
24658
- */
24659
-
24660
- 'use strict';
24661
-
24662
- var invariant = require('fbjs/lib/invariant');
24663
-
24664
- /**
24665
- * ReactOwners are capable of storing references to owned components.
24666
- *
24667
- * All components are capable of //being// referenced by owner components, but
24668
- * only ReactOwner components are capable of //referencing// owned components.
24669
- * The named reference is known as a "ref".
24670
- *
24671
- * Refs are available when mounted and updated during reconciliation.
24672
- *
24673
- * var MyComponent = React.createClass({
24674
- * render: function() {
24675
- * return (
24676
- * <div onClick={this.handleClick}>
24677
- * <CustomComponent ref="custom" />
24678
- * </div>
24679
- * );
24680
- * },
24681
- * handleClick: function() {
24682
- * this.refs.custom.handleClick();
24683
- * },
24684
- * componentDidMount: function() {
24685
- * this.refs.custom.initialize();
24686
- * }
24687
- * });
24688
- *
24689
- * Refs should rarely be used. When refs are used, they should only be done to
24690
- * control data that is not handled by React's data flow.
24691
- *
24692
- * @class ReactOwner
24693
- */
24694
- var ReactOwner = {
24695
-
24696
- /**
24697
- * @param {?object} object
24698
- * @return {boolean} True if `object` is a valid owner.
24699
- * @final
24700
- */
24701
- isValidOwner: function (object) {
24702
- return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function');
24703
- },
24704
-
24705
- /**
24706
- * Adds a component by ref to an owner component.
24707
- *
24708
- * @param {ReactComponent} component Component to reference.
24709
- * @param {string} ref Name by which to refer to the component.
24710
- * @param {ReactOwner} owner Component on which to record the ref.
24711
- * @final
24712
- * @internal
24713
- */
24714
- addComponentAsRefTo: function (component, ref, owner) {
24715
- !ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might ' + 'be adding a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
24716
- owner.attachRef(ref, component);
24717
- },
24718
-
24719
- /**
24720
- * Removes a component by ref from an owner component.
24721
- *
24722
- * @param {ReactComponent} component Component to dereference.
24723
- * @param {string} ref Name of the ref to remove.
24724
- * @param {ReactOwner} owner Component on which the ref is recorded.
24725
- * @final
24726
- * @internal
24727
- */
24728
- removeComponentAsRefFrom: function (component, ref, owner) {
24729
- !ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might ' + 'be removing a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
24730
- // Check that `component` is still the current ref because we do not want to
24731
- // detach the ref if another component stole it.
24732
- if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) {
24733
- owner.detachRef(ref);
24734
- }
24735
- }
24736
-
24737
- };
24738
-
24739
- module.exports = ReactOwner;
24740
- }).call(this,require('_process'))
24741
-
24742
- },{"_process":31,"fbjs/lib/invariant":18}],103:[function(require,module,exports){
24743
- (function (process){
24744
- /**
24745
- * Copyright 2013-2015, Facebook, Inc.
24746
- * All rights reserved.
24747
- *
24748
- * This source code is licensed under the BSD-style license found in the
24749
- * LICENSE file in the root directory of this source tree. An additional grant
24750
- * of patent rights can be found in the PATENTS file in the same directory.
24751
- *
24752
- * @providesModule ReactPerf
24753
- * @typechecks static-only
24754
- */
24755
-
24756
- 'use strict';
24757
-
24758
- /**
24759
- * ReactPerf is a general AOP system designed to measure performance. This
24760
- * module only has the hooks: see ReactDefaultPerf for the analysis tool.
24761
- */
24762
- var ReactPerf = {
24763
- /**
24764
- * Boolean to enable/disable measurement. Set to false by default to prevent
24765
- * accidental logging and perf loss.
24766
- */
24767
- enableMeasure: false,
24768
-
24769
- /**
24770
- * Holds onto the measure function in use. By default, don't measure
24771
- * anything, but we'll override this if we inject a measure function.
24772
- */
24773
- storedMeasure: _noMeasure,
24774
-
24775
- /**
24776
- * @param {object} object
24777
- * @param {string} objectName
24778
- * @param {object<string>} methodNames
24779
- */
24780
- measureMethods: function (object, objectName, methodNames) {
24781
- if (process.env.NODE_ENV !== 'production') {
24782
- for (var key in methodNames) {
24783
- if (!methodNames.hasOwnProperty(key)) {
24784
- continue;
24785
- }
24786
- object[key] = ReactPerf.measure(objectName, methodNames[key], object[key]);
24787
- }
24788
- }
24789
- },
24790
-
24791
- /**
24792
- * Use this to wrap methods you want to measure. Zero overhead in production.
24793
- *
24794
- * @param {string} objName
24795
- * @param {string} fnName
24796
- * @param {function} func
24797
- * @return {function}
24798
- */
24799
- measure: function (objName, fnName, func) {
24800
- if (process.env.NODE_ENV !== 'production') {
24801
- var measuredFunc = null;
24802
- var wrapper = function () {
24803
- if (ReactPerf.enableMeasure) {
24804
- if (!measuredFunc) {
24805
- measuredFunc = ReactPerf.storedMeasure(objName, fnName, func);
24806
- }
24807
- return measuredFunc.apply(this, arguments);
24808
- }
24809
- return func.apply(this, arguments);
24810
- };
24811
- wrapper.displayName = objName + '_' + fnName;
24812
- return wrapper;
24813
- }
24814
- return func;
24815
- },
24816
-
24817
- injection: {
24818
- /**
24819
- * @param {function} measure
24820
- */
24821
- injectMeasure: function (measure) {
24822
- ReactPerf.storedMeasure = measure;
24823
- }
24824
- }
24825
- };
24826
-
24827
- /**
24828
- * Simply passes through the measured function, without measuring it.
24829
- *
24830
- * @param {string} objName
24831
- * @param {string} fnName
24832
- * @param {function} func
24833
- * @return {function}
24834
- */
24835
- function _noMeasure(objName, fnName, func) {
24836
- return func;
24837
- }
24838
-
24839
- module.exports = ReactPerf;
24840
- }).call(this,require('_process'))
24841
-
24842
- },{"_process":31}],104:[function(require,module,exports){
24843
- (function (process){
24844
- /**
24845
- * Copyright 2013-2015, Facebook, Inc.
24846
- * All rights reserved.
24847
- *
24848
- * This source code is licensed under the BSD-style license found in the
24849
- * LICENSE file in the root directory of this source tree. An additional grant
24850
- * of patent rights can be found in the PATENTS file in the same directory.
24851
- *
24852
- * @providesModule ReactPropTypeLocationNames
24853
- */
24854
-
24855
- 'use strict';
24856
-
24857
- var ReactPropTypeLocationNames = {};
24858
-
24859
- if (process.env.NODE_ENV !== 'production') {
24860
- ReactPropTypeLocationNames = {
24861
- prop: 'prop',
24862
- context: 'context',
24863
- childContext: 'child context'
24864
- };
24865
- }
24866
-
24867
- module.exports = ReactPropTypeLocationNames;
24868
- }).call(this,require('_process'))
24869
-
24870
- },{"_process":31}],105:[function(require,module,exports){
24871
- /**
24872
- * Copyright 2013-2015, Facebook, Inc.
24873
- * All rights reserved.
24874
- *
24875
- * This source code is licensed under the BSD-style license found in the
24876
- * LICENSE file in the root directory of this source tree. An additional grant
24877
- * of patent rights can be found in the PATENTS file in the same directory.
24878
- *
24879
- * @providesModule ReactPropTypeLocations
24880
- */
24881
-
24882
- 'use strict';
24883
-
24884
- var keyMirror = require('fbjs/lib/keyMirror');
24885
-
24886
- var ReactPropTypeLocations = keyMirror({
24887
- prop: null,
24888
- context: null,
24889
- childContext: null
24890
- });
24891
-
24892
- module.exports = ReactPropTypeLocations;
24893
- },{"fbjs/lib/keyMirror":21}],106:[function(require,module,exports){
24894
- /**
24895
- * Copyright 2013-2015, Facebook, Inc.
24896
- * All rights reserved.
24897
- *
24898
- * This source code is licensed under the BSD-style license found in the
24899
- * LICENSE file in the root directory of this source tree. An additional grant
24900
- * of patent rights can be found in the PATENTS file in the same directory.
24901
- *
24902
- * @providesModule ReactPropTypes
24903
- */
24904
-
24905
- 'use strict';
24906
-
24907
- var ReactElement = require('./ReactElement');
24908
- var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
24909
-
24910
- var emptyFunction = require('fbjs/lib/emptyFunction');
24911
- var getIteratorFn = require('./getIteratorFn');
24912
-
24913
- /**
24914
- * Collection of methods that allow declaration and validation of props that are
24915
- * supplied to React components. Example usage:
24916
- *
24917
- * var Props = require('ReactPropTypes');
24918
- * var MyArticle = React.createClass({
24919
- * propTypes: {
24920
- * // An optional string prop named "description".
24921
- * description: Props.string,
24922
- *
24923
- * // A required enum prop named "category".
24924
- * category: Props.oneOf(['News','Photos']).isRequired,
24925
- *
24926
- * // A prop named "dialog" that requires an instance of Dialog.
24927
- * dialog: Props.instanceOf(Dialog).isRequired
24928
- * },
24929
- * render: function() { ... }
24930
- * });
24931
- *
24932
- * A more formal specification of how these methods are used:
24933
- *
24934
- * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
24935
- * decl := ReactPropTypes.{type}(.isRequired)?
24936
- *
24937
- * Each and every declaration produces a function with the same signature. This
24938
- * allows the creation of custom validation functions. For example:
24939
- *
24940
- * var MyLink = React.createClass({
24941
- * propTypes: {
24942
- * // An optional string or URI prop named "href".
24943
- * href: function(props, propName, componentName) {
24944
- * var propValue = props[propName];
24945
- * if (propValue != null && typeof propValue !== 'string' &&
24946
- * !(propValue instanceof URI)) {
24947
- * return new Error(
24948
- * 'Expected a string or an URI for ' + propName + ' in ' +
24949
- * componentName
24950
- * );
24951
- * }
24952
- * }
24953
- * },
24954
- * render: function() {...}
24955
- * });
24956
- *
24957
- * @internal
24958
- */
24959
-
24960
- var ANONYMOUS = '<<anonymous>>';
24961
-
24962
- var ReactPropTypes = {
24963
- array: createPrimitiveTypeChecker('array'),
24964
- bool: createPrimitiveTypeChecker('boolean'),
24965
- func: createPrimitiveTypeChecker('function'),
24966
- number: createPrimitiveTypeChecker('number'),
24967
- object: createPrimitiveTypeChecker('object'),
24968
- string: createPrimitiveTypeChecker('string'),
24969
-
24970
- any: createAnyTypeChecker(),
24971
- arrayOf: createArrayOfTypeChecker,
24972
- element: createElementTypeChecker(),
24973
- instanceOf: createInstanceTypeChecker,
24974
- node: createNodeChecker(),
24975
- objectOf: createObjectOfTypeChecker,
24976
- oneOf: createEnumTypeChecker,
24977
- oneOfType: createUnionTypeChecker,
24978
- shape: createShapeTypeChecker
24979
- };
24980
-
24981
- function createChainableTypeChecker(validate) {
24982
- function checkType(isRequired, props, propName, componentName, location, propFullName) {
24983
- componentName = componentName || ANONYMOUS;
24984
- propFullName = propFullName || propName;
24985
- if (props[propName] == null) {
24986
- var locationName = ReactPropTypeLocationNames[location];
24987
- if (isRequired) {
24988
- return new Error('Required ' + locationName + ' `' + propFullName + '` was not specified in ' + ('`' + componentName + '`.'));
24989
- }
24990
- return null;
24991
- } else {
24992
- return validate(props, propName, componentName, location, propFullName);
24993
- }
24994
- }
24995
-
24996
- var chainedCheckType = checkType.bind(null, false);
24997
- chainedCheckType.isRequired = checkType.bind(null, true);
24998
-
24999
- return chainedCheckType;
25000
- }
25001
-
25002
- function createPrimitiveTypeChecker(expectedType) {
25003
- function validate(props, propName, componentName, location, propFullName) {
25004
- var propValue = props[propName];
25005
- var propType = getPropType(propValue);
25006
- if (propType !== expectedType) {
25007
- var locationName = ReactPropTypeLocationNames[location];
25008
- // `propValue` being instance of, say, date/regexp, pass the 'object'
25009
- // check, but we can offer a more precise error message here rather than
25010
- // 'of type `object`'.
25011
- var preciseType = getPreciseType(propValue);
25012
-
25013
- return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
25014
- }
25015
- return null;
25016
- }
25017
- return createChainableTypeChecker(validate);
25018
- }
25019
-
25020
- function createAnyTypeChecker() {
25021
- return createChainableTypeChecker(emptyFunction.thatReturns(null));
25022
- }
25023
-
25024
- function createArrayOfTypeChecker(typeChecker) {
25025
- function validate(props, propName, componentName, location, propFullName) {
25026
- var propValue = props[propName];
25027
- if (!Array.isArray(propValue)) {
25028
- var locationName = ReactPropTypeLocationNames[location];
25029
- var propType = getPropType(propValue);
25030
- return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
25031
- }
25032
- for (var i = 0; i < propValue.length; i++) {
25033
- var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']');
25034
- if (error instanceof Error) {
25035
- return error;
25036
- }
25037
- }
25038
- return null;
25039
- }
25040
- return createChainableTypeChecker(validate);
25041
- }
25042
-
25043
- function createElementTypeChecker() {
25044
- function validate(props, propName, componentName, location, propFullName) {
25045
- if (!ReactElement.isValidElement(props[propName])) {
25046
- var locationName = ReactPropTypeLocationNames[location];
25047
- return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a single ReactElement.'));
25048
- }
25049
- return null;
25050
- }
25051
- return createChainableTypeChecker(validate);
25052
- }
25053
-
25054
- function createInstanceTypeChecker(expectedClass) {
25055
- function validate(props, propName, componentName, location, propFullName) {
25056
- if (!(props[propName] instanceof expectedClass)) {
25057
- var locationName = ReactPropTypeLocationNames[location];
25058
- var expectedClassName = expectedClass.name || ANONYMOUS;
25059
- var actualClassName = getClassName(props[propName]);
25060
- return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
25061
- }
25062
- return null;
25063
- }
25064
- return createChainableTypeChecker(validate);
25065
- }
25066
-
25067
- function createEnumTypeChecker(expectedValues) {
25068
- if (!Array.isArray(expectedValues)) {
25069
- return createChainableTypeChecker(function () {
25070
- return new Error('Invalid argument supplied to oneOf, expected an instance of array.');
25071
- });
25072
- }
25073
-
25074
- function validate(props, propName, componentName, location, propFullName) {
25075
- var propValue = props[propName];
25076
- for (var i = 0; i < expectedValues.length; i++) {
25077
- if (propValue === expectedValues[i]) {
25078
- return null;
25079
- }
25080
- }
25081
-
25082
- var locationName = ReactPropTypeLocationNames[location];
25083
- var valuesString = JSON.stringify(expectedValues);
25084
- return new Error('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
25085
- }
25086
- return createChainableTypeChecker(validate);
25087
- }
25088
-
25089
- function createObjectOfTypeChecker(typeChecker) {
25090
- function validate(props, propName, componentName, location, propFullName) {
25091
- var propValue = props[propName];
25092
- var propType = getPropType(propValue);
25093
- if (propType !== 'object') {
25094
- var locationName = ReactPropTypeLocationNames[location];
25095
- return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
25096
- }
25097
- for (var key in propValue) {
25098
- if (propValue.hasOwnProperty(key)) {
25099
- var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key);
25100
- if (error instanceof Error) {
25101
- return error;
25102
- }
25103
- }
25104
- }
25105
- return null;
25106
- }
25107
- return createChainableTypeChecker(validate);
25108
- }
25109
-
25110
- function createUnionTypeChecker(arrayOfTypeCheckers) {
25111
- if (!Array.isArray(arrayOfTypeCheckers)) {
25112
- return createChainableTypeChecker(function () {
25113
- return new Error('Invalid argument supplied to oneOfType, expected an instance of array.');
25114
- });
25115
- }
25116
-
25117
- function validate(props, propName, componentName, location, propFullName) {
25118
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
25119
- var checker = arrayOfTypeCheckers[i];
25120
- if (checker(props, propName, componentName, location, propFullName) == null) {
25121
- return null;
25122
- }
25123
- }
25124
-
25125
- var locationName = ReactPropTypeLocationNames[location];
25126
- return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
25127
- }
25128
- return createChainableTypeChecker(validate);
25129
- }
25130
-
25131
- function createNodeChecker() {
25132
- function validate(props, propName, componentName, location, propFullName) {
25133
- if (!isNode(props[propName])) {
25134
- var locationName = ReactPropTypeLocationNames[location];
25135
- return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
25136
- }
25137
- return null;
25138
- }
25139
- return createChainableTypeChecker(validate);
25140
- }
25141
-
25142
- function createShapeTypeChecker(shapeTypes) {
25143
- function validate(props, propName, componentName, location, propFullName) {
25144
- var propValue = props[propName];
25145
- var propType = getPropType(propValue);
25146
- if (propType !== 'object') {
25147
- var locationName = ReactPropTypeLocationNames[location];
25148
- return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
25149
- }
25150
- for (var key in shapeTypes) {
25151
- var checker = shapeTypes[key];
25152
- if (!checker) {
25153
- continue;
25154
- }
25155
- var error = checker(propValue, key, componentName, location, propFullName + '.' + key);
25156
- if (error) {
25157
- return error;
25158
- }
25159
- }
25160
- return null;
25161
- }
25162
- return createChainableTypeChecker(validate);
25163
- }
25164
-
25165
- function isNode(propValue) {
25166
- switch (typeof propValue) {
25167
- case 'number':
25168
- case 'string':
25169
- case 'undefined':
25170
- return true;
25171
- case 'boolean':
25172
- return !propValue;
25173
- case 'object':
25174
- if (Array.isArray(propValue)) {
25175
- return propValue.every(isNode);
25176
- }
25177
- if (propValue === null || ReactElement.isValidElement(propValue)) {
25178
- return true;
25179
- }
25180
-
25181
- var iteratorFn = getIteratorFn(propValue);
25182
- if (iteratorFn) {
25183
- var iterator = iteratorFn.call(propValue);
25184
- var step;
25185
- if (iteratorFn !== propValue.entries) {
25186
- while (!(step = iterator.next()).done) {
25187
- if (!isNode(step.value)) {
25188
- return false;
25189
- }
25190
- }
25191
- } else {
25192
- // Iterator will provide entry [k,v] tuples rather than values.
25193
- while (!(step = iterator.next()).done) {
25194
- var entry = step.value;
25195
- if (entry) {
25196
- if (!isNode(entry[1])) {
25197
- return false;
25198
- }
25199
- }
25200
- }
25201
- }
25202
- } else {
25203
- return false;
25204
- }
25205
-
25206
- return true;
25207
- default:
25208
- return false;
25209
- }
25210
- }
25211
-
25212
- // Equivalent of `typeof` but with special handling for array and regexp.
25213
- function getPropType(propValue) {
25214
- var propType = typeof propValue;
25215
- if (Array.isArray(propValue)) {
25216
- return 'array';
25217
- }
25218
- if (propValue instanceof RegExp) {
25219
- // Old webkits (at least until Android 4.0) return 'function' rather than
25220
- // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
25221
- // passes PropTypes.object.
25222
- return 'object';
25223
- }
25224
- return propType;
25225
- }
25226
-
25227
- // This handles more types than `getPropType`. Only used for error messages.
25228
- // See `createPrimitiveTypeChecker`.
25229
- function getPreciseType(propValue) {
25230
- var propType = getPropType(propValue);
25231
- if (propType === 'object') {
25232
- if (propValue instanceof Date) {
25233
- return 'date';
25234
- } else if (propValue instanceof RegExp) {
25235
- return 'regexp';
25236
- }
25237
- }
25238
- return propType;
25239
- }
25240
-
25241
- // Returns class name of the object, if any.
25242
- function getClassName(propValue) {
25243
- if (!propValue.constructor || !propValue.constructor.name) {
25244
- return '<<anonymous>>';
25245
- }
25246
- return propValue.constructor.name;
25247
- }
25248
-
25249
- module.exports = ReactPropTypes;
25250
- },{"./ReactElement":84,"./ReactPropTypeLocationNames":104,"./getIteratorFn":147,"fbjs/lib/emptyFunction":10}],107:[function(require,module,exports){
25251
- /**
25252
- * Copyright 2013-2015, Facebook, Inc.
25253
- * All rights reserved.
25254
- *
25255
- * This source code is licensed under the BSD-style license found in the
25256
- * LICENSE file in the root directory of this source tree. An additional grant
25257
- * of patent rights can be found in the PATENTS file in the same directory.
25258
- *
25259
- * @providesModule ReactReconcileTransaction
25260
- * @typechecks static-only
25261
- */
25262
-
25263
- 'use strict';
25264
-
25265
- var CallbackQueue = require('./CallbackQueue');
25266
- var PooledClass = require('./PooledClass');
25267
- var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
25268
- var ReactDOMFeatureFlags = require('./ReactDOMFeatureFlags');
25269
- var ReactInputSelection = require('./ReactInputSelection');
25270
- var Transaction = require('./Transaction');
25271
-
25272
- var assign = require('./Object.assign');
25273
-
25274
- /**
25275
- * Ensures that, when possible, the selection range (currently selected text
25276
- * input) is not disturbed by performing the transaction.
25277
- */
25278
- var SELECTION_RESTORATION = {
25279
- /**
25280
- * @return {Selection} Selection information.
25281
- */
25282
- initialize: ReactInputSelection.getSelectionInformation,
25283
- /**
25284
- * @param {Selection} sel Selection information returned from `initialize`.
25285
- */
25286
- close: ReactInputSelection.restoreSelection
25287
- };
25288
-
25289
- /**
25290
- * Suppresses events (blur/focus) that could be inadvertently dispatched due to
25291
- * high level DOM manipulations (like temporarily removing a text input from the
25292
- * DOM).
25293
- */
25294
- var EVENT_SUPPRESSION = {
25295
- /**
25296
- * @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
25297
- * the reconciliation.
25298
- */
25299
- initialize: function () {
25300
- var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
25301
- ReactBrowserEventEmitter.setEnabled(false);
25302
- return currentlyEnabled;
25303
- },
25304
-
25305
- /**
25306
- * @param {boolean} previouslyEnabled Enabled status of
25307
- * `ReactBrowserEventEmitter` before the reconciliation occurred. `close`
25308
- * restores the previous value.
25309
- */
25310
- close: function (previouslyEnabled) {
25311
- ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
25312
- }
25313
- };
25314
-
25315
- /**
25316
- * Provides a queue for collecting `componentDidMount` and
25317
- * `componentDidUpdate` callbacks during the the transaction.
25318
- */
25319
- var ON_DOM_READY_QUEUEING = {
25320
- /**
25321
- * Initializes the internal `onDOMReady` queue.
25322
- */
25323
- initialize: function () {
25324
- this.reactMountReady.reset();
25325
- },
25326
-
25327
- /**
25328
- * After DOM is flushed, invoke all registered `onDOMReady` callbacks.
25329
- */
25330
- close: function () {
25331
- this.reactMountReady.notifyAll();
25332
- }
25333
- };
25334
-
25335
- /**
25336
- * Executed within the scope of the `Transaction` instance. Consider these as
25337
- * being member methods, but with an implied ordering while being isolated from
25338
- * each other.
25339
- */
25340
- var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING];
25341
-
25342
- /**
25343
- * Currently:
25344
- * - The order that these are listed in the transaction is critical:
25345
- * - Suppresses events.
25346
- * - Restores selection range.
25347
- *
25348
- * Future:
25349
- * - Restore document/overflow scroll positions that were unintentionally
25350
- * modified via DOM insertions above the top viewport boundary.
25351
- * - Implement/integrate with customized constraint based layout system and keep
25352
- * track of which dimensions must be remeasured.
25353
- *
25354
- * @class ReactReconcileTransaction
25355
- */
25356
- function ReactReconcileTransaction(forceHTML) {
25357
- this.reinitializeTransaction();
25358
- // Only server-side rendering really needs this option (see
25359
- // `ReactServerRendering`), but server-side uses
25360
- // `ReactServerRenderingTransaction` instead. This option is here so that it's
25361
- // accessible and defaults to false when `ReactDOMComponent` and
25362
- // `ReactTextComponent` checks it in `mountComponent`.`
25363
- this.renderToStaticMarkup = false;
25364
- this.reactMountReady = CallbackQueue.getPooled(null);
25365
- this.useCreateElement = !forceHTML && ReactDOMFeatureFlags.useCreateElement;
25366
- }
25367
-
25368
- var Mixin = {
25369
- /**
25370
- * @see Transaction
25371
- * @abstract
25372
- * @final
25373
- * @return {array<object>} List of operation wrap procedures.
25374
- * TODO: convert to array<TransactionWrapper>
25375
- */
25376
- getTransactionWrappers: function () {
25377
- return TRANSACTION_WRAPPERS;
25378
- },
25379
-
25380
- /**
25381
- * @return {object} The queue to collect `onDOMReady` callbacks with.
25382
- */
25383
- getReactMountReady: function () {
25384
- return this.reactMountReady;
25385
- },
25386
-
25387
- /**
25388
- * `PooledClass` looks for this, and will invoke this before allowing this
25389
- * instance to be reused.
25390
- */
25391
- destructor: function () {
25392
- CallbackQueue.release(this.reactMountReady);
25393
- this.reactMountReady = null;
25394
- }
25395
- };
25396
-
25397
- assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin);
25398
-
25399
- PooledClass.addPoolingTo(ReactReconcileTransaction);
25400
-
25401
- module.exports = ReactReconcileTransaction;
25402
- },{"./CallbackQueue":37,"./Object.assign":54,"./PooledClass":55,"./ReactBrowserEventEmitter":58,"./ReactDOMFeatureFlags":71,"./ReactInputSelection":92,"./Transaction":132}],108:[function(require,module,exports){
25403
- /**
25404
- * Copyright 2013-2015, Facebook, Inc.
25405
- * All rights reserved.
25406
- *
25407
- * This source code is licensed under the BSD-style license found in the
25408
- * LICENSE file in the root directory of this source tree. An additional grant
25409
- * of patent rights can be found in the PATENTS file in the same directory.
25410
- *
25411
- * @providesModule ReactReconciler
25412
- */
25413
-
25414
- 'use strict';
25415
-
25416
- var ReactRef = require('./ReactRef');
25417
-
25418
- /**
25419
- * Helper to call ReactRef.attachRefs with this composite component, split out
25420
- * to avoid allocations in the transaction mount-ready queue.
25421
- */
25422
- function attachRefs() {
25423
- ReactRef.attachRefs(this, this._currentElement);
25424
- }
25425
-
25426
- var ReactReconciler = {
25427
-
25428
- /**
25429
- * Initializes the component, renders markup, and registers event listeners.
25430
- *
25431
- * @param {ReactComponent} internalInstance
25432
- * @param {string} rootID DOM ID of the root node.
25433
- * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
25434
- * @return {?string} Rendered markup to be inserted into the DOM.
25435
- * @final
25436
- * @internal
25437
- */
25438
- mountComponent: function (internalInstance, rootID, transaction, context) {
25439
- var markup = internalInstance.mountComponent(rootID, transaction, context);
25440
- if (internalInstance._currentElement && internalInstance._currentElement.ref != null) {
25441
- transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
25442
- }
25443
- return markup;
25444
- },
25445
-
25446
- /**
25447
- * Releases any resources allocated by `mountComponent`.
25448
- *
25449
- * @final
25450
- * @internal
25451
- */
25452
- unmountComponent: function (internalInstance) {
25453
- ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
25454
- internalInstance.unmountComponent();
25455
- },
25456
-
25457
- /**
25458
- * Update a component using a new element.
25459
- *
25460
- * @param {ReactComponent} internalInstance
25461
- * @param {ReactElement} nextElement
25462
- * @param {ReactReconcileTransaction} transaction
25463
- * @param {object} context
25464
- * @internal
25465
- */
25466
- receiveComponent: function (internalInstance, nextElement, transaction, context) {
25467
- var prevElement = internalInstance._currentElement;
25468
-
25469
- if (nextElement === prevElement && context === internalInstance._context) {
25470
- // Since elements are immutable after the owner is rendered,
25471
- // we can do a cheap identity compare here to determine if this is a
25472
- // superfluous reconcile. It's possible for state to be mutable but such
25473
- // change should trigger an update of the owner which would recreate
25474
- // the element. We explicitly check for the existence of an owner since
25475
- // it's possible for an element created outside a composite to be
25476
- // deeply mutated and reused.
25477
-
25478
- // TODO: Bailing out early is just a perf optimization right?
25479
- // TODO: Removing the return statement should affect correctness?
25480
- return;
25481
- }
25482
-
25483
- var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement);
25484
-
25485
- if (refsChanged) {
25486
- ReactRef.detachRefs(internalInstance, prevElement);
25487
- }
25488
-
25489
- internalInstance.receiveComponent(nextElement, transaction, context);
25490
-
25491
- if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) {
25492
- transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
25493
- }
25494
- },
25495
-
25496
- /**
25497
- * Flush any dirty changes in a component.
25498
- *
25499
- * @param {ReactComponent} internalInstance
25500
- * @param {ReactReconcileTransaction} transaction
25501
- * @internal
25502
- */
25503
- performUpdateIfNecessary: function (internalInstance, transaction) {
25504
- internalInstance.performUpdateIfNecessary(transaction);
25505
- }
25506
-
25507
- };
25508
-
25509
- module.exports = ReactReconciler;
25510
- },{"./ReactRef":109}],109:[function(require,module,exports){
25511
- /**
25512
- * Copyright 2013-2015, Facebook, Inc.
25513
- * All rights reserved.
25514
- *
25515
- * This source code is licensed under the BSD-style license found in the
25516
- * LICENSE file in the root directory of this source tree. An additional grant
25517
- * of patent rights can be found in the PATENTS file in the same directory.
25518
- *
25519
- * @providesModule ReactRef
25520
- */
25521
-
25522
- 'use strict';
25523
-
25524
- var ReactOwner = require('./ReactOwner');
25525
-
25526
- var ReactRef = {};
25527
-
25528
- function attachRef(ref, component, owner) {
25529
- if (typeof ref === 'function') {
25530
- ref(component.getPublicInstance());
25531
- } else {
25532
- // Legacy ref
25533
- ReactOwner.addComponentAsRefTo(component, ref, owner);
25534
- }
25535
- }
25536
-
25537
- function detachRef(ref, component, owner) {
25538
- if (typeof ref === 'function') {
25539
- ref(null);
25540
- } else {
25541
- // Legacy ref
25542
- ReactOwner.removeComponentAsRefFrom(component, ref, owner);
25543
- }
25544
- }
25545
-
25546
- ReactRef.attachRefs = function (instance, element) {
25547
- if (element === null || element === false) {
25548
- return;
25549
- }
25550
- var ref = element.ref;
25551
- if (ref != null) {
25552
- attachRef(ref, instance, element._owner);
25553
- }
25554
- };
25555
-
25556
- ReactRef.shouldUpdateRefs = function (prevElement, nextElement) {
25557
- // If either the owner or a `ref` has changed, make sure the newest owner
25558
- // has stored a reference to `this`, and the previous owner (if different)
25559
- // has forgotten the reference to `this`. We use the element instead
25560
- // of the public this.props because the post processing cannot determine
25561
- // a ref. The ref conceptually lives on the element.
25562
-
25563
- // TODO: Should this even be possible? The owner cannot change because
25564
- // it's forbidden by shouldUpdateReactComponent. The ref can change
25565
- // if you swap the keys of but not the refs. Reconsider where this check
25566
- // is made. It probably belongs where the key checking and
25567
- // instantiateReactComponent is done.
25568
-
25569
- var prevEmpty = prevElement === null || prevElement === false;
25570
- var nextEmpty = nextElement === null || nextElement === false;
25571
-
25572
- return(
25573
- // This has a few false positives w/r/t empty components.
25574
- prevEmpty || nextEmpty || nextElement._owner !== prevElement._owner || nextElement.ref !== prevElement.ref
25575
- );
25576
- };
25577
-
25578
- ReactRef.detachRefs = function (instance, element) {
25579
- if (element === null || element === false) {
25580
- return;
25581
- }
25582
- var ref = element.ref;
25583
- if (ref != null) {
25584
- detachRef(ref, instance, element._owner);
25585
- }
25586
- };
25587
-
25588
- module.exports = ReactRef;
25589
- },{"./ReactOwner":102}],110:[function(require,module,exports){
25590
- /**
25591
- * Copyright 2013-2015, Facebook, Inc.
25592
- * All rights reserved.
25593
- *
25594
- * This source code is licensed under the BSD-style license found in the
25595
- * LICENSE file in the root directory of this source tree. An additional grant
25596
- * of patent rights can be found in the PATENTS file in the same directory.
25597
- *
25598
- * @providesModule ReactRootIndex
25599
- * @typechecks
25600
- */
25601
-
25602
- 'use strict';
25603
-
25604
- var ReactRootIndexInjection = {
25605
- /**
25606
- * @param {function} _createReactRootIndex
25607
- */
25608
- injectCreateReactRootIndex: function (_createReactRootIndex) {
25609
- ReactRootIndex.createReactRootIndex = _createReactRootIndex;
25610
- }
25611
- };
25612
-
25613
- var ReactRootIndex = {
25614
- createReactRootIndex: null,
25615
- injection: ReactRootIndexInjection
25616
- };
25617
-
25618
- module.exports = ReactRootIndex;
25619
- },{}],111:[function(require,module,exports){
25620
- /**
25621
- * Copyright 2014-2015, Facebook, Inc.
25622
- * All rights reserved.
25623
- *
25624
- * This source code is licensed under the BSD-style license found in the
25625
- * LICENSE file in the root directory of this source tree. An additional grant
25626
- * of patent rights can be found in the PATENTS file in the same directory.
25627
- *
25628
- * @providesModule ReactServerBatchingStrategy
25629
- * @typechecks
25630
- */
25631
-
25632
- 'use strict';
25633
-
25634
- var ReactServerBatchingStrategy = {
25635
- isBatchingUpdates: false,
25636
- batchedUpdates: function (callback) {
25637
- // Don't do anything here. During the server rendering we don't want to
25638
- // schedule any updates. We will simply ignore them.
25639
- }
25640
- };
25641
-
25642
- module.exports = ReactServerBatchingStrategy;
25643
- },{}],112:[function(require,module,exports){
25644
- (function (process){
25645
- /**
25646
- * Copyright 2013-2015, Facebook, Inc.
25647
- * All rights reserved.
25648
- *
25649
- * This source code is licensed under the BSD-style license found in the
25650
- * LICENSE file in the root directory of this source tree. An additional grant
25651
- * of patent rights can be found in the PATENTS file in the same directory.
25652
- *
25653
- * @typechecks static-only
25654
- * @providesModule ReactServerRendering
25655
- */
25656
- 'use strict';
25657
-
25658
- var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
25659
- var ReactElement = require('./ReactElement');
25660
- var ReactInstanceHandles = require('./ReactInstanceHandles');
25661
- var ReactMarkupChecksum = require('./ReactMarkupChecksum');
25662
- var ReactServerBatchingStrategy = require('./ReactServerBatchingStrategy');
25663
- var ReactServerRenderingTransaction = require('./ReactServerRenderingTransaction');
25664
- var ReactUpdates = require('./ReactUpdates');
25665
-
25666
- var emptyObject = require('fbjs/lib/emptyObject');
25667
- var instantiateReactComponent = require('./instantiateReactComponent');
25668
- var invariant = require('fbjs/lib/invariant');
25669
-
25670
- /**
25671
- * @param {ReactElement} element
25672
- * @return {string} the HTML markup
25673
- */
25674
- function renderToString(element) {
25675
- !ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : invariant(false) : undefined;
25676
-
25677
- var transaction;
25678
- try {
25679
- ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
25680
-
25681
- var id = ReactInstanceHandles.createReactRootID();
25682
- transaction = ReactServerRenderingTransaction.getPooled(false);
25683
-
25684
- return transaction.perform(function () {
25685
- var componentInstance = instantiateReactComponent(element, null);
25686
- var markup = componentInstance.mountComponent(id, transaction, emptyObject);
25687
- return ReactMarkupChecksum.addChecksumToMarkup(markup);
25688
- }, null);
25689
- } finally {
25690
- ReactServerRenderingTransaction.release(transaction);
25691
- // Revert to the DOM batching strategy since these two renderers
25692
- // currently share these stateful modules.
25693
- ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
25694
- }
25695
- }
25696
-
25697
- /**
25698
- * @param {ReactElement} element
25699
- * @return {string} the HTML markup, without the extra React ID and checksum
25700
- * (for generating static pages)
25701
- */
25702
- function renderToStaticMarkup(element) {
25703
- !ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') : invariant(false) : undefined;
25704
-
25705
- var transaction;
25706
- try {
25707
- ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
25708
-
25709
- var id = ReactInstanceHandles.createReactRootID();
25710
- transaction = ReactServerRenderingTransaction.getPooled(true);
25711
-
25712
- return transaction.perform(function () {
25713
- var componentInstance = instantiateReactComponent(element, null);
25714
- return componentInstance.mountComponent(id, transaction, emptyObject);
25715
- }, null);
25716
- } finally {
25717
- ReactServerRenderingTransaction.release(transaction);
25718
- // Revert to the DOM batching strategy since these two renderers
25719
- // currently share these stateful modules.
25720
- ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
25721
- }
25722
- }
25723
-
25724
- module.exports = {
25725
- renderToString: renderToString,
25726
- renderToStaticMarkup: renderToStaticMarkup
25727
- };
25728
- }).call(this,require('_process'))
25729
-
25730
- },{"./ReactDefaultBatchingStrategy":80,"./ReactElement":84,"./ReactInstanceHandles":93,"./ReactMarkupChecksum":96,"./ReactServerBatchingStrategy":111,"./ReactServerRenderingTransaction":113,"./ReactUpdates":115,"./instantiateReactComponent":150,"_process":31,"fbjs/lib/emptyObject":11,"fbjs/lib/invariant":18}],113:[function(require,module,exports){
25731
- /**
25732
- * Copyright 2014-2015, Facebook, Inc.
25733
- * All rights reserved.
25734
- *
25735
- * This source code is licensed under the BSD-style license found in the
25736
- * LICENSE file in the root directory of this source tree. An additional grant
25737
- * of patent rights can be found in the PATENTS file in the same directory.
25738
- *
25739
- * @providesModule ReactServerRenderingTransaction
25740
- * @typechecks
25741
- */
25742
-
25743
- 'use strict';
25744
-
25745
- var PooledClass = require('./PooledClass');
25746
- var CallbackQueue = require('./CallbackQueue');
25747
- var Transaction = require('./Transaction');
25748
-
25749
- var assign = require('./Object.assign');
25750
- var emptyFunction = require('fbjs/lib/emptyFunction');
25751
-
25752
- /**
25753
- * Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks
25754
- * during the performing of the transaction.
25755
- */
25756
- var ON_DOM_READY_QUEUEING = {
25757
- /**
25758
- * Initializes the internal `onDOMReady` queue.
25759
- */
25760
- initialize: function () {
25761
- this.reactMountReady.reset();
25762
- },
25763
-
25764
- close: emptyFunction
25765
- };
25766
-
25767
- /**
25768
- * Executed within the scope of the `Transaction` instance. Consider these as
25769
- * being member methods, but with an implied ordering while being isolated from
25770
- * each other.
25771
- */
25772
- var TRANSACTION_WRAPPERS = [ON_DOM_READY_QUEUEING];
25773
-
25774
- /**
25775
- * @class ReactServerRenderingTransaction
25776
- * @param {boolean} renderToStaticMarkup
25777
- */
25778
- function ReactServerRenderingTransaction(renderToStaticMarkup) {
25779
- this.reinitializeTransaction();
25780
- this.renderToStaticMarkup = renderToStaticMarkup;
25781
- this.reactMountReady = CallbackQueue.getPooled(null);
25782
- this.useCreateElement = false;
25783
- }
25784
-
25785
- var Mixin = {
25786
- /**
25787
- * @see Transaction
25788
- * @abstract
25789
- * @final
25790
- * @return {array} Empty list of operation wrap procedures.
25791
- */
25792
- getTransactionWrappers: function () {
25793
- return TRANSACTION_WRAPPERS;
25794
- },
25795
-
25796
- /**
25797
- * @return {object} The queue to collect `onDOMReady` callbacks with.
25798
- */
25799
- getReactMountReady: function () {
25800
- return this.reactMountReady;
25801
- },
25802
-
25803
- /**
25804
- * `PooledClass` looks for this, and will invoke this before allowing this
25805
- * instance to be reused.
25806
- */
25807
- destructor: function () {
25808
- CallbackQueue.release(this.reactMountReady);
25809
- this.reactMountReady = null;
25810
- }
25811
- };
25812
-
25813
- assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin);
25814
-
25815
- PooledClass.addPoolingTo(ReactServerRenderingTransaction);
25816
-
25817
- module.exports = ReactServerRenderingTransaction;
25818
- },{"./CallbackQueue":37,"./Object.assign":54,"./PooledClass":55,"./Transaction":132,"fbjs/lib/emptyFunction":10}],114:[function(require,module,exports){
25819
- (function (process){
25820
- /**
25821
- * Copyright 2015, Facebook, Inc.
25822
- * All rights reserved.
25823
- *
25824
- * This source code is licensed under the BSD-style license found in the
25825
- * LICENSE file in the root directory of this source tree. An additional grant
25826
- * of patent rights can be found in the PATENTS file in the same directory.
25827
- *
25828
- * @providesModule ReactUpdateQueue
25829
- */
25830
-
25831
- 'use strict';
25832
-
25833
- var ReactCurrentOwner = require('./ReactCurrentOwner');
25834
- var ReactElement = require('./ReactElement');
25835
- var ReactInstanceMap = require('./ReactInstanceMap');
25836
- var ReactUpdates = require('./ReactUpdates');
25837
-
25838
- var assign = require('./Object.assign');
25839
- var invariant = require('fbjs/lib/invariant');
25840
- var warning = require('fbjs/lib/warning');
25841
-
25842
- function enqueueUpdate(internalInstance) {
25843
- ReactUpdates.enqueueUpdate(internalInstance);
25844
- }
25845
-
25846
- function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
25847
- var internalInstance = ReactInstanceMap.get(publicInstance);
25848
- if (!internalInstance) {
25849
- if (process.env.NODE_ENV !== 'production') {
25850
- // Only warn when we have a callerName. Otherwise we should be silent.
25851
- // We're probably calling from enqueueCallback. We don't want to warn
25852
- // there because we already warned for the corresponding lifecycle method.
25853
- process.env.NODE_ENV !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor.displayName) : undefined;
25854
- }
25855
- return null;
25856
- }
25857
-
25858
- if (process.env.NODE_ENV !== 'production') {
25859
- process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition ' + '(such as within `render`). Render methods should be a pure function ' + 'of props and state.', callerName) : undefined;
25860
- }
25861
-
25862
- return internalInstance;
25863
- }
25864
-
25865
- /**
25866
- * ReactUpdateQueue allows for state updates to be scheduled into a later
25867
- * reconciliation step.
25868
- */
25869
- var ReactUpdateQueue = {
25870
-
25871
- /**
25872
- * Checks whether or not this composite component is mounted.
25873
- * @param {ReactClass} publicInstance The instance we want to test.
25874
- * @return {boolean} True if mounted, false otherwise.
25875
- * @protected
25876
- * @final
25877
- */
25878
- isMounted: function (publicInstance) {
25879
- if (process.env.NODE_ENV !== 'production') {
25880
- var owner = ReactCurrentOwner.current;
25881
- if (owner !== null) {
25882
- process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
25883
- owner._warnedAboutRefsInRender = true;
25884
- }
25885
- }
25886
- var internalInstance = ReactInstanceMap.get(publicInstance);
25887
- if (internalInstance) {
25888
- // During componentWillMount and render this will still be null but after
25889
- // that will always render to something. At least for now. So we can use
25890
- // this hack.
25891
- return !!internalInstance._renderedComponent;
25892
- } else {
25893
- return false;
25894
- }
25895
- },
25896
-
25897
- /**
25898
- * Enqueue a callback that will be executed after all the pending updates
25899
- * have processed.
25900
- *
25901
- * @param {ReactClass} publicInstance The instance to use as `this` context.
25902
- * @param {?function} callback Called after state is updated.
25903
- * @internal
25904
- */
25905
- enqueueCallback: function (publicInstance, callback) {
25906
- !(typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
25907
- var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
25908
-
25909
- // Previously we would throw an error if we didn't have an internal
25910
- // instance. Since we want to make it a no-op instead, we mirror the same
25911
- // behavior we have in other enqueue* methods.
25912
- // We also need to ignore callbacks in componentWillMount. See
25913
- // enqueueUpdates.
25914
- if (!internalInstance) {
25915
- return null;
25916
- }
25917
-
25918
- if (internalInstance._pendingCallbacks) {
25919
- internalInstance._pendingCallbacks.push(callback);
25920
- } else {
25921
- internalInstance._pendingCallbacks = [callback];
25922
- }
25923
- // TODO: The callback here is ignored when setState is called from
25924
- // componentWillMount. Either fix it or disallow doing so completely in
25925
- // favor of getInitialState. Alternatively, we can disallow
25926
- // componentWillMount during server-side rendering.
25927
- enqueueUpdate(internalInstance);
25928
- },
25929
-
25930
- enqueueCallbackInternal: function (internalInstance, callback) {
25931
- !(typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
25932
- if (internalInstance._pendingCallbacks) {
25933
- internalInstance._pendingCallbacks.push(callback);
25934
- } else {
25935
- internalInstance._pendingCallbacks = [callback];
25936
- }
25937
- enqueueUpdate(internalInstance);
25938
- },
25939
-
25940
- /**
25941
- * Forces an update. This should only be invoked when it is known with
25942
- * certainty that we are **not** in a DOM transaction.
25943
- *
25944
- * You may want to call this when you know that some deeper aspect of the
25945
- * component's state has changed but `setState` was not called.
25946
- *
25947
- * This will not invoke `shouldComponentUpdate`, but it will invoke
25948
- * `componentWillUpdate` and `componentDidUpdate`.
25949
- *
25950
- * @param {ReactClass} publicInstance The instance that should rerender.
25951
- * @internal
25952
- */
25953
- enqueueForceUpdate: function (publicInstance) {
25954
- var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate');
25955
-
25956
- if (!internalInstance) {
25957
- return;
25958
- }
25959
-
25960
- internalInstance._pendingForceUpdate = true;
25961
-
25962
- enqueueUpdate(internalInstance);
25963
- },
25964
-
25965
- /**
25966
- * Replaces all of the state. Always use this or `setState` to mutate state.
25967
- * You should treat `this.state` as immutable.
25968
- *
25969
- * There is no guarantee that `this.state` will be immediately updated, so
25970
- * accessing `this.state` after calling this method may return the old value.
25971
- *
25972
- * @param {ReactClass} publicInstance The instance that should rerender.
25973
- * @param {object} completeState Next state.
25974
- * @internal
25975
- */
25976
- enqueueReplaceState: function (publicInstance, completeState) {
25977
- var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState');
25978
-
25979
- if (!internalInstance) {
25980
- return;
25981
- }
25982
-
25983
- internalInstance._pendingStateQueue = [completeState];
25984
- internalInstance._pendingReplaceState = true;
25985
-
25986
- enqueueUpdate(internalInstance);
25987
- },
25988
-
25989
- /**
25990
- * Sets a subset of the state. This only exists because _pendingState is
25991
- * internal. This provides a merging strategy that is not available to deep
25992
- * properties which is confusing. TODO: Expose pendingState or don't use it
25993
- * during the merge.
25994
- *
25995
- * @param {ReactClass} publicInstance The instance that should rerender.
25996
- * @param {object} partialState Next partial state to be merged with state.
25997
- * @internal
25998
- */
25999
- enqueueSetState: function (publicInstance, partialState) {
26000
- var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState');
26001
-
26002
- if (!internalInstance) {
26003
- return;
26004
- }
26005
-
26006
- var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []);
26007
- queue.push(partialState);
26008
-
26009
- enqueueUpdate(internalInstance);
26010
- },
26011
-
26012
- /**
26013
- * Sets a subset of the props.
26014
- *
26015
- * @param {ReactClass} publicInstance The instance that should rerender.
26016
- * @param {object} partialProps Subset of the next props.
26017
- * @internal
26018
- */
26019
- enqueueSetProps: function (publicInstance, partialProps) {
26020
- var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setProps');
26021
- if (!internalInstance) {
26022
- return;
26023
- }
26024
- ReactUpdateQueue.enqueueSetPropsInternal(internalInstance, partialProps);
26025
- },
26026
-
26027
- enqueueSetPropsInternal: function (internalInstance, partialProps) {
26028
- var topLevelWrapper = internalInstance._topLevelWrapper;
26029
- !topLevelWrapper ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setProps(...): You called `setProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
26030
-
26031
- // Merge with the pending element if it exists, otherwise with existing
26032
- // element props.
26033
- var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
26034
- var element = wrapElement.props;
26035
- var props = assign({}, element.props, partialProps);
26036
- topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
26037
-
26038
- enqueueUpdate(topLevelWrapper);
26039
- },
26040
-
26041
- /**
26042
- * Replaces all of the props.
26043
- *
26044
- * @param {ReactClass} publicInstance The instance that should rerender.
26045
- * @param {object} props New props.
26046
- * @internal
26047
- */
26048
- enqueueReplaceProps: function (publicInstance, props) {
26049
- var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceProps');
26050
- if (!internalInstance) {
26051
- return;
26052
- }
26053
- ReactUpdateQueue.enqueueReplacePropsInternal(internalInstance, props);
26054
- },
26055
-
26056
- enqueueReplacePropsInternal: function (internalInstance, props) {
26057
- var topLevelWrapper = internalInstance._topLevelWrapper;
26058
- !topLevelWrapper ? process.env.NODE_ENV !== 'production' ? invariant(false, 'replaceProps(...): You called `replaceProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
26059
-
26060
- // Merge with the pending element if it exists, otherwise with existing
26061
- // element props.
26062
- var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
26063
- var element = wrapElement.props;
26064
- topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
26065
-
26066
- enqueueUpdate(topLevelWrapper);
26067
- },
26068
-
26069
- enqueueElementInternal: function (internalInstance, newElement) {
26070
- internalInstance._pendingElement = newElement;
26071
- enqueueUpdate(internalInstance);
26072
- }
26073
-
26074
- };
26075
-
26076
- module.exports = ReactUpdateQueue;
26077
- }).call(this,require('_process'))
26078
-
26079
- },{"./Object.assign":54,"./ReactCurrentOwner":66,"./ReactElement":84,"./ReactInstanceMap":94,"./ReactUpdates":115,"_process":31,"fbjs/lib/invariant":18,"fbjs/lib/warning":29}],115:[function(require,module,exports){
26080
- (function (process){
26081
- /**
26082
- * Copyright 2013-2015, Facebook, Inc.
26083
- * All rights reserved.
26084
- *
26085
- * This source code is licensed under the BSD-style license found in the
26086
- * LICENSE file in the root directory of this source tree. An additional grant
26087
- * of patent rights can be found in the PATENTS file in the same directory.
26088
- *
26089
- * @providesModule ReactUpdates
26090
- */
26091
-
26092
- 'use strict';
26093
-
26094
- var CallbackQueue = require('./CallbackQueue');
26095
- var PooledClass = require('./PooledClass');
26096
- var ReactPerf = require('./ReactPerf');
26097
- var ReactReconciler = require('./ReactReconciler');
26098
- var Transaction = require('./Transaction');
26099
-
26100
- var assign = require('./Object.assign');
26101
- var invariant = require('fbjs/lib/invariant');
26102
-
26103
- var dirtyComponents = [];
26104
- var asapCallbackQueue = CallbackQueue.getPooled();
26105
- var asapEnqueued = false;
26106
-
26107
- var batchingStrategy = null;
26108
-
26109
- function ensureInjected() {
26110
- !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching ' + 'strategy') : invariant(false) : undefined;
26111
- }
26112
-
26113
- var NESTED_UPDATES = {
26114
- initialize: function () {
26115
- this.dirtyComponentsLength = dirtyComponents.length;
26116
- },
26117
- close: function () {
26118
- if (this.dirtyComponentsLength !== dirtyComponents.length) {
26119
- // Additional updates were enqueued by componentDidUpdate handlers or
26120
- // similar; before our own UPDATE_QUEUEING wrapper closes, we want to run
26121
- // these new updates so that if A's componentDidUpdate calls setState on
26122
- // B, B will update before the callback A's updater provided when calling
26123
- // setState.
26124
- dirtyComponents.splice(0, this.dirtyComponentsLength);
26125
- flushBatchedUpdates();
26126
- } else {
26127
- dirtyComponents.length = 0;
26128
- }
26129
- }
26130
- };
26131
-
26132
- var UPDATE_QUEUEING = {
26133
- initialize: function () {
26134
- this.callbackQueue.reset();
26135
- },
26136
- close: function () {
26137
- this.callbackQueue.notifyAll();
26138
- }
26139
- };
26140
-
26141
- var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING];
26142
-
26143
- function ReactUpdatesFlushTransaction() {
26144
- this.reinitializeTransaction();
26145
- this.dirtyComponentsLength = null;
26146
- this.callbackQueue = CallbackQueue.getPooled();
26147
- this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled( /* forceHTML */false);
26148
- }
26149
-
26150
- assign(ReactUpdatesFlushTransaction.prototype, Transaction.Mixin, {
26151
- getTransactionWrappers: function () {
26152
- return TRANSACTION_WRAPPERS;
26153
- },
26154
-
26155
- destructor: function () {
26156
- this.dirtyComponentsLength = null;
26157
- CallbackQueue.release(this.callbackQueue);
26158
- this.callbackQueue = null;
26159
- ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);
26160
- this.reconcileTransaction = null;
26161
- },
26162
-
26163
- perform: function (method, scope, a) {
26164
- // Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
26165
- // with this transaction's wrappers around it.
26166
- return Transaction.Mixin.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a);
26167
- }
26168
- });
26169
-
26170
- PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
26171
-
26172
- function batchedUpdates(callback, a, b, c, d, e) {
26173
- ensureInjected();
26174
- batchingStrategy.batchedUpdates(callback, a, b, c, d, e);
26175
- }
26176
-
26177
- /**
26178
- * Array comparator for ReactComponents by mount ordering.
26179
- *
26180
- * @param {ReactComponent} c1 first component you're comparing
26181
- * @param {ReactComponent} c2 second component you're comparing
26182
- * @return {number} Return value usable by Array.prototype.sort().
26183
- */
26184
- function mountOrderComparator(c1, c2) {
26185
- return c1._mountOrder - c2._mountOrder;
26186
- }
26187
-
26188
- function runBatchedUpdates(transaction) {
26189
- var len = transaction.dirtyComponentsLength;
26190
- !(len === dirtyComponents.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to ' + 'match dirty-components array length (%s).', len, dirtyComponents.length) : invariant(false) : undefined;
26191
-
26192
- // Since reconciling a component higher in the owner hierarchy usually (not
26193
- // always -- see shouldComponentUpdate()) will reconcile children, reconcile
26194
- // them before their children by sorting the array.
26195
- dirtyComponents.sort(mountOrderComparator);
26196
-
26197
- for (var i = 0; i < len; i++) {
26198
- // If a component is unmounted before pending changes apply, it will still
26199
- // be here, but we assume that it has cleared its _pendingCallbacks and
26200
- // that performUpdateIfNecessary is a noop.
26201
- var component = dirtyComponents[i];
26202
-
26203
- // If performUpdateIfNecessary happens to enqueue any new updates, we
26204
- // shouldn't execute the callbacks until the next render happens, so
26205
- // stash the callbacks first
26206
- var callbacks = component._pendingCallbacks;
26207
- component._pendingCallbacks = null;
26208
-
26209
- ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction);
26210
-
26211
- if (callbacks) {
26212
- for (var j = 0; j < callbacks.length; j++) {
26213
- transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance());
26214
- }
26215
- }
26216
- }
26217
- }
26218
-
26219
- var flushBatchedUpdates = function () {
26220
- // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
26221
- // array and perform any updates enqueued by mount-ready handlers (i.e.,
26222
- // componentDidUpdate) but we need to check here too in order to catch
26223
- // updates enqueued by setState callbacks and asap calls.
26224
- while (dirtyComponents.length || asapEnqueued) {
26225
- if (dirtyComponents.length) {
26226
- var transaction = ReactUpdatesFlushTransaction.getPooled();
26227
- transaction.perform(runBatchedUpdates, null, transaction);
26228
- ReactUpdatesFlushTransaction.release(transaction);
26229
- }
26230
-
26231
- if (asapEnqueued) {
26232
- asapEnqueued = false;
26233
- var queue = asapCallbackQueue;
26234
- asapCallbackQueue = CallbackQueue.getPooled();
26235
- queue.notifyAll();
26236
- CallbackQueue.release(queue);
26237
- }
26238
- }
26239
- };
26240
- flushBatchedUpdates = ReactPerf.measure('ReactUpdates', 'flushBatchedUpdates', flushBatchedUpdates);
26241
-
26242
- /**
26243
- * Mark a component as needing a rerender, adding an optional callback to a
26244
- * list of functions which will be executed once the rerender occurs.
26245
- */
26246
- function enqueueUpdate(component) {
26247
- ensureInjected();
26248
-
26249
- // Various parts of our code (such as ReactCompositeComponent's
26250
- // _renderValidatedComponent) assume that calls to render aren't nested;
26251
- // verify that that's the case. (This is called by each top-level update
26252
- // function, like setProps, setState, forceUpdate, etc.; creation and
26253
- // destruction of top-level components is guarded in ReactMount.)
26254
-
26255
- if (!batchingStrategy.isBatchingUpdates) {
26256
- batchingStrategy.batchedUpdates(enqueueUpdate, component);
26257
- return;
26258
- }
26259
-
26260
- dirtyComponents.push(component);
26261
- }
26262
-
26263
- /**
26264
- * Enqueue a callback to be run at the end of the current batching cycle. Throws
26265
- * if no updates are currently being performed.
26266
- */
26267
- function asap(callback, context) {
26268
- !batchingStrategy.isBatchingUpdates ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + 'updates are not being batched.') : invariant(false) : undefined;
26269
- asapCallbackQueue.enqueue(callback, context);
26270
- asapEnqueued = true;
26271
- }
26272
-
26273
- var ReactUpdatesInjection = {
26274
- injectReconcileTransaction: function (ReconcileTransaction) {
26275
- !ReconcileTransaction ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : invariant(false) : undefined;
26276
- ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
26277
- },
26278
-
26279
- injectBatchingStrategy: function (_batchingStrategy) {
26280
- !_batchingStrategy ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : invariant(false) : undefined;
26281
- !(typeof _batchingStrategy.batchedUpdates === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : invariant(false) : undefined;
26282
- !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : invariant(false) : undefined;
26283
- batchingStrategy = _batchingStrategy;
26284
- }
26285
- };
26286
-
26287
- var ReactUpdates = {
26288
- /**
26289
- * React references `ReactReconcileTransaction` using this property in order
26290
- * to allow dependency injection.
26291
- *
26292
- * @internal
26293
- */
26294
- ReactReconcileTransaction: null,
26295
-
26296
- batchedUpdates: batchedUpdates,
26297
- enqueueUpdate: enqueueUpdate,
26298
- flushBatchedUpdates: flushBatchedUpdates,
26299
- injection: ReactUpdatesInjection,
26300
- asap: asap
26301
- };
26302
-
26303
- module.exports = ReactUpdates;
26304
- }).call(this,require('_process'))
26305
-
26306
- },{"./CallbackQueue":37,"./Object.assign":54,"./PooledClass":55,"./ReactPerf":103,"./ReactReconciler":108,"./Transaction":132,"_process":31,"fbjs/lib/invariant":18}],116:[function(require,module,exports){
26307
- /**
26308
- * Copyright 2013-2015, Facebook, Inc.
26309
- * All rights reserved.
26310
- *
26311
- * This source code is licensed under the BSD-style license found in the
26312
- * LICENSE file in the root directory of this source tree. An additional grant
26313
- * of patent rights can be found in the PATENTS file in the same directory.
26314
- *
26315
- * @providesModule ReactVersion
26316
- */
26317
-
26318
- 'use strict';
26319
-
26320
- module.exports = '0.14.8';
26321
- },{}],117:[function(require,module,exports){
26322
- /**
26323
- * Copyright 2013-2015, Facebook, Inc.
26324
- * All rights reserved.
26325
- *
26326
- * This source code is licensed under the BSD-style license found in the
26327
- * LICENSE file in the root directory of this source tree. An additional grant
26328
- * of patent rights can be found in the PATENTS file in the same directory.
26329
- *
26330
- * @providesModule SVGDOMPropertyConfig
26331
- */
26332
-
26333
- 'use strict';
26334
-
26335
- var DOMProperty = require('./DOMProperty');
26336
-
26337
- var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
26338
-
26339
- var NS = {
26340
- xlink: 'http://www.w3.org/1999/xlink',
26341
- xml: 'http://www.w3.org/XML/1998/namespace'
26342
- };
26343
-
26344
- var SVGDOMPropertyConfig = {
26345
- Properties: {
26346
- clipPath: MUST_USE_ATTRIBUTE,
26347
- cx: MUST_USE_ATTRIBUTE,
26348
- cy: MUST_USE_ATTRIBUTE,
26349
- d: MUST_USE_ATTRIBUTE,
26350
- dx: MUST_USE_ATTRIBUTE,
26351
- dy: MUST_USE_ATTRIBUTE,
26352
- fill: MUST_USE_ATTRIBUTE,
26353
- fillOpacity: MUST_USE_ATTRIBUTE,
26354
- fontFamily: MUST_USE_ATTRIBUTE,
26355
- fontSize: MUST_USE_ATTRIBUTE,
26356
- fx: MUST_USE_ATTRIBUTE,
26357
- fy: MUST_USE_ATTRIBUTE,
26358
- gradientTransform: MUST_USE_ATTRIBUTE,
26359
- gradientUnits: MUST_USE_ATTRIBUTE,
26360
- markerEnd: MUST_USE_ATTRIBUTE,
26361
- markerMid: MUST_USE_ATTRIBUTE,
26362
- markerStart: MUST_USE_ATTRIBUTE,
26363
- offset: MUST_USE_ATTRIBUTE,
26364
- opacity: MUST_USE_ATTRIBUTE,
26365
- patternContentUnits: MUST_USE_ATTRIBUTE,
26366
- patternUnits: MUST_USE_ATTRIBUTE,
26367
- points: MUST_USE_ATTRIBUTE,
26368
- preserveAspectRatio: MUST_USE_ATTRIBUTE,
26369
- r: MUST_USE_ATTRIBUTE,
26370
- rx: MUST_USE_ATTRIBUTE,
26371
- ry: MUST_USE_ATTRIBUTE,
26372
- spreadMethod: MUST_USE_ATTRIBUTE,
26373
- stopColor: MUST_USE_ATTRIBUTE,
26374
- stopOpacity: MUST_USE_ATTRIBUTE,
26375
- stroke: MUST_USE_ATTRIBUTE,
26376
- strokeDasharray: MUST_USE_ATTRIBUTE,
26377
- strokeLinecap: MUST_USE_ATTRIBUTE,
26378
- strokeOpacity: MUST_USE_ATTRIBUTE,
26379
- strokeWidth: MUST_USE_ATTRIBUTE,
26380
- textAnchor: MUST_USE_ATTRIBUTE,
26381
- transform: MUST_USE_ATTRIBUTE,
26382
- version: MUST_USE_ATTRIBUTE,
26383
- viewBox: MUST_USE_ATTRIBUTE,
26384
- x1: MUST_USE_ATTRIBUTE,
26385
- x2: MUST_USE_ATTRIBUTE,
26386
- x: MUST_USE_ATTRIBUTE,
26387
- xlinkActuate: MUST_USE_ATTRIBUTE,
26388
- xlinkArcrole: MUST_USE_ATTRIBUTE,
26389
- xlinkHref: MUST_USE_ATTRIBUTE,
26390
- xlinkRole: MUST_USE_ATTRIBUTE,
26391
- xlinkShow: MUST_USE_ATTRIBUTE,
26392
- xlinkTitle: MUST_USE_ATTRIBUTE,
26393
- xlinkType: MUST_USE_ATTRIBUTE,
26394
- xmlBase: MUST_USE_ATTRIBUTE,
26395
- xmlLang: MUST_USE_ATTRIBUTE,
26396
- xmlSpace: MUST_USE_ATTRIBUTE,
26397
- y1: MUST_USE_ATTRIBUTE,
26398
- y2: MUST_USE_ATTRIBUTE,
26399
- y: MUST_USE_ATTRIBUTE
26400
- },
26401
- DOMAttributeNamespaces: {
26402
- xlinkActuate: NS.xlink,
26403
- xlinkArcrole: NS.xlink,
26404
- xlinkHref: NS.xlink,
26405
- xlinkRole: NS.xlink,
26406
- xlinkShow: NS.xlink,
26407
- xlinkTitle: NS.xlink,
26408
- xlinkType: NS.xlink,
26409
- xmlBase: NS.xml,
26410
- xmlLang: NS.xml,
26411
- xmlSpace: NS.xml
26412
- },
26413
- DOMAttributeNames: {
26414
- clipPath: 'clip-path',
26415
- fillOpacity: 'fill-opacity',
26416
- fontFamily: 'font-family',
26417
- fontSize: 'font-size',
26418
- gradientTransform: 'gradientTransform',
26419
- gradientUnits: 'gradientUnits',
26420
- markerEnd: 'marker-end',
26421
- markerMid: 'marker-mid',
26422
- markerStart: 'marker-start',
26423
- patternContentUnits: 'patternContentUnits',
26424
- patternUnits: 'patternUnits',
26425
- preserveAspectRatio: 'preserveAspectRatio',
26426
- spreadMethod: 'spreadMethod',
26427
- stopColor: 'stop-color',
26428
- stopOpacity: 'stop-opacity',
26429
- strokeDasharray: 'stroke-dasharray',
26430
- strokeLinecap: 'stroke-linecap',
26431
- strokeOpacity: 'stroke-opacity',
26432
- strokeWidth: 'stroke-width',
26433
- textAnchor: 'text-anchor',
26434
- viewBox: 'viewBox',
26435
- xlinkActuate: 'xlink:actuate',
26436
- xlinkArcrole: 'xlink:arcrole',
26437
- xlinkHref: 'xlink:href',
26438
- xlinkRole: 'xlink:role',
26439
- xlinkShow: 'xlink:show',
26440
- xlinkTitle: 'xlink:title',
26441
- xlinkType: 'xlink:type',
26442
- xmlBase: 'xml:base',
26443
- xmlLang: 'xml:lang',
26444
- xmlSpace: 'xml:space'
26445
- }
26446
- };
26447
-
26448
- module.exports = SVGDOMPropertyConfig;
26449
- },{"./DOMProperty":41}],118:[function(require,module,exports){
26450
- /**
26451
- * Copyright 2013-2015, Facebook, Inc.
26452
- * All rights reserved.
26453
- *
26454
- * This source code is licensed under the BSD-style license found in the
26455
- * LICENSE file in the root directory of this source tree. An additional grant
26456
- * of patent rights can be found in the PATENTS file in the same directory.
26457
- *
26458
- * @providesModule SelectEventPlugin
26459
- */
26460
-
26461
- 'use strict';
26462
-
26463
- var EventConstants = require('./EventConstants');
26464
- var EventPropagators = require('./EventPropagators');
26465
- var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
26466
- var ReactInputSelection = require('./ReactInputSelection');
26467
- var SyntheticEvent = require('./SyntheticEvent');
26468
-
26469
- var getActiveElement = require('fbjs/lib/getActiveElement');
26470
- var isTextInputElement = require('./isTextInputElement');
26471
- var keyOf = require('fbjs/lib/keyOf');
26472
- var shallowEqual = require('fbjs/lib/shallowEqual');
26473
-
26474
- var topLevelTypes = EventConstants.topLevelTypes;
26475
-
26476
- var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11;
26477
-
26478
- var eventTypes = {
26479
- select: {
26480
- phasedRegistrationNames: {
26481
- bubbled: keyOf({ onSelect: null }),
26482
- captured: keyOf({ onSelectCapture: null })
26483
- },
26484
- dependencies: [topLevelTypes.topBlur, topLevelTypes.topContextMenu, topLevelTypes.topFocus, topLevelTypes.topKeyDown, topLevelTypes.topMouseDown, topLevelTypes.topMouseUp, topLevelTypes.topSelectionChange]
26485
- }
26486
- };
26487
-
26488
- var activeElement = null;
26489
- var activeElementID = null;
26490
- var lastSelection = null;
26491
- var mouseDown = false;
26492
-
26493
- // Track whether a listener exists for this plugin. If none exist, we do
26494
- // not extract events.
26495
- var hasListener = false;
26496
- var ON_SELECT_KEY = keyOf({ onSelect: null });
26497
-
26498
- /**
26499
- * Get an object which is a unique representation of the current selection.
26500
- *
26501
- * The return value will not be consistent across nodes or browsers, but
26502
- * two identical selections on the same node will return identical objects.
26503
- *
26504
- * @param {DOMElement} node
26505
- * @return {object}
26506
- */
26507
- function getSelection(node) {
26508
- if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) {
26509
- return {
26510
- start: node.selectionStart,
26511
- end: node.selectionEnd
26512
- };
26513
- } else if (window.getSelection) {
26514
- var selection = window.getSelection();
26515
- return {
26516
- anchorNode: selection.anchorNode,
26517
- anchorOffset: selection.anchorOffset,
26518
- focusNode: selection.focusNode,
26519
- focusOffset: selection.focusOffset
26520
- };
26521
- } else if (document.selection) {
26522
- var range = document.selection.createRange();
26523
- return {
26524
- parentElement: range.parentElement(),
26525
- text: range.text,
26526
- top: range.boundingTop,
26527
- left: range.boundingLeft
26528
- };
26529
- }
26530
- }
26531
-
26532
- /**
26533
- * Poll selection to see whether it's changed.
26534
- *
26535
- * @param {object} nativeEvent
26536
- * @return {?SyntheticEvent}
26537
- */
26538
- function constructSelectEvent(nativeEvent, nativeEventTarget) {
26539
- // Ensure we have the right element, and that the user is not dragging a
26540
- // selection (this matches native `select` event behavior). In HTML5, select
26541
- // fires only on input and textarea thus if there's no focused element we
26542
- // won't dispatch.
26543
- if (mouseDown || activeElement == null || activeElement !== getActiveElement()) {
26544
- return null;
26545
- }
26546
-
26547
- // Only fire when selection has actually changed.
26548
- var currentSelection = getSelection(activeElement);
26549
- if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
26550
- lastSelection = currentSelection;
26551
-
26552
- var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementID, nativeEvent, nativeEventTarget);
26553
-
26554
- syntheticEvent.type = 'select';
26555
- syntheticEvent.target = activeElement;
26556
-
26557
- EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);
26558
-
26559
- return syntheticEvent;
26560
- }
26561
-
26562
- return null;
26563
- }
26564
-
26565
- /**
26566
- * This plugin creates an `onSelect` event that normalizes select events
26567
- * across form elements.
26568
- *
26569
- * Supported elements are:
26570
- * - input (see `isTextInputElement`)
26571
- * - textarea
26572
- * - contentEditable
26573
- *
26574
- * This differs from native browser implementations in the following ways:
26575
- * - Fires on contentEditable fields as well as inputs.
26576
- * - Fires for collapsed selection.
26577
- * - Fires after user input.
26578
- */
26579
- var SelectEventPlugin = {
26580
-
26581
- eventTypes: eventTypes,
26582
-
26583
- /**
26584
- * @param {string} topLevelType Record from `EventConstants`.
26585
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
26586
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
26587
- * @param {object} nativeEvent Native browser event.
26588
- * @return {*} An accumulation of synthetic events.
26589
- * @see {EventPluginHub.extractEvents}
26590
- */
26591
- extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
26592
- if (!hasListener) {
26593
- return null;
26594
- }
26595
-
26596
- switch (topLevelType) {
26597
- // Track the input node that has focus.
26598
- case topLevelTypes.topFocus:
26599
- if (isTextInputElement(topLevelTarget) || topLevelTarget.contentEditable === 'true') {
26600
- activeElement = topLevelTarget;
26601
- activeElementID = topLevelTargetID;
26602
- lastSelection = null;
26603
- }
26604
- break;
26605
- case topLevelTypes.topBlur:
26606
- activeElement = null;
26607
- activeElementID = null;
26608
- lastSelection = null;
26609
- break;
26610
-
26611
- // Don't fire the event while the user is dragging. This matches the
26612
- // semantics of the native select event.
26613
- case topLevelTypes.topMouseDown:
26614
- mouseDown = true;
26615
- break;
26616
- case topLevelTypes.topContextMenu:
26617
- case topLevelTypes.topMouseUp:
26618
- mouseDown = false;
26619
- return constructSelectEvent(nativeEvent, nativeEventTarget);
26620
-
26621
- // Chrome and IE fire non-standard event when selection is changed (and
26622
- // sometimes when it hasn't). IE's event fires out of order with respect
26623
- // to key and input events on deletion, so we discard it.
26624
- //
26625
- // Firefox doesn't support selectionchange, so check selection status
26626
- // after each key entry. The selection changes after keydown and before
26627
- // keyup, but we check on keydown as well in the case of holding down a
26628
- // key, when multiple keydown events are fired but only one keyup is.
26629
- // This is also our approach for IE handling, for the reason above.
26630
- case topLevelTypes.topSelectionChange:
26631
- if (skipSelectionChangeEvent) {
26632
- break;
26633
- }
26634
- // falls through
26635
- case topLevelTypes.topKeyDown:
26636
- case topLevelTypes.topKeyUp:
26637
- return constructSelectEvent(nativeEvent, nativeEventTarget);
26638
- }
26639
-
26640
- return null;
26641
- },
26642
-
26643
- didPutListener: function (id, registrationName, listener) {
26644
- if (registrationName === ON_SELECT_KEY) {
26645
- hasListener = true;
26646
- }
26647
- }
26648
- };
26649
-
26650
- module.exports = SelectEventPlugin;
26651
- },{"./EventConstants":46,"./EventPropagators":50,"./ReactInputSelection":92,"./SyntheticEvent":124,"./isTextInputElement":152,"fbjs/lib/ExecutionEnvironment":4,"fbjs/lib/getActiveElement":13,"fbjs/lib/keyOf":22,"fbjs/lib/shallowEqual":27}],119:[function(require,module,exports){
26652
- /**
26653
- * Copyright 2013-2015, Facebook, Inc.
26654
- * All rights reserved.
26655
- *
26656
- * This source code is licensed under the BSD-style license found in the
26657
- * LICENSE file in the root directory of this source tree. An additional grant
26658
- * of patent rights can be found in the PATENTS file in the same directory.
26659
- *
26660
- * @providesModule ServerReactRootIndex
26661
- * @typechecks
26662
- */
26663
-
26664
- 'use strict';
26665
-
26666
- /**
26667
- * Size of the reactRoot ID space. We generate random numbers for React root
26668
- * IDs and if there's a collision the events and DOM update system will
26669
- * get confused. In the future we need a way to generate GUIDs but for
26670
- * now this will work on a smaller scale.
26671
- */
26672
- var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53);
26673
-
26674
- var ServerReactRootIndex = {
26675
- createReactRootIndex: function () {
26676
- return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX);
26677
- }
26678
- };
26679
-
26680
- module.exports = ServerReactRootIndex;
26681
- },{}],120:[function(require,module,exports){
26682
- (function (process){
26683
- /**
26684
- * Copyright 2013-2015, Facebook, Inc.
26685
- * All rights reserved.
26686
- *
26687
- * This source code is licensed under the BSD-style license found in the
26688
- * LICENSE file in the root directory of this source tree. An additional grant
26689
- * of patent rights can be found in the PATENTS file in the same directory.
26690
- *
26691
- * @providesModule SimpleEventPlugin
26692
- */
26693
-
26694
- 'use strict';
26695
-
26696
- var EventConstants = require('./EventConstants');
26697
- var EventListener = require('fbjs/lib/EventListener');
26698
- var EventPropagators = require('./EventPropagators');
26699
- var ReactMount = require('./ReactMount');
26700
- var SyntheticClipboardEvent = require('./SyntheticClipboardEvent');
26701
- var SyntheticEvent = require('./SyntheticEvent');
26702
- var SyntheticFocusEvent = require('./SyntheticFocusEvent');
26703
- var SyntheticKeyboardEvent = require('./SyntheticKeyboardEvent');
26704
- var SyntheticMouseEvent = require('./SyntheticMouseEvent');
26705
- var SyntheticDragEvent = require('./SyntheticDragEvent');
26706
- var SyntheticTouchEvent = require('./SyntheticTouchEvent');
26707
- var SyntheticUIEvent = require('./SyntheticUIEvent');
26708
- var SyntheticWheelEvent = require('./SyntheticWheelEvent');
26709
-
26710
- var emptyFunction = require('fbjs/lib/emptyFunction');
26711
- var getEventCharCode = require('./getEventCharCode');
26712
- var invariant = require('fbjs/lib/invariant');
26713
- var keyOf = require('fbjs/lib/keyOf');
26714
-
26715
- var topLevelTypes = EventConstants.topLevelTypes;
26716
-
26717
- var eventTypes = {
26718
- abort: {
26719
- phasedRegistrationNames: {
26720
- bubbled: keyOf({ onAbort: true }),
26721
- captured: keyOf({ onAbortCapture: true })
26722
- }
26723
- },
26724
- blur: {
26725
- phasedRegistrationNames: {
26726
- bubbled: keyOf({ onBlur: true }),
26727
- captured: keyOf({ onBlurCapture: true })
26728
- }
26729
- },
26730
- canPlay: {
26731
- phasedRegistrationNames: {
26732
- bubbled: keyOf({ onCanPlay: true }),
26733
- captured: keyOf({ onCanPlayCapture: true })
26734
- }
26735
- },
26736
- canPlayThrough: {
26737
- phasedRegistrationNames: {
26738
- bubbled: keyOf({ onCanPlayThrough: true }),
26739
- captured: keyOf({ onCanPlayThroughCapture: true })
26740
- }
26741
- },
26742
- click: {
26743
- phasedRegistrationNames: {
26744
- bubbled: keyOf({ onClick: true }),
26745
- captured: keyOf({ onClickCapture: true })
26746
- }
26747
- },
26748
- contextMenu: {
26749
- phasedRegistrationNames: {
26750
- bubbled: keyOf({ onContextMenu: true }),
26751
- captured: keyOf({ onContextMenuCapture: true })
26752
- }
26753
- },
26754
- copy: {
26755
- phasedRegistrationNames: {
26756
- bubbled: keyOf({ onCopy: true }),
26757
- captured: keyOf({ onCopyCapture: true })
26758
- }
26759
- },
26760
- cut: {
26761
- phasedRegistrationNames: {
26762
- bubbled: keyOf({ onCut: true }),
26763
- captured: keyOf({ onCutCapture: true })
26764
- }
26765
- },
26766
- doubleClick: {
26767
- phasedRegistrationNames: {
26768
- bubbled: keyOf({ onDoubleClick: true }),
26769
- captured: keyOf({ onDoubleClickCapture: true })
26770
- }
26771
- },
26772
- drag: {
26773
- phasedRegistrationNames: {
26774
- bubbled: keyOf({ onDrag: true }),
26775
- captured: keyOf({ onDragCapture: true })
26776
- }
26777
- },
26778
- dragEnd: {
26779
- phasedRegistrationNames: {
26780
- bubbled: keyOf({ onDragEnd: true }),
26781
- captured: keyOf({ onDragEndCapture: true })
26782
- }
26783
- },
26784
- dragEnter: {
26785
- phasedRegistrationNames: {
26786
- bubbled: keyOf({ onDragEnter: true }),
26787
- captured: keyOf({ onDragEnterCapture: true })
26788
- }
26789
- },
26790
- dragExit: {
26791
- phasedRegistrationNames: {
26792
- bubbled: keyOf({ onDragExit: true }),
26793
- captured: keyOf({ onDragExitCapture: true })
26794
- }
26795
- },
26796
- dragLeave: {
26797
- phasedRegistrationNames: {
26798
- bubbled: keyOf({ onDragLeave: true }),
26799
- captured: keyOf({ onDragLeaveCapture: true })
26800
- }
26801
- },
26802
- dragOver: {
26803
- phasedRegistrationNames: {
26804
- bubbled: keyOf({ onDragOver: true }),
26805
- captured: keyOf({ onDragOverCapture: true })
26806
- }
26807
- },
26808
- dragStart: {
26809
- phasedRegistrationNames: {
26810
- bubbled: keyOf({ onDragStart: true }),
26811
- captured: keyOf({ onDragStartCapture: true })
26812
- }
26813
- },
26814
- drop: {
26815
- phasedRegistrationNames: {
26816
- bubbled: keyOf({ onDrop: true }),
26817
- captured: keyOf({ onDropCapture: true })
26818
- }
26819
- },
26820
- durationChange: {
26821
- phasedRegistrationNames: {
26822
- bubbled: keyOf({ onDurationChange: true }),
26823
- captured: keyOf({ onDurationChangeCapture: true })
26824
- }
26825
- },
26826
- emptied: {
26827
- phasedRegistrationNames: {
26828
- bubbled: keyOf({ onEmptied: true }),
26829
- captured: keyOf({ onEmptiedCapture: true })
26830
- }
26831
- },
26832
- encrypted: {
26833
- phasedRegistrationNames: {
26834
- bubbled: keyOf({ onEncrypted: true }),
26835
- captured: keyOf({ onEncryptedCapture: true })
26836
- }
26837
- },
26838
- ended: {
26839
- phasedRegistrationNames: {
26840
- bubbled: keyOf({ onEnded: true }),
26841
- captured: keyOf({ onEndedCapture: true })
26842
- }
26843
- },
26844
- error: {
26845
- phasedRegistrationNames: {
26846
- bubbled: keyOf({ onError: true }),
26847
- captured: keyOf({ onErrorCapture: true })
26848
- }
26849
- },
26850
- focus: {
26851
- phasedRegistrationNames: {
26852
- bubbled: keyOf({ onFocus: true }),
26853
- captured: keyOf({ onFocusCapture: true })
26854
- }
26855
- },
26856
- input: {
26857
- phasedRegistrationNames: {
26858
- bubbled: keyOf({ onInput: true }),
26859
- captured: keyOf({ onInputCapture: true })
26860
- }
26861
- },
26862
- keyDown: {
26863
- phasedRegistrationNames: {
26864
- bubbled: keyOf({ onKeyDown: true }),
26865
- captured: keyOf({ onKeyDownCapture: true })
26866
- }
26867
- },
26868
- keyPress: {
26869
- phasedRegistrationNames: {
26870
- bubbled: keyOf({ onKeyPress: true }),
26871
- captured: keyOf({ onKeyPressCapture: true })
26872
- }
26873
- },
26874
- keyUp: {
26875
- phasedRegistrationNames: {
26876
- bubbled: keyOf({ onKeyUp: true }),
26877
- captured: keyOf({ onKeyUpCapture: true })
26878
- }
26879
- },
26880
- load: {
26881
- phasedRegistrationNames: {
26882
- bubbled: keyOf({ onLoad: true }),
26883
- captured: keyOf({ onLoadCapture: true })
26884
- }
26885
- },
26886
- loadedData: {
26887
- phasedRegistrationNames: {
26888
- bubbled: keyOf({ onLoadedData: true }),
26889
- captured: keyOf({ onLoadedDataCapture: true })
26890
- }
26891
- },
26892
- loadedMetadata: {
26893
- phasedRegistrationNames: {
26894
- bubbled: keyOf({ onLoadedMetadata: true }),
26895
- captured: keyOf({ onLoadedMetadataCapture: true })
26896
- }
26897
- },
26898
- loadStart: {
26899
- phasedRegistrationNames: {
26900
- bubbled: keyOf({ onLoadStart: true }),
26901
- captured: keyOf({ onLoadStartCapture: true })
26902
- }
26903
- },
26904
- // Note: We do not allow listening to mouseOver events. Instead, use the
26905
- // onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.
26906
- mouseDown: {
26907
- phasedRegistrationNames: {
26908
- bubbled: keyOf({ onMouseDown: true }),
26909
- captured: keyOf({ onMouseDownCapture: true })
26910
- }
26911
- },
26912
- mouseMove: {
26913
- phasedRegistrationNames: {
26914
- bubbled: keyOf({ onMouseMove: true }),
26915
- captured: keyOf({ onMouseMoveCapture: true })
26916
- }
26917
- },
26918
- mouseOut: {
26919
- phasedRegistrationNames: {
26920
- bubbled: keyOf({ onMouseOut: true }),
26921
- captured: keyOf({ onMouseOutCapture: true })
26922
- }
26923
- },
26924
- mouseOver: {
26925
- phasedRegistrationNames: {
26926
- bubbled: keyOf({ onMouseOver: true }),
26927
- captured: keyOf({ onMouseOverCapture: true })
26928
- }
26929
- },
26930
- mouseUp: {
26931
- phasedRegistrationNames: {
26932
- bubbled: keyOf({ onMouseUp: true }),
26933
- captured: keyOf({ onMouseUpCapture: true })
26934
- }
26935
- },
26936
- paste: {
26937
- phasedRegistrationNames: {
26938
- bubbled: keyOf({ onPaste: true }),
26939
- captured: keyOf({ onPasteCapture: true })
26940
- }
26941
- },
26942
- pause: {
26943
- phasedRegistrationNames: {
26944
- bubbled: keyOf({ onPause: true }),
26945
- captured: keyOf({ onPauseCapture: true })
26946
- }
26947
- },
26948
- play: {
26949
- phasedRegistrationNames: {
26950
- bubbled: keyOf({ onPlay: true }),
26951
- captured: keyOf({ onPlayCapture: true })
26952
- }
26953
- },
26954
- playing: {
26955
- phasedRegistrationNames: {
26956
- bubbled: keyOf({ onPlaying: true }),
26957
- captured: keyOf({ onPlayingCapture: true })
26958
- }
26959
- },
26960
- progress: {
26961
- phasedRegistrationNames: {
26962
- bubbled: keyOf({ onProgress: true }),
26963
- captured: keyOf({ onProgressCapture: true })
26964
- }
26965
- },
26966
- rateChange: {
26967
- phasedRegistrationNames: {
26968
- bubbled: keyOf({ onRateChange: true }),
26969
- captured: keyOf({ onRateChangeCapture: true })
26970
- }
26971
- },
26972
- reset: {
26973
- phasedRegistrationNames: {
26974
- bubbled: keyOf({ onReset: true }),
26975
- captured: keyOf({ onResetCapture: true })
26976
- }
26977
- },
26978
- scroll: {
26979
- phasedRegistrationNames: {
26980
- bubbled: keyOf({ onScroll: true }),
26981
- captured: keyOf({ onScrollCapture: true })
26982
- }
26983
- },
26984
- seeked: {
26985
- phasedRegistrationNames: {
26986
- bubbled: keyOf({ onSeeked: true }),
26987
- captured: keyOf({ onSeekedCapture: true })
26988
- }
26989
- },
26990
- seeking: {
26991
- phasedRegistrationNames: {
26992
- bubbled: keyOf({ onSeeking: true }),
26993
- captured: keyOf({ onSeekingCapture: true })
26994
- }
26995
- },
26996
- stalled: {
26997
- phasedRegistrationNames: {
26998
- bubbled: keyOf({ onStalled: true }),
26999
- captured: keyOf({ onStalledCapture: true })
27000
- }
27001
- },
27002
- submit: {
27003
- phasedRegistrationNames: {
27004
- bubbled: keyOf({ onSubmit: true }),
27005
- captured: keyOf({ onSubmitCapture: true })
27006
- }
27007
- },
27008
- suspend: {
27009
- phasedRegistrationNames: {
27010
- bubbled: keyOf({ onSuspend: true }),
27011
- captured: keyOf({ onSuspendCapture: true })
27012
- }
27013
- },
27014
- timeUpdate: {
27015
- phasedRegistrationNames: {
27016
- bubbled: keyOf({ onTimeUpdate: true }),
27017
- captured: keyOf({ onTimeUpdateCapture: true })
27018
- }
27019
- },
27020
- touchCancel: {
27021
- phasedRegistrationNames: {
27022
- bubbled: keyOf({ onTouchCancel: true }),
27023
- captured: keyOf({ onTouchCancelCapture: true })
27024
- }
27025
- },
27026
- touchEnd: {
27027
- phasedRegistrationNames: {
27028
- bubbled: keyOf({ onTouchEnd: true }),
27029
- captured: keyOf({ onTouchEndCapture: true })
27030
- }
27031
- },
27032
- touchMove: {
27033
- phasedRegistrationNames: {
27034
- bubbled: keyOf({ onTouchMove: true }),
27035
- captured: keyOf({ onTouchMoveCapture: true })
27036
- }
27037
- },
27038
- touchStart: {
27039
- phasedRegistrationNames: {
27040
- bubbled: keyOf({ onTouchStart: true }),
27041
- captured: keyOf({ onTouchStartCapture: true })
27042
- }
27043
- },
27044
- volumeChange: {
27045
- phasedRegistrationNames: {
27046
- bubbled: keyOf({ onVolumeChange: true }),
27047
- captured: keyOf({ onVolumeChangeCapture: true })
27048
- }
27049
- },
27050
- waiting: {
27051
- phasedRegistrationNames: {
27052
- bubbled: keyOf({ onWaiting: true }),
27053
- captured: keyOf({ onWaitingCapture: true })
27054
- }
27055
- },
27056
- wheel: {
27057
- phasedRegistrationNames: {
27058
- bubbled: keyOf({ onWheel: true }),
27059
- captured: keyOf({ onWheelCapture: true })
27060
- }
27061
- }
27062
- };
27063
-
27064
- var topLevelEventsToDispatchConfig = {
27065
- topAbort: eventTypes.abort,
27066
- topBlur: eventTypes.blur,
27067
- topCanPlay: eventTypes.canPlay,
27068
- topCanPlayThrough: eventTypes.canPlayThrough,
27069
- topClick: eventTypes.click,
27070
- topContextMenu: eventTypes.contextMenu,
27071
- topCopy: eventTypes.copy,
27072
- topCut: eventTypes.cut,
27073
- topDoubleClick: eventTypes.doubleClick,
27074
- topDrag: eventTypes.drag,
27075
- topDragEnd: eventTypes.dragEnd,
27076
- topDragEnter: eventTypes.dragEnter,
27077
- topDragExit: eventTypes.dragExit,
27078
- topDragLeave: eventTypes.dragLeave,
27079
- topDragOver: eventTypes.dragOver,
27080
- topDragStart: eventTypes.dragStart,
27081
- topDrop: eventTypes.drop,
27082
- topDurationChange: eventTypes.durationChange,
27083
- topEmptied: eventTypes.emptied,
27084
- topEncrypted: eventTypes.encrypted,
27085
- topEnded: eventTypes.ended,
27086
- topError: eventTypes.error,
27087
- topFocus: eventTypes.focus,
27088
- topInput: eventTypes.input,
27089
- topKeyDown: eventTypes.keyDown,
27090
- topKeyPress: eventTypes.keyPress,
27091
- topKeyUp: eventTypes.keyUp,
27092
- topLoad: eventTypes.load,
27093
- topLoadedData: eventTypes.loadedData,
27094
- topLoadedMetadata: eventTypes.loadedMetadata,
27095
- topLoadStart: eventTypes.loadStart,
27096
- topMouseDown: eventTypes.mouseDown,
27097
- topMouseMove: eventTypes.mouseMove,
27098
- topMouseOut: eventTypes.mouseOut,
27099
- topMouseOver: eventTypes.mouseOver,
27100
- topMouseUp: eventTypes.mouseUp,
27101
- topPaste: eventTypes.paste,
27102
- topPause: eventTypes.pause,
27103
- topPlay: eventTypes.play,
27104
- topPlaying: eventTypes.playing,
27105
- topProgress: eventTypes.progress,
27106
- topRateChange: eventTypes.rateChange,
27107
- topReset: eventTypes.reset,
27108
- topScroll: eventTypes.scroll,
27109
- topSeeked: eventTypes.seeked,
27110
- topSeeking: eventTypes.seeking,
27111
- topStalled: eventTypes.stalled,
27112
- topSubmit: eventTypes.submit,
27113
- topSuspend: eventTypes.suspend,
27114
- topTimeUpdate: eventTypes.timeUpdate,
27115
- topTouchCancel: eventTypes.touchCancel,
27116
- topTouchEnd: eventTypes.touchEnd,
27117
- topTouchMove: eventTypes.touchMove,
27118
- topTouchStart: eventTypes.touchStart,
27119
- topVolumeChange: eventTypes.volumeChange,
27120
- topWaiting: eventTypes.waiting,
27121
- topWheel: eventTypes.wheel
27122
- };
27123
-
27124
- for (var type in topLevelEventsToDispatchConfig) {
27125
- topLevelEventsToDispatchConfig[type].dependencies = [type];
27126
- }
27127
-
27128
- var ON_CLICK_KEY = keyOf({ onClick: null });
27129
- var onClickListeners = {};
27130
-
27131
- var SimpleEventPlugin = {
27132
-
27133
- eventTypes: eventTypes,
27134
-
27135
- /**
27136
- * @param {string} topLevelType Record from `EventConstants`.
27137
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
27138
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
27139
- * @param {object} nativeEvent Native browser event.
27140
- * @return {*} An accumulation of synthetic events.
27141
- * @see {EventPluginHub.extractEvents}
27142
- */
27143
- extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
27144
- var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
27145
- if (!dispatchConfig) {
27146
- return null;
27147
- }
27148
- var EventConstructor;
27149
- switch (topLevelType) {
27150
- case topLevelTypes.topAbort:
27151
- case topLevelTypes.topCanPlay:
27152
- case topLevelTypes.topCanPlayThrough:
27153
- case topLevelTypes.topDurationChange:
27154
- case topLevelTypes.topEmptied:
27155
- case topLevelTypes.topEncrypted:
27156
- case topLevelTypes.topEnded:
27157
- case topLevelTypes.topError:
27158
- case topLevelTypes.topInput:
27159
- case topLevelTypes.topLoad:
27160
- case topLevelTypes.topLoadedData:
27161
- case topLevelTypes.topLoadedMetadata:
27162
- case topLevelTypes.topLoadStart:
27163
- case topLevelTypes.topPause:
27164
- case topLevelTypes.topPlay:
27165
- case topLevelTypes.topPlaying:
27166
- case topLevelTypes.topProgress:
27167
- case topLevelTypes.topRateChange:
27168
- case topLevelTypes.topReset:
27169
- case topLevelTypes.topSeeked:
27170
- case topLevelTypes.topSeeking:
27171
- case topLevelTypes.topStalled:
27172
- case topLevelTypes.topSubmit:
27173
- case topLevelTypes.topSuspend:
27174
- case topLevelTypes.topTimeUpdate:
27175
- case topLevelTypes.topVolumeChange:
27176
- case topLevelTypes.topWaiting:
27177
- // HTML Events
27178
- // @see http://www.w3.org/TR/html5/index.html#events-0
27179
- EventConstructor = SyntheticEvent;
27180
- break;
27181
- case topLevelTypes.topKeyPress:
27182
- // FireFox creates a keypress event for function keys too. This removes
27183
- // the unwanted keypress events. Enter is however both printable and
27184
- // non-printable. One would expect Tab to be as well (but it isn't).
27185
- if (getEventCharCode(nativeEvent) === 0) {
27186
- return null;
27187
- }
27188
- /* falls through */
27189
- case topLevelTypes.topKeyDown:
27190
- case topLevelTypes.topKeyUp:
27191
- EventConstructor = SyntheticKeyboardEvent;
27192
- break;
27193
- case topLevelTypes.topBlur:
27194
- case topLevelTypes.topFocus:
27195
- EventConstructor = SyntheticFocusEvent;
27196
- break;
27197
- case topLevelTypes.topClick:
27198
- // Firefox creates a click event on right mouse clicks. This removes the
27199
- // unwanted click events.
27200
- if (nativeEvent.button === 2) {
27201
- return null;
27202
- }
27203
- /* falls through */
27204
- case topLevelTypes.topContextMenu:
27205
- case topLevelTypes.topDoubleClick:
27206
- case topLevelTypes.topMouseDown:
27207
- case topLevelTypes.topMouseMove:
27208
- case topLevelTypes.topMouseOut:
27209
- case topLevelTypes.topMouseOver:
27210
- case topLevelTypes.topMouseUp:
27211
- EventConstructor = SyntheticMouseEvent;
27212
- break;
27213
- case topLevelTypes.topDrag:
27214
- case topLevelTypes.topDragEnd:
27215
- case topLevelTypes.topDragEnter:
27216
- case topLevelTypes.topDragExit:
27217
- case topLevelTypes.topDragLeave:
27218
- case topLevelTypes.topDragOver:
27219
- case topLevelTypes.topDragStart:
27220
- case topLevelTypes.topDrop:
27221
- EventConstructor = SyntheticDragEvent;
27222
- break;
27223
- case topLevelTypes.topTouchCancel:
27224
- case topLevelTypes.topTouchEnd:
27225
- case topLevelTypes.topTouchMove:
27226
- case topLevelTypes.topTouchStart:
27227
- EventConstructor = SyntheticTouchEvent;
27228
- break;
27229
- case topLevelTypes.topScroll:
27230
- EventConstructor = SyntheticUIEvent;
27231
- break;
27232
- case topLevelTypes.topWheel:
27233
- EventConstructor = SyntheticWheelEvent;
27234
- break;
27235
- case topLevelTypes.topCopy:
27236
- case topLevelTypes.topCut:
27237
- case topLevelTypes.topPaste:
27238
- EventConstructor = SyntheticClipboardEvent;
27239
- break;
27240
- }
27241
- !EventConstructor ? process.env.NODE_ENV !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : invariant(false) : undefined;
27242
- var event = EventConstructor.getPooled(dispatchConfig, topLevelTargetID, nativeEvent, nativeEventTarget);
27243
- EventPropagators.accumulateTwoPhaseDispatches(event);
27244
- return event;
27245
- },
27246
-
27247
- didPutListener: function (id, registrationName, listener) {
27248
- // Mobile Safari does not fire properly bubble click events on
27249
- // non-interactive elements, which means delegated click listeners do not
27250
- // fire. The workaround for this bug involves attaching an empty click
27251
- // listener on the target node.
27252
- if (registrationName === ON_CLICK_KEY) {
27253
- var node = ReactMount.getNode(id);
27254
- if (!onClickListeners[id]) {
27255
- onClickListeners[id] = EventListener.listen(node, 'click', emptyFunction);
27256
- }
27257
- }
27258
- },
27259
-
27260
- willDeleteListener: function (id, registrationName) {
27261
- if (registrationName === ON_CLICK_KEY) {
27262
- onClickListeners[id].remove();
27263
- delete onClickListeners[id];
27264
- }
27265
- }
27266
-
27267
- };
27268
-
27269
- module.exports = SimpleEventPlugin;
27270
- }).call(this,require('_process'))
27271
-
27272
- },{"./EventConstants":46,"./EventPropagators":50,"./ReactMount":97,"./SyntheticClipboardEvent":121,"./SyntheticDragEvent":123,"./SyntheticEvent":124,"./SyntheticFocusEvent":125,"./SyntheticKeyboardEvent":127,"./SyntheticMouseEvent":128,"./SyntheticTouchEvent":129,"./SyntheticUIEvent":130,"./SyntheticWheelEvent":131,"./getEventCharCode":143,"_process":31,"fbjs/lib/EventListener":3,"fbjs/lib/emptyFunction":10,"fbjs/lib/invariant":18,"fbjs/lib/keyOf":22}],121:[function(require,module,exports){
27273
- /**
27274
- * Copyright 2013-2015, Facebook, Inc.
27275
- * All rights reserved.
27276
- *
27277
- * This source code is licensed under the BSD-style license found in the
27278
- * LICENSE file in the root directory of this source tree. An additional grant
27279
- * of patent rights can be found in the PATENTS file in the same directory.
27280
- *
27281
- * @providesModule SyntheticClipboardEvent
27282
- * @typechecks static-only
27283
- */
27284
-
27285
- 'use strict';
27286
-
27287
- var SyntheticEvent = require('./SyntheticEvent');
27288
-
27289
- /**
27290
- * @interface Event
27291
- * @see http://www.w3.org/TR/clipboard-apis/
27292
- */
27293
- var ClipboardEventInterface = {
27294
- clipboardData: function (event) {
27295
- return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
27296
- }
27297
- };
27298
-
27299
- /**
27300
- * @param {object} dispatchConfig Configuration used to dispatch this event.
27301
- * @param {string} dispatchMarker Marker identifying the event target.
27302
- * @param {object} nativeEvent Native browser event.
27303
- * @extends {SyntheticUIEvent}
27304
- */
27305
- function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
27306
- SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
27307
- }
27308
-
27309
- SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
27310
-
27311
- module.exports = SyntheticClipboardEvent;
27312
- },{"./SyntheticEvent":124}],122:[function(require,module,exports){
27313
- /**
27314
- * Copyright 2013-2015, Facebook, Inc.
27315
- * All rights reserved.
27316
- *
27317
- * This source code is licensed under the BSD-style license found in the
27318
- * LICENSE file in the root directory of this source tree. An additional grant
27319
- * of patent rights can be found in the PATENTS file in the same directory.
27320
- *
27321
- * @providesModule SyntheticCompositionEvent
27322
- * @typechecks static-only
27323
- */
27324
-
27325
- 'use strict';
27326
-
27327
- var SyntheticEvent = require('./SyntheticEvent');
27328
-
27329
- /**
27330
- * @interface Event
27331
- * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
27332
- */
27333
- var CompositionEventInterface = {
27334
- data: null
27335
- };
27336
-
27337
- /**
27338
- * @param {object} dispatchConfig Configuration used to dispatch this event.
27339
- * @param {string} dispatchMarker Marker identifying the event target.
27340
- * @param {object} nativeEvent Native browser event.
27341
- * @extends {SyntheticUIEvent}
27342
- */
27343
- function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
27344
- SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
27345
- }
27346
-
27347
- SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface);
27348
-
27349
- module.exports = SyntheticCompositionEvent;
27350
- },{"./SyntheticEvent":124}],123:[function(require,module,exports){
27351
- /**
27352
- * Copyright 2013-2015, Facebook, Inc.
27353
- * All rights reserved.
27354
- *
27355
- * This source code is licensed under the BSD-style license found in the
27356
- * LICENSE file in the root directory of this source tree. An additional grant
27357
- * of patent rights can be found in the PATENTS file in the same directory.
27358
- *
27359
- * @providesModule SyntheticDragEvent
27360
- * @typechecks static-only
27361
- */
27362
-
27363
- 'use strict';
27364
-
27365
- var SyntheticMouseEvent = require('./SyntheticMouseEvent');
27366
-
27367
- /**
27368
- * @interface DragEvent
27369
- * @see http://www.w3.org/TR/DOM-Level-3-Events/
27370
- */
27371
- var DragEventInterface = {
27372
- dataTransfer: null
27373
- };
27374
-
27375
- /**
27376
- * @param {object} dispatchConfig Configuration used to dispatch this event.
27377
- * @param {string} dispatchMarker Marker identifying the event target.
27378
- * @param {object} nativeEvent Native browser event.
27379
- * @extends {SyntheticUIEvent}
27380
- */
27381
- function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
27382
- SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
27383
- }
27384
-
27385
- SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
27386
-
27387
- module.exports = SyntheticDragEvent;
27388
- },{"./SyntheticMouseEvent":128}],124:[function(require,module,exports){
27389
- (function (process){
27390
- /**
27391
- * Copyright 2013-2015, Facebook, Inc.
27392
- * All rights reserved.
27393
- *
27394
- * This source code is licensed under the BSD-style license found in the
27395
- * LICENSE file in the root directory of this source tree. An additional grant
27396
- * of patent rights can be found in the PATENTS file in the same directory.
27397
- *
27398
- * @providesModule SyntheticEvent
27399
- * @typechecks static-only
27400
- */
27401
-
27402
- 'use strict';
27403
-
27404
- var PooledClass = require('./PooledClass');
27405
-
27406
- var assign = require('./Object.assign');
27407
- var emptyFunction = require('fbjs/lib/emptyFunction');
27408
- var warning = require('fbjs/lib/warning');
27409
-
27410
- /**
27411
- * @interface Event
27412
- * @see http://www.w3.org/TR/DOM-Level-3-Events/
27413
- */
27414
- var EventInterface = {
27415
- type: null,
27416
- target: null,
27417
- // currentTarget is set when dispatching; no use in copying it here
27418
- currentTarget: emptyFunction.thatReturnsNull,
27419
- eventPhase: null,
27420
- bubbles: null,
27421
- cancelable: null,
27422
- timeStamp: function (event) {
27423
- return event.timeStamp || Date.now();
27424
- },
27425
- defaultPrevented: null,
27426
- isTrusted: null
27427
- };
27428
-
27429
- /**
27430
- * Synthetic events are dispatched by event plugins, typically in response to a
27431
- * top-level event delegation handler.
27432
- *
27433
- * These systems should generally use pooling to reduce the frequency of garbage
27434
- * collection. The system should check `isPersistent` to determine whether the
27435
- * event should be released into the pool after being dispatched. Users that
27436
- * need a persisted event should invoke `persist`.
27437
- *
27438
- * Synthetic events (and subclasses) implement the DOM Level 3 Events API by
27439
- * normalizing browser quirks. Subclasses do not necessarily have to implement a
27440
- * DOM interface; custom application-specific events can also subclass this.
27441
- *
27442
- * @param {object} dispatchConfig Configuration used to dispatch this event.
27443
- * @param {string} dispatchMarker Marker identifying the event target.
27444
- * @param {object} nativeEvent Native browser event.
27445
- */
27446
- function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
27447
- this.dispatchConfig = dispatchConfig;
27448
- this.dispatchMarker = dispatchMarker;
27449
- this.nativeEvent = nativeEvent;
27450
-
27451
- var Interface = this.constructor.Interface;
27452
- for (var propName in Interface) {
27453
- if (!Interface.hasOwnProperty(propName)) {
27454
- continue;
27455
- }
27456
- var normalize = Interface[propName];
27457
- if (normalize) {
27458
- this[propName] = normalize(nativeEvent);
27459
- } else {
27460
- if (propName === 'target') {
27461
- this.target = nativeEventTarget;
27462
- } else {
27463
- this[propName] = nativeEvent[propName];
27464
- }
27465
- }
27466
- }
27467
-
27468
- var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
27469
- if (defaultPrevented) {
27470
- this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
27471
- } else {
27472
- this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
27473
- }
27474
- this.isPropagationStopped = emptyFunction.thatReturnsFalse;
27475
- }
27476
-
27477
- assign(SyntheticEvent.prototype, {
27478
-
27479
- preventDefault: function () {
27480
- this.defaultPrevented = true;
27481
- var event = this.nativeEvent;
27482
- if (process.env.NODE_ENV !== 'production') {
27483
- process.env.NODE_ENV !== 'production' ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `preventDefault` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined;
27484
- }
27485
- if (!event) {
27486
- return;
27487
- }
27488
-
27489
- if (event.preventDefault) {
27490
- event.preventDefault();
27491
- } else {
27492
- event.returnValue = false;
27493
- }
27494
- this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
27495
- },
27496
-
27497
- stopPropagation: function () {
27498
- var event = this.nativeEvent;
27499
- if (process.env.NODE_ENV !== 'production') {
27500
- process.env.NODE_ENV !== 'production' ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `stopPropagation` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined;
27501
- }
27502
- if (!event) {
27503
- return;
27504
- }
27505
-
27506
- if (event.stopPropagation) {
27507
- event.stopPropagation();
27508
- } else {
27509
- event.cancelBubble = true;
27510
- }
27511
- this.isPropagationStopped = emptyFunction.thatReturnsTrue;
27512
- },
27513
-
27514
- /**
27515
- * We release all dispatched `SyntheticEvent`s after each event loop, adding
27516
- * them back into the pool. This allows a way to hold onto a reference that
27517
- * won't be added back into the pool.
27518
- */
27519
- persist: function () {
27520
- this.isPersistent = emptyFunction.thatReturnsTrue;
27521
- },
27522
-
27523
- /**
27524
- * Checks if this event should be released back into the pool.
27525
- *
27526
- * @return {boolean} True if this should not be released, false otherwise.
27527
- */
27528
- isPersistent: emptyFunction.thatReturnsFalse,
27529
-
27530
- /**
27531
- * `PooledClass` looks for `destructor` on each instance it releases.
27532
- */
27533
- destructor: function () {
27534
- var Interface = this.constructor.Interface;
27535
- for (var propName in Interface) {
27536
- this[propName] = null;
27537
- }
27538
- this.dispatchConfig = null;
27539
- this.dispatchMarker = null;
27540
- this.nativeEvent = null;
27541
- }
27542
-
27543
- });
27544
-
27545
- SyntheticEvent.Interface = EventInterface;
27546
-
27547
- /**
27548
- * Helper to reduce boilerplate when creating subclasses.
27549
- *
27550
- * @param {function} Class
27551
- * @param {?object} Interface
27552
- */
27553
- SyntheticEvent.augmentClass = function (Class, Interface) {
27554
- var Super = this;
27555
-
27556
- var prototype = Object.create(Super.prototype);
27557
- assign(prototype, Class.prototype);
27558
- Class.prototype = prototype;
27559
- Class.prototype.constructor = Class;
27560
-
27561
- Class.Interface = assign({}, Super.Interface, Interface);
27562
- Class.augmentClass = Super.augmentClass;
27563
-
27564
- PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
27565
- };
27566
-
27567
- PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);
27568
-
27569
- module.exports = SyntheticEvent;
27570
- }).call(this,require('_process'))
27571
-
27572
- },{"./Object.assign":54,"./PooledClass":55,"_process":31,"fbjs/lib/emptyFunction":10,"fbjs/lib/warning":29}],125:[function(require,module,exports){
27573
- /**
27574
- * Copyright 2013-2015, Facebook, Inc.
27575
- * All rights reserved.
27576
- *
27577
- * This source code is licensed under the BSD-style license found in the
27578
- * LICENSE file in the root directory of this source tree. An additional grant
27579
- * of patent rights can be found in the PATENTS file in the same directory.
27580
- *
27581
- * @providesModule SyntheticFocusEvent
27582
- * @typechecks static-only
27583
- */
27584
-
27585
- 'use strict';
27586
-
27587
- var SyntheticUIEvent = require('./SyntheticUIEvent');
27588
-
27589
- /**
27590
- * @interface FocusEvent
27591
- * @see http://www.w3.org/TR/DOM-Level-3-Events/
27592
- */
27593
- var FocusEventInterface = {
27594
- relatedTarget: null
27595
- };
27596
-
27597
- /**
27598
- * @param {object} dispatchConfig Configuration used to dispatch this event.
27599
- * @param {string} dispatchMarker Marker identifying the event target.
27600
- * @param {object} nativeEvent Native browser event.
27601
- * @extends {SyntheticUIEvent}
27602
- */
27603
- function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
27604
- SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
27605
- }
27606
-
27607
- SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
27608
-
27609
- module.exports = SyntheticFocusEvent;
27610
- },{"./SyntheticUIEvent":130}],126:[function(require,module,exports){
27611
- /**
27612
- * Copyright 2013-2015, Facebook, Inc.
27613
- * All rights reserved.
27614
- *
27615
- * This source code is licensed under the BSD-style license found in the
27616
- * LICENSE file in the root directory of this source tree. An additional grant
27617
- * of patent rights can be found in the PATENTS file in the same directory.
27618
- *
27619
- * @providesModule SyntheticInputEvent
27620
- * @typechecks static-only
27621
- */
27622
-
27623
- 'use strict';
27624
-
27625
- var SyntheticEvent = require('./SyntheticEvent');
27626
-
27627
- /**
27628
- * @interface Event
27629
- * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
27630
- * /#events-inputevents
27631
- */
27632
- var InputEventInterface = {
27633
- data: null
27634
- };
27635
-
27636
- /**
27637
- * @param {object} dispatchConfig Configuration used to dispatch this event.
27638
- * @param {string} dispatchMarker Marker identifying the event target.
27639
- * @param {object} nativeEvent Native browser event.
27640
- * @extends {SyntheticUIEvent}
27641
- */
27642
- function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
27643
- SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
27644
- }
27645
-
27646
- SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface);
27647
-
27648
- module.exports = SyntheticInputEvent;
27649
- },{"./SyntheticEvent":124}],127:[function(require,module,exports){
27650
- /**
27651
- * Copyright 2013-2015, Facebook, Inc.
27652
- * All rights reserved.
27653
- *
27654
- * This source code is licensed under the BSD-style license found in the
27655
- * LICENSE file in the root directory of this source tree. An additional grant
27656
- * of patent rights can be found in the PATENTS file in the same directory.
27657
- *
27658
- * @providesModule SyntheticKeyboardEvent
27659
- * @typechecks static-only
27660
- */
27661
-
27662
- 'use strict';
27663
-
27664
- var SyntheticUIEvent = require('./SyntheticUIEvent');
27665
-
27666
- var getEventCharCode = require('./getEventCharCode');
27667
- var getEventKey = require('./getEventKey');
27668
- var getEventModifierState = require('./getEventModifierState');
27669
-
27670
- /**
27671
- * @interface KeyboardEvent
27672
- * @see http://www.w3.org/TR/DOM-Level-3-Events/
27673
- */
27674
- var KeyboardEventInterface = {
27675
- key: getEventKey,
27676
- location: null,
27677
- ctrlKey: null,
27678
- shiftKey: null,
27679
- altKey: null,
27680
- metaKey: null,
27681
- repeat: null,
27682
- locale: null,
27683
- getModifierState: getEventModifierState,
27684
- // Legacy Interface
27685
- charCode: function (event) {
27686
- // `charCode` is the result of a KeyPress event and represents the value of
27687
- // the actual printable character.
27688
-
27689
- // KeyPress is deprecated, but its replacement is not yet final and not
27690
- // implemented in any major browser. Only KeyPress has charCode.
27691
- if (event.type === 'keypress') {
27692
- return getEventCharCode(event);
27693
- }
27694
- return 0;
27695
- },
27696
- keyCode: function (event) {
27697
- // `keyCode` is the result of a KeyDown/Up event and represents the value of
27698
- // physical keyboard key.
27699
-
27700
- // The actual meaning of the value depends on the users' keyboard layout
27701
- // which cannot be detected. Assuming that it is a US keyboard layout
27702
- // provides a surprisingly accurate mapping for US and European users.
27703
- // Due to this, it is left to the user to implement at this time.
27704
- if (event.type === 'keydown' || event.type === 'keyup') {
27705
- return event.keyCode;
27706
- }
27707
- return 0;
27708
- },
27709
- which: function (event) {
27710
- // `which` is an alias for either `keyCode` or `charCode` depending on the
27711
- // type of the event.
27712
- if (event.type === 'keypress') {
27713
- return getEventCharCode(event);
27714
- }
27715
- if (event.type === 'keydown' || event.type === 'keyup') {
27716
- return event.keyCode;
27717
- }
27718
- return 0;
27719
- }
27720
- };
27721
-
27722
- /**
27723
- * @param {object} dispatchConfig Configuration used to dispatch this event.
27724
- * @param {string} dispatchMarker Marker identifying the event target.
27725
- * @param {object} nativeEvent Native browser event.
27726
- * @extends {SyntheticUIEvent}
27727
- */
27728
- function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
27729
- SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
27730
- }
27731
-
27732
- SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
27733
-
27734
- module.exports = SyntheticKeyboardEvent;
27735
- },{"./SyntheticUIEvent":130,"./getEventCharCode":143,"./getEventKey":144,"./getEventModifierState":145}],128:[function(require,module,exports){
27736
- /**
27737
- * Copyright 2013-2015, Facebook, Inc.
27738
- * All rights reserved.
27739
- *
27740
- * This source code is licensed under the BSD-style license found in the
27741
- * LICENSE file in the root directory of this source tree. An additional grant
27742
- * of patent rights can be found in the PATENTS file in the same directory.
27743
- *
27744
- * @providesModule SyntheticMouseEvent
27745
- * @typechecks static-only
27746
- */
27747
-
27748
- 'use strict';
27749
-
27750
- var SyntheticUIEvent = require('./SyntheticUIEvent');
27751
- var ViewportMetrics = require('./ViewportMetrics');
27752
-
27753
- var getEventModifierState = require('./getEventModifierState');
27754
-
27755
- /**
27756
- * @interface MouseEvent
27757
- * @see http://www.w3.org/TR/DOM-Level-3-Events/
27758
- */
27759
- var MouseEventInterface = {
27760
- screenX: null,
27761
- screenY: null,
27762
- clientX: null,
27763
- clientY: null,
27764
- ctrlKey: null,
27765
- shiftKey: null,
27766
- altKey: null,
27767
- metaKey: null,
27768
- getModifierState: getEventModifierState,
27769
- button: function (event) {
27770
- // Webkit, Firefox, IE9+
27771
- // which: 1 2 3
27772
- // button: 0 1 2 (standard)
27773
- var button = event.button;
27774
- if ('which' in event) {
27775
- return button;
27776
- }
27777
- // IE<9
27778
- // which: undefined
27779
- // button: 0 0 0
27780
- // button: 1 4 2 (onmouseup)
27781
- return button === 2 ? 2 : button === 4 ? 1 : 0;
27782
- },
27783
- buttons: null,
27784
- relatedTarget: function (event) {
27785
- return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
27786
- },
27787
- // "Proprietary" Interface.
27788
- pageX: function (event) {
27789
- return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft;
27790
- },
27791
- pageY: function (event) {
27792
- return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop;
27793
- }
27794
- };
27795
-
27796
- /**
27797
- * @param {object} dispatchConfig Configuration used to dispatch this event.
27798
- * @param {string} dispatchMarker Marker identifying the event target.
27799
- * @param {object} nativeEvent Native browser event.
27800
- * @extends {SyntheticUIEvent}
27801
- */
27802
- function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
27803
- SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
27804
- }
27805
-
27806
- SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
27807
-
27808
- module.exports = SyntheticMouseEvent;
27809
- },{"./SyntheticUIEvent":130,"./ViewportMetrics":133,"./getEventModifierState":145}],129:[function(require,module,exports){
27810
- /**
27811
- * Copyright 2013-2015, Facebook, Inc.
27812
- * All rights reserved.
27813
- *
27814
- * This source code is licensed under the BSD-style license found in the
27815
- * LICENSE file in the root directory of this source tree. An additional grant
27816
- * of patent rights can be found in the PATENTS file in the same directory.
27817
- *
27818
- * @providesModule SyntheticTouchEvent
27819
- * @typechecks static-only
27820
- */
27821
-
27822
- 'use strict';
27823
-
27824
- var SyntheticUIEvent = require('./SyntheticUIEvent');
27825
-
27826
- var getEventModifierState = require('./getEventModifierState');
27827
-
27828
- /**
27829
- * @interface TouchEvent
27830
- * @see http://www.w3.org/TR/touch-events/
27831
- */
27832
- var TouchEventInterface = {
27833
- touches: null,
27834
- targetTouches: null,
27835
- changedTouches: null,
27836
- altKey: null,
27837
- metaKey: null,
27838
- ctrlKey: null,
27839
- shiftKey: null,
27840
- getModifierState: getEventModifierState
27841
- };
27842
-
27843
- /**
27844
- * @param {object} dispatchConfig Configuration used to dispatch this event.
27845
- * @param {string} dispatchMarker Marker identifying the event target.
27846
- * @param {object} nativeEvent Native browser event.
27847
- * @extends {SyntheticUIEvent}
27848
- */
27849
- function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
27850
- SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
27851
- }
27852
-
27853
- SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
27854
-
27855
- module.exports = SyntheticTouchEvent;
27856
- },{"./SyntheticUIEvent":130,"./getEventModifierState":145}],130:[function(require,module,exports){
27857
- /**
27858
- * Copyright 2013-2015, Facebook, Inc.
27859
- * All rights reserved.
27860
- *
27861
- * This source code is licensed under the BSD-style license found in the
27862
- * LICENSE file in the root directory of this source tree. An additional grant
27863
- * of patent rights can be found in the PATENTS file in the same directory.
27864
- *
27865
- * @providesModule SyntheticUIEvent
27866
- * @typechecks static-only
27867
- */
27868
-
27869
- 'use strict';
27870
-
27871
- var SyntheticEvent = require('./SyntheticEvent');
27872
-
27873
- var getEventTarget = require('./getEventTarget');
27874
-
27875
- /**
27876
- * @interface UIEvent
27877
- * @see http://www.w3.org/TR/DOM-Level-3-Events/
27878
- */
27879
- var UIEventInterface = {
27880
- view: function (event) {
27881
- if (event.view) {
27882
- return event.view;
27883
- }
27884
-
27885
- var target = getEventTarget(event);
27886
- if (target != null && target.window === target) {
27887
- // target is a window object
27888
- return target;
27889
- }
27890
-
27891
- var doc = target.ownerDocument;
27892
- // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
27893
- if (doc) {
27894
- return doc.defaultView || doc.parentWindow;
27895
- } else {
27896
- return window;
27897
- }
27898
- },
27899
- detail: function (event) {
27900
- return event.detail || 0;
27901
- }
27902
- };
27903
-
27904
- /**
27905
- * @param {object} dispatchConfig Configuration used to dispatch this event.
27906
- * @param {string} dispatchMarker Marker identifying the event target.
27907
- * @param {object} nativeEvent Native browser event.
27908
- * @extends {SyntheticEvent}
27909
- */
27910
- function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
27911
- SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
27912
- }
27913
-
27914
- SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
27915
-
27916
- module.exports = SyntheticUIEvent;
27917
- },{"./SyntheticEvent":124,"./getEventTarget":146}],131:[function(require,module,exports){
27918
- /**
27919
- * Copyright 2013-2015, Facebook, Inc.
27920
- * All rights reserved.
27921
- *
27922
- * This source code is licensed under the BSD-style license found in the
27923
- * LICENSE file in the root directory of this source tree. An additional grant
27924
- * of patent rights can be found in the PATENTS file in the same directory.
27925
- *
27926
- * @providesModule SyntheticWheelEvent
27927
- * @typechecks static-only
27928
- */
27929
-
27930
- 'use strict';
27931
-
27932
- var SyntheticMouseEvent = require('./SyntheticMouseEvent');
27933
-
27934
- /**
27935
- * @interface WheelEvent
27936
- * @see http://www.w3.org/TR/DOM-Level-3-Events/
27937
- */
27938
- var WheelEventInterface = {
27939
- deltaX: function (event) {
27940
- return 'deltaX' in event ? event.deltaX :
27941
- // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
27942
- 'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
27943
- },
27944
- deltaY: function (event) {
27945
- return 'deltaY' in event ? event.deltaY :
27946
- // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
27947
- 'wheelDeltaY' in event ? -event.wheelDeltaY :
27948
- // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
27949
- 'wheelDelta' in event ? -event.wheelDelta : 0;
27950
- },
27951
- deltaZ: null,
27952
-
27953
- // Browsers without "deltaMode" is reporting in raw wheel delta where one
27954
- // notch on the scroll is always +/- 120, roughly equivalent to pixels.
27955
- // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
27956
- // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
27957
- deltaMode: null
27958
- };
27959
-
27960
- /**
27961
- * @param {object} dispatchConfig Configuration used to dispatch this event.
27962
- * @param {string} dispatchMarker Marker identifying the event target.
27963
- * @param {object} nativeEvent Native browser event.
27964
- * @extends {SyntheticMouseEvent}
27965
- */
27966
- function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
27967
- SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
27968
- }
27969
-
27970
- SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
27971
-
27972
- module.exports = SyntheticWheelEvent;
27973
- },{"./SyntheticMouseEvent":128}],132:[function(require,module,exports){
27974
- (function (process){
27975
- /**
27976
- * Copyright 2013-2015, Facebook, Inc.
27977
- * All rights reserved.
27978
- *
27979
- * This source code is licensed under the BSD-style license found in the
27980
- * LICENSE file in the root directory of this source tree. An additional grant
27981
- * of patent rights can be found in the PATENTS file in the same directory.
27982
- *
27983
- * @providesModule Transaction
27984
- */
27985
-
27986
- 'use strict';
27987
-
27988
- var invariant = require('fbjs/lib/invariant');
27989
-
27990
- /**
27991
- * `Transaction` creates a black box that is able to wrap any method such that
27992
- * certain invariants are maintained before and after the method is invoked
27993
- * (Even if an exception is thrown while invoking the wrapped method). Whoever
27994
- * instantiates a transaction can provide enforcers of the invariants at
27995
- * creation time. The `Transaction` class itself will supply one additional
27996
- * automatic invariant for you - the invariant that any transaction instance
27997
- * should not be run while it is already being run. You would typically create a
27998
- * single instance of a `Transaction` for reuse multiple times, that potentially
27999
- * is used to wrap several different methods. Wrappers are extremely simple -
28000
- * they only require implementing two methods.
28001
- *
28002
- * <pre>
28003
- * wrappers (injected at creation time)
28004
- * + +
28005
- * | |
28006
- * +-----------------|--------|--------------+
28007
- * | v | |
28008
- * | +---------------+ | |
28009
- * | +--| wrapper1 |---|----+ |
28010
- * | | +---------------+ v | |
28011
- * | | +-------------+ | |
28012
- * | | +----| wrapper2 |--------+ |
28013
- * | | | +-------------+ | | |
28014
- * | | | | | |
28015
- * | v v v v | wrapper
28016
- * | +---+ +---+ +---------+ +---+ +---+ | invariants
28017
- * perform(anyMethod) | | | | | | | | | | | | maintained
28018
- * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->
28019
- * | | | | | | | | | | | |
28020
- * | | | | | | | | | | | |
28021
- * | | | | | | | | | | | |
28022
- * | +---+ +---+ +---------+ +---+ +---+ |
28023
- * | initialize close |
28024
- * +-----------------------------------------+
28025
- * </pre>
28026
- *
28027
- * Use cases:
28028
- * - Preserving the input selection ranges before/after reconciliation.
28029
- * Restoring selection even in the event of an unexpected error.
28030
- * - Deactivating events while rearranging the DOM, preventing blurs/focuses,
28031
- * while guaranteeing that afterwards, the event system is reactivated.
28032
- * - Flushing a queue of collected DOM mutations to the main UI thread after a
28033
- * reconciliation takes place in a worker thread.
28034
- * - Invoking any collected `componentDidUpdate` callbacks after rendering new
28035
- * content.
28036
- * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue
28037
- * to preserve the `scrollTop` (an automatic scroll aware DOM).
28038
- * - (Future use case): Layout calculations before and after DOM updates.
28039
- *
28040
- * Transactional plugin API:
28041
- * - A module that has an `initialize` method that returns any precomputation.
28042
- * - and a `close` method that accepts the precomputation. `close` is invoked
28043
- * when the wrapped process is completed, or has failed.
28044
- *
28045
- * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules
28046
- * that implement `initialize` and `close`.
28047
- * @return {Transaction} Single transaction for reuse in thread.
28048
- *
28049
- * @class Transaction
28050
- */
28051
- var Mixin = {
28052
- /**
28053
- * Sets up this instance so that it is prepared for collecting metrics. Does
28054
- * so such that this setup method may be used on an instance that is already
28055
- * initialized, in a way that does not consume additional memory upon reuse.
28056
- * That can be useful if you decide to make your subclass of this mixin a
28057
- * "PooledClass".
28058
- */
28059
- reinitializeTransaction: function () {
28060
- this.transactionWrappers = this.getTransactionWrappers();
28061
- if (this.wrapperInitData) {
28062
- this.wrapperInitData.length = 0;
28063
- } else {
28064
- this.wrapperInitData = [];
28065
- }
28066
- this._isInTransaction = false;
28067
- },
28068
-
28069
- _isInTransaction: false,
28070
-
28071
- /**
28072
- * @abstract
28073
- * @return {Array<TransactionWrapper>} Array of transaction wrappers.
28074
- */
28075
- getTransactionWrappers: null,
28076
-
28077
- isInTransaction: function () {
28078
- return !!this._isInTransaction;
28079
- },
28080
-
28081
- /**
28082
- * Executes the function within a safety window. Use this for the top level
28083
- * methods that result in large amounts of computation/mutations that would
28084
- * need to be safety checked. The optional arguments helps prevent the need
28085
- * to bind in many cases.
28086
- *
28087
- * @param {function} method Member of scope to call.
28088
- * @param {Object} scope Scope to invoke from.
28089
- * @param {Object?=} a Argument to pass to the method.
28090
- * @param {Object?=} b Argument to pass to the method.
28091
- * @param {Object?=} c Argument to pass to the method.
28092
- * @param {Object?=} d Argument to pass to the method.
28093
- * @param {Object?=} e Argument to pass to the method.
28094
- * @param {Object?=} f Argument to pass to the method.
28095
- *
28096
- * @return {*} Return value from `method`.
28097
- */
28098
- perform: function (method, scope, a, b, c, d, e, f) {
28099
- !!this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there ' + 'is already an outstanding transaction.') : invariant(false) : undefined;
28100
- var errorThrown;
28101
- var ret;
28102
- try {
28103
- this._isInTransaction = true;
28104
- // Catching errors makes debugging more difficult, so we start with
28105
- // errorThrown set to true before setting it to false after calling
28106
- // close -- if it's still set to true in the finally block, it means
28107
- // one of these calls threw.
28108
- errorThrown = true;
28109
- this.initializeAll(0);
28110
- ret = method.call(scope, a, b, c, d, e, f);
28111
- errorThrown = false;
28112
- } finally {
28113
- try {
28114
- if (errorThrown) {
28115
- // If `method` throws, prefer to show that stack trace over any thrown
28116
- // by invoking `closeAll`.
28117
- try {
28118
- this.closeAll(0);
28119
- } catch (err) {}
28120
- } else {
28121
- // Since `method` didn't throw, we don't want to silence the exception
28122
- // here.
28123
- this.closeAll(0);
28124
- }
28125
- } finally {
28126
- this._isInTransaction = false;
28127
- }
28128
- }
28129
- return ret;
28130
- },
28131
-
28132
- initializeAll: function (startIndex) {
28133
- var transactionWrappers = this.transactionWrappers;
28134
- for (var i = startIndex; i < transactionWrappers.length; i++) {
28135
- var wrapper = transactionWrappers[i];
28136
- try {
28137
- // Catching errors makes debugging more difficult, so we start with the
28138
- // OBSERVED_ERROR state before overwriting it with the real return value
28139
- // of initialize -- if it's still set to OBSERVED_ERROR in the finally
28140
- // block, it means wrapper.initialize threw.
28141
- this.wrapperInitData[i] = Transaction.OBSERVED_ERROR;
28142
- this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null;
28143
- } finally {
28144
- if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) {
28145
- // The initializer for wrapper i threw an error; initialize the
28146
- // remaining wrappers but silence any exceptions from them to ensure
28147
- // that the first error is the one to bubble up.
28148
- try {
28149
- this.initializeAll(i + 1);
28150
- } catch (err) {}
28151
- }
28152
- }
28153
- }
28154
- },
28155
-
28156
- /**
28157
- * Invokes each of `this.transactionWrappers.close[i]` functions, passing into
28158
- * them the respective return values of `this.transactionWrappers.init[i]`
28159
- * (`close`rs that correspond to initializers that failed will not be
28160
- * invoked).
28161
- */
28162
- closeAll: function (startIndex) {
28163
- !this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : invariant(false) : undefined;
28164
- var transactionWrappers = this.transactionWrappers;
28165
- for (var i = startIndex; i < transactionWrappers.length; i++) {
28166
- var wrapper = transactionWrappers[i];
28167
- var initData = this.wrapperInitData[i];
28168
- var errorThrown;
28169
- try {
28170
- // Catching errors makes debugging more difficult, so we start with
28171
- // errorThrown set to true before setting it to false after calling
28172
- // close -- if it's still set to true in the finally block, it means
28173
- // wrapper.close threw.
28174
- errorThrown = true;
28175
- if (initData !== Transaction.OBSERVED_ERROR && wrapper.close) {
28176
- wrapper.close.call(this, initData);
28177
- }
28178
- errorThrown = false;
28179
- } finally {
28180
- if (errorThrown) {
28181
- // The closer for wrapper i threw an error; close the remaining
28182
- // wrappers but silence any exceptions from them to ensure that the
28183
- // first error is the one to bubble up.
28184
- try {
28185
- this.closeAll(i + 1);
28186
- } catch (e) {}
28187
- }
28188
- }
28189
- }
28190
- this.wrapperInitData.length = 0;
28191
- }
28192
- };
28193
-
28194
- var Transaction = {
28195
-
28196
- Mixin: Mixin,
28197
-
28198
- /**
28199
- * Token to look for to determine if an error occurred.
28200
- */
28201
- OBSERVED_ERROR: {}
28202
-
28203
- };
28204
-
28205
- module.exports = Transaction;
28206
- }).call(this,require('_process'))
28207
-
28208
- },{"_process":31,"fbjs/lib/invariant":18}],133:[function(require,module,exports){
28209
- /**
28210
- * Copyright 2013-2015, Facebook, Inc.
28211
- * All rights reserved.
28212
- *
28213
- * This source code is licensed under the BSD-style license found in the
28214
- * LICENSE file in the root directory of this source tree. An additional grant
28215
- * of patent rights can be found in the PATENTS file in the same directory.
28216
- *
28217
- * @providesModule ViewportMetrics
28218
- */
28219
-
28220
- 'use strict';
28221
-
28222
- var ViewportMetrics = {
28223
-
28224
- currentScrollLeft: 0,
28225
-
28226
- currentScrollTop: 0,
28227
-
28228
- refreshScrollValues: function (scrollPosition) {
28229
- ViewportMetrics.currentScrollLeft = scrollPosition.x;
28230
- ViewportMetrics.currentScrollTop = scrollPosition.y;
28231
- }
28232
-
28233
- };
28234
-
28235
- module.exports = ViewportMetrics;
28236
- },{}],134:[function(require,module,exports){
28237
- (function (process){
28238
- /**
28239
- * Copyright 2014-2015, Facebook, Inc.
28240
- * All rights reserved.
28241
- *
28242
- * This source code is licensed under the BSD-style license found in the
28243
- * LICENSE file in the root directory of this source tree. An additional grant
28244
- * of patent rights can be found in the PATENTS file in the same directory.
28245
- *
28246
- * @providesModule accumulateInto
28247
- */
28248
-
28249
- 'use strict';
28250
-
28251
- var invariant = require('fbjs/lib/invariant');
28252
-
28253
- /**
28254
- *
28255
- * Accumulates items that must not be null or undefined into the first one. This
28256
- * is used to conserve memory by avoiding array allocations, and thus sacrifices
28257
- * API cleanness. Since `current` can be null before being passed in and not
28258
- * null after this function, make sure to assign it back to `current`:
28259
- *
28260
- * `a = accumulateInto(a, b);`
28261
- *
28262
- * This API should be sparingly used. Try `accumulate` for something cleaner.
28263
- *
28264
- * @return {*|array<*>} An accumulation of items.
28265
- */
28266
-
28267
- function accumulateInto(current, next) {
28268
- !(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : invariant(false) : undefined;
28269
- if (current == null) {
28270
- return next;
28271
- }
28272
-
28273
- // Both are not empty. Warning: Never call x.concat(y) when you are not
28274
- // certain that x is an Array (x could be a string with concat method).
28275
- var currentIsArray = Array.isArray(current);
28276
- var nextIsArray = Array.isArray(next);
28277
-
28278
- if (currentIsArray && nextIsArray) {
28279
- current.push.apply(current, next);
28280
- return current;
28281
- }
28282
-
28283
- if (currentIsArray) {
28284
- current.push(next);
28285
- return current;
28286
- }
28287
-
28288
- if (nextIsArray) {
28289
- // A bit too dangerous to mutate `next`.
28290
- return [current].concat(next);
28291
- }
28292
-
28293
- return [current, next];
28294
- }
28295
-
28296
- module.exports = accumulateInto;
28297
- }).call(this,require('_process'))
28298
-
28299
- },{"_process":31,"fbjs/lib/invariant":18}],135:[function(require,module,exports){
28300
- /**
28301
- * Copyright 2013-2015, Facebook, Inc.
28302
- * All rights reserved.
28303
- *
28304
- * This source code is licensed under the BSD-style license found in the
28305
- * LICENSE file in the root directory of this source tree. An additional grant
28306
- * of patent rights can be found in the PATENTS file in the same directory.
28307
- *
28308
- * @providesModule adler32
28309
- */
28310
-
28311
- 'use strict';
28312
-
28313
- var MOD = 65521;
28314
-
28315
- // adler32 is not cryptographically strong, and is only used to sanity check that
28316
- // markup generated on the server matches the markup generated on the client.
28317
- // This implementation (a modified version of the SheetJS version) has been optimized
28318
- // for our use case, at the expense of conforming to the adler32 specification
28319
- // for non-ascii inputs.
28320
- function adler32(data) {
28321
- var a = 1;
28322
- var b = 0;
28323
- var i = 0;
28324
- var l = data.length;
28325
- var m = l & ~0x3;
28326
- while (i < m) {
28327
- for (; i < Math.min(i + 4096, m); i += 4) {
28328
- b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3));
28329
- }
28330
- a %= MOD;
28331
- b %= MOD;
28332
- }
28333
- for (; i < l; i++) {
28334
- b += a += data.charCodeAt(i);
28335
- }
28336
- a %= MOD;
28337
- b %= MOD;
28338
- return a | b << 16;
28339
- }
28340
-
28341
- module.exports = adler32;
28342
- },{}],136:[function(require,module,exports){
28343
- (function (process){
28344
- /**
28345
- * Copyright 2013-2015, Facebook, Inc.
28346
- * All rights reserved.
28347
- *
28348
- * This source code is licensed under the BSD-style license found in the
28349
- * LICENSE file in the root directory of this source tree. An additional grant
28350
- * of patent rights can be found in the PATENTS file in the same directory.
28351
- *
28352
- * @providesModule canDefineProperty
28353
- */
28354
-
28355
- 'use strict';
28356
-
28357
- var canDefineProperty = false;
28358
- if (process.env.NODE_ENV !== 'production') {
28359
- try {
28360
- Object.defineProperty({}, 'x', { get: function () {} });
28361
- canDefineProperty = true;
28362
- } catch (x) {
28363
- // IE will fail on defineProperty
28364
- }
28365
- }
28366
-
28367
- module.exports = canDefineProperty;
28368
- }).call(this,require('_process'))
28369
-
28370
- },{"_process":31}],137:[function(require,module,exports){
28371
- /**
28372
- * Copyright 2013-2015, Facebook, Inc.
28373
- * All rights reserved.
28374
- *
28375
- * This source code is licensed under the BSD-style license found in the
28376
- * LICENSE file in the root directory of this source tree. An additional grant
28377
- * of patent rights can be found in the PATENTS file in the same directory.
28378
- *
28379
- * @providesModule dangerousStyleValue
28380
- * @typechecks static-only
28381
- */
28382
-
28383
- 'use strict';
28384
-
28385
- var CSSProperty = require('./CSSProperty');
28386
-
28387
- var isUnitlessNumber = CSSProperty.isUnitlessNumber;
28388
-
28389
- /**
28390
- * Convert a value into the proper css writable value. The style name `name`
28391
- * should be logical (no hyphens), as specified
28392
- * in `CSSProperty.isUnitlessNumber`.
28393
- *
28394
- * @param {string} name CSS property name such as `topMargin`.
28395
- * @param {*} value CSS property value such as `10px`.
28396
- * @return {string} Normalized style value with dimensions applied.
28397
- */
28398
- function dangerousStyleValue(name, value) {
28399
- // Note that we've removed escapeTextForBrowser() calls here since the
28400
- // whole string will be escaped when the attribute is injected into
28401
- // the markup. If you provide unsafe user data here they can inject
28402
- // arbitrary CSS which may be problematic (I couldn't repro this):
28403
- // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
28404
- // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
28405
- // This is not an XSS hole but instead a potential CSS injection issue
28406
- // which has lead to a greater discussion about how we're going to
28407
- // trust URLs moving forward. See #2115901
28408
-
28409
- var isEmpty = value == null || typeof value === 'boolean' || value === '';
28410
- if (isEmpty) {
28411
- return '';
28412
- }
28413
-
28414
- var isNonNumeric = isNaN(value);
28415
- if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
28416
- return '' + value; // cast to string
28417
- }
28418
-
28419
- if (typeof value === 'string') {
28420
- value = value.trim();
28421
- }
28422
- return value + 'px';
28423
- }
28424
-
28425
- module.exports = dangerousStyleValue;
28426
- },{"./CSSProperty":35}],138:[function(require,module,exports){
28427
- (function (process){
28428
- /**
28429
- * Copyright 2013-2015, Facebook, Inc.
28430
- * All rights reserved.
28431
- *
28432
- * This source code is licensed under the BSD-style license found in the
28433
- * LICENSE file in the root directory of this source tree. An additional grant
28434
- * of patent rights can be found in the PATENTS file in the same directory.
28435
- *
28436
- * @providesModule deprecated
28437
- */
28438
-
28439
- 'use strict';
28440
-
28441
- var assign = require('./Object.assign');
28442
- var warning = require('fbjs/lib/warning');
28443
-
28444
- /**
28445
- * This will log a single deprecation notice per function and forward the call
28446
- * on to the new API.
28447
- *
28448
- * @param {string} fnName The name of the function
28449
- * @param {string} newModule The module that fn will exist in
28450
- * @param {string} newPackage The module that fn will exist in
28451
- * @param {*} ctx The context this forwarded call should run in
28452
- * @param {function} fn The function to forward on to
28453
- * @return {function} The function that will warn once and then call fn
28454
- */
28455
- function deprecated(fnName, newModule, newPackage, ctx, fn) {
28456
- var warned = false;
28457
- if (process.env.NODE_ENV !== 'production') {
28458
- var newFn = function () {
28459
- process.env.NODE_ENV !== 'production' ? warning(warned,
28460
- // Require examples in this string must be split to prevent React's
28461
- // build tools from mistaking them for real requires.
28462
- // Otherwise the build tools will attempt to build a '%s' module.
28463
- 'React.%s is deprecated. Please use %s.%s from require' + '(\'%s\') ' + 'instead.', fnName, newModule, fnName, newPackage) : undefined;
28464
- warned = true;
28465
- return fn.apply(ctx, arguments);
28466
- };
28467
- // We need to make sure all properties of the original fn are copied over.
28468
- // In particular, this is needed to support PropTypes
28469
- return assign(newFn, fn);
28470
- }
28471
-
28472
- return fn;
28473
- }
28474
-
28475
- module.exports = deprecated;
28476
- }).call(this,require('_process'))
28477
-
28478
- },{"./Object.assign":54,"_process":31,"fbjs/lib/warning":29}],139:[function(require,module,exports){
28479
- /**
28480
- * Copyright 2013-2015, Facebook, Inc.
28481
- * All rights reserved.
28482
- *
28483
- * This source code is licensed under the BSD-style license found in the
28484
- * LICENSE file in the root directory of this source tree. An additional grant
28485
- * of patent rights can be found in the PATENTS file in the same directory.
28486
- *
28487
- * @providesModule escapeTextContentForBrowser
28488
- */
28489
-
28490
- 'use strict';
28491
-
28492
- var ESCAPE_LOOKUP = {
28493
- '&': '&amp;',
28494
- '>': '&gt;',
28495
- '<': '&lt;',
28496
- '"': '&quot;',
28497
- '\'': '&#x27;'
28498
- };
28499
-
28500
- var ESCAPE_REGEX = /[&><"']/g;
28501
-
28502
- function escaper(match) {
28503
- return ESCAPE_LOOKUP[match];
28504
- }
28505
-
28506
- /**
28507
- * Escapes text to prevent scripting attacks.
28508
- *
28509
- * @param {*} text Text value to escape.
28510
- * @return {string} An escaped string.
28511
- */
28512
- function escapeTextContentForBrowser(text) {
28513
- return ('' + text).replace(ESCAPE_REGEX, escaper);
28514
- }
28515
-
28516
- module.exports = escapeTextContentForBrowser;
28517
- },{}],140:[function(require,module,exports){
28518
- (function (process){
28519
- /**
28520
- * Copyright 2013-2015, Facebook, Inc.
28521
- * All rights reserved.
28522
- *
28523
- * This source code is licensed under the BSD-style license found in the
28524
- * LICENSE file in the root directory of this source tree. An additional grant
28525
- * of patent rights can be found in the PATENTS file in the same directory.
28526
- *
28527
- * @providesModule findDOMNode
28528
- * @typechecks static-only
28529
- */
28530
-
28531
- 'use strict';
28532
-
28533
- var ReactCurrentOwner = require('./ReactCurrentOwner');
28534
- var ReactInstanceMap = require('./ReactInstanceMap');
28535
- var ReactMount = require('./ReactMount');
28536
-
28537
- var invariant = require('fbjs/lib/invariant');
28538
- var warning = require('fbjs/lib/warning');
28539
-
28540
- /**
28541
- * Returns the DOM node rendered by this element.
28542
- *
28543
- * @param {ReactComponent|DOMElement} componentOrElement
28544
- * @return {?DOMElement} The root node of this element.
28545
- */
28546
- function findDOMNode(componentOrElement) {
28547
- if (process.env.NODE_ENV !== 'production') {
28548
- var owner = ReactCurrentOwner.current;
28549
- if (owner !== null) {
28550
- process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing getDOMNode or findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
28551
- owner._warnedAboutRefsInRender = true;
28552
- }
28553
- }
28554
- if (componentOrElement == null) {
28555
- return null;
28556
- }
28557
- if (componentOrElement.nodeType === 1) {
28558
- return componentOrElement;
28559
- }
28560
- if (ReactInstanceMap.has(componentOrElement)) {
28561
- return ReactMount.getNodeFromInstance(componentOrElement);
28562
- }
28563
- !(componentOrElement.render == null || typeof componentOrElement.render !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : invariant(false) : undefined;
28564
- !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : invariant(false) : undefined;
28565
- }
28566
-
28567
- module.exports = findDOMNode;
28568
- }).call(this,require('_process'))
28569
-
28570
- },{"./ReactCurrentOwner":66,"./ReactInstanceMap":94,"./ReactMount":97,"_process":31,"fbjs/lib/invariant":18,"fbjs/lib/warning":29}],141:[function(require,module,exports){
28571
- (function (process){
28572
- /**
28573
- * Copyright 2013-2015, Facebook, Inc.
28574
- * All rights reserved.
28575
- *
28576
- * This source code is licensed under the BSD-style license found in the
28577
- * LICENSE file in the root directory of this source tree. An additional grant
28578
- * of patent rights can be found in the PATENTS file in the same directory.
28579
- *
28580
- * @providesModule flattenChildren
28581
- */
28582
-
28583
- 'use strict';
28584
-
28585
- var traverseAllChildren = require('./traverseAllChildren');
28586
- var warning = require('fbjs/lib/warning');
28587
-
28588
- /**
28589
- * @param {function} traverseContext Context passed through traversal.
28590
- * @param {?ReactComponent} child React child component.
28591
- * @param {!string} name String name of key path to child.
28592
- */
28593
- function flattenSingleChildIntoContext(traverseContext, child, name) {
28594
- // We found a component instance.
28595
- var result = traverseContext;
28596
- var keyUnique = result[name] === undefined;
28597
- if (process.env.NODE_ENV !== 'production') {
28598
- process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined;
28599
- }
28600
- if (keyUnique && child != null) {
28601
- result[name] = child;
28602
- }
28603
- }
28604
-
28605
- /**
28606
- * Flattens children that are typically specified as `props.children`. Any null
28607
- * children will not be included in the resulting object.
28608
- * @return {!object} flattened children keyed by name.
28609
- */
28610
- function flattenChildren(children) {
28611
- if (children == null) {
28612
- return children;
28613
- }
28614
- var result = {};
28615
- traverseAllChildren(children, flattenSingleChildIntoContext, result);
28616
- return result;
28617
- }
28618
-
28619
- module.exports = flattenChildren;
28620
- }).call(this,require('_process'))
28621
-
28622
- },{"./traverseAllChildren":159,"_process":31,"fbjs/lib/warning":29}],142:[function(require,module,exports){
28623
- /**
28624
- * Copyright 2013-2015, Facebook, Inc.
28625
- * All rights reserved.
28626
- *
28627
- * This source code is licensed under the BSD-style license found in the
28628
- * LICENSE file in the root directory of this source tree. An additional grant
28629
- * of patent rights can be found in the PATENTS file in the same directory.
28630
- *
28631
- * @providesModule forEachAccumulated
28632
- */
28633
-
28634
- 'use strict';
28635
-
28636
- /**
28637
- * @param {array} arr an "accumulation" of items which is either an Array or
28638
- * a single item. Useful when paired with the `accumulate` module. This is a
28639
- * simple utility that allows us to reason about a collection of items, but
28640
- * handling the case when there is exactly one item (and we do not need to
28641
- * allocate an array).
28642
- */
28643
- var forEachAccumulated = function (arr, cb, scope) {
28644
- if (Array.isArray(arr)) {
28645
- arr.forEach(cb, scope);
28646
- } else if (arr) {
28647
- cb.call(scope, arr);
28648
- }
28649
- };
28650
-
28651
- module.exports = forEachAccumulated;
28652
- },{}],143:[function(require,module,exports){
28653
- /**
28654
- * Copyright 2013-2015, Facebook, Inc.
28655
- * All rights reserved.
28656
- *
28657
- * This source code is licensed under the BSD-style license found in the
28658
- * LICENSE file in the root directory of this source tree. An additional grant
28659
- * of patent rights can be found in the PATENTS file in the same directory.
28660
- *
28661
- * @providesModule getEventCharCode
28662
- * @typechecks static-only
28663
- */
28664
-
28665
- 'use strict';
28666
-
28667
- /**
28668
- * `charCode` represents the actual "character code" and is safe to use with
28669
- * `String.fromCharCode`. As such, only keys that correspond to printable
28670
- * characters produce a valid `charCode`, the only exception to this is Enter.
28671
- * The Tab-key is considered non-printable and does not have a `charCode`,
28672
- * presumably because it does not produce a tab-character in browsers.
28673
- *
28674
- * @param {object} nativeEvent Native browser event.
28675
- * @return {number} Normalized `charCode` property.
28676
- */
28677
- function getEventCharCode(nativeEvent) {
28678
- var charCode;
28679
- var keyCode = nativeEvent.keyCode;
28680
-
28681
- if ('charCode' in nativeEvent) {
28682
- charCode = nativeEvent.charCode;
28683
-
28684
- // FF does not set `charCode` for the Enter-key, check against `keyCode`.
28685
- if (charCode === 0 && keyCode === 13) {
28686
- charCode = 13;
28687
- }
28688
- } else {
28689
- // IE8 does not implement `charCode`, but `keyCode` has the correct value.
28690
- charCode = keyCode;
28691
- }
28692
-
28693
- // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
28694
- // Must not discard the (non-)printable Enter-key.
28695
- if (charCode >= 32 || charCode === 13) {
28696
- return charCode;
28697
- }
28698
-
28699
- return 0;
28700
- }
28701
-
28702
- module.exports = getEventCharCode;
28703
- },{}],144:[function(require,module,exports){
28704
- /**
28705
- * Copyright 2013-2015, Facebook, Inc.
28706
- * All rights reserved.
28707
- *
28708
- * This source code is licensed under the BSD-style license found in the
28709
- * LICENSE file in the root directory of this source tree. An additional grant
28710
- * of patent rights can be found in the PATENTS file in the same directory.
28711
- *
28712
- * @providesModule getEventKey
28713
- * @typechecks static-only
28714
- */
28715
-
28716
- 'use strict';
28717
-
28718
- var getEventCharCode = require('./getEventCharCode');
28719
-
28720
- /**
28721
- * Normalization of deprecated HTML5 `key` values
28722
- * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
28723
- */
28724
- var normalizeKey = {
28725
- 'Esc': 'Escape',
28726
- 'Spacebar': ' ',
28727
- 'Left': 'ArrowLeft',
28728
- 'Up': 'ArrowUp',
28729
- 'Right': 'ArrowRight',
28730
- 'Down': 'ArrowDown',
28731
- 'Del': 'Delete',
28732
- 'Win': 'OS',
28733
- 'Menu': 'ContextMenu',
28734
- 'Apps': 'ContextMenu',
28735
- 'Scroll': 'ScrollLock',
28736
- 'MozPrintableKey': 'Unidentified'
28737
- };
28738
-
28739
- /**
28740
- * Translation from legacy `keyCode` to HTML5 `key`
28741
- * Only special keys supported, all others depend on keyboard layout or browser
28742
- * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
28743
- */
28744
- var translateToKey = {
28745
- 8: 'Backspace',
28746
- 9: 'Tab',
28747
- 12: 'Clear',
28748
- 13: 'Enter',
28749
- 16: 'Shift',
28750
- 17: 'Control',
28751
- 18: 'Alt',
28752
- 19: 'Pause',
28753
- 20: 'CapsLock',
28754
- 27: 'Escape',
28755
- 32: ' ',
28756
- 33: 'PageUp',
28757
- 34: 'PageDown',
28758
- 35: 'End',
28759
- 36: 'Home',
28760
- 37: 'ArrowLeft',
28761
- 38: 'ArrowUp',
28762
- 39: 'ArrowRight',
28763
- 40: 'ArrowDown',
28764
- 45: 'Insert',
28765
- 46: 'Delete',
28766
- 112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6',
28767
- 118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12',
28768
- 144: 'NumLock',
28769
- 145: 'ScrollLock',
28770
- 224: 'Meta'
28771
- };
28772
-
28773
- /**
28774
- * @param {object} nativeEvent Native browser event.
28775
- * @return {string} Normalized `key` property.
28776
- */
28777
- function getEventKey(nativeEvent) {
28778
- if (nativeEvent.key) {
28779
- // Normalize inconsistent values reported by browsers due to
28780
- // implementations of a working draft specification.
28781
-
28782
- // FireFox implements `key` but returns `MozPrintableKey` for all
28783
- // printable characters (normalized to `Unidentified`), ignore it.
28784
- var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
28785
- if (key !== 'Unidentified') {
28786
- return key;
28787
- }
28788
- }
28789
-
28790
- // Browser does not implement `key`, polyfill as much of it as we can.
28791
- if (nativeEvent.type === 'keypress') {
28792
- var charCode = getEventCharCode(nativeEvent);
28793
-
28794
- // The enter-key is technically both printable and non-printable and can
28795
- // thus be captured by `keypress`, no other non-printable key should.
28796
- return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
28797
- }
28798
- if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
28799
- // While user keyboard layout determines the actual meaning of each
28800
- // `keyCode` value, almost all function keys have a universal value.
28801
- return translateToKey[nativeEvent.keyCode] || 'Unidentified';
28802
- }
28803
- return '';
28804
- }
28805
-
28806
- module.exports = getEventKey;
28807
- },{"./getEventCharCode":143}],145:[function(require,module,exports){
28808
- /**
28809
- * Copyright 2013-2015, Facebook, Inc.
28810
- * All rights reserved.
28811
- *
28812
- * This source code is licensed under the BSD-style license found in the
28813
- * LICENSE file in the root directory of this source tree. An additional grant
28814
- * of patent rights can be found in the PATENTS file in the same directory.
28815
- *
28816
- * @providesModule getEventModifierState
28817
- * @typechecks static-only
28818
- */
28819
-
28820
- 'use strict';
28821
-
28822
- /**
28823
- * Translation from modifier key to the associated property in the event.
28824
- * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
28825
- */
28826
-
28827
- var modifierKeyToProp = {
28828
- 'Alt': 'altKey',
28829
- 'Control': 'ctrlKey',
28830
- 'Meta': 'metaKey',
28831
- 'Shift': 'shiftKey'
28832
- };
28833
-
28834
- // IE8 does not implement getModifierState so we simply map it to the only
28835
- // modifier keys exposed by the event itself, does not support Lock-keys.
28836
- // Currently, all major browsers except Chrome seems to support Lock-keys.
28837
- function modifierStateGetter(keyArg) {
28838
- var syntheticEvent = this;
28839
- var nativeEvent = syntheticEvent.nativeEvent;
28840
- if (nativeEvent.getModifierState) {
28841
- return nativeEvent.getModifierState(keyArg);
28842
- }
28843
- var keyProp = modifierKeyToProp[keyArg];
28844
- return keyProp ? !!nativeEvent[keyProp] : false;
28845
- }
28846
-
28847
- function getEventModifierState(nativeEvent) {
28848
- return modifierStateGetter;
28849
- }
28850
-
28851
- module.exports = getEventModifierState;
28852
- },{}],146:[function(require,module,exports){
28853
- /**
28854
- * Copyright 2013-2015, Facebook, Inc.
28855
- * All rights reserved.
28856
- *
28857
- * This source code is licensed under the BSD-style license found in the
28858
- * LICENSE file in the root directory of this source tree. An additional grant
28859
- * of patent rights can be found in the PATENTS file in the same directory.
28860
- *
28861
- * @providesModule getEventTarget
28862
- * @typechecks static-only
28863
- */
28864
-
28865
- 'use strict';
28866
-
28867
- /**
28868
- * Gets the target node from a native browser event by accounting for
28869
- * inconsistencies in browser DOM APIs.
28870
- *
28871
- * @param {object} nativeEvent Native browser event.
28872
- * @return {DOMEventTarget} Target node.
28873
- */
28874
- function getEventTarget(nativeEvent) {
28875
- var target = nativeEvent.target || nativeEvent.srcElement || window;
28876
- // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
28877
- // @see http://www.quirksmode.org/js/events_properties.html
28878
- return target.nodeType === 3 ? target.parentNode : target;
28879
- }
28880
-
28881
- module.exports = getEventTarget;
28882
- },{}],147:[function(require,module,exports){
28883
- /**
28884
- * Copyright 2013-2015, Facebook, Inc.
28885
- * All rights reserved.
28886
- *
28887
- * This source code is licensed under the BSD-style license found in the
28888
- * LICENSE file in the root directory of this source tree. An additional grant
28889
- * of patent rights can be found in the PATENTS file in the same directory.
28890
- *
28891
- * @providesModule getIteratorFn
28892
- * @typechecks static-only
28893
- */
28894
-
28895
- 'use strict';
28896
-
28897
- /* global Symbol */
28898
- var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
28899
- var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
28900
-
28901
- /**
28902
- * Returns the iterator method function contained on the iterable object.
28903
- *
28904
- * Be sure to invoke the function with the iterable as context:
28905
- *
28906
- * var iteratorFn = getIteratorFn(myIterable);
28907
- * if (iteratorFn) {
28908
- * var iterator = iteratorFn.call(myIterable);
28909
- * ...
28910
- * }
28911
- *
28912
- * @param {?object} maybeIterable
28913
- * @return {?function}
28914
- */
28915
- function getIteratorFn(maybeIterable) {
28916
- var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
28917
- if (typeof iteratorFn === 'function') {
28918
- return iteratorFn;
28919
- }
28920
- }
28921
-
28922
- module.exports = getIteratorFn;
28923
- },{}],148:[function(require,module,exports){
28924
- /**
28925
- * Copyright 2013-2015, Facebook, Inc.
28926
- * All rights reserved.
28927
- *
28928
- * This source code is licensed under the BSD-style license found in the
28929
- * LICENSE file in the root directory of this source tree. An additional grant
28930
- * of patent rights can be found in the PATENTS file in the same directory.
28931
- *
28932
- * @providesModule getNodeForCharacterOffset
28933
- */
28934
-
28935
- 'use strict';
28936
-
28937
- /**
28938
- * Given any node return the first leaf node without children.
28939
- *
28940
- * @param {DOMElement|DOMTextNode} node
28941
- * @return {DOMElement|DOMTextNode}
28942
- */
28943
- function getLeafNode(node) {
28944
- while (node && node.firstChild) {
28945
- node = node.firstChild;
28946
- }
28947
- return node;
28948
- }
28949
-
28950
- /**
28951
- * Get the next sibling within a container. This will walk up the
28952
- * DOM if a node's siblings have been exhausted.
28953
- *
28954
- * @param {DOMElement|DOMTextNode} node
28955
- * @return {?DOMElement|DOMTextNode}
28956
- */
28957
- function getSiblingNode(node) {
28958
- while (node) {
28959
- if (node.nextSibling) {
28960
- return node.nextSibling;
28961
- }
28962
- node = node.parentNode;
28963
- }
28964
- }
28965
-
28966
- /**
28967
- * Get object describing the nodes which contain characters at offset.
28968
- *
28969
- * @param {DOMElement|DOMTextNode} root
28970
- * @param {number} offset
28971
- * @return {?object}
28972
- */
28973
- function getNodeForCharacterOffset(root, offset) {
28974
- var node = getLeafNode(root);
28975
- var nodeStart = 0;
28976
- var nodeEnd = 0;
28977
-
28978
- while (node) {
28979
- if (node.nodeType === 3) {
28980
- nodeEnd = nodeStart + node.textContent.length;
28981
-
28982
- if (nodeStart <= offset && nodeEnd >= offset) {
28983
- return {
28984
- node: node,
28985
- offset: offset - nodeStart
28986
- };
28987
- }
28988
-
28989
- nodeStart = nodeEnd;
28990
- }
28991
-
28992
- node = getLeafNode(getSiblingNode(node));
28993
- }
28994
- }
28995
-
28996
- module.exports = getNodeForCharacterOffset;
28997
- },{}],149:[function(require,module,exports){
28998
- /**
28999
- * Copyright 2013-2015, Facebook, Inc.
29000
- * All rights reserved.
29001
- *
29002
- * This source code is licensed under the BSD-style license found in the
29003
- * LICENSE file in the root directory of this source tree. An additional grant
29004
- * of patent rights can be found in the PATENTS file in the same directory.
29005
- *
29006
- * @providesModule getTextContentAccessor
29007
- */
29008
-
29009
- 'use strict';
29010
-
29011
- var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
29012
-
29013
- var contentKey = null;
29014
-
29015
- /**
29016
- * Gets the key used to access text content on a DOM node.
29017
- *
29018
- * @return {?string} Key used to access text content.
29019
- * @internal
29020
- */
29021
- function getTextContentAccessor() {
29022
- if (!contentKey && ExecutionEnvironment.canUseDOM) {
29023
- // Prefer textContent to innerText because many browsers support both but
29024
- // SVG <text> elements don't support innerText even when <div> does.
29025
- contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText';
29026
- }
29027
- return contentKey;
29028
- }
29029
-
29030
- module.exports = getTextContentAccessor;
29031
- },{"fbjs/lib/ExecutionEnvironment":4}],150:[function(require,module,exports){
29032
- (function (process){
29033
- /**
29034
- * Copyright 2013-2015, Facebook, Inc.
29035
- * All rights reserved.
29036
- *
29037
- * This source code is licensed under the BSD-style license found in the
29038
- * LICENSE file in the root directory of this source tree. An additional grant
29039
- * of patent rights can be found in the PATENTS file in the same directory.
29040
- *
29041
- * @providesModule instantiateReactComponent
29042
- * @typechecks static-only
29043
- */
29044
-
29045
- 'use strict';
29046
-
29047
- var ReactCompositeComponent = require('./ReactCompositeComponent');
29048
- var ReactEmptyComponent = require('./ReactEmptyComponent');
29049
- var ReactNativeComponent = require('./ReactNativeComponent');
29050
-
29051
- var assign = require('./Object.assign');
29052
- var invariant = require('fbjs/lib/invariant');
29053
- var warning = require('fbjs/lib/warning');
29054
-
29055
- // To avoid a cyclic dependency, we create the final class in this module
29056
- var ReactCompositeComponentWrapper = function () {};
29057
- assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
29058
- _instantiateReactComponent: instantiateReactComponent
29059
- });
29060
-
29061
- function getDeclarationErrorAddendum(owner) {
29062
- if (owner) {
29063
- var name = owner.getName();
29064
- if (name) {
29065
- return ' Check the render method of `' + name + '`.';
29066
- }
29067
- }
29068
- return '';
29069
- }
29070
-
29071
- /**
29072
- * Check if the type reference is a known internal type. I.e. not a user
29073
- * provided composite type.
29074
- *
29075
- * @param {function} type
29076
- * @return {boolean} Returns true if this is a valid internal type.
29077
- */
29078
- function isInternalComponentType(type) {
29079
- return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function';
29080
- }
29081
-
29082
- /**
29083
- * Given a ReactNode, create an instance that will actually be mounted.
29084
- *
29085
- * @param {ReactNode} node
29086
- * @return {object} A new instance of the element's constructor.
29087
- * @protected
29088
- */
29089
- function instantiateReactComponent(node) {
29090
- var instance;
29091
-
29092
- if (node === null || node === false) {
29093
- instance = new ReactEmptyComponent(instantiateReactComponent);
29094
- } else if (typeof node === 'object') {
29095
- var element = node;
29096
- !(element && (typeof element.type === 'function' || typeof element.type === 'string')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element type is invalid: expected a string (for built-in components) ' + 'or a class/function (for composite components) but got: %s.%s', element.type == null ? element.type : typeof element.type, getDeclarationErrorAddendum(element._owner)) : invariant(false) : undefined;
29097
-
29098
- // Special case string values
29099
- if (typeof element.type === 'string') {
29100
- instance = ReactNativeComponent.createInternalComponent(element);
29101
- } else if (isInternalComponentType(element.type)) {
29102
- // This is temporarily available for custom components that are not string
29103
- // representations. I.e. ART. Once those are updated to use the string
29104
- // representation, we can drop this code path.
29105
- instance = new element.type(element);
29106
- } else {
29107
- instance = new ReactCompositeComponentWrapper();
29108
- }
29109
- } else if (typeof node === 'string' || typeof node === 'number') {
29110
- instance = ReactNativeComponent.createInstanceForText(node);
29111
- } else {
29112
- !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : invariant(false) : undefined;
29113
- }
29114
-
29115
- if (process.env.NODE_ENV !== 'production') {
29116
- process.env.NODE_ENV !== 'production' ? warning(typeof instance.construct === 'function' && typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : undefined;
29117
- }
29118
-
29119
- // Sets up the instance. This can probably just move into the constructor now.
29120
- instance.construct(node);
29121
-
29122
- // These two fields are used by the DOM and ART diffing algorithms
29123
- // respectively. Instead of using expandos on components, we should be
29124
- // storing the state needed by the diffing algorithms elsewhere.
29125
- instance._mountIndex = 0;
29126
- instance._mountImage = null;
29127
-
29128
- if (process.env.NODE_ENV !== 'production') {
29129
- instance._isOwnerNecessary = false;
29130
- instance._warnedAboutRefsInRender = false;
29131
- }
29132
-
29133
- // Internal instances should fully constructed at this point, so they should
29134
- // not get any new fields added to them at this point.
29135
- if (process.env.NODE_ENV !== 'production') {
29136
- if (Object.preventExtensions) {
29137
- Object.preventExtensions(instance);
29138
- }
29139
- }
29140
-
29141
- return instance;
29142
- }
29143
-
29144
- module.exports = instantiateReactComponent;
29145
- }).call(this,require('_process'))
29146
-
29147
- },{"./Object.assign":54,"./ReactCompositeComponent":65,"./ReactEmptyComponent":86,"./ReactNativeComponent":100,"_process":31,"fbjs/lib/invariant":18,"fbjs/lib/warning":29}],151:[function(require,module,exports){
29148
- /**
29149
- * Copyright 2013-2015, Facebook, Inc.
29150
- * All rights reserved.
29151
- *
29152
- * This source code is licensed under the BSD-style license found in the
29153
- * LICENSE file in the root directory of this source tree. An additional grant
29154
- * of patent rights can be found in the PATENTS file in the same directory.
29155
- *
29156
- * @providesModule isEventSupported
29157
- */
29158
-
29159
- 'use strict';
29160
-
29161
- var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
29162
-
29163
- var useHasFeature;
29164
- if (ExecutionEnvironment.canUseDOM) {
29165
- useHasFeature = document.implementation && document.implementation.hasFeature &&
29166
- // always returns true in newer browsers as per the standard.
29167
- // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
29168
- document.implementation.hasFeature('', '') !== true;
29169
- }
29170
-
29171
- /**
29172
- * Checks if an event is supported in the current execution environment.
29173
- *
29174
- * NOTE: This will not work correctly for non-generic events such as `change`,
29175
- * `reset`, `load`, `error`, and `select`.
29176
- *
29177
- * Borrows from Modernizr.
29178
- *
29179
- * @param {string} eventNameSuffix Event name, e.g. "click".
29180
- * @param {?boolean} capture Check if the capture phase is supported.
29181
- * @return {boolean} True if the event is supported.
29182
- * @internal
29183
- * @license Modernizr 3.0.0pre (Custom Build) | MIT
29184
- */
29185
- function isEventSupported(eventNameSuffix, capture) {
29186
- if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
29187
- return false;
29188
- }
29189
-
29190
- var eventName = 'on' + eventNameSuffix;
29191
- var isSupported = (eventName in document);
29192
-
29193
- if (!isSupported) {
29194
- var element = document.createElement('div');
29195
- element.setAttribute(eventName, 'return;');
29196
- isSupported = typeof element[eventName] === 'function';
29197
- }
29198
-
29199
- if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {
29200
- // This is the only way to test support for the `wheel` event in IE9+.
29201
- isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
29202
- }
29203
-
29204
- return isSupported;
29205
- }
29206
-
29207
- module.exports = isEventSupported;
29208
- },{"fbjs/lib/ExecutionEnvironment":4}],152:[function(require,module,exports){
29209
- /**
29210
- * Copyright 2013-2015, Facebook, Inc.
29211
- * All rights reserved.
29212
- *
29213
- * This source code is licensed under the BSD-style license found in the
29214
- * LICENSE file in the root directory of this source tree. An additional grant
29215
- * of patent rights can be found in the PATENTS file in the same directory.
29216
- *
29217
- * @providesModule isTextInputElement
29218
- */
29219
-
29220
- 'use strict';
29221
-
29222
- /**
29223
- * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
29224
- */
29225
- var supportedInputTypes = {
29226
- 'color': true,
29227
- 'date': true,
29228
- 'datetime': true,
29229
- 'datetime-local': true,
29230
- 'email': true,
29231
- 'month': true,
29232
- 'number': true,
29233
- 'password': true,
29234
- 'range': true,
29235
- 'search': true,
29236
- 'tel': true,
29237
- 'text': true,
29238
- 'time': true,
29239
- 'url': true,
29240
- 'week': true
29241
- };
29242
-
29243
- function isTextInputElement(elem) {
29244
- var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
29245
- return nodeName && (nodeName === 'input' && supportedInputTypes[elem.type] || nodeName === 'textarea');
29246
- }
29247
-
29248
- module.exports = isTextInputElement;
29249
- },{}],153:[function(require,module,exports){
29250
- (function (process){
29251
- /**
29252
- * Copyright 2013-2015, Facebook, Inc.
29253
- * All rights reserved.
29254
- *
29255
- * This source code is licensed under the BSD-style license found in the
29256
- * LICENSE file in the root directory of this source tree. An additional grant
29257
- * of patent rights can be found in the PATENTS file in the same directory.
29258
- *
29259
- * @providesModule onlyChild
29260
- */
29261
- 'use strict';
29262
-
29263
- var ReactElement = require('./ReactElement');
29264
-
29265
- var invariant = require('fbjs/lib/invariant');
29266
-
29267
- /**
29268
- * Returns the first child in a collection of children and verifies that there
29269
- * is only one child in the collection. The current implementation of this
29270
- * function assumes that a single child gets passed without a wrapper, but the
29271
- * purpose of this helper function is to abstract away the particular structure
29272
- * of children.
29273
- *
29274
- * @param {?object} children Child collection structure.
29275
- * @return {ReactComponent} The first and only `ReactComponent` contained in the
29276
- * structure.
29277
- */
29278
- function onlyChild(children) {
29279
- !ReactElement.isValidElement(children) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'onlyChild must be passed a children with exactly one child.') : invariant(false) : undefined;
29280
- return children;
29281
- }
29282
-
29283
- module.exports = onlyChild;
29284
- }).call(this,require('_process'))
29285
-
29286
- },{"./ReactElement":84,"_process":31,"fbjs/lib/invariant":18}],154:[function(require,module,exports){
29287
- /**
29288
- * Copyright 2013-2015, Facebook, Inc.
29289
- * All rights reserved.
29290
- *
29291
- * This source code is licensed under the BSD-style license found in the
29292
- * LICENSE file in the root directory of this source tree. An additional grant
29293
- * of patent rights can be found in the PATENTS file in the same directory.
29294
- *
29295
- * @providesModule quoteAttributeValueForBrowser
29296
- */
29297
-
29298
- 'use strict';
29299
-
29300
- var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
29301
-
29302
- /**
29303
- * Escapes attribute value to prevent scripting attacks.
29304
- *
29305
- * @param {*} value Value to escape.
29306
- * @return {string} An escaped string.
29307
- */
29308
- function quoteAttributeValueForBrowser(value) {
29309
- return '"' + escapeTextContentForBrowser(value) + '"';
29310
- }
29311
-
29312
- module.exports = quoteAttributeValueForBrowser;
29313
- },{"./escapeTextContentForBrowser":139}],155:[function(require,module,exports){
29314
- /**
29315
- * Copyright 2013-2015, Facebook, Inc.
29316
- * All rights reserved.
29317
- *
29318
- * This source code is licensed under the BSD-style license found in the
29319
- * LICENSE file in the root directory of this source tree. An additional grant
29320
- * of patent rights can be found in the PATENTS file in the same directory.
29321
- *
29322
- * @providesModule renderSubtreeIntoContainer
29323
- */
29324
-
29325
- 'use strict';
29326
-
29327
- var ReactMount = require('./ReactMount');
29328
-
29329
- module.exports = ReactMount.renderSubtreeIntoContainer;
29330
- },{"./ReactMount":97}],156:[function(require,module,exports){
29331
- /**
29332
- * Copyright 2013-2015, Facebook, Inc.
29333
- * All rights reserved.
29334
- *
29335
- * This source code is licensed under the BSD-style license found in the
29336
- * LICENSE file in the root directory of this source tree. An additional grant
29337
- * of patent rights can be found in the PATENTS file in the same directory.
29338
- *
29339
- * @providesModule setInnerHTML
29340
- */
29341
-
29342
- /* globals MSApp */
29343
-
29344
- 'use strict';
29345
-
29346
- var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
29347
-
29348
- var WHITESPACE_TEST = /^[ \r\n\t\f]/;
29349
- var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
29350
-
29351
- /**
29352
- * Set the innerHTML property of a node, ensuring that whitespace is preserved
29353
- * even in IE8.
29354
- *
29355
- * @param {DOMElement} node
29356
- * @param {string} html
29357
- * @internal
29358
- */
29359
- var setInnerHTML = function (node, html) {
29360
- node.innerHTML = html;
29361
- };
29362
-
29363
- // Win8 apps: Allow all html to be inserted
29364
- if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
29365
- setInnerHTML = function (node, html) {
29366
- MSApp.execUnsafeLocalFunction(function () {
29367
- node.innerHTML = html;
29368
- });
29369
- };
29370
- }
29371
-
29372
- if (ExecutionEnvironment.canUseDOM) {
29373
- // IE8: When updating a just created node with innerHTML only leading
29374
- // whitespace is removed. When updating an existing node with innerHTML
29375
- // whitespace in root TextNodes is also collapsed.
29376
- // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html
29377
-
29378
- // Feature detection; only IE8 is known to behave improperly like this.
29379
- var testElement = document.createElement('div');
29380
- testElement.innerHTML = ' ';
29381
- if (testElement.innerHTML === '') {
29382
- setInnerHTML = function (node, html) {
29383
- // Magic theory: IE8 supposedly differentiates between added and updated
29384
- // nodes when processing innerHTML, innerHTML on updated nodes suffers
29385
- // from worse whitespace behavior. Re-adding a node like this triggers
29386
- // the initial and more favorable whitespace behavior.
29387
- // TODO: What to do on a detached node?
29388
- if (node.parentNode) {
29389
- node.parentNode.replaceChild(node, node);
29390
- }
29391
-
29392
- // We also implement a workaround for non-visible tags disappearing into
29393
- // thin air on IE8, this only happens if there is no visible text
29394
- // in-front of the non-visible tags. Piggyback on the whitespace fix
29395
- // and simply check if any non-visible tags appear in the source.
29396
- if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) {
29397
- // Recover leading whitespace by temporarily prepending any character.
29398
- // \uFEFF has the potential advantage of being zero-width/invisible.
29399
- // UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode
29400
- // in hopes that this is preserved even if "\uFEFF" is transformed to
29401
- // the actual Unicode character (by Babel, for example).
29402
- // https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216
29403
- node.innerHTML = String.fromCharCode(0xFEFF) + html;
29404
-
29405
- // deleteData leaves an empty `TextNode` which offsets the index of all
29406
- // children. Definitely want to avoid this.
29407
- var textNode = node.firstChild;
29408
- if (textNode.data.length === 1) {
29409
- node.removeChild(textNode);
29410
- } else {
29411
- textNode.deleteData(0, 1);
29412
- }
29413
- } else {
29414
- node.innerHTML = html;
29415
- }
29416
- };
29417
- }
29418
- }
29419
-
29420
- module.exports = setInnerHTML;
29421
- },{"fbjs/lib/ExecutionEnvironment":4}],157:[function(require,module,exports){
29422
- /**
29423
- * Copyright 2013-2015, Facebook, Inc.
29424
- * All rights reserved.
29425
- *
29426
- * This source code is licensed under the BSD-style license found in the
29427
- * LICENSE file in the root directory of this source tree. An additional grant
29428
- * of patent rights can be found in the PATENTS file in the same directory.
29429
- *
29430
- * @providesModule setTextContent
29431
- */
29432
-
29433
- 'use strict';
29434
-
29435
- var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
29436
- var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
29437
- var setInnerHTML = require('./setInnerHTML');
29438
-
29439
- /**
29440
- * Set the textContent property of a node, ensuring that whitespace is preserved
29441
- * even in IE8. innerText is a poor substitute for textContent and, among many
29442
- * issues, inserts <br> instead of the literal newline chars. innerHTML behaves
29443
- * as it should.
29444
- *
29445
- * @param {DOMElement} node
29446
- * @param {string} text
29447
- * @internal
29448
- */
29449
- var setTextContent = function (node, text) {
29450
- node.textContent = text;
29451
- };
29452
-
29453
- if (ExecutionEnvironment.canUseDOM) {
29454
- if (!('textContent' in document.documentElement)) {
29455
- setTextContent = function (node, text) {
29456
- setInnerHTML(node, escapeTextContentForBrowser(text));
29457
- };
29458
- }
29459
- }
29460
-
29461
- module.exports = setTextContent;
29462
- },{"./escapeTextContentForBrowser":139,"./setInnerHTML":156,"fbjs/lib/ExecutionEnvironment":4}],158:[function(require,module,exports){
29463
- /**
29464
- * Copyright 2013-2015, Facebook, Inc.
29465
- * All rights reserved.
29466
- *
29467
- * This source code is licensed under the BSD-style license found in the
29468
- * LICENSE file in the root directory of this source tree. An additional grant
29469
- * of patent rights can be found in the PATENTS file in the same directory.
29470
- *
29471
- * @providesModule shouldUpdateReactComponent
29472
- * @typechecks static-only
29473
- */
29474
-
29475
- 'use strict';
29476
-
29477
- /**
29478
- * Given a `prevElement` and `nextElement`, determines if the existing
29479
- * instance should be updated as opposed to being destroyed or replaced by a new
29480
- * instance. Both arguments are elements. This ensures that this logic can
29481
- * operate on stateless trees without any backing instance.
29482
- *
29483
- * @param {?object} prevElement
29484
- * @param {?object} nextElement
29485
- * @return {boolean} True if the existing instance should be updated.
29486
- * @protected
29487
- */
29488
- function shouldUpdateReactComponent(prevElement, nextElement) {
29489
- var prevEmpty = prevElement === null || prevElement === false;
29490
- var nextEmpty = nextElement === null || nextElement === false;
29491
- if (prevEmpty || nextEmpty) {
29492
- return prevEmpty === nextEmpty;
29493
- }
29494
-
29495
- var prevType = typeof prevElement;
29496
- var nextType = typeof nextElement;
29497
- if (prevType === 'string' || prevType === 'number') {
29498
- return nextType === 'string' || nextType === 'number';
29499
- } else {
29500
- return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key;
29501
- }
29502
- return false;
29503
- }
29504
-
29505
- module.exports = shouldUpdateReactComponent;
29506
- },{}],159:[function(require,module,exports){
29507
- (function (process){
29508
- /**
29509
- * Copyright 2013-2015, Facebook, Inc.
29510
- * All rights reserved.
29511
- *
29512
- * This source code is licensed under the BSD-style license found in the
29513
- * LICENSE file in the root directory of this source tree. An additional grant
29514
- * of patent rights can be found in the PATENTS file in the same directory.
29515
- *
29516
- * @providesModule traverseAllChildren
29517
- */
29518
-
29519
- 'use strict';
29520
-
29521
- var ReactCurrentOwner = require('./ReactCurrentOwner');
29522
- var ReactElement = require('./ReactElement');
29523
- var ReactInstanceHandles = require('./ReactInstanceHandles');
29524
-
29525
- var getIteratorFn = require('./getIteratorFn');
29526
- var invariant = require('fbjs/lib/invariant');
29527
- var warning = require('fbjs/lib/warning');
29528
-
29529
- var SEPARATOR = ReactInstanceHandles.SEPARATOR;
29530
- var SUBSEPARATOR = ':';
29531
-
29532
- /**
29533
- * TODO: Test that a single child and an array with one item have the same key
29534
- * pattern.
29535
- */
29536
-
29537
- var userProvidedKeyEscaperLookup = {
29538
- '=': '=0',
29539
- '.': '=1',
29540
- ':': '=2'
29541
- };
29542
-
29543
- var userProvidedKeyEscapeRegex = /[=.:]/g;
29544
-
29545
- var didWarnAboutMaps = false;
29546
-
29547
- function userProvidedKeyEscaper(match) {
29548
- return userProvidedKeyEscaperLookup[match];
29549
- }
29550
-
29551
- /**
29552
- * Generate a key string that identifies a component within a set.
29553
- *
29554
- * @param {*} component A component that could contain a manual key.
29555
- * @param {number} index Index that is used if a manual key is not provided.
29556
- * @return {string}
29557
- */
29558
- function getComponentKey(component, index) {
29559
- if (component && component.key != null) {
29560
- // Explicit key
29561
- return wrapUserProvidedKey(component.key);
29562
- }
29563
- // Implicit key determined by the index in the set
29564
- return index.toString(36);
29565
- }
29566
-
29567
- /**
29568
- * Escape a component key so that it is safe to use in a reactid.
29569
- *
29570
- * @param {*} text Component key to be escaped.
29571
- * @return {string} An escaped string.
29572
- */
29573
- function escapeUserProvidedKey(text) {
29574
- return ('' + text).replace(userProvidedKeyEscapeRegex, userProvidedKeyEscaper);
29575
- }
29576
-
29577
- /**
29578
- * Wrap a `key` value explicitly provided by the user to distinguish it from
29579
- * implicitly-generated keys generated by a component's index in its parent.
29580
- *
29581
- * @param {string} key Value of a user-provided `key` attribute
29582
- * @return {string}
29583
- */
29584
- function wrapUserProvidedKey(key) {
29585
- return '$' + escapeUserProvidedKey(key);
29586
- }
29587
-
29588
- /**
29589
- * @param {?*} children Children tree container.
29590
- * @param {!string} nameSoFar Name of the key path so far.
29591
- * @param {!function} callback Callback to invoke with each child found.
29592
- * @param {?*} traverseContext Used to pass information throughout the traversal
29593
- * process.
29594
- * @return {!number} The number of children in this subtree.
29595
- */
29596
- function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
29597
- var type = typeof children;
29598
-
29599
- if (type === 'undefined' || type === 'boolean') {
29600
- // All of the above are perceived as null.
29601
- children = null;
29602
- }
29603
-
29604
- if (children === null || type === 'string' || type === 'number' || ReactElement.isValidElement(children)) {
29605
- callback(traverseContext, children,
29606
- // If it's the only child, treat the name as if it was wrapped in an array
29607
- // so that it's consistent if the number of children grows.
29608
- nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
29609
- return 1;
29610
- }
29611
-
29612
- var child;
29613
- var nextName;
29614
- var subtreeCount = 0; // Count of children found in the current subtree.
29615
- var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
29616
-
29617
- if (Array.isArray(children)) {
29618
- for (var i = 0; i < children.length; i++) {
29619
- child = children[i];
29620
- nextName = nextNamePrefix + getComponentKey(child, i);
29621
- subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
29622
- }
29623
- } else {
29624
- var iteratorFn = getIteratorFn(children);
29625
- if (iteratorFn) {
29626
- var iterator = iteratorFn.call(children);
29627
- var step;
29628
- if (iteratorFn !== children.entries) {
29629
- var ii = 0;
29630
- while (!(step = iterator.next()).done) {
29631
- child = step.value;
29632
- nextName = nextNamePrefix + getComponentKey(child, ii++);
29633
- subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
29634
- }
29635
- } else {
29636
- if (process.env.NODE_ENV !== 'production') {
29637
- process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.') : undefined;
29638
- didWarnAboutMaps = true;
29639
- }
29640
- // Iterator will provide entry [k,v] tuples rather than values.
29641
- while (!(step = iterator.next()).done) {
29642
- var entry = step.value;
29643
- if (entry) {
29644
- child = entry[1];
29645
- nextName = nextNamePrefix + wrapUserProvidedKey(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
29646
- subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
29647
- }
29648
  }
29649
- }
29650
- } else if (type === 'object') {
29651
- var addendum = '';
29652
- if (process.env.NODE_ENV !== 'production') {
29653
- addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.';
29654
- if (children._isReactElement) {
29655
- addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29656
  }
29657
- if (ReactCurrentOwner.current) {
29658
- var name = ReactCurrentOwner.current.getName();
29659
- if (name) {
29660
- addendum += ' Check the render method of `' + name + '`.';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29661
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29662
  }
29663
- }
29664
- var childrenString = String(children);
29665
- !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : invariant(false) : undefined;
29666
- }
29667
- }
29668
-
29669
- return subtreeCount;
29670
- }
29671
-
29672
- /**
29673
- * Traverses children that are typically specified as `props.children`, but
29674
- * might also be specified through attributes:
29675
- *
29676
- * - `traverseAllChildren(this.props.children, ...)`
29677
- * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
29678
- *
29679
- * The `traverseContext` is an optional argument that is passed through the
29680
- * entire traversal. It can be used to store accumulations or anything else that
29681
- * the callback might find relevant.
29682
- *
29683
- * @param {?*} children Children tree object.
29684
- * @param {!function} callback To invoke upon traversing each child.
29685
- * @param {?*} traverseContext Context for traversal.
29686
- * @return {!number} The number of children in this subtree.
29687
- */
29688
- function traverseAllChildren(children, callback, traverseContext) {
29689
- if (children == null) {
29690
- return 0;
29691
- }
29692
-
29693
- return traverseAllChildrenImpl(children, '', callback, traverseContext);
29694
- }
29695
-
29696
- module.exports = traverseAllChildren;
29697
- }).call(this,require('_process'))
29698
-
29699
- },{"./ReactCurrentOwner":66,"./ReactElement":84,"./ReactInstanceHandles":93,"./getIteratorFn":147,"_process":31,"fbjs/lib/invariant":18,"fbjs/lib/warning":29}],160:[function(require,module,exports){
29700
- (function (process){
29701
- /**
29702
- * Copyright 2015, Facebook, Inc.
29703
- * All rights reserved.
29704
- *
29705
- * This source code is licensed under the BSD-style license found in the
29706
- * LICENSE file in the root directory of this source tree. An additional grant
29707
- * of patent rights can be found in the PATENTS file in the same directory.
29708
- *
29709
- * @providesModule validateDOMNesting
29710
- */
29711
-
29712
- 'use strict';
29713
-
29714
- var assign = require('./Object.assign');
29715
- var emptyFunction = require('fbjs/lib/emptyFunction');
29716
- var warning = require('fbjs/lib/warning');
29717
-
29718
- var validateDOMNesting = emptyFunction;
29719
-
29720
- if (process.env.NODE_ENV !== 'production') {
29721
- // This validation code was written based on the HTML5 parsing spec:
29722
- // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
29723
- //
29724
- // Note: this does not catch all invalid nesting, nor does it try to (as it's
29725
- // not clear what practical benefit doing so provides); instead, we warn only
29726
- // for cases where the parser will give a parse tree differing from what React
29727
- // intended. For example, <b><div></div></b> is invalid but we don't warn
29728
- // because it still parses correctly; we do warn for other cases like nested
29729
- // <p> tags where the beginning of the second element implicitly closes the
29730
- // first, causing a confusing mess.
29731
-
29732
- // https://html.spec.whatwg.org/multipage/syntax.html#special
29733
- var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp'];
29734
-
29735
- // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
29736
- var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template',
29737
-
29738
- // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
29739
- // TODO: Distinguish by namespace here -- for <title>, including it here
29740
- // errs on the side of fewer warnings
29741
- 'foreignObject', 'desc', 'title'];
29742
-
29743
- // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
29744
- var buttonScopeTags = inScopeTags.concat(['button']);
29745
-
29746
- // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
29747
- var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
29748
-
29749
- var emptyAncestorInfo = {
29750
- parentTag: null,
29751
-
29752
- formTag: null,
29753
- aTagInScope: null,
29754
- buttonTagInScope: null,
29755
- nobrTagInScope: null,
29756
- pTagInButtonScope: null,
29757
-
29758
- listItemTagAutoclosing: null,
29759
- dlItemTagAutoclosing: null
29760
- };
29761
-
29762
- var updatedAncestorInfo = function (oldInfo, tag, instance) {
29763
- var ancestorInfo = assign({}, oldInfo || emptyAncestorInfo);
29764
- var info = { tag: tag, instance: instance };
29765
-
29766
- if (inScopeTags.indexOf(tag) !== -1) {
29767
- ancestorInfo.aTagInScope = null;
29768
- ancestorInfo.buttonTagInScope = null;
29769
- ancestorInfo.nobrTagInScope = null;
29770
- }
29771
- if (buttonScopeTags.indexOf(tag) !== -1) {
29772
- ancestorInfo.pTagInButtonScope = null;
29773
- }
29774
-
29775
- // See rules for 'li', 'dd', 'dt' start tags in
29776
- // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
29777
- if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
29778
- ancestorInfo.listItemTagAutoclosing = null;
29779
- ancestorInfo.dlItemTagAutoclosing = null;
29780
- }
29781
-
29782
- ancestorInfo.parentTag = info;
29783
-
29784
- if (tag === 'form') {
29785
- ancestorInfo.formTag = info;
29786
- }
29787
- if (tag === 'a') {
29788
- ancestorInfo.aTagInScope = info;
29789
- }
29790
- if (tag === 'button') {
29791
- ancestorInfo.buttonTagInScope = info;
29792
- }
29793
- if (tag === 'nobr') {
29794
- ancestorInfo.nobrTagInScope = info;
29795
- }
29796
- if (tag === 'p') {
29797
- ancestorInfo.pTagInButtonScope = info;
29798
- }
29799
- if (tag === 'li') {
29800
- ancestorInfo.listItemTagAutoclosing = info;
29801
- }
29802
- if
1
+ jQuery(function () {
 
 
2
 
3
+ /**
4
+ * 投稿記事フォント設定
5
+ */
6
+
7
+ // 追加ボタンを押してクラスを羅列するための処理
8
+ jQuery(document).on("click", ".add_box", function () {
9
+ var input_text = jQuery(this).prev('input').val();
10
+
11
+ // 入力フォームに入力されていたらラベル追加
12
+ if (input_text) {
13
+ let label_p = document.createElement('p');
14
+ label_p.innerHTML = input_text + " ×";
15
+
16
+ jQuery(label_p).addClass("add_class_label");
17
+ jQuery(this).parent().append(label_p);
18
+
19
+ // 送信するためにinputに格納
20
+ var fontname_input_num = jQuery(this).parents('td.add_class_td').next('input#fontlist_select').attr('name');
21
+ var num = fontname_input_num.replace(/[^0-9]/g, "");
22
+
23
+ let font_select_value = document.createElement('input');
24
+ font_select_value.value = input_text;
25
+ font_select_value.type = 'hidden';
26
+ font_select_value.name = 'fontlist_cls' + num + '[]';
27
+ jQuery(label_p).append(font_select_value);
28
+ }
29
+
30
+ // inputのテキストを空にする
31
+ jQuery(this).prev().val('');
32
+ });
33
+
34
+ // クラス名のラベルをクリックして消す
35
+ jQuery(document).on("click", ".add_class_label", function () {
36
+ jQuery(this).remove();
37
+ });
38
+
39
+ var fontlist_input_length = jQuery('input#fontlist_input').length;
40
+ var count = fontlist_input_length + 1;
41
+
42
+ // 設定を追加するボタンでテーブルの行を追加
43
+ jQuery('#input_add_btn').on('click', function () {
44
+ var tr_length = jQuery("tbody.cls_tb").children('tr#font_setting').length;
45
+ if (tr_length < 10) {
46
+ // 追加された行にフォントリストのデータをいれるため取得
47
+ let add_tr = document.createElement('tr');
48
+ add_tr.id = "font_setting";
49
+ jQuery(add_tr).append('<td><div class="cls_delete_btn cls_delete_btn_selected">×</div><input id="fontlist_input" class="fontlist_input" autocomplete="off" placeholder="未設定"/><div class="w_fontlist" id="w_fontlist' + count + '"></div></td><td class="add_class_td"><input type="text" class="class_input" value=""/><button type="button" class="add_box" id="add_box">追加</button></td>');
50
+
51
+ var fontselect_hidden = document.createElement('input');
52
+ fontselect_hidden.name = "fontlist_fontname" + count;
53
+ fontselect_hidden.type = "hidden";
54
+ fontselect_hidden.id = "fontlist_select";
55
+ jQuery(add_tr).append(fontselect_hidden);
56
+ jQuery(add_tr).insertBefore('#addbtn_tr');
57
+
58
+ jQuery('.font_select_menu:last').clone(true).appendTo('#w_fontlist' + count);
59
+ count++;
60
+ }
61
+ });
62
+
63
+ jQuery(document).on("click", ".cls_delete_btn", function () {
64
+ jQuery(this).parents('#font_setting').remove();
65
+ });
66
+
67
+
68
+
69
+ /**
70
+ * フォント検索・選択共通処理
71
+ */
72
+
73
+ // フォント選択リストを生成する
74
+ var fontlist_creater = function (data, append_target) {
75
+ // 一段目のフォント名のループ
76
+ for (var i = 0; i < data.length; i++) {
77
+ let subopt = document.createElement('ul');
78
+ jQuery(subopt).addClass('subclass');
79
+ // 二段目のフォント名のループ
80
+ let sub = data[i]["font-family"];
81
+ for (var j = 0; j < sub.length; j++) {
82
+ let suboptlist = document.createElement('li');
83
+ jQuery(suboptlist).addClass("font-name");
84
+ let subfont = document.createElement('a');
85
+ subfont.text = sub[j]["font-name"];
86
+ jQuery(subfont).css('font-family', sub[j]["font-name"]);
87
+ jQuery(suboptlist).append(subfont);
88
+
89
+ jQuery(subopt).append(suboptlist);
90
+ }
91
+
92
+ let opt = document.createElement('li');
93
+ jQuery(opt).addClass("font-family-name");
94
+ let mainfont = document.createElement('a');
95
+ jQuery(mainfont).css('font-family', data[i]['fontstyle-name']);
96
+ mainfont.text = data[i]["main-font-name"];
97
+ jQuery(opt).append(mainfont);
98
+ jQuery(opt).append(subopt);
99
+
100
+ jQuery(append_target).append(opt);
101
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  }
103
+
104
+ // フォントデータ取得
105
+ if (typeof json_endpoint !== 'undefined') {
106
+ jQuery.ajax({
107
+ type: "GET",
108
+ url: json_endpoint,
109
+ dataType: 'json',
110
+ cache: false,
111
+ success: (function (data) {
112
+ var fontselect_hidden = document.createElement('ul');
113
+ fontselect_hidden.id = "font_select_menu_2";
114
+ jQuery(fontselect_hidden).addClass('font_select_menu');
115
+
116
+ var add_tr = jQuery('div.b_def_fontlist');
117
+ jQuery(add_tr).append(fontselect_hidden);
118
+
119
+ fontlist_creater(data, 'ul.font_select_menu');
120
+
121
+ jQuery("ul.font_select_menu li").hover(
122
+ function () {
123
+ jQuery("ul:not(:animated)", this).slideDown("fast")
124
+ },
125
+ function () {
126
+ jQuery("ul", this).slideUp("fast");
127
+ jQuery("ul", this).css("display", "none");
128
+ }
129
+ )
130
+
131
+ // 検索で該当フォントが見つからなかった場合
132
+ jQuery("ul.font_select_menu").prepend('<li class="font-family-name no-match"><a>検索結果なし</a></li>');
133
+ // 未設定の場合
134
+ jQuery("ul.font_select_menu").prepend('<li class="font-family-name no-setting"><a>未設定</a></li>');
135
+ }).bind(this),
136
+ error: (function (xhr, status, err) {
137
+ console.error(this.props.url, status, err.toString());
138
+ }).bind(this)
139
+ });
140
  }
141
+
142
+
143
+ // フォント検索機能
144
+ var font_search = function (listItem) {
145
+ var searchItem = '.fontlist_input';
146
+ var hideClass = 'is-hide'; // 絞り込み対象外の場合に付与されるclass名
147
+ var activeClass = 'is-active'; // 選択中のグループに付与されるclass名
148
+
149
+ function search_filter(group, search_list) {
150
+ // リスト内の各アイテムをチェック(font-family-name)
151
+ var search_flg = false;
152
+ for (var i = 0; i < jQuery(listItem).length; i++) {
153
+ var list_data = jQuery(listItem).eq(i);
154
+ var itemData = list_data.children('a').text();
155
+
156
+ if ( itemData.indexOf(group) != -1) {
157
+ list_data.addClass(activeClass);
158
+ list_data.removeClass(hideClass);
159
+
160
+ // 一つでも該当のフォントが見つかれば変更
161
+ if (search_flg === false) {
162
+ search_flg = true;
163
+ }
164
+ } else {
165
+ list_data.addClass(hideClass);
166
+ list_data.removeClass(activeClass);
167
+ }
168
+ }
169
+
170
+ // 該当のフォントがなかったときは、「検索結果なし」を表示させる
171
+ if (search_flg !== true) {
172
+ jQuery('li.no-match').removeClass(hideClass);
173
+ jQuery('li.no-match').addClass(activeClass);
174
+ } else {
175
+ jQuery('li.no-match').removeClass(activeClass);
176
+ jQuery('li.no-match').addClass(hideClass);
177
+ }
178
+ }
179
+
180
+ let timeOutId;
181
+
182
+ // 入力値を変更した時
183
+ jQuery(searchItem).on('input', function() {
184
+ var search_list = jQuery(this).next().children('.font_select_menu');
185
+ var group = jQuery(this).val();
186
+
187
+ var filter = function(){
188
+ search_filter(group, search_list);
189
+ }
190
+
191
+ // filterが何度も実行されるのを制御(clearTimeout)
192
+ if ( timeOutId != null) {
193
+ clearTimeout(timeOutId);
194
+ }
195
+
196
+ if (group.length >= 1) {
197
+ // 非同期にするための処理(setTimeout)
198
+ timeOutId = setTimeout(filter, 300);
199
+ } else if(group.length === 0) {
200
+ jQuery(listItem).removeClass(hideClass);
201
+ jQuery(listItem).addClass(activeClass);
202
+ jQuery('li.no-match').removeClass(activeClass);
203
+ jQuery('li.no-match').addClass(hideClass);
204
+ return;
205
+ }
206
+ });
207
+ };
208
+
209
+
210
+ // インプットフォームにフォーカスした時の動作
211
+ jQuery(document).on("focus", "input.fontlist_input", function () {
212
+ jQuery(this).removeAttr('placeholder');
213
+ jQuery(this).attr('placeholder', 'フォント名を入力または検索');
214
+ jQuery(this).next("div").children("ul").css("display", "block");
215
+
216
+ jQuery('li.no-match').removeClass('is-active');
217
+ jQuery('li.no-match').addClass('is-hide');
218
+
219
+ var listItem = jQuery(this).next().find('.font-family-name'); // 絞り込み対象のアイテム(font-family-name)
220
+ listItem.removeClass('is-hide');
221
+ font_search(listItem);
222
+ }).on("focusout", "input.fontlist_input", function () {
223
+ // インプットフォームからフォーカスアウトした時の動作
224
+ jQuery(this).removeAttr('placeholder');
225
+ jQuery(this).attr('placeholder', '未設定');
226
+
227
+ // フォント選択をしていたら、そのフォント名を表示させる
228
+ if(jQuery(this).closest('td').next().val()) {
229
+ // サイトフォント設定・カスタムテーマ編集の場合
230
+ jQuery(this).val(jQuery(this).closest('td').next().val());
231
+ } else if(jQuery(this).closest('td').next().next().val()) {
232
+ // 投稿記事フォント設定の場合
233
+ jQuery(this).val(jQuery(this).closest('td').next().next().val());
234
+ } else {
235
+ // 選択していなかったら空にする
236
+ jQuery(this).val('');
237
+ }
238
+
239
+ var _this = jQuery(this);
240
+ var focusOut = function(){
241
+ jQuery(_this).next("div").children("ul").css("display", "none");
242
+ }
243
+
244
+ var userAgent = window.navigator.userAgent.toLowerCase();
245
+ if(userAgent.indexOf('msie') != -1 || userAgent.indexOf('trident') != -1) {
246
+ jQuery(this).next("div").children("ul").css("display", "none");
247
+ } else {
248
+ setTimeout(focusOut, 140);
249
+ }
250
+ });
251
+
252
+
253
+ // 「未設定」を選択した場合はフォントリストを非表示にする
254
+ jQuery(document).on("mousedown", ".font-family-name", function () {
255
+ if(jQuery(this).hasClass('no-setting')) {
256
+ jQuery(this).parent().css('display', 'none');
257
+
258
+ // 直接指定の場合
259
+ if(jQuery(this).closest('.ts-custome_form_font').length > 0) {
260
+ // インプットフォームに入力されている内容を削除する
261
+ var input_fontname = jQuery(this).closest('div').prev();
262
+ input_fontname.val('');
263
+ input_fontname.closest('td').next().next().val('');
264
+ } else {
265
+ // サイトフォント・カスタムテーマの場合
266
+ // インプットフォームに入力されている内容を削除する
267
+ var input_fontname = jQuery(this).parent().parent().prev();
268
+ input_fontname.val('');
269
+ input_fontname.closest('td').next().val('');
270
+ }
271
+ }
272
+ });
273
+
274
+
275
+ // リストの二段目をクリックで、インプットフォームにフォント名を代入・送信用のフォームのvalueに値を代入する
276
+ jQuery(document).on("mousedown", ".font-name", function () {
277
+
278
+ // trが何番目にあるかを調べる
279
+ var cls_tb_tr = jQuery(this).parents('tr#font_setting');
280
+ var cls_tb_num = jQuery("tbody").children('tr#font_setting').index(cls_tb_tr) + 1;
281
+ var custom_input_name = 'typesquare_custom_theme[fonts]'
282
+
283
+ switch (cls_tb_num) {
284
+ case 1:
285
+ cls_tb_num = custom_input_name + '[title][type]';
286
+ cls_name_tb_num = custom_input_name + '[title][type][name]';
287
+ break;
288
+ case 2:
289
+ cls_tb_num = custom_input_name + '[lead][type]';
290
+ cls_name_tb_num = custom_input_name + '[lead][type][name]';
291
+ break;
292
+ case 3:
293
+ cls_tb_num = custom_input_name + '[text][type]';
294
+ cls_name_tb_num = custom_input_name + '[text][type][name]';
295
+ break;
296
+ case 4:
297
+ cls_tb_num = custom_input_name + '[bold][type]';
298
+ cls_name_tb_num = custom_input_name + '[bold][type][name]';
299
+ break;
300
+ default:
301
+ cls_tb_num = '';
302
+ }
303
+
304
+ // 送信するために設置しているinputタグを取得
305
+ var fontlist_input_hidden = jQuery(this).parents('tr').children("input#fontlist_select");
306
+ // fontlist_input_hidden に fontlist_select_fontname を代入
307
+ var fontlist_select_fontname = jQuery(this).children("a").text();
308
+ jQuery(fontlist_input_hidden).val(fontlist_select_fontname);
309
+
310
+ // フォント選択の入力フォームにフォント名を入れる
311
+ var fontlist_input_form = jQuery(this).closest('div.w_fontlist').prev("input");
312
+ // fontlist_input_form.val("fontlist_select_fontname");
313
+ fontlist_input_form.css("font-family", `'${fontlist_select_fontname}'`);
314
+
315
+ // 選択されたらリストを非表示にする
316
+ jQuery(".font_select_menu").css("display", "none");
317
+ jQuery(".font_select_menu").removeClass('is-active');
318
+
319
+ // その番号と組み合わせてnameを設定
320
+ var cls_tb_tr_hidden = jQuery(this).parents('td.font_table_td').children('input.fontselect_input_hidden');
321
+ cls_tb_tr_hidden.attr('name', cls_tb_num);
322
+ });
323
+
324
+
325
+ var activeLimit = localStorage.getItem('activeLimit');
326
+ if (activeLimit === null) {
327
+ // 初めてのアクセスなら「フォント利用制限について」を表示
328
+ jQuery('#ts-ad-area-messages').css('display', 'block');
329
+ jQuery('#ts-ad-area-messages').addClass('ts-active');
330
+ jQuery('.limitTriangle').addClass('open');
331
+ } else if (activeLimit === 'true') {
332
+ jQuery('#ts-ad-area-messages').css('display', 'block');
333
+ jQuery('#ts-ad-area-messages').addClass('ts-active');
334
+ jQuery('.limitTriangle').addClass('open');
335
+ }
336
+
337
+
338
+ // 「フォント利用制限について」クリック時イベント
339
+ jQuery(".toggleLimit,.limitTriangle").on('click', function () {
340
+ jQuery('#ts-ad-area-messages').slideToggle('normal', function () {
341
+ if (jQuery('#ts-ad-area-messages').hasClass('ts-active')) {
342
+ jQuery('#ts-ad-area-messages').removeClass('ts-active');
343
+ localStorage.setItem('activeLimit', false);
344
+ jQuery('.limitTriangle').removeClass('open');
345
+ } else {
346
+ jQuery('#ts-ad-area-messages').addClass('ts-active');
347
+ localStorage.setItem('activeLimit', true);
348
+ jQuery('.limitTriangle').addClass('open');
349
+ }
350
+ });
351
+ });
352
+
353
+ // フォントテーマ設定
354
+ jQuery('#fontThemeSelect').change(function () {
355
+ var selectTheme = jQuery(this).val();
356
+ // 新しくテーマを作成する。表示
357
+ if (selectTheme === 'new') {
358
+ jQuery('input[name=ts_edit_mode]').val('new');
359
+ jQuery('#ts_custome_theme_id').val(unique_id);
360
+ jQuery('#fontThemeDeleteButton').hide();
361
+ jQuery('#custmeFontForm').find('input').each(function () {
362
+ // 空にする
363
+ if (jQuery(this).attr('type') === undefined) {
364
+ jQuery(this).val('');
365
+ }
366
+ });
367
+ jQuery('#custome_font_name').val('');
368
+ jQuery('input[name=typesquare_custom_theme\\[fonts\\]\\[title\\]\\[type\\]]').val(fonttheme.fonts.title);
369
+ jQuery('input[name=typesquare_custom_theme\\[fonts\\]\\[lead\\]\\[type\\]]').val(fonttheme.fonts.lead);
370
+ jQuery('input[name=typesquare_custom_theme\\[fonts\\]\\[text\\]\\[type\\]]').val(fonttheme.fonts.text);
371
+ jQuery('input[name=typesquare_custom_theme\\[fonts\\]\\[bold\\]\\[type\\]]').val(fonttheme.fonts.bold);
372
+ } else {
373
+ jQuery('input[name=ts_edit_mode]').val('update');
374
+ jQuery('#ts_custome_theme_id').val('');
375
+ var custome_fonts = option_font_list.theme;
376
+ jQuery.each(custome_fonts, function (i, cs_font) {
377
+ if (cs_font.id === selectTheme) {
378
+ jQuery('input[name=ts_edit_mode]').val('update');
379
+ jQuery('#ts_custome_theme_id').val(cs_font.id);
380
+ var fonttheme_json = jQuery('#' + cs_font.id).val();
381
+ fonttheme = JSON.parse(fonttheme_json);
382
+
383
+ choiceTheme = jQuery('#choiceTheme');
384
+ choiceTheme.show();
385
+ var insertCount = 0;
386
+ jQuery('#custmeFontForm').find('input').each(function () {
387
+ if (jQuery(this).attr('type') === undefined) {
388
+ if (insertCount === 0) {
389
+ jQuery(this).val(fonttheme.fonts.title)
390
+ jQuery(this).css("font-family", `'${fonttheme.fonts.title}'`);
391
+ jQuery('input[name=typesquare_custom_theme\\[fonts\\]\\[title\\]\\[type\\]]').val(fonttheme.fonts.title);
392
+ } else if (insertCount === 1) {
393
+ jQuery(this).val(fonttheme.fonts.lead)
394
+ jQuery(this).css("font-family", `'${fonttheme.fonts.lead}'`);
395
+ jQuery('input[name=typesquare_custom_theme\\[fonts\\]\\[lead\\]\\[type\\]]').val(fonttheme.fonts.lead);
396
+ } else if (insertCount === 2) {
397
+ jQuery(this).val(fonttheme.fonts.text)
398
+ jQuery(this).css("font-family", `'${fonttheme.fonts.text}'`);
399
+ jQuery('input[name=typesquare_custom_theme\\[fonts\\]\\[text\\]\\[type\\]]').val(fonttheme.fonts.text);
400
+ } else if (insertCount === 3) {
401
+ jQuery(this).val(fonttheme.fonts.bold)
402
+ jQuery(this).css("font-family", `'${fonttheme.fonts.bold}'`);
403
+ jQuery('input[name=typesquare_custom_theme\\[fonts\\]\\[bold\\]\\[type\\]]').val(fonttheme.fonts.bold);
404
+ }
405
+ insertCount++;
406
+ }
407
+ });
408
+ jQuery('#custome_font_name').val(fonttheme.name);
409
+ jQuery('#current_custome_font_name').val(fonttheme.name);
410
+ }
411
+ });
412
+ jQuery('#fontThemeDeleteButton').show();
413
+ }
414
+ });
415
+
416
+ window.onload = function () {
417
+ theme_preview();
418
+ };
419
+
420
+ jQuery('#choiceTheme').change(function() {
421
+ theme_preview();
422
+ });
423
+
424
+ function theme_preview() {
425
+ var select_val = jQuery('.font_theme_select_pre option:selected').val();
426
+ var val = document.getElementById("selected-get-" + select_val);
427
+ if (val == null) {
428
+ return;
429
+ }
430
+ var theme_data = JSON.parse(val.value);
431
+
432
+ jQuery('#theme_preview').val(val);
433
+
434
+ jQuery('.pre_title').text(theme_data.fonts.title);
435
+ jQuery('.pre_title').css("font-family", `'${theme_data.fonts.title}'`);
436
+
437
+ jQuery('.pre_lead').text(theme_data.fonts.lead);
438
+ jQuery('.pre_lead').css("font-family", `'${theme_data.fonts.lead}'`);
439
+
440
+ if (theme_data.fonts.content) {
441
+ jQuery('.pre_body').text(theme_data.fonts.content);
442
+ jQuery('.pre_body').css("font-family", `'${theme_data.fonts.content}'`);
443
+ } else {
444
+ jQuery('.pre_body').text(theme_data.fonts.text);
445
+ jQuery('.pre_body').css("font-family", `'${theme_data.fonts.text}'`);
446
  }
447
+
448
+ jQuery('.pre_bold').text(theme_data.fonts.bold);
449
+ jQuery('.pre_bold').css("font-family", `'${theme_data.fonts.bold}'`);
450
+ };
451
+
452
+ // フォントテーマ更新ボタン押下処理。
453
+ jQuery('#fontThemeUpdateButton').click(function () {
454
+ var nameDuplicateMessage = "同一名のカスタムフォントテーマは作成できません";
455
+ var countOverMessage = "カスタムフォントテーマは10個を超えて作成できません";
456
+
457
+ var warningFlg = 0;
458
+
459
+ // カスタムテーマ以外の選択
460
+ if (jQuery('#customeFontThemeForm').is(':hidden')) {
461
+ return true;
462
+ }
463
+
464
+ // 同一名チェック
465
+ var all_font_theme = all_font_list;
466
+ var custome_font_name = jQuery('#custome_font_name').val();
467
+ var duble_check_count = 0;
468
+ if (custome_font_name !== jQuery('#current_custome_font_name').val()) {
469
+ jQuery.each(all_font_theme, function (i, af_font) {
470
+ if (af_font.name === custome_font_name) {
471
+ duble_check_count++;
472
+ }
473
+ });
474
+ }
475
+
476
+ if (jQuery('input[name=ts_edit_mode]').val() === 'new' && duble_check_count > 0) {
477
+ warningFlg = 1;
478
+ } else if (duble_check_count > 1) {
479
+ warningFlg = 1;
480
+ }
481
+ // 個数チェック
482
+ var custome_fonts = option_font_list.theme;
483
+ var custome_font_count = Object.keys(custome_fonts).length;
484
+ if (custome_font_count >= 10 && !jQuery('#current_custome_font_name').val()) {
485
+ warningFlg = 2;
486
+ }
487
+
488
+ // エラー切り分け
489
+ switch (warningFlg) {
490
+ case 1:
491
+ // 同一名警告
492
+ alert(nameDuplicateMessage);
493
+ return false;
494
+ break;
495
+ case 2:
496
+ // 11個以上警告
497
+ alert(countOverMessage);
498
+ return false;
499
+ break;
500
+ default:
501
+ if (jQuery('#custome_font_name').val()) {
502
+ if (jQuery('input[name=ts_edit_mode]').val() !== 'new') {
503
+ var dialogMessage = jQuery('#current_custome_font_name').val() + 'を上書き保存します。よろしいですか?\n※テーマを利用しているすべての投稿に変更が反映されます';
504
+ var fontDeleteConfirmDialog = window.confirm(dialogMessage);
505
+ if (fontDeleteConfirmDialog) {
506
+ jQuery('#custmeFontForm').submit();
507
+ } else {
508
+ return false;
509
+ }
510
+ }
511
+ }
512
+ }
513
+ });
514
+
515
+ // フォントテーマ削除ボタン押下処理。
516
+ jQuery('#updateFontListButton').click(function () {
517
+ jQuery('#update_font_list').val('on');
518
+ jQuery('.update_msg').text('更新中...');
519
+
520
+ });
521
+
522
+ // フォントテーマ削除ボタン押下処理。
523
+ jQuery('#fontThemeDeleteButton').click(function () {
524
+ var dialogMessage = jQuery('#custome_font_name').val() + 'を削除します。よろしいですか?\n※テーマを利用している投稿のWebフォント設定がクリアされます';
525
+ var fontDeleteConfirmDialog = window.confirm(dialogMessage);
526
+
527
+ if (fontDeleteConfirmDialog) {
528
+ jQuery('input[name=ts_edit_mode]').val('delete');
529
+ jQuery('#custome_font_name').removeAttr('required');
530
+ jQuery('#custmeFontForm').submit();
531
+ } else {
532
+ return false;
533
+ }
534
+ });
535
+
536
+ // localStorageのactiveAuthを取得
537
+ var activeAuth = localStorage.getItem('activeAuth');
538
+ if (activeAuth === null) {
539
+ // 初めてのアクセスなら「アカウントを変更する」を表示
540
+ jQuery('.toggleAuthTargetParent').css('display', 'block');
541
+ jQuery('.toggleAuthTargetParent').addClass('ts-active');
542
+ jQuery('.authTriangle').addClass('open');
543
+ } else if (activeAuth === 'true') {
544
+ jQuery('.toggleAuthTargetParent').css('display', 'block');
545
+ jQuery('.toggleAuthTargetParent').addClass('ts-active');
546
+ jQuery('.authTriangle').addClass('open');
547
+ }
548
+
549
+ // 「アカウントを変更する」クリック時イベント
550
+ jQuery(".toggleAuth,.authTriangle").on('click', function () {
551
+ jQuery('.toggleAuthTargetParent').slideToggle('normal', function () {
552
+ if (jQuery('.toggleAuthTargetParent').hasClass('ts-active')) {
553
+ jQuery('.toggleAuthTargetParent').removeClass('ts-active');
554
+ localStorage.setItem('activeAuth', false);
555
+ jQuery('.authTriangle').removeClass('open');
556
+ } else {
557
+ jQuery('.toggleAuthTargetParent').addClass('ts-active');
558
+ localStorage.setItem('activeAuth', true);
559
+ jQuery('.authTriangle').addClass('open');
560
+ }
561
+ });
562
+ });
563
+
564
+ // フェードイン設定
565
+ jQuery("#fade_in").on('click', function () {
566
+ if (jQuery('#hidden_time').hasClass('ts-table-low')) {
567
+ jQuery('#hidden_time').removeClass('ts-table-low');
568
+ jQuery('#hidden_time').addClass('hidden');
569
+ } else {
570
+ jQuery('#hidden_time').addClass('ts-table-low');
571
+ }
572
+ });
573
+
574
+ // 各設定ブロックのトグル処理共通化
575
+ function toggle_setting(form, triangle) {
576
+ form.slideToggle('normal', function () {
577
+ // アクティブになっていたら外す
578
+ if (form.hasClass('ts-active')) {
579
+ form.removeClass('ts-active');
580
+ triangle.removeClass('open');
581
+ } else {
582
+ // なっていなかったらアクティブにする
583
+ form.addClass('ts-active');
584
+ triangle.addClass('open');
585
+ }
586
+ });
587
  }