Form Maker by WD – user-friendly drag & drop Form Builder plugin - Version 1.14.10

Version Description

  • Improved: FM Cookie init process.
  • Fixed: Stripe transaction worked in case of form not submitted.
  • Fixed: Conditions with Hidden field.
  • Fixed: Conditions with Send a copy field.
  • Fixed: Statistics button with Twenty Twenty-Two theme.
  • Fixed: Conditional emails issue with multiple selected options.
  • Fixed: Signature in PDF.
  • Fixed: Theme saving from form.
Download this release

Release Info

Developer 10web
Plugin Icon 128x128 Form Maker by WD – user-friendly drag & drop Form Builder plugin
Version 1.14.10
Comparing to
See all releases

Code changes from version 1.14.9 to 1.14.10

admin/controllers/Manage_fm.php CHANGED
@@ -1142,7 +1142,7 @@ class FMControllerManage_fm extends FMAdminController {
1142
  $this->model->update_data('formmaker_backup', array(
1143
  'type' => $display_options['type'],
1144
  'theme' => $theme,
1145
- ), array( 'id' => $where['form_id'] ));
1146
 
1147
  $this->model->update_data('formmaker', array(
1148
  'type' => $display_options['type'],
@@ -1280,7 +1280,7 @@ class FMControllerManage_fm extends FMAdminController {
1280
  $form_front = WDW_FM_Library(self::PLUGIN)->get('form_front', '', false);
1281
  $form_front = str_replace('onerror', '', html_entity_decode(base64_decode($form_front)));
1282
  $form_front = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $form_front);
1283
- $theme = WDW_FM_Library(self::PLUGIN)->get('theme', $this->model->get_default_theme_id(), 'intval');
1284
  $sortable = WDW_FM_Library(self::PLUGIN)->get('sortable', 0);
1285
  $counter = WDW_FM_Library(self::PLUGIN)->get('counter', 0, 'intval');
1286
  $label_order = WDW_FM_Library(self::PLUGIN)->get('label_order', '');
@@ -1318,7 +1318,6 @@ class FMControllerManage_fm extends FMAdminController {
1318
  $save = $this->model->update_data('formmaker', array(
1319
  'title' => $title,
1320
  'form_front' => $form_front,
1321
- 'theme' => $theme,
1322
  'sortable' => $sortable,
1323
  'counter' => $counter,
1324
  'label_order' => $label_order,
@@ -1474,7 +1473,6 @@ class FMControllerManage_fm extends FMAdminController {
1474
  'title' => $title,
1475
  'type' => $type,
1476
  'form_front' => $form_front,
1477
- 'theme' => $theme,
1478
  'sortable' => $sortable,
1479
  'counter' => $counter,
1480
  'label_order' => $label_order,
1142
  $this->model->update_data('formmaker_backup', array(
1143
  'type' => $display_options['type'],
1144
  'theme' => $theme,
1145
+ ), array( 'id' => $where['form_id'], 'cur' => 1 ));
1146
 
1147
  $this->model->update_data('formmaker', array(
1148
  'type' => $display_options['type'],
1280
  $form_front = WDW_FM_Library(self::PLUGIN)->get('form_front', '', false);
1281
  $form_front = str_replace('onerror', '', html_entity_decode(base64_decode($form_front)));
1282
  $form_front = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $form_front);
1283
+ $theme = WDW_FM_Library(self::PLUGIN)->get('theme', $this->model->get_current_theme_id($id), 'intval');
1284
  $sortable = WDW_FM_Library(self::PLUGIN)->get('sortable', 0);
1285
  $counter = WDW_FM_Library(self::PLUGIN)->get('counter', 0, 'intval');
1286
  $label_order = WDW_FM_Library(self::PLUGIN)->get('label_order', '');
1318
  $save = $this->model->update_data('formmaker', array(
1319
  'title' => $title,
1320
  'form_front' => $form_front,
 
1321
  'sortable' => $sortable,
1322
  'counter' => $counter,
1323
  'label_order' => $label_order,
1473
  'title' => $title,
1474
  'type' => $type,
1475
  'form_front' => $form_front,
 
1476
  'sortable' => $sortable,
1477
  'counter' => $counter,
1478
  'label_order' => $label_order,
admin/models/Manage_fm.php CHANGED
@@ -3974,6 +3974,23 @@ class FMModelManage_fm extends FMAdminModel {
3974
  return $wpdb->get_var("SELECT id FROM " . $wpdb->prefix . "formmaker_themes WHERE `default`='1'");
3975
  }
3976
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3977
  /**
3978
  * Replace data.
3979
  *
3974
  return $wpdb->get_var("SELECT id FROM " . $wpdb->prefix . "formmaker_themes WHERE `default`='1'");
3975
  }
3976
 
3977
+ /**
3978
+ * Get id of current theme
3979
+ * else return id of default theme
3980
+ *
3981
+ * @param int $id form_id
3982
+ *
3983
+ * @return int (id)
3984
+ */
3985
+ public function get_current_theme_id( $id ) {
3986
+ if ( $id == 0 ) {
3987
+ return $this->get_default_theme_id();
3988
+ }
3989
+ global $wpdb;
3990
+
3991
+ return $wpdb->get_var($wpdb->prepare("SELECT theme FROM " . $wpdb->prefix . "formmaker WHERE `id`=%d", $id));
3992
+ }
3993
+
3994
  /**
3995
  * Replace data.
3996
  *
form-maker.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Form Maker
4
  * Plugin URI: https://10web.io/plugins/wordpress-form-maker/?utm_source=form_maker&utm_medium=free_plugin
5
  * Description: This plugin is a modern and advanced tool for easy and fast creating of a WordPress Form. The backend interface is intuitive and user friendly which allows users far from scripting and programming to create WordPress Forms.
6
- * Version: 1.14.9
7
  * Author: 10Web Form Builder Team
8
  * Author URI: https://10web.io/plugins/?utm_source=form_maker&utm_medium=free_plugin
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
@@ -103,8 +103,8 @@ final class WDFM {
103
  $this->plugin_url = plugins_url(plugin_basename(dirname(__FILE__)));
104
  $this->front_urls = $this->get_front_urls();
105
  $this->main_file = plugin_basename(__FILE__);
106
- $this->plugin_version = '1.14.9';
107
- $this->db_version = '2.14.9';
108
  $this->menu_postfix = ($this->is_free == 2 ? '_fmc' : '_fm');
109
  $this->plugin_postfix = ($this->is_free == 2 ? '_fmc' : '');
110
  $this->menu_slug = 'manage' . $this->menu_postfix;
@@ -1010,13 +1010,6 @@ final class WDFM {
1010
  echo __('Sorry, you are not allowed to access this page.', $this->prefix);
1011
  }
1012
  else {
1013
- if ( get_option( 'wd_form_maker_version', FALSE ) ) {
1014
- if( !class_exists('Cookie_fm') ) {
1015
- require_once($this->plugin_dir . '/framework/Cookie.php');
1016
- }
1017
- new Cookie_fm();
1018
- }
1019
-
1020
  $id = WDW_FM_Library(self::PLUGIN)->get('wdform_id', 0);
1021
  $display_options_row = WDW_FM_Library(self::PLUGIN)->display_options($id);
1022
  $display_options_row = WDW_FM_Library::convert_json_options_to_old($display_options_row, 'display_options');
@@ -1039,13 +1032,6 @@ final class WDFM {
1039
  */
1040
  public function fm_shortcode($attrs) {
1041
  ob_start();
1042
- if ( get_option( 'wd_form_maker_version', FALSE ) ) {
1043
- if( !class_exists('Cookie_fm') ) {
1044
- require_once($this->plugin_dir . '/framework/Cookie.php');
1045
- }
1046
- new Cookie_fm();
1047
- }
1048
-
1049
  $this->FM_front_end_main($attrs, 'embedded');
1050
 
1051
  return str_replace(array("\r\n", "\n", "\r"), '', ob_get_clean());
@@ -1059,7 +1045,6 @@ final class WDFM {
1059
  */
1060
  public function FM_front_end_main($params = array(), $type = '') {
1061
  $form_id = isset($params['id']) ? (int) $params['id'] : 0;
1062
-
1063
  if ( !isset($params['type']) ) {
1064
  if ($this->is_free == 2) {
1065
  wd_contact_form_maker($form_id, $type);
@@ -1642,13 +1627,13 @@ final class WDFM {
1642
  'file' => 'fm_reg.php',
1643
  ),
1644
  'form-maker-save-progress' => array(
1645
- 'version' => '1.1.11',
1646
- 'fm_version' => '2.14.6',
1647
  'file' => 'fm_save.php',
1648
  ),
1649
  'form-maker-stripe' => array(
1650
- 'version' => '1.2.8',
1651
- 'fm_version' => '2.14.0',
1652
  'file' => 'fm_stripe.php',
1653
  ),
1654
  'form-maker-webhooks' => array(
3
  * Plugin Name: Form Maker
4
  * Plugin URI: https://10web.io/plugins/wordpress-form-maker/?utm_source=form_maker&utm_medium=free_plugin
5
  * Description: This plugin is a modern and advanced tool for easy and fast creating of a WordPress Form. The backend interface is intuitive and user friendly which allows users far from scripting and programming to create WordPress Forms.
6
+ * Version: 1.14.10
7
  * Author: 10Web Form Builder Team
8
  * Author URI: https://10web.io/plugins/?utm_source=form_maker&utm_medium=free_plugin
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
103
  $this->plugin_url = plugins_url(plugin_basename(dirname(__FILE__)));
104
  $this->front_urls = $this->get_front_urls();
105
  $this->main_file = plugin_basename(__FILE__);
106
+ $this->plugin_version = '1.14.10';
107
+ $this->db_version = '2.14.10';
108
  $this->menu_postfix = ($this->is_free == 2 ? '_fmc' : '_fm');
109
  $this->plugin_postfix = ($this->is_free == 2 ? '_fmc' : '');
110
  $this->menu_slug = 'manage' . $this->menu_postfix;
1010
  echo __('Sorry, you are not allowed to access this page.', $this->prefix);
1011
  }
1012
  else {
 
 
 
 
 
 
 
1013
  $id = WDW_FM_Library(self::PLUGIN)->get('wdform_id', 0);
1014
  $display_options_row = WDW_FM_Library(self::PLUGIN)->display_options($id);
1015
  $display_options_row = WDW_FM_Library::convert_json_options_to_old($display_options_row, 'display_options');
1032
  */
1033
  public function fm_shortcode($attrs) {
1034
  ob_start();
 
 
 
 
 
 
 
1035
  $this->FM_front_end_main($attrs, 'embedded');
1036
 
1037
  return str_replace(array("\r\n", "\n", "\r"), '', ob_get_clean());
1045
  */
1046
  public function FM_front_end_main($params = array(), $type = '') {
1047
  $form_id = isset($params['id']) ? (int) $params['id'] : 0;
 
1048
  if ( !isset($params['type']) ) {
1049
  if ($this->is_free == 2) {
1050
  wd_contact_form_maker($form_id, $type);
1627
  'file' => 'fm_reg.php',
1628
  ),
1629
  'form-maker-save-progress' => array(
1630
+ 'version' => '1.1.14',
1631
+ 'fm_version' => '2.14.10',
1632
  'file' => 'fm_save.php',
1633
  ),
1634
  'form-maker-stripe' => array(
1635
+ 'version' => '1.2.9',
1636
+ 'fm_version' => '2.14.10',
1637
  'file' => 'fm_stripe.php',
1638
  ),
1639
  'form-maker-webhooks' => array(
framework/Cookie.php CHANGED
@@ -61,7 +61,7 @@ class Cookie_fm {
61
  * @return string
62
  */
63
  public static function get_hash() {
64
- $user_ip = $_SERVER['REMOTE_ADDR'];
65
  $user_agent = self::get_user_agent();
66
  $site_url = get_bloginfo('url');
67
  $to_hash = md5($site_url . $user_ip . $user_agent);
@@ -217,5 +217,24 @@ class Cookie_fm {
217
 
218
  return $agent;
219
  }
220
- }
221
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  * @return string
62
  */
63
  public static function get_hash() {
64
+ $user_ip = self::getIPAddress();
65
  $user_agent = self::get_user_agent();
66
  $site_url = get_bloginfo('url');
67
  $to_hash = md5($site_url . $user_ip . $user_agent);
217
 
218
  return $agent;
219
  }
 
220
 
221
+ /**
222
+ * Get IP address.
223
+ *
224
+ * @return mixed
225
+ */
226
+ private static function getIPAddress() {
227
+ // whether ip is from the remote address.
228
+ $ip = $_SERVER['REMOTE_ADDR'];
229
+ // whether ip is from the share internet.
230
+ if ( !empty($_SERVER['HTTP_CLIENT_IP']) ) {
231
+ $ip = $_SERVER['HTTP_CLIENT_IP'];
232
+ }
233
+ // whether ip is from the proxy.
234
+ elseif ( !empty($_SERVER['HTTP_X_FORWARDED_FOR']) ) {
235
+ $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
236
+ }
237
+
238
+ return $ip;
239
+ }
240
+ }
framework/WDW_FM_Library.php CHANGED
@@ -1167,6 +1167,7 @@ class WDW_FM_Library {
1167
  }
1168
  switch ( $type_key ) {
1169
  case "type_text":
 
1170
  case "type_star_rating":
1171
  case "type_password":
1172
  case "type_textarea":
@@ -6425,4 +6426,4 @@ class WDW_FM_Library {
6425
  }
6426
  return $user_email;
6427
  }
6428
- }
1167
  }
1168
  switch ( $type_key ) {
1169
  case "type_text":
1170
+ case "type_hidden":
1171
  case "type_star_rating":
1172
  case "type_password":
1173
  case "type_textarea":
6426
  }
6427
  return $user_email;
6428
  }
6429
+ }
frontend/controllers/form_maker.php CHANGED
@@ -41,7 +41,8 @@ class FMControllerForm_maker {
41
  $action = WDW_FM_Library(self::PLUGIN)->get('action');
42
  if ( method_exists($this, $action) ) {
43
  $this->$action();
44
- } else {
 
45
  return $this->display($id, $type);
46
  }
47
  }
@@ -55,7 +56,7 @@ class FMControllerForm_maker {
55
  * @return string|void
56
  */
57
  public function display( $id = 0, $type = '' ) {
58
- if ( !$this->form_preview && $id && !isset($_GET[ "succes" ]) && !isset( $_POST[ "save_or_submit" . $id ] ) ) {
59
  // Increment views count.
60
  $this->model->increment_views_count($id);
61
  }
@@ -72,7 +73,23 @@ class FMControllerForm_maker {
72
  if ( !$result ) {
73
  return;
74
  }
 
 
 
 
 
 
 
75
  $this->model->savedata($result[0], $id);
 
 
 
 
 
 
 
 
 
76
  $display = $this->view->display($result, $fm_settings, $id, $type);
77
  }
78
  else {
@@ -110,6 +127,8 @@ class FMControllerForm_maker {
110
  $current_categories = explode(',', $form->current_categories);
111
  $posts_include = array_filter($posts_include);
112
  $pages_include = array_filter($pages_include);
 
 
113
  if ($display_on) {
114
  wp_reset_query();
115
  if (in_array('everything', $display_on)) {
@@ -129,8 +148,14 @@ class FMControllerForm_maker {
129
  }
130
  }
131
  else {
132
- $page_id = (is_front_page() && !is_page()) ? 'homepage' : get_the_ID();
133
- $current_post_type = 'homepage' == $page_id ? 'home' : get_post_type($page_id);
 
 
 
 
 
 
134
  if (is_singular() || 'home' == $current_post_type) {
135
  if (in_array('home', $display_on) && is_front_page()) {
136
  $display_on_this = TRUE;
@@ -142,7 +167,7 @@ class FMControllerForm_maker {
142
  $posts_and_pages[] = $dis;
143
  }
144
  }
145
- if ($posts_and_pages && is_singular($posts_and_pages)) {
146
  switch ($current_post_type) {
147
  case 'page' :
148
  case 'home' :
@@ -185,8 +210,12 @@ class FMControllerForm_maker {
185
  $display_on_this = TRUE;
186
  }
187
 
 
 
 
 
188
  if ( get_option( 'wd_form_maker_version', FALSE ) && $display_on_this ) {
189
- if( !class_exists('Cookie_fm') ) {
190
  require_once(WDFMInstance(self::PLUGIN)->plugin_dir . '/framework/Cookie.php');
191
  }
192
  new Cookie_fm();
@@ -202,10 +231,6 @@ class FMControllerForm_maker {
202
  }
203
  }
204
 
205
- $form_result = $this->model->showform($id, $type);
206
- if ( !$form_result ) {
207
- continue;
208
- }
209
  $this->model->savedata($form_result[0], $id);
210
  $params = array();
211
  $params['id'] = $id;
@@ -217,9 +242,10 @@ class FMControllerForm_maker {
217
  $params['fm_settings'] = $fm_settings;
218
  $params['error'] = $error;
219
  $params['message'] = $message;
 
 
220
  $fm_forms[$id] = $this->view->autoload_form( $params );
221
  }
222
-
223
  return implode('', $fm_forms);
224
  }
225
 
41
  $action = WDW_FM_Library(self::PLUGIN)->get('action');
42
  if ( method_exists($this, $action) ) {
43
  $this->$action();
44
+ }
45
+ else {
46
  return $this->display($id, $type);
47
  }
48
  }
56
  * @return string|void
57
  */
58
  public function display( $id = 0, $type = '' ) {
59
+ if ( !$this->form_preview && $id && !isset($_GET["succes"]) && !isset( $_POST["save_or_submit" . $id] ) ) {
60
  // Increment views count.
61
  $this->model->increment_views_count($id);
62
  }
73
  if ( !$result ) {
74
  return;
75
  }
76
+ if ( get_option('wd_form_maker_version', FALSE) ) {
77
+ if ( !class_exists('Cookie_fm') ) {
78
+ require_once(WDFMInstance(self::PLUGIN)->plugin_dir . '/framework/Cookie.php');
79
+ }
80
+ new Cookie_fm();
81
+ }
82
+
83
  $this->model->savedata($result[0], $id);
84
+
85
+ $page_id = (is_front_page() && !is_page()) ? 'homepage' : get_the_ID();
86
+ $current_post_type = 'homepage' == $page_id ? 'home' : get_post_type($page_id);
87
+ if ( !empty(WDW_FM_Library(self::PLUGIN)->get('fm_page_id')) && !empty(WDW_FM_Library(self::PLUGIN)->get('fm_current_post_type')) ) {
88
+ $page_id = WDW_FM_Library(self::PLUGIN)->get('fm_page_id', '', 'intval');
89
+ $current_post_type = WDW_FM_Library(self::PLUGIN)->get('fm_current_post_type');
90
+ }
91
+ $result['fm_page_id'] = $page_id;
92
+ $result['fm_current_post_type'] = $current_post_type;
93
  $display = $this->view->display($result, $fm_settings, $id, $type);
94
  }
95
  else {
127
  $current_categories = explode(',', $form->current_categories);
128
  $posts_include = array_filter($posts_include);
129
  $pages_include = array_filter($pages_include);
130
+ $page_id = (is_front_page() && !is_page()) ? 'homepage' : get_the_ID();
131
+ $current_post_type = 'homepage' == $page_id ? 'home' : get_post_type($page_id);
132
  if ($display_on) {
133
  wp_reset_query();
134
  if (in_array('everything', $display_on)) {
148
  }
149
  }
150
  else {
151
+ // We use both of these parameters from GET, as "page_id" and "current_post_type" do not get value after ajax submit.
152
+ $after_ajax_submit = false;
153
+ if ( !empty(WDW_FM_Library(self::PLUGIN)->get('fm_page_id')) && !empty(WDW_FM_Library(self::PLUGIN)->get('fm_current_post_type')) ) {
154
+ $after_ajax_submit = true;
155
+ $page_id = WDW_FM_Library(self::PLUGIN)->get('fm_page_id', '', 'intval');
156
+ $current_post_type = WDW_FM_Library(self::PLUGIN)->get('fm_current_post_type');
157
+ }
158
+
159
  if (is_singular() || 'home' == $current_post_type) {
160
  if (in_array('home', $display_on) && is_front_page()) {
161
  $display_on_this = TRUE;
167
  $posts_and_pages[] = $dis;
168
  }
169
  }
170
+ if ( ($posts_and_pages && is_singular($posts_and_pages)) || $after_ajax_submit ) {
171
  switch ($current_post_type) {
172
  case 'page' :
173
  case 'home' :
210
  $display_on_this = TRUE;
211
  }
212
 
213
+ $form_result = $this->model->showform($id, $type);
214
+ if ( !$form_result ) {
215
+ continue;
216
+ }
217
  if ( get_option( 'wd_form_maker_version', FALSE ) && $display_on_this ) {
218
+ if ( !class_exists('Cookie_fm') ) {
219
  require_once(WDFMInstance(self::PLUGIN)->plugin_dir . '/framework/Cookie.php');
220
  }
221
  new Cookie_fm();
231
  }
232
  }
233
 
 
 
 
 
234
  $this->model->savedata($form_result[0], $id);
235
  $params = array();
236
  $params['id'] = $id;
242
  $params['fm_settings'] = $fm_settings;
243
  $params['error'] = $error;
244
  $params['message'] = $message;
245
+ $params['fm_page_id'] = $page_id;
246
+ $params['fm_current_post_type'] = $current_post_type;
247
  $fm_forms[$id] = $this->view->autoload_form( $params );
248
  }
 
249
  return implode('', $fm_forms);
250
  }
251
 
frontend/models/form_maker.php CHANGED
@@ -1171,9 +1171,8 @@ class FMModelForm_maker {
1171
  // If removed special field.
1172
  return;
1173
  }
1174
-
1175
  if ( get_option( 'wd_form_maker_version', FALSE ) ) {
1176
- if( !class_exists('Cookie_fm') ) {
1177
  require_once(WDFMInstance(self::PLUGIN)->plugin_dir . '/framework/Cookie.php');
1178
  }
1179
  new Cookie_fm();
@@ -1188,30 +1187,30 @@ class FMModelForm_maker {
1188
 
1189
  // If IP is blacklisted.
1190
  $this->check_ip($id);
1191
-
1192
  if ( !$this->fm_empty_field_validation($id) ) {
1193
- return;
 
 
1194
  }
1195
  $fm_settings = WDFMInstance(self::PLUGIN)->fm_settings;
1196
  if ( $fm_settings['fm_antispam_referer'] && !$this->check_http_referer() ) {
1197
  // If failed empty field and referer verification with enabled antispam protection.
1198
- return;
1199
  }
1200
  if ( $fm_settings['fm_antispam_bot_validation'] && ( !isset( $_POST[ "fm_bot_validation" . $id ] ) || $_POST[ "fm_bot_validation" . $id ] != '' )) {
1201
  // If bot validation field does not exist or is not empty.
1202
- return;
1203
  }
1204
  if ( $fm_settings['fm_antispam_nonce'] ) {
1205
- if ( !isset($_POST[WDFMInstance(self::PLUGIN)->fm_form_nonce . $id ])
1206
- || !wp_verify_nonce($_POST[WDFMInstance(self::PLUGIN)->fm_form_nonce . $id], WDFMInstance(self::PLUGIN)->fm_form_nonce) ) {
1207
  // If failed nonce verification.
1208
- return;
1209
  }
1210
  }
1211
 
1212
  // If action is Save and Save progress add-on is enabled.
1213
  $save_progress = (WDFMInstance(self::PLUGIN)->is_free != 2 && $_POST["save_or_submit" . $id] == 'save' && has_action('WD_FM_SAVE_PROG_save_progress_init'));
1214
-
1215
  $success = FALSE;
1216
  if ( $_POST["save_or_submit" . $id] == 'submit' || $save_progress ) {
1217
  if ( isset($_POST["captcha_input"]) ) {
@@ -1244,7 +1243,8 @@ class FMModelForm_maker {
1244
  if (Cookie_fm::getCookieByKey($id, 'g-recaptcha_passed') === 'g-recaptcha_passed') {
1245
  $success = TRUE;
1246
  Cookie_fm::getCookieByKey($id, 'g-recaptcha_passed', TRUE);
1247
- } else {
 
1248
  $privatekey = isset($fm_settings['private_key']) ? $fm_settings['private_key'] : '';
1249
  $captcha = $_POST['g-recaptcha-response'];
1250
  $url = 'https://www.google.com/recaptcha/api/siteverify';
@@ -1306,6 +1306,25 @@ class FMModelForm_maker {
1306
  $success = TRUE;
1307
  }
1308
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1309
  if ( $success ) {
1310
  if ( $save_progress ) {
1311
  $current_user = wp_get_current_user();
@@ -1335,6 +1354,7 @@ class FMModelForm_maker {
1335
  if( $fm_settings['fm_block_ip_exceeded_limit'] ) {
1336
  $this->ip_exceeded_limit( $id, $_SERVER['REMOTE_ADDR'] );
1337
  }
 
1338
  if ( isset( $result_temp['error'] ) ) {
1339
  $this->remove( $result_temp['group_id'] );
1340
  if ( isset($result_temp['message']) ) {
@@ -1347,9 +1367,9 @@ class FMModelForm_maker {
1347
  }
1348
  else {
1349
  // Enqueue any message from an extension to display.
1350
- if ( isset( $result_temp[ 'message' ] ) ) {
1351
  Cookie_fm::setCookieValueByKey($id, 'massage_after_submit', $result_temp['message']);
1352
- Cookie_fm::getCookieByKey($id, 'error_or_no', true);
1353
  }
1354
 
1355
  if ( WDFMInstance(self::PLUGIN)->is_free != 2 ) {
@@ -1365,8 +1385,8 @@ class FMModelForm_maker {
1365
  );
1366
  }
1367
  }
1368
- Cookie_fm::saveCookieValue();
1369
  }
 
1370
  }
1371
 
1372
  public function check_ip($id) {
@@ -2823,6 +2843,7 @@ class FMModelForm_maker {
2823
  }
2824
  Cookie_fm::setCookieValueByKey($id, 'form_submit_type', $form->submit_text_type . ',' . $form->id . ',' . $group_id);
2825
  Cookie_fm::setCookieValueByKey($id, 'error_or_no', 1);
 
2826
  // Add query arg to url to display message on cached pages.
2827
  $redirect_url = add_query_arg( array( 'succes' => time() ), $_SERVER[ "REQUEST_URI" ] );
2828
  wp_redirect( $redirect_url );
@@ -2871,7 +2892,12 @@ class FMModelForm_maker {
2871
  $frontend_params['user_email'] = WDW_FM_Library(self::PLUGIN)->is_email($useremail) ? $useremail : '';
2872
  do_action( 'fm_addon_frontend_init', $frontend_params );
2873
  }
2874
- $return_value = array( 'group_id' => $group_id, 'all_files' => $all_files, 'redirect_url' => $str, 'post_data' => $key_values);
 
 
 
 
 
2875
  // Get output from extensions.
2876
  $return_value = $this->get_output_from_add_ons( $return_value );
2877
 
@@ -3570,8 +3596,7 @@ class FMModelForm_maker {
3570
  $i = $label_order_id;
3571
  $type = $label_type[$i];
3572
  if ( $type != "type_map" and $type != "type_submit_reset" and $type != "type_editor" and $type != "type_captcha" and $type != "type_arithmetic_captcha" and $type != "type_recaptcha" and $type != "type_button" ) {
3573
- $element_label = $label_order_original[ $i ];
3574
-
3575
  if ( !in_array( $i, $disabled_fields ) ) {
3576
  switch ( $type ) {
3577
  case 'type_text':
@@ -4189,12 +4214,12 @@ class FMModelForm_maker {
4189
 
4190
  if ( $row->mail_mode_user ) {
4191
  $content_type = "text/html";
4192
- $list_user = wordwrap( $list, 100, "\n", TRUE );
4193
  $new_script = wpautop( do_shortcode( $row->script_mail_user ));
4194
  }
4195
  else {
4196
  $content_type = "text/plain";
4197
- $list_user = wordwrap( $list_text_mode, 1000, "\n", TRUE );
4198
  $new_script = do_shortcode( $row->script_mail_user );
4199
  }
4200
 
@@ -4527,6 +4552,7 @@ class FMModelForm_maker {
4527
  }
4528
  }
4529
  }
 
4530
 
4531
  // Extension conditional email.
4532
  if ( has_action('fm_set_params_frontend_init') && WDFMInstance(self::PLUGIN)->is_free != 2 ) {
@@ -4560,8 +4586,8 @@ class FMModelForm_maker {
4560
  }
4561
 
4562
  Cookie_fm::setCookieValueByKey($id, 'form_submit_type', $row->submit_text_type . ',' . $row->id . ',' . $group_id);
4563
- $https = ((isset( $_SERVER[ 'HTTPS' ] ) && $_SERVER[ 'HTTPS' ] == 'on') ? 'https://' : 'http://');
4564
- $redirect_url = $https . $_SERVER[ "HTTP_HOST" ] . $_SERVER[ "REQUEST_URI" ];
4565
  if ( $row->submit_text_type == 4 && $row->url ) {
4566
  // Action after submission: URL.
4567
  $redirect_url = $row->url;
@@ -4570,12 +4596,21 @@ class FMModelForm_maker {
4570
  // Action after submission: Post/page.
4571
  $redirect_url = $row->article_id;
4572
  }
4573
-
 
 
 
 
 
 
 
4574
  if ( $row->submit_text_type != 4 || $row->url == '' ) {
 
4575
  // This ensures that no message is enqueued by an extension.
4576
- if ( ! Cookie_fm::getCookieByKey($id, 'massage_after_submit') ) {
4577
  Cookie_fm::setCookieValueByKey($id, 'massage_after_submit', $msg);
4578
  }
 
4579
  if ( $row->type == 'popover' || $row->type == 'topbar' || $row->type == 'scrollbox' ) {
4580
  Cookie_fm::setCookieValueByKey($id, 'fm_hide_form_after_submit', 1);
4581
  }
@@ -4586,14 +4621,14 @@ class FMModelForm_maker {
4586
  foreach ( $key_value_placeholders as $key => $val ) {
4587
  $redirect_url = str_replace( array( '{' . $key . '}' ), $val, $redirect_url );
4588
  }
4589
- Cookie_fm::saveCookieValue();
4590
- // Add query arg to url to display message on cached pages.
4591
- $redirect_url = add_query_arg( array( 'succes' => $success_time ), $redirect_url );
4592
- /* Cleare message if form submit redirect to another page/post */
4593
- if ( $row->article_id && ($row->submit_text_type == 2 || $row->submit_text_type == 5) ) {
4594
- Cookie_fm::setCookieValueByKey($id, 'massage_after_submit', '');
4595
- }
4596
 
 
 
 
 
 
 
4597
  if ( !$str ) {
4598
  if( !$this->fm_ajax_submit || $row->submit_text_type != 4 ) {
4599
  wp_redirect( $redirect_url );
@@ -4611,8 +4646,8 @@ class FMModelForm_maker {
4611
  echo json_encode( $json );
4612
  }
4613
  else {
4614
- $str .= "&return=" . urlencode( $redirect_url );
4615
- wp_redirect( $str );
4616
  }
4617
  exit;
4618
  }
1171
  // If removed special field.
1172
  return;
1173
  }
 
1174
  if ( get_option( 'wd_form_maker_version', FALSE ) ) {
1175
+ if ( !class_exists('Cookie_fm') ) {
1176
  require_once(WDFMInstance(self::PLUGIN)->plugin_dir . '/framework/Cookie.php');
1177
  }
1178
  new Cookie_fm();
1187
 
1188
  // If IP is blacklisted.
1189
  $this->check_ip($id);
1190
+ $error = false;
1191
  if ( !$this->fm_empty_field_validation($id) ) {
1192
+ $error = true;
1193
+ Cookie_fm::setCookieValueByKey($id, 'error_or_no', 1);
1194
+ Cookie_fm::setCookieValueByKey($id, 'massage_after_submit', addslashes(addslashes(__('Error: Something went wrong, please try again.', WDFMInstance(self::PLUGIN)->prefix))));
1195
  }
1196
  $fm_settings = WDFMInstance(self::PLUGIN)->fm_settings;
1197
  if ( $fm_settings['fm_antispam_referer'] && !$this->check_http_referer() ) {
1198
  // If failed empty field and referer verification with enabled antispam protection.
1199
+ $error = true;
1200
  }
1201
  if ( $fm_settings['fm_antispam_bot_validation'] && ( !isset( $_POST[ "fm_bot_validation" . $id ] ) || $_POST[ "fm_bot_validation" . $id ] != '' )) {
1202
  // If bot validation field does not exist or is not empty.
1203
+ $error = true;
1204
  }
1205
  if ( $fm_settings['fm_antispam_nonce'] ) {
1206
+ if ( !isset($_POST[WDFMInstance(self::PLUGIN)->fm_form_nonce . $id ]) || !wp_verify_nonce($_POST[WDFMInstance(self::PLUGIN)->fm_form_nonce . $id], WDFMInstance(self::PLUGIN)->fm_form_nonce) ) {
 
1207
  // If failed nonce verification.
1208
+ $error = true;
1209
  }
1210
  }
1211
 
1212
  // If action is Save and Save progress add-on is enabled.
1213
  $save_progress = (WDFMInstance(self::PLUGIN)->is_free != 2 && $_POST["save_or_submit" . $id] == 'save' && has_action('WD_FM_SAVE_PROG_save_progress_init'));
 
1214
  $success = FALSE;
1215
  if ( $_POST["save_or_submit" . $id] == 'submit' || $save_progress ) {
1216
  if ( isset($_POST["captcha_input"]) ) {
1243
  if (Cookie_fm::getCookieByKey($id, 'g-recaptcha_passed') === 'g-recaptcha_passed') {
1244
  $success = TRUE;
1245
  Cookie_fm::getCookieByKey($id, 'g-recaptcha_passed', TRUE);
1246
+ }
1247
+ else {
1248
  $privatekey = isset($fm_settings['private_key']) ? $fm_settings['private_key'] : '';
1249
  $captcha = $_POST['g-recaptcha-response'];
1250
  $url = 'https://www.google.com/recaptcha/api/siteverify';
1306
  $success = TRUE;
1307
  }
1308
  }
1309
+ if ( $fm_settings['fm_ajax_submit'] ) {
1310
+ if ( $error || ( !$success && !empty(Cookie_fm::getCookieByKey($id, 'error_or_no')) ) ) {
1311
+ $url_args = array(
1312
+ 'fm_page_id' => WDW_FM_Library(self::PLUGIN)->get('fm_page_id' . $id, '', 'intval'),
1313
+ 'fm_current_post_type' => WDW_FM_Library(self::PLUGIN)->get('fm_current_post_type'. $id)
1314
+ );
1315
+
1316
+ $https = (isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
1317
+ $redirect_url = $https . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
1318
+ $redirect_url = add_query_arg( $url_args, $redirect_url );
1319
+ Cookie_fm::saveCookieValue();
1320
+ wp_redirect( $redirect_url ); exit;
1321
+ }
1322
+ }
1323
+ else {
1324
+ if ( $error ) {
1325
+ return;
1326
+ }
1327
+ }
1328
  if ( $success ) {
1329
  if ( $save_progress ) {
1330
  $current_user = wp_get_current_user();
1354
  if( $fm_settings['fm_block_ip_exceeded_limit'] ) {
1355
  $this->ip_exceeded_limit( $id, $_SERVER['REMOTE_ADDR'] );
1356
  }
1357
+
1358
  if ( isset( $result_temp['error'] ) ) {
1359
  $this->remove( $result_temp['group_id'] );
1360
  if ( isset($result_temp['message']) ) {
1367
  }
1368
  else {
1369
  // Enqueue any message from an extension to display.
1370
+ if ( isset( $result_temp['message'] ) ) {
1371
  Cookie_fm::setCookieValueByKey($id, 'massage_after_submit', $result_temp['message']);
1372
+ Cookie_fm::setCookieValueByKey($id, 'error_or_no', 1);
1373
  }
1374
 
1375
  if ( WDFMInstance(self::PLUGIN)->is_free != 2 ) {
1385
  );
1386
  }
1387
  }
 
1388
  }
1389
+ Cookie_fm::saveCookieValue();
1390
  }
1391
 
1392
  public function check_ip($id) {
2843
  }
2844
  Cookie_fm::setCookieValueByKey($id, 'form_submit_type', $form->submit_text_type . ',' . $form->id . ',' . $group_id);
2845
  Cookie_fm::setCookieValueByKey($id, 'error_or_no', 1);
2846
+
2847
  // Add query arg to url to display message on cached pages.
2848
  $redirect_url = add_query_arg( array( 'succes' => time() ), $_SERVER[ "REQUEST_URI" ] );
2849
  wp_redirect( $redirect_url );
2892
  $frontend_params['user_email'] = WDW_FM_Library(self::PLUGIN)->is_email($useremail) ? $useremail : '';
2893
  do_action( 'fm_addon_frontend_init', $frontend_params );
2894
  }
2895
+ $return_value = array(
2896
+ 'group_id' => $group_id,
2897
+ 'all_files' => $all_files,
2898
+ 'redirect_url' => $str,
2899
+ 'post_data' => $key_values
2900
+ );
2901
  // Get output from extensions.
2902
  $return_value = $this->get_output_from_add_ons( $return_value );
2903
 
3596
  $i = $label_order_id;
3597
  $type = $label_type[$i];
3598
  if ( $type != "type_map" and $type != "type_submit_reset" and $type != "type_editor" and $type != "type_captcha" and $type != "type_arithmetic_captcha" and $type != "type_recaptcha" and $type != "type_button" ) {
3599
+ $element_label = $label_order_original[$i];
 
3600
  if ( !in_array( $i, $disabled_fields ) ) {
3601
  switch ( $type ) {
3602
  case 'type_text':
4214
 
4215
  if ( $row->mail_mode_user ) {
4216
  $content_type = "text/html";
4217
+ $list_user = wordwrap( $list, 100, "\n" );
4218
  $new_script = wpautop( do_shortcode( $row->script_mail_user ));
4219
  }
4220
  else {
4221
  $content_type = "text/plain";
4222
+ $list_user = wordwrap( $list_text_mode, 1000, "\n" );
4223
  $new_script = do_shortcode( $row->script_mail_user );
4224
  }
4225
 
4552
  }
4553
  }
4554
  }
4555
+ Cookie_fm::setCookieValueByKey($id, 'massage_after_submit', $msg);
4556
 
4557
  // Extension conditional email.
4558
  if ( has_action('fm_set_params_frontend_init') && WDFMInstance(self::PLUGIN)->is_free != 2 ) {
4586
  }
4587
 
4588
  Cookie_fm::setCookieValueByKey($id, 'form_submit_type', $row->submit_text_type . ',' . $row->id . ',' . $group_id);
4589
+ $https = ((isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://');
4590
+ $redirect_url = $https . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
4591
  if ( $row->submit_text_type == 4 && $row->url ) {
4592
  // Action after submission: URL.
4593
  $redirect_url = $row->url;
4596
  // Action after submission: Post/page.
4597
  $redirect_url = $row->article_id;
4598
  }
4599
+ // Add query arg to url to display message on cached pages.
4600
+ $url_args = array( 'succes' => $success_time );
4601
+ // We're sending these two parameters via GET, as it is necessary to perform checks in the "autoload_form" method.
4602
+ // It only works on ajax submit
4603
+ if ( $this->fm_ajax_submit ) {
4604
+ $url_args['fm_page_id'] = WDW_FM_Library(self::PLUGIN)->get('fm_page_id' . $row->id, '', 'intval');
4605
+ $url_args['fm_current_post_type'] = WDW_FM_Library(self::PLUGIN)->get('fm_current_post_type'. $row->id);
4606
+ }
4607
  if ( $row->submit_text_type != 4 || $row->url == '' ) {
4608
+ /* @todo this should not work for you to view the "success" message
4609
  // This ensures that no message is enqueued by an extension.
4610
+ if ( !Cookie_fm::getCookieByKey($id, 'massage_after_submit') ) {
4611
  Cookie_fm::setCookieValueByKey($id, 'massage_after_submit', $msg);
4612
  }
4613
+ */
4614
  if ( $row->type == 'popover' || $row->type == 'topbar' || $row->type == 'scrollbox' ) {
4615
  Cookie_fm::setCookieValueByKey($id, 'fm_hide_form_after_submit', 1);
4616
  }
4621
  foreach ( $key_value_placeholders as $key => $val ) {
4622
  $redirect_url = str_replace( array( '{' . $key . '}' ), $val, $redirect_url );
4623
  }
4624
+ $redirect_url = add_query_arg( $url_args, $redirect_url );
 
 
 
 
 
 
4625
 
4626
+ // Cleare message if not "Stay on Form".
4627
+ if ( $row->submit_text_type != 1 ) {
4628
+ Cookie_fm::getCookieByKey($id, 'massage_after_submit', TRUE);
4629
+ Cookie_fm::getCookieByKey($id, 'error_or_no', TRUE);
4630
+ }
4631
+ Cookie_fm::saveCookieValue();
4632
  if ( !$str ) {
4633
  if( !$this->fm_ajax_submit || $row->submit_text_type != 4 ) {
4634
  wp_redirect( $redirect_url );
4646
  echo json_encode( $json );
4647
  }
4648
  else {
4649
+ $str .= "&return=" . urlencode( $redirect_url );
4650
+ wp_redirect( $str );
4651
  }
4652
  exit;
4653
  }
frontend/views/form_maker.php CHANGED
@@ -34,6 +34,8 @@ class FMViewForm_maker {
34
  * @return string
35
  */
36
  public function display( $result = array(), $fm_settings = array(), $form_id = 0, $formType = 'embedded' ) {
 
 
37
  if ( $form_id ) {
38
  Cookie_fm::setCookieValueByKey($form_id, 'fm_empty_field_validation', md5('uniqid(rand(), TRUE)'));
39
  }
@@ -104,7 +106,7 @@ class FMViewForm_maker {
104
  }
105
  }
106
  }
107
- elseif ( Cookie_fm::getCookieByKey($form_id, 'massage_after_submit') != '' && isset($row->submit_text_type) && $row->submit_text_type == 1 ) {
108
  $message = Cookie_fm::getCookieByKey($form_id, 'massage_after_submit');
109
  Cookie_fm::getCookieByKey($form_id, 'massage_after_submit', true);
110
  if ( Cookie_fm::getCookieByKey($form_id, 'error_or_no') ) {
@@ -115,7 +117,7 @@ class FMViewForm_maker {
115
  $limsub = 1;
116
  }
117
  if ( !Cookie_fm::getCookieByKey($form_id, 'message_captcha') || $message != Cookie_fm::getCookieByKey($form_id, 'message_captcha') ) {
118
- if( is_array($message) ) {
119
  foreach( $message as $msg ) {
120
  $form_maker_front_end .= WDW_FM_Library(self::PLUGIN)->message($msg, $error, $form_id);
121
  }
@@ -125,6 +127,7 @@ class FMViewForm_maker {
125
  }
126
  }
127
  }
 
128
  if ( Cookie_fm::getCookieByKey($form_id, 'massage_after_save') != '' ) {
129
  $save_message = Cookie_fm::getCookieByKey($form_id, 'massage_after_save', true);
130
  Cookie_fm::getCookieByKey($form_id, 'massage_after_submit', true);
@@ -147,6 +150,8 @@ class FMViewForm_maker {
147
  Cookie_fm::getCookieByKey($form_id, 'fm_hide_form_after_submit', true);
148
  $fm_hide_form_after_submit = 1;
149
  }
 
 
150
  $form_maker_front_end .= '<input type="hidden" id="counter' . $form_id . '" value="' . $row->counter . '" name="counter' . $form_id . '" />';
151
  $form_maker_front_end .= '<input type="hidden" id="Itemid' . $form_id . '" value="" name="Itemid' . $form_id . '" />';
152
  $form_maker_front_end .= '<input type="hidden" id="fm_shake' . $form_id . '" value="'. ((isset($form_theme['OPShake']) && $form_theme['OPShake'] == 'no') ? 0 : 1) .'" name="fm_shake' . $form_id . '" />';
@@ -1852,9 +1857,8 @@ class FMViewForm_maker {
1852
  $submission_count = $result[5];
1853
  if ( $submission_count != 0 && $submission_count >= intval($row->submissions_limit) ) {
1854
  $submissions_limit_text = $row->submissions_limit_text;
1855
- /*
1856
- Check if the form is after submittions
1857
- */
1858
  if( $limsub == 1 ) {
1859
  $form_maker_front_end = '<div id="fm-pages' . $form_id . '" class="fm-pages wdform_page_navigation ' . $pagination_align . '" show_title="' . $row->show_title . '" show_numbers="' . $row->show_numbers . '" type="' . $row->pagination . '"></div><form name="form' . $form_id . '" action="' . $current_url . '" method="post" id="form' . $form_id . '" class="fm-form form' . $form_id . ' ' . $header_pos . ' ' . ( ( Cookie_fm::getCookieByKey($form_id, 'form_submit_type') || Cookie_fm::getCookieByKey($form_id, 'massage_after_submit') ) ? 'fm-form-submitted' : '' ) . '" enctype="multipart/form-data"><div class="fm-message fm-notice-success">' . __( 'Your form was successfully submitted.', WDFMInstance(self::PLUGIN)->prefix ) . '</div></form>';
1860
  }
@@ -1867,7 +1871,6 @@ class FMViewForm_maker {
1867
  }
1868
  }
1869
  }
1870
-
1871
  return $formType == 'embedded' ? WDW_FM_Library(self::PLUGIN)->fm_container($theme_id, $form_maker_front_end) : $form_maker_front_end;
1872
  }
1873
 
@@ -1884,6 +1887,8 @@ class FMViewForm_maker {
1884
  $display_on_this = $params['display_on_this'];
1885
  $show_for_admin = $params['show_for_admin'];
1886
  $form_result = $params['form_result'];
 
 
1887
  $fm_settings = $params['fm_settings'];
1888
  $error = $params['error'];
1889
  $message = $params['message'];
@@ -1901,13 +1906,6 @@ class FMViewForm_maker {
1901
  * which keeped in $_SESSION['fm_hide_form_after_submit' . $id] variable
1902
  */
1903
  if ( $display_on_this && $hide_mobile || ( $fm_settings['fm_ajax_submit'] && Cookie_fm::getCookieByKey($id, 'fm_hide_form_after_submit') == 1 ) ) {
1904
- if ( get_option( 'wd_form_maker_version', FALSE ) ) {
1905
- if( !class_exists('Cookie_fm') ) {
1906
- require_once(WDFMInstance(self::PLUGIN)->plugin_dir . '/framework/Cookie.php');
1907
- }
1908
- new Cookie_fm();
1909
- }
1910
-
1911
  if ( Cookie_fm::getCookieByKey($id, 'fm_hide_form_after_submit') == 1 ) {
1912
  if ( $error == 'success' ) {
1913
  if ($message) {
@@ -1965,13 +1963,6 @@ class FMViewForm_maker {
1965
  * which keeped in $_SESSION['fm_hide_form_after_submit' . $id] variable
1966
  */
1967
  if ($display_on_this && $hide_mobile || ( $fm_settings['fm_ajax_submit'] && Cookie_fm::getCookieByKey($id, 'fm_hide_form_after_submit') == 1) ) {
1968
- if ( get_option( 'wd_form_maker_version', FALSE ) ) {
1969
- if( !class_exists('Cookie_fm') ) {
1970
- require_once(WDFMInstance(self::PLUGIN)->plugin_dir . '/framework/Cookie.php');
1971
- }
1972
- new Cookie_fm();
1973
- }
1974
-
1975
  if ( Cookie_fm::getCookieByKey($id, 'fm_hide_form_after_submit') == 1 ) {
1976
  if ( $error == 'success' ) {
1977
  if ( $message ) {
@@ -2052,13 +2043,6 @@ class FMViewForm_maker {
2052
  * which keeped in $_SESSION['fm_hide_form_after_submit' . $id] variable
2053
  */
2054
  if ($display_on_this && $hide_mobile || ($fm_settings['fm_ajax_submit'] && Cookie_fm::getCookieByKey($id, 'fm_hide_form_after_submit') == 1)) {
2055
- if ( get_option( 'wd_form_maker_version', FALSE ) ) {
2056
- if( !class_exists('Cookie_fm') ) {
2057
- require_once(WDFMInstance(self::PLUGIN)->plugin_dir . '/framework/Cookie.php');
2058
- }
2059
- new Cookie_fm();
2060
- }
2061
-
2062
  if ( Cookie_fm::getCookieByKey($id, 'fm_hide_form_after_submit') == 1) {
2063
  if ( $error == 'success' ) {
2064
  if ($message) {
@@ -2117,7 +2101,6 @@ class FMViewForm_maker {
2117
  }';
2118
  }
2119
  }
2120
-
2121
  $onload_js .= '
2122
  jQuery("#fm-popover-inner-background' . $id . '").on("click", function(){
2123
  fm_hide_form(' . $id . ', ' . $frequency . ', function(){
@@ -2132,9 +2115,9 @@ class FMViewForm_maker {
2132
  <div class="fm-popover-container" id="fm-popover-container' . $id . '">
2133
  <div class="fm-popover-inner-background" id="fm-popover-inner-background' . $id . '"></div>
2134
  <div class="fm-popover-content">';
2135
- $fm_form .= $this->display($form_result, $fm_settings, $id, $type);
2136
- $fm_form .= '<div id="fm-action-buttons' . $id . '" class="fm-action-buttons">';
2137
- $fm_form .= '<span id="closing-form' . $id . '" class="closing-form fm-ico-delete" onclick="fm_hide_form(' . $id . ', ' . $frequency . ', function(){
2138
  jQuery(\'#fm-popover-background' . $id . '\').css(\'display\', \'none\');
2139
  jQuery(\'#fm-popover' . $id . '\').css(\'display\', \'none\');
2140
  });"></span>
34
  * @return string
35
  */
36
  public function display( $result = array(), $fm_settings = array(), $form_id = 0, $formType = 'embedded' ) {
37
+ $fm_page_id = !empty($result['fm_page_id']) ? $result['fm_page_id'] : '';
38
+ $fm_current_post_type = !empty($result['fm_current_post_type']) ? $result['fm_current_post_type'] : '';
39
  if ( $form_id ) {
40
  Cookie_fm::setCookieValueByKey($form_id, 'fm_empty_field_validation', md5('uniqid(rand(), TRUE)'));
41
  }
106
  }
107
  }
108
  }
109
+ elseif ( Cookie_fm::getCookieByKey($form_id, 'massage_after_submit') != '' ) {
110
  $message = Cookie_fm::getCookieByKey($form_id, 'massage_after_submit');
111
  Cookie_fm::getCookieByKey($form_id, 'massage_after_submit', true);
112
  if ( Cookie_fm::getCookieByKey($form_id, 'error_or_no') ) {
117
  $limsub = 1;
118
  }
119
  if ( !Cookie_fm::getCookieByKey($form_id, 'message_captcha') || $message != Cookie_fm::getCookieByKey($form_id, 'message_captcha') ) {
120
+ if ( is_array($message) ) {
121
  foreach( $message as $msg ) {
122
  $form_maker_front_end .= WDW_FM_Library(self::PLUGIN)->message($msg, $error, $form_id);
123
  }
127
  }
128
  }
129
  }
130
+
131
  if ( Cookie_fm::getCookieByKey($form_id, 'massage_after_save') != '' ) {
132
  $save_message = Cookie_fm::getCookieByKey($form_id, 'massage_after_save', true);
133
  Cookie_fm::getCookieByKey($form_id, 'massage_after_submit', true);
150
  Cookie_fm::getCookieByKey($form_id, 'fm_hide_form_after_submit', true);
151
  $fm_hide_form_after_submit = 1;
152
  }
153
+ $form_maker_front_end .= '<input type="hidden" id="fm_page_id' . $form_id . '" value="' . $fm_page_id . '" name="fm_page_id' . $form_id . '" />';
154
+ $form_maker_front_end .= '<input type="hidden" id="fm_current_post_type' . $form_id . '" value="' . $fm_current_post_type . '" name="fm_current_post_type' . $form_id . '" />';
155
  $form_maker_front_end .= '<input type="hidden" id="counter' . $form_id . '" value="' . $row->counter . '" name="counter' . $form_id . '" />';
156
  $form_maker_front_end .= '<input type="hidden" id="Itemid' . $form_id . '" value="" name="Itemid' . $form_id . '" />';
157
  $form_maker_front_end .= '<input type="hidden" id="fm_shake' . $form_id . '" value="'. ((isset($form_theme['OPShake']) && $form_theme['OPShake'] == 'no') ? 0 : 1) .'" name="fm_shake' . $form_id . '" />';
1857
  $submission_count = $result[5];
1858
  if ( $submission_count != 0 && $submission_count >= intval($row->submissions_limit) ) {
1859
  $submissions_limit_text = $row->submissions_limit_text;
1860
+
1861
+ // Check if the form is after submittions
 
1862
  if( $limsub == 1 ) {
1863
  $form_maker_front_end = '<div id="fm-pages' . $form_id . '" class="fm-pages wdform_page_navigation ' . $pagination_align . '" show_title="' . $row->show_title . '" show_numbers="' . $row->show_numbers . '" type="' . $row->pagination . '"></div><form name="form' . $form_id . '" action="' . $current_url . '" method="post" id="form' . $form_id . '" class="fm-form form' . $form_id . ' ' . $header_pos . ' ' . ( ( Cookie_fm::getCookieByKey($form_id, 'form_submit_type') || Cookie_fm::getCookieByKey($form_id, 'massage_after_submit') ) ? 'fm-form-submitted' : '' ) . '" enctype="multipart/form-data"><div class="fm-message fm-notice-success">' . __( 'Your form was successfully submitted.', WDFMInstance(self::PLUGIN)->prefix ) . '</div></form>';
1864
  }
1871
  }
1872
  }
1873
  }
 
1874
  return $formType == 'embedded' ? WDW_FM_Library(self::PLUGIN)->fm_container($theme_id, $form_maker_front_end) : $form_maker_front_end;
1875
  }
1876
 
1887
  $display_on_this = $params['display_on_this'];
1888
  $show_for_admin = $params['show_for_admin'];
1889
  $form_result = $params['form_result'];
1890
+ $form_result['fm_page_id'] = $params['fm_page_id'];
1891
+ $form_result['fm_current_post_type'] = $params['fm_current_post_type'];
1892
  $fm_settings = $params['fm_settings'];
1893
  $error = $params['error'];
1894
  $message = $params['message'];
1906
  * which keeped in $_SESSION['fm_hide_form_after_submit' . $id] variable
1907
  */
1908
  if ( $display_on_this && $hide_mobile || ( $fm_settings['fm_ajax_submit'] && Cookie_fm::getCookieByKey($id, 'fm_hide_form_after_submit') == 1 ) ) {
 
 
 
 
 
 
 
1909
  if ( Cookie_fm::getCookieByKey($id, 'fm_hide_form_after_submit') == 1 ) {
1910
  if ( $error == 'success' ) {
1911
  if ($message) {
1963
  * which keeped in $_SESSION['fm_hide_form_after_submit' . $id] variable
1964
  */
1965
  if ($display_on_this && $hide_mobile || ( $fm_settings['fm_ajax_submit'] && Cookie_fm::getCookieByKey($id, 'fm_hide_form_after_submit') == 1) ) {
 
 
 
 
 
 
 
1966
  if ( Cookie_fm::getCookieByKey($id, 'fm_hide_form_after_submit') == 1 ) {
1967
  if ( $error == 'success' ) {
1968
  if ( $message ) {
2043
  * which keeped in $_SESSION['fm_hide_form_after_submit' . $id] variable
2044
  */
2045
  if ($display_on_this && $hide_mobile || ($fm_settings['fm_ajax_submit'] && Cookie_fm::getCookieByKey($id, 'fm_hide_form_after_submit') == 1)) {
 
 
 
 
 
 
 
2046
  if ( Cookie_fm::getCookieByKey($id, 'fm_hide_form_after_submit') == 1) {
2047
  if ( $error == 'success' ) {
2048
  if ($message) {
2101
  }';
2102
  }
2103
  }
 
2104
  $onload_js .= '
2105
  jQuery("#fm-popover-inner-background' . $id . '").on("click", function(){
2106
  fm_hide_form(' . $id . ', ' . $frequency . ', function(){
2115
  <div class="fm-popover-container" id="fm-popover-container' . $id . '">
2116
  <div class="fm-popover-inner-background" id="fm-popover-inner-background' . $id . '"></div>
2117
  <div class="fm-popover-content">';
2118
+ $fm_form .= $this->display($form_result, $fm_settings, $id, $type);
2119
+ $fm_form .= '<div id="fm-action-buttons' . $id . '" class="fm-action-buttons">';
2120
+ $fm_form .= '<span id="closing-form' . $id . '" class="closing-form fm-ico-delete" onclick="fm_hide_form(' . $id . ', ' . $frequency . ', function(){
2121
  jQuery(\'#fm-popover-background' . $id . '\').css(\'display\', \'none\');
2122
  jQuery(\'#fm-popover' . $id . '\').css(\'display\', \'none\');
2123
  });"></span>
js/form_maker_manage.js CHANGED
@@ -634,6 +634,7 @@ function add_condition_fields( num ) {
634
  case "type_range":
635
  case "type_file_upload":
636
  case "type_slider":
 
637
  if ( types[index_of_field] == "type_number" || types[index_of_field] == "type_phone" ) {
638
  var keypress_function = "return check_isnum_space(event)";
639
  }
@@ -808,6 +809,7 @@ function change_choices(value) {
808
  case "type_range":
809
  case "type_slider":
810
  case "type_editor":
 
811
  if(types_array[id]=="type_number" || types_array[id]=="type_phone")
812
  var keypress_function = "return check_isnum_space(event)";
813
  else
634
  case "type_range":
635
  case "type_file_upload":
636
  case "type_slider":
637
+ case "type_hidden":
638
  if ( types[index_of_field] == "type_number" || types[index_of_field] == "type_phone" ) {
639
  var keypress_function = "return check_isnum_space(event)";
640
  }
809
  case "type_range":
810
  case "type_slider":
811
  case "type_editor":
812
+ case "type_hidden":
813
  if(types_array[id]=="type_number" || types_array[id]=="type_phone")
814
  var keypress_function = "return check_isnum_space(event)";
815
  else
js/main_div_front_end.js CHANGED
@@ -1947,7 +1947,7 @@ function fm_submit_form(form_id) {
1947
  jQuery("<input type=\"hidden\" name=\"save_or_submit"+form_id+"\" value =\"submit\" />").appendTo("#form"+form_id);
1948
  window["onsubmit_js" + form_id]();
1949
 
1950
- if (window['checkStripe' + form_id] == 1) {
1951
  var jq_mainForm = jQuery("form[id='form"+form_id+"']");
1952
  if (jq_mainForm.find(".StripeElement").first().parents(".wdform_row").css('display') != 'none') {
1953
  wdfm_call_stripe(true);
@@ -2041,30 +2041,25 @@ function fm_submit(form_id) {
2041
  return;
2042
  }
2043
  }
2044
- if ( after_submit_redirect_url != 0 ) {
2045
- window.location.replace(after_submit_redirect_url);
2046
- return;
2047
- }
2048
  jQuery("#form" + form_id + " .button-submit").prop("disabled", false);
2049
  jQuery('#form'+form_id+' .fm-submit-loading').hide();
2050
-
2051
  var result = jQuery(response).find('#form'+form_id).html();
 
 
 
 
2052
  jQuery('#form'+form_id).html(result);
2053
-
2054
  /* Using for save progress addon */
2055
  if (typeof window['fm_save_progress_buttons_' + form_id] === 'function') {
2056
  window['fm_save_progress_buttons_' + form_id]();
2057
  }
2058
-
2059
  if (jQuery(document).find(".g-recaptcha").length > 0) {
2060
  fmRecaptchaInit(1);
2061
  }
2062
-
2063
  var fm_func_name = 'fm_script_ready' + form_id;
2064
  if ( typeof( window[fm_func_name] ) !== 'undefined' ) {
2065
  window[fm_func_name]();
2066
  }
2067
-
2068
  if( jQuery(result).find('.fm-not-filled.message_captcha').length > 0 ) {
2069
  var msg = jQuery(result).find('.fm-not-filled.message_captcha').text();
2070
  jQuery('#form'+form_id+' .fm-message').remove();
1947
  jQuery("<input type=\"hidden\" name=\"save_or_submit"+form_id+"\" value =\"submit\" />").appendTo("#form"+form_id);
1948
  window["onsubmit_js" + form_id]();
1949
 
1950
+ if ( window['checkStripe' + form_id] == 1 ) {
1951
  var jq_mainForm = jQuery("form[id='form"+form_id+"']");
1952
  if (jq_mainForm.find(".StripeElement").first().parents(".wdform_row").css('display') != 'none') {
1953
  wdfm_call_stripe(true);
2041
  return;
2042
  }
2043
  }
 
 
 
 
2044
  jQuery("#form" + form_id + " .button-submit").prop("disabled", false);
2045
  jQuery('#form'+form_id+' .fm-submit-loading').hide();
 
2046
  var result = jQuery(response).find('#form'+form_id).html();
2047
+ if ( after_submit_redirect_url != 0 && jQuery(result).find('.fm-not-filled.message_captcha').length == 0 && jQuery(result).filter('.fm-notice-error').length == 0 ) {
2048
+ window.location.replace(after_submit_redirect_url);
2049
+ return;
2050
+ }
2051
  jQuery('#form'+form_id).html(result);
 
2052
  /* Using for save progress addon */
2053
  if (typeof window['fm_save_progress_buttons_' + form_id] === 'function') {
2054
  window['fm_save_progress_buttons_' + form_id]();
2055
  }
 
2056
  if (jQuery(document).find(".g-recaptcha").length > 0) {
2057
  fmRecaptchaInit(1);
2058
  }
 
2059
  var fm_func_name = 'fm_script_ready' + form_id;
2060
  if ( typeof( window[fm_func_name] ) !== 'undefined' ) {
2061
  window[fm_func_name]();
2062
  }
 
2063
  if( jQuery(result).find('.fm-not-filled.message_captcha').length > 0 ) {
2064
  var msg = jQuery(result).find('.fm-not-filled.message_captcha').text();
2065
  jQuery('#form'+form_id+' .fm-message').remove();
js/manage-edit-scripts.min.js CHANGED
@@ -1 +1 @@
1
- function fm_admin_ready(){jQuery(".wd-header a").on("click",function(){jQuery("input[name='task']").val("add"),jQuery(this).parents("form").submit()}),set_no_items(),jQuery(".wd-datepicker").each(function(){jQuery(this).datepicker(),jQuery(this).datepicker("option","dateFormat",jQuery(this).data("format"))}),jQuery(".hndle:not(.readonly), .handlediv").each(function(){jQuery(this).off("click").on("click",function(){fm_toggle_postbox(this)})}),jQuery(".wd-has-placeholder .dashicons.dashicons-list-view, .wd-editor-placeholder .dashicons.dashicons-list-view").each(function(){jQuery(this).attr("title",form_maker.add_placeholder)}),jQuery(document).on("click",".wd-has-placeholder .dashicons.dashicons-list-view, .wd-editor-placeholder .dashicons.dashicons-list-view",function(){fm_placeholders_popup(jQuery(this).data("id"))}),fm_disabled_uninstall_btn(),void 0!==jQuery(document).tooltip&&jQuery(document).tooltip({show:null,items:".wd-info",content:function(){if(jQuery(this).is(".wd-info"))return jQuery("#"+jQuery(this).data("id")).html()},open:function(e,t){if(void 0===e.originalEvent)return!1;var i=jQuery(t.tooltip).attr("id");jQuery("div.ui-tooltip").not("#"+i).remove()},close:function(e,t){t.tooltip.hover(function(){jQuery(this).stop(!0).fadeTo(400,1)},function(){jQuery(this).fadeOut("400",function(){jQuery(this).remove()})})},position:{my:"center top+30",at:"center top",using:function(e,t){jQuery(this).css(e),jQuery("<div>").addClass("tooltip-arrow").addClass(t.vertical).addClass(t.horizontal).appendTo(this)}}}),jQuery("#fm-submission-lists").length&&jQuery("#fm-submission-lists td").each(function(){"0"==jQuery(this).data("status")&&jQuery(this).parent().hide()})}function wd_insert_placeholder(e,t){var i=document.getElementById(e);if("undefined"==typeof tinyMCE||(tinyMCE.get(e)&&tinyMCE.get(e).focus(),"none"!=i.style.display))if(i.focus(),document.selection)sel=document.selection.createRange(),sel.text=t;else if(i.selectionStart||"0"==i.selectionStart){var n=i.selectionStart,a=i.selectionEnd;i.value=i.value.substring(0,n)+"{"+t+"}"+i.value.substring(a,i.value.length)}else i.value+="{"+t+"}";else tinyMCE.execCommand("mceInsertContent",!1,"{"+t+"}")}function fm_toggle_postbox(e){jQuery(e).parent(".postbox").toggleClass("closed")}function fm_option_tabs_mail_validation(){return!0}function fm_clear_input_value(e){jQuery("#"+e).val("")}function set_no_items(){jQuery(".colspanchange").attr("colspan",jQuery(".wd-form table.adminlist>thead>tr>th:visible").length+jQuery(".wd-form table.adminlist>thead>tr>td:visible").length)}function search(e){var t=jQuery(e).parents("form");t.attr("action",t.attr("action")+"&paged=1&s="+jQuery("input[name='s']").val()),t.submit()}function input_search(e,t){return 13==(e.keyCode?e.keyCode:e.which)&&search(t),!0}function input_pagination(e,t){if(13==(e.keyCode?e.keyCode:e.which)){var i=jQuery(t).parents("form"),n=jQuery(t).val();if(n<=jQuery(t).parents(".pagination-links").data("pages-count")&&0<n){var a=new RegExp("&nonce_fm="+nonce_fm,"g"),r=i.attr("action").replace(a,"").replace(/&paged=(\d+)/,"")+"&paged="+n;i.attr("action",r),location.href=r}}return!0}function fm_select_value(e){e.focus(),e.select()}function fm_doNothing(e){13==(e.keyCode?e.keyCode:e.which?e.which:e.charCode)&&(e.preventDefault?e.preventDefault():e.returnValue=!1)}function wd_bulk_action(e){var t=jQuery("select[name='bulk_action']").val();if(-1!=t){if(!jQuery("input[name^='check']").is(":checked"))return void alert(form_maker.select_at_least_one_item);if("delete"==t&&!confirm(form_maker.delete_confirmation))return!1;jQuery("input[name='task']").val(t),jQuery(e).parents("form").submit()}}function fm_ajax_save(e){var t=jQuery("#"+e).action,i=jQuery("#search_value").val(),n=jQuery("#current_id").val(),a=jQuery("#page_number").val(),r=(jQuery("#search_or_not").val(),jQuery("#ids_string").val()),l=jQuery("#image_order_by").val(),d=jQuery("#asc_or_desc").val(),_=jQuery("#ajax_task").val(),o=jQuery("#image_current_id").val();return ids_array=r.split(","),jQuery.ajax({type:"POST",url:t,data:{search_value:i,current_id:n,page_number:a,image_order_by:l,asc_or_desc:d,ids_string:r,task:"ajax_search",ajax_task:_,image_current_id:o,nonce:fm_ajax.ajaxnonce},success:function(e){var t=jQuery(e).find("#images_table").html();jQuery("#images_table").html(t);t=jQuery(e).find("#tablenav-pages").html();jQuery("#tablenav-pages").html(t),jQuery("#show_hide_weights").val("Hide order column"),fm_show_hide_weights(),fm_run_checkbox()}}),!1}function fm_run_checkbox(){jQuery("tbody").children().children(".check-column").find(":checkbox").click(function(e){if("undefined"==e.shiftKey)return!0;if(e.shiftKey){if(!i)return!0;d=jQuery(i).closest("form").find(":checkbox"),f=d.index(i),j=d.index(this),h=jQuery(this).prop("checked"),0<f&&0<j&&f!=j&&d.slice(f,j).prop("checked",function(){return!!jQuery(this).closest("tr").is(":visible")&&h})}i=this;var t=jQuery(this).closest("tbody").find(":checkbox").filter(":visible").not(":checked");return jQuery(this).closest("table").children("thead, tfoot").find(":checkbox").prop("checked",function(){return 0==t.length}),!0}),jQuery("thead, tfoot").find(".check-column :checkbox").click(function(e){var t=jQuery(this).prop("checked"),i="undefined"!=typeof toggleWithKeyboard&&toggleWithKeyboard,n=e.shiftKey||i;jQuery(this).closest("table").children("tbody").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked",function(){return!jQuery(this).is(":hidden")&&(n?jQuery(this).prop("checked"):!!t)}),jQuery(this).closest("table").children("thead, tfoot").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked",function(){return!n&&!!t})})}function fm_set_input_value(e,t){document.getElementById(e)&&(document.getElementById(e).value=t)}function fm_form_submit(e,t,i,n){document.getElementById(t)&&document.getElementById(t).submit(),e.preventDefault?e.preventDefault():e.returnValue=!1}function fm_check_required(e,t){return""==jQuery("#"+e).val()&&(alert(t+" field is required."),jQuery("#"+e).attr("style","border-color: #FF0000; border-style: solid; border-width: 1px;"),jQuery("#"+e).focus(),jQuery("html, body").animate({scrollTop:jQuery("#"+e).offset().top-200},500),!0)}function fm_show_hide_weights(){var n;"Show order column"==jQuery("#show_hide_weights").val()?(jQuery(".connectedSortable").css("cursor","default"),jQuery("#tbody_arr").find(".handle").hide(0),jQuery("#th_order").show(0),jQuery("#tbody_arr").find(".fm_order").show(0),jQuery("#show_hide_weights").val("Hide order column"),jQuery("#tbody_arr").sortable()&&jQuery("#tbody_arr").sortable("disable")):(jQuery(".connectedSortable").css("cursor","move"),n=jQuery("#page_number")&&""!=jQuery("#page_number").val()&&1!=jQuery("#page_number").val()?20*(jQuery("#page_number").val()-1)+1:1,jQuery("#tbody_arr").sortable({handle:".connectedSortable",connectWith:".connectedSortable",update:function(e,t){jQuery("#draganddrop").attr("style",""),jQuery("#draganddrop").html("<strong><p>Changes made in this table should be saved.</p></strong>");var i=n;jQuery(".fm_order").each(function(e){jQuery(this).find("input").val()&&jQuery(this).find("input").val(i++)})}}),jQuery("#tbody_arr").sortable("enable"),jQuery("#tbody_arr").find(".handle").show(0),jQuery("#tbody_arr").find(".handle").attr("class","handle connectedSortable"),jQuery("#th_order").hide(0),jQuery("#tbody_arr").find(".fm_order").hide(0),jQuery("#show_hide_weights").val("Show order column"))}function fm_popup(e){if(void 0===e)e="";var n,r,l;(n=function(){var e,t,i=jQuery("#TB_window"),n=jQuery(window).height(),a=jQuery(window).width();e=r&&r<a-90?r:a-40,t=l&&l<n-60?l:n-40,i.length&&(i.width(e).height(t),jQuery("#TB_iframeContent").width(e).height(t-27),i.css({"margin-left":"-"+parseInt(e/2,10)+"px"}),void 0!==document.body.style.maxWidth&&i.css({top:(n-t)/2,"margin-top":"0"}))})(),jQuery(window).resize(function(){n()}),jQuery("a.thickbox-preview"+e).click(function(){tb_click.call(this);var e=jQuery(this).parents(".available-theme").find(".activatelink"),t="",i=jQuery(this).attr("href");return r=(r=i.match(/&width=[0-9]+/))?parseInt(r[0].replace(/[^0-9]+/g,""),10):jQuery(window).width()-120,l=(l=i.match(/&height=[0-9]+/))?parseInt(l[0].replace(/[^0-9]+/g,""),10):jQuery(window).height()-120,t=e.length?'&nbsp; <a href="'+(e.attr("href")||"")+'" target="_top" class="tb-theme-preview-link">'+(e.attr("title")||"")+"</a>":'&nbsp; <span class="tb-theme-preview-link">'+(jQuery(this).attr("title")||"")+"</span>",jQuery("#TB_title").css({"background-color":"#222",color:"#dfdfdf"}),jQuery("#TB_closeAjaxWindow").css({float:"right"}),jQuery("#TB_ajaxWindowTitle").css({float:"left"}).html(t),jQuery("#TB_iframeContent").width("100%"),n(),!1}),jQuery(".theme-detail").click(function(){return jQuery(this).siblings(".themedetaildiv").toggle(),!1})}function bwg_inputs(){jQuery(".fm_int_input").keypress(function(e){var t=e.which||e.paramlist_keyCode;return!(31<t&&(t<48||57<t)&&46!=t&&45!=t)})}function fm_check_isnum(e){var t=e.which||e.paramlist_keyCode;return!(31<t&&(t<48||58<t)&&46!=t&&45!=t&&(t<65||70<t)&&(t<97||102<t))}function fm_change_payment_method(e){switch(e){case"paypal":jQuery(".fm_payment_option").show(),jQuery(".fm_paypal_option").show(),jQuery(".fm_payment_option_stripe").hide();break;case"stripe":jQuery(".fm_payment_option").hide(),jQuery(".fm_paypal_option").hide(),jQuery(".fm_payment_option_stripe").show();break;default:jQuery(".fm_payment_option").hide(),jQuery(".fm_paypal_option").hide(),jQuery(".fm_payment_option_stripe").hide()}}function stopRKey(e){var t=(e=e||(event||null)).target?e.target:e.srcElement?e.srcElement:null;if(13==e.keyCode&&("text"==t.type||"search"==t.type))return!1}function fmRemoveHeaderImage(e,t){jQuery("#header_image_url").val(""),jQuery("#header_image").css("background-image",""),jQuery("#header_image").addClass("fm-hide")}function fmOpenMediaUploader(e,t){void 0===t&&(t=!1),e.preventDefault();var i=wp.media({title:"Upload",button:{text:"Add Image"},multiple:!1}).on("select",function(){var e=i.state().get("selection").first().toJSON();jQuery("#header_image_url").val(e.url),jQuery("#header_image").css("background-image",'url("'+e.url+'")'),jQuery("#header_image").css("background-position","center"),jQuery("#header_image").removeClass("fm-hide")}).open();return!1}function fm_toggle_posts(e){jQuery(e).prop("checked")?jQuery(".fm-posts-show, .fm-cat-show").removeClass("fm-hide").addClass("fm-show"):jQuery(".fm-posts-show, .fm-cat-show").removeClass("fm-show").addClass("fm-hide")}function fm_toggle_pages(e){jQuery(e).prop("checked")?jQuery(".fm-pages-show").removeClass("fm-hide").addClass("fm-show"):jQuery(".fm-pages-show").removeClass("fm-show").addClass("fm-hide")}function fm_apply_options(e){fm_set_input_value("task",e),document.getElementById("manage_form").submit()}function pp_live_search(e,t,i){var n=e,a=n.val(),r=n.data("post_type");setTimeout(function(){a===n.val()&&jQuery.ajax({type:"POST",url:ajaxurl,data:{action:"manage_fm",task:"fm_live_search",nonce:fm_ajax.ajaxnonce,pp_live_search:a,pp_post_type:r,pp_full_content:i},beforeSend:function(e){n.css("width","95%"),n.parent().find(".fm-loading").css("display","inline-block")},success:function(e){n.css("width","100%"),n.parent().find(".fm-loading").css("display","none"),n.closest(".fm-pp").find(".pp_search_results").replaceWith(e)},error:function(e){console.log(e)}})},t)}function fm_toggle(e){jQuery(e).parent().next().toggleClass("hide")}function change_tab(e){jQuery(".fm-subscriber-header .fm-button").removeClass("active-button"),jQuery(".fm-subscriber-header ."+e).addClass("active-button"),jQuery(".fm-subscriber-content").hide(),jQuery("."+e+"-tab").show()}function change_form_type(e){jQuery(".fm-form-types span").removeClass("active"),jQuery(".fm-form-types").find(".fm-"+e).addClass("active"),jQuery("#type_settings_fieldset .wd-group").removeClass("fm-show").addClass("fm-hide")}function change_hide_show(e){jQuery("."+e+".fm-hide").removeClass("fm-hide").addClass("fm-temporary"),jQuery("."+e+".fm-show").removeClass("fm-show").addClass("fm-hide"),jQuery("."+e+".fm-show-table").removeClass("fm-show-table").addClass("fm-hide"),jQuery("."+e+".fm-temporary").removeClass("fm-temporary").addClass("fm-show"),"fm-embedded"!=e&&(fm_toggle_posts(jQuery(".pp_display_on #pt3")),fm_toggle_pages(jQuery(".pp_display_on #pt4")))}function fm_change_radio_checkbox_text(e){var t=[];t.stripemode=["Test","Live"],t.checkout_mode=["Testmode","Production"],t.mail_mode=["Text","HTML"],t.mail_mode_user=["Text","HTML"],t.value=["1","0"],t.popover_show_on=["Page Exit","Page Load"],t.topbar_position=["Bottom","Top"],t.scrollbox_position=["Left","Right"],jQuery(e).val(t.value[jQuery(e).val()]),jQuery(e).next().val(jQuery(e).val());var i=t[jQuery(e).attr("name")];jQuery(e).find("label").html(i[jQuery(e).val()]),jQuery(e).hasClass("fm-text-yes")?(jQuery(e).removeClass("fm-text-yes").addClass("fm-text-no"),jQuery(e).find("span").animate({right:parseInt(jQuery(e).css("width"))-14+"px"},400,function(){})):(jQuery(e).removeClass("fm-text-no").addClass("fm-text-yes"),jQuery(e).find("span").animate({right:0},400,function(){}))}function fm_show_hide(e){jQuery("."+e).hasClass("fm-hide")?jQuery("."+e).removeClass("fm-hide").addClass("fm-show"):jQuery("."+e).removeClass("fm-show").addClass("fm-hide")}function fm_delete_ip(e){jQuery("#td_ip_"+e+" .loading").css("display","initial");var i=jQuery("#blocked_ips").attr("action");jQuery.ajax({type:"POST",url:i,data:{current_id:e,nonce_fm:jQuery("#nonce_fm").val(),task:"delete_blocked_ip"},success:function(e){var t=parseInt(jQuery(e).find("#total_for_paging").html());isNaN(t)||(i=i.replace(/(paged=)[^\&]+/,"$1"+t)),jQuery("#blocked_ips").parent(".wrap").load(i+" #blocked_ips",function(){window.history.pushState(null,null,i),0!=jQuery(".updated").length?jQuery(" .updated p strong").html("Items Successfully Deleted"):jQuery("<div class='updated below-h2'><p><strong>Items Successfully Deleted.</strong></p></div>").insertBefore("#blocked_ips"),set_no_items()})}})}function fm_save_ip(t){var i=jQuery("#ip"+t).val();url=jQuery("#blocked_ips").attr("action"),jQuery.ajax({type:"POST",url:url,data:{ip:i,nonce_fm:jQuery("#nonce_fm").val(),task:"insert_blocked_ip"},success:function(e){jQuery("#td_ip_"+t).html('<a id="ip'+t+'" class="pointer" title="Edit" onclick="fm_edit_ip('+t+')">'+i+"</a>"),jQuery(".insert, .error").hide(),jQuery("#fm_blocked_ips_message").html("<div class='updated'><strong><p>Items Successfully Inserted.</p></strong></div>"),jQuery("#fm_blocked_ips_message").show()}})}function fm_insert_blocked_ip(){jQuery("#tr .loading").css("display","initial");var e=jQuery("#fm_ip").val(),t=window.location.href;jQuery.ajax({type:"POST",url:t,data:{ip:e,nonce_fm:jQuery("#nonce_fm").val(),task:"insert_blocked_ip",last_id:1},success:function(e){jQuery("#blocked_ips").parent(".wrap").load(t+" #blocked_ips",function(){window.history.pushState(null,null,t),0!=jQuery(".updated").length?jQuery(".updated p strong").html("Items Successfully Saved"):jQuery("<div class='updated below-h2'><p><strong>Items Successfully Saved.</strong></p></div>").insertBefore("#blocked_ips")})}})}function fm_edit_ip(e){var t='<input id="ip'+e+'" class="input_th'+e+' ip_input" type="text" onkeypress="if(event.keyCode == 13){ if (fm_check_required(\'ip'+e+"', 'IP')) {return false;} fm_update_blocked_ip("+e+'); } return fm_check_isnum(event); " value="'+jQuery("#ip"+e).html()+'" name="ip'+e+'"/>';t+='<input type="button" class="button ip_save" style="margin-left: 5px" onclick="if (fm_check_required(\'ip'+e+"', 'IP')) {return false;} fm_update_blocked_ip("+e+'); return false;" value="Save"><div class="loading">',t+="<img src="+plugin_url+"/images/loading.gif></div>",jQuery("#td_ip_"+e).html(t)}function fm_enter_ip(e){if(13==e.which){if(fm_check_required("fm_ip","IP"))return!1;e.preventDefault(),fm_insert_blocked_ip()}}function fm_update_blocked_ip(e){jQuery("#td_ip_"+e+" .loading").css("display","initial");var t=jQuery("#ip"+e).val(),i=window.location.href;jQuery.ajax({type:"POST",url:i,data:{ip:t,current_id:e,nonce_fm:jQuery("#nonce_fm").val(),task:"update_blocked_ip"},success:function(e){jQuery("#fm-form-admin").load(i+" #blocked_ips",function(){0!=jQuery(".updated").length?(window.history.pushState(null,null,i),jQuery(".updated p strong").html("Items Successfully Updated")):jQuery("<div class='updated below-h2'><p><strong>Items Successfully Updated.</strong></p></div>").insertBefore("#blocked_ips")})}})}function onEnableChange(e,t,i){var n=jQuery("#"+e+" #"+t);"1"==i?n.removeClass("hidden"):n.addClass("hidden")}function show_stats(){var e=jQuery(".fm-statistics .fm_error_sorted_label_key");""!=jQuery("#sorted_label_key").val()?(e.hide(),jQuery(".fm-div_stats-loading").addClass("is-active"),jQuery.ajax({dataType:"json",type:"POST",url:show_stats_url,data:{sorted_label_key:jQuery("#sorted_label_key").val(),startdate:jQuery("#startstats").val(),enddate:jQuery("#endstats").val(),nonce:fm_ajax.ajaxnonce},beforeSend:function(e){},error:function(e){},success:function(e){jQuery(".fm-div_stats-loading").removeClass("is-active"),e.html&&jQuery("#div_stats").html(e.html)}})):e.show()}function fm_loading_show(){jQuery("#fm_loading").show()}function fm_loading_hide(){jQuery("#fm_loading").hide(),"function"==typeof add_scroll_width&&add_scroll_width(),set_no_items()}function getFormLocalStorage(){var e={};formId=getAllUrlParams().current_id;var t=localStorage.getItem("fm_form"+formId);return null!=t&&(e=jQuery.parseJSON(t)),e}function getAllUrlParams(e){var t=e?e.split("?")[1]:window.location.search.slice(1),i={};if(t)for(var n=(t=t.split("#")[0]).split("&"),a=0;a<n.length;a++){var r=n[a].split("="),l=void 0,d=r[0].replace(/\[\d*\]/,function(e){return l=e.slice(1,-1),""}),_=void 0===r[1]||r[1];d=d.toLowerCase(),_=_.toLowerCase(),i[d]?("string"==typeof i[d]&&(i[d]=[i[d]]),void 0===l?i[d].push(_):i[d][l]=_):i[d]=_}return i}function fm_disabled_uninstall_btn(){jQuery(".form_maker_uninstall .fm-uninstall-btn").prop("disabled",!0),jQuery(".form_maker_uninstall #check_yes").on("click",function(){jQuery(this).is(":checked")?jQuery(".form_maker_uninstall .fm-uninstall-btn").prop("disabled",!1):jQuery(".form_maker_uninstall .fm-uninstall-btn").prop("disabled",!0)})}function fm_html_entities(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function remove_whitespace(e){var t;for(t=0;t<e.childNodes.length;t++)e.childNodes[t]&&"3"==e.childNodes[t].nodeType&&!/\S/.test(e.childNodes[t].nodeValue)?(e.removeChild(e.childNodes[t]),t--):e.childNodes[t].childNodes.length&&remove_whitespace(e.childNodes[t])}function fm_row_handle(e){var t=jQuery(e);t.find(".wdform_row_handle").remove();var i=jQuery('<div class="wdform_row_handle"><span class="fm-ico-draggable"></span><span title="Remove the column" class="page_toolbar fm-ico-delete" onclick="fm_remove_row_popup(this);"></span>'+"<span class=\"add-new-field\" onclick=\"jQuery('#cur_column').removeAttr('id');jQuery(this).parent().parent().attr('id', 'cur_column').val(1);popup_ready(); Enable(); return false;\">"+form_maker_manage.add_new_field+'</span><div class="fm-divider"></div></div>');t.prepend(i),i.after('<div class="fm-section-overlay"></div>')}function sortable_columns(){jQuery("#take").sortable({cursor:"move",placeholder:"highlight",tolerance:"pointer",handle:".form_id_tempform_view_img .fm-ico-draggable",items:"> .wdform-page-and-images",axis:"y",update:function(e,t){refresh_page_numbers()}}),jQuery(".wdform_page").sortable({connectWith:".wdform_page",cursor:"move",placeholder:"highlight",tolerance:"pointer",handle:".wdform_row_handle",cancel:".add-new-field, .page_toolbar",items:"> .wdform_section",create:function(e,t){jQuery(e.target).find(".wdform_section").each(function(){fm_row_handle(this)})},start:function(e,t){jQuery(".wdform_row_empty").hide()},stop:function(e,t){fm_rows_refresh(),jQuery(".wdform_row_empty").show()}}),jQuery(".wdform_column").sortable({connectWith:".wdform_column",cursor:"move",placeholder:"highlight",tolerance:"pointer",cancel:".wdform_section_handle",items:"> .wdform_row, #add_field",start:function(e,t){jQuery(".add-new-button").off("click"),jQuery(".wdform_column").removeClass("fm-hidden"),jQuery("#cur_column").removeAttr("id")},stop:function(e,t){return"add_field_cont"!=t.item.parent().attr("id")&&("add_field"==t.item.attr("id")&&"add_field_cont"!=t.item.parent().attr("id")?(fm_check_something_really_important()||(nextID=jQuery("#add_field").next(".wdform_row").attr("wdid"),jQuery("#add_field").parent().attr("id","cur_column"),popup_ready(),Enable(),jQuery(".add-new-button").removeAttr("onclick")),!1):(jQuery(".wdform_column:not(#add_field_cont):empty").addClass("fm-hidden"),void fm_columns_refresh()))}})}function all_sortable_events(){fm_rows_refresh(),fm_columns_refresh(),jQuery(".wdform_row, .wdform_tr_section_break").off("mouseover touchstart").on("mouseover touchstart",function(e){if(!jQuery(this).find(".wdform_arrows").is(":visible"))return jQuery(".wdform_arrows").hide(),jQuery(this).find(".wdform_arrows").show(),e.preventDefault(),!1}).off("mouseleave").on("mouseleave",function(){jQuery(this).find(".wdform_arrows").hide()}),jQuery(".wdform_section_handle, .wdform_row_handle").off("mouseover touchstart").on("mouseover touchstart",function(e){jQuery(this).parent().addClass("fm-hover")}).off("mouseleave").on("mouseleave",function(){jQuery(this).parent().removeClass("fm-hover")})}function fm_change_radio(e){jQuery(e).hasClass("fm-yes")?(jQuery(e).val("0"),jQuery(e).next().val("0"),jQuery(e).removeClass("fm-yes").addClass("fm-no"),jQuery(e).find("span").animate({right:parseInt(jQuery(e).css("width"))-14+"px"},400,function(){})):(jQuery(e).val("1"),jQuery(e).next().val("1"),jQuery(e).find("span").animate({right:0},400,function(){jQuery(e).removeClass("fm-no").addClass("fm-yes")})),"mail_verify"==jQuery(e).next().attr("name")&&show_verify_options(1==jQuery(e).val())}function enable_drag(){jQuery(".wdform_column").sortable("enable"),jQuery(".wdform_arrows_advanced").hide(),jQuery(".wdform_field").css("cursor",""),jQuery("#add_field .wdform_field").css("cursor",""),all_sortable_events()}function refresh_(){document.getElementById("counter").value=gen,jQuery(".wdform-page-and-images").each(function(){var e=jQuery(this);e.find("[id^=page_next_]").removeAttr("src"),e.find("[id^=page_previous_]").removeAttr("src"),e.find(".form_id_tempform_view_img").remove()}),jQuery("#take div").removeClass("ui-sortable ui-sortable-disabled ui-sortable-handle"),jQuery("#add_field_cont").remove(),document.getElementById("form_front").value=fm_base64EncodeUnicode(fm_htmlentities(document.getElementById("take").innerHTML))}function fm_base64EncodeUnicode(e){return utf8Bytes=encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}),btoa(utf8Bytes)}function fm_htmlentities(e){var t=document.createElement("div"),i=document.createTextNode(e);return t.style.cssText="display:none",t.appendChild(i),t.innerHTML}function fm_add_submission_email(e,t,i,n){var a=jQuery("#"+t).val();if(a){var r=jQuery("<p>").attr("class","fm_mail_input").prependTo("#"+i);jQuery("<span>").attr("class","mail_name").text(a).appendTo(r),jQuery("<span>").attr("class","dashicons dashicons-trash").attr("onclick","fm_delete_mail(this, '"+a+"')").attr("title","Delete Email").appendTo(r),jQuery("#"+t).val(""),jQuery("#"+e).val(jQuery("#"+e).val()+a+",")}}function fm_delete_mail(e,t){jQuery(e).parent().remove(),jQuery("#mail").val(jQuery("#mail").val().replace(t+",",""))}function form_maker_options_tabs(e){return jQuery("#fieldset_id").val(e),jQuery(".fm_fieldset_active").removeClass("fm_fieldset_active").addClass("fm_fieldset_deactive"),jQuery("#"+e+"_fieldset").removeClass("fm_fieldset_deactive").addClass("fm_fieldset_active"),jQuery(".fm_fieldset_tab").removeClass("active"),jQuery("#"+e).addClass("active"),!1}function set_type(e){switch(e){case"post":document.getElementById("post").removeAttribute("style"),document.getElementById("page").setAttribute("style","display:none"),document.getElementById("custom_text").setAttribute("style","display:none"),document.getElementById("url_wrap").setAttribute("style","display:none");break;case"page":document.getElementById("page").removeAttribute("style"),document.getElementById("post").setAttribute("style","display:none"),document.getElementById("custom_text").setAttribute("style","display:none"),document.getElementById("url_wrap").setAttribute("style","display:none");break;case"custom_text":document.getElementById("page").setAttribute("style","display:none"),document.getElementById("post").setAttribute("style","display:none"),document.getElementById("custom_text").removeAttribute("style"),document.getElementById("url_wrap").setAttribute("style","display:none");break;case"url_wrap":document.getElementById("page").setAttribute("style","display:none"),document.getElementById("post").setAttribute("style","display:none"),document.getElementById("custom_text").setAttribute("style","display:none"),document.getElementById("url_wrap").removeAttribute("style");break;case"none":document.getElementById("page").setAttribute("style","display:none"),document.getElementById("post").setAttribute("style","display:none"),document.getElementById("custom_text").setAttribute("style","display:none"),document.getElementById("url_wrap").setAttribute("style","display:none")}}function check_isnum(e){var t=e.which||e.keyCode;return!(31<t&&(t<48||57<t)&&46!=t&&45!=t&&(t<35||40<t))}function fm_check_email(e){if(document.getElementById(e)&&""!=jQuery("#"+e).val()){for(var t=jQuery("#"+e).val().split(","),i=/^[\u0400-\u04FFa-zA-Z0-9.+_-]+@[\u0400-\u04FFa-zA-Z0-9.-]+\.[\u0400-\u04FFa-zA-Z]{2,61}$/,n=0;n<t.length;n++){var a=t[n].replace(/^\s+|\s+$/g,"");if(a&&!i.test(a)&&-1===a.indexOf("{")){if(alert("This is not a valid email address."),jQuery("#submenu li a").hasClass("active")){var r=jQuery("#submenu .active").attr("id");if(void 0!==(d=jQuery("#"+e).closest(".fm_fieldset_deactive").attr("id")))if(r!=(_=d.split("_fieldset")[0])){var l=r+"_fieldset";jQuery("#"+l).removeClass("fm_fieldset_active"),jQuery("#"+l).removeClass("fm_fieldset_deactive"),jQuery("#"+d).addClass("fm_fieldset_active"),jQuery("#submenu .active").removeClass("active"),jQuery("#"+_).addClass("active")}}else{var d;if(void 0!==(d=jQuery("#"+e).closest(".fm_fieldset_deactive").attr("id"))){var _=d.split("_fieldset");_=_[0],jQuery("#"+d).removeClass("fm_fieldset_deactive"),jQuery("#"+d).addClass("fm_fieldset_active"),jQuery("#"+_).addClass("active")}}return jQuery("#"+e).css("border","1px solid #FF0000"),jQuery("#"+e).focus(),jQuery("html, body").animate({scrollTop:jQuery("#"+e).offset().top-200},500),!0}}jQuery("#"+e).css("border","1px solid #ddd")}return!1}function wdhide(e){document.getElementById(e).style.display="none"}function wdshow(e){document.getElementById(e).style.display="block"}function delete_field_condition(e){var t=e.split("_");document.getElementById("condition"+t[0]).removeChild(document.getElementById("condition_div"+e)),0==jQuery("#condition"+t[0]+" .fm_condition_div").length&&jQuery("#fields"+t[0]).prop("disabled",!1)}function add_condition(){var e=jQuery("#fm-conditions-json").data("conditions-json"),t=e.ids_index,n=e.ids,a=e.all_ids,r=e.labels,l=e.all_labels,d=e.types,_=e.params,o=e.ids_for_match,s=e.all_ids_for_match,m=e.labels_for_match,u=(e.all_labels_for_math,e.types_for_match),c=e.params_for_match;for(i=500;0<=i&&!document.getElementById("condition"+i);i--);num=i+1;var p=document.createElement("div");p.setAttribute("id","condition"+num),p.setAttribute("class","fm_condition");var f=document.createElement("div");f.setAttribute("id","conditional_fileds"+num);var h=document.createElement("select");h.setAttribute("id","show_hide"+num),h.setAttribute("name","show_hide"+num),h.setAttribute("class","fm_condition_show_hide");var y=document.createElement("option");y.setAttribute("value","1"),y.innerHTML="Show";var b=document.createElement("option");b.setAttribute("value","0"),b.innerHTML="Hide",h.appendChild(y),h.appendChild(b);var v=document.createElement("select");v.setAttribute("id","fields"+num),v.setAttribute("name","fields"+num),v.setAttribute("class","fm_condition_fields"),jQuery.each(r,function(e,t){var i=document.createElement("option");i.setAttribute("value",n[e]),i.innerHTML=replaceQuote(t),v.appendChild(i)});var g=document.createElement("span");g.innerHTML="if";var w=document.createElement("select");w.setAttribute("id","all_any"+num),w.setAttribute("name","all_any"+num),w.setAttribute("class","fm_condition_all_any");var E=document.createElement("option");E.setAttribute("value","and"),E.innerHTML="all";var A=document.createElement("option");A.setAttribute("value","or"),A.innerHTML="any",w.appendChild(E),w.appendChild(A);var x=document.createElement("span");x.style.maxWidth="235px",x.style.width="100%",x.style.display="inline-block",x.innerHTML="of the following match:";var k=document.createElement("span");k.setAttribute("id","fm-condition-fields-"+num),k.setAttribute("data-conditions-field-ids-index",JSON.stringify(t)),k.setAttribute("data-conditions-field-ids",JSON.stringify(n)),k.setAttribute("data-conditions-field-all-ids",JSON.stringify(a)),k.setAttribute("data-conditions-field-labels",JSON.stringify(r)),k.setAttribute("data-conditions-field-all-labels",JSON.stringify(l)),k.setAttribute("data-conditions-field-types",JSON.stringify(d)),k.setAttribute("data-conditions-field-params",JSON.stringify(_)),k.setAttribute("data-conditions-field-ids_for_match",JSON.stringify(o)),k.setAttribute("data-conditions-field-all-ids_for_match",JSON.stringify(s)),k.setAttribute("data-conditions-field-labels_for_match",JSON.stringify(m)),k.setAttribute("data-conditions-field-types_for_match",JSON.stringify(u)),k.setAttribute("data-conditions-field-params_for_match",JSON.stringify(c));var j=document.createElement("span");j.setAttribute("class","dashicons dashicons-plus-alt"),j.setAttribute("onClick",'add_condition_fields("'+num+'")');var C=document.createElement("span");C.setAttribute("class","dashicons dashicons-trash"),C.setAttribute("onClick",'delete_condition("'+num+'")'),f.appendChild(h),f.appendChild(document.createTextNode(" ")),f.appendChild(v),f.appendChild(document.createTextNode(" ")),f.appendChild(g),f.appendChild(document.createTextNode(" ")),f.appendChild(w),f.appendChild(document.createTextNode(" ")),f.appendChild(x),f.appendChild(document.createTextNode(" ")),f.appendChild(C),f.appendChild(document.createTextNode(" ")),f.appendChild(k),f.appendChild(j),p.appendChild(f),document.getElementById("conditions_fieldset_wrap").appendChild(p)}function delete_condition(e){document.getElementById("conditions_fieldset_wrap").removeChild(document.getElementById("condition"+e))}function replaceQuote(e){return void 0!==e&&""!==e?e=(e=e.replaceAll("%quot%","'")).replaceAll("%dquot%",'"'):e}function is_select_options_HTML_array(e){var t=[],i=supported_is_select_conditions_of_type(e);if(!0===i[0]){var n=document.createElement("option");n.setAttribute("id","is"),n.setAttribute("value","=="),n.innerHTML="is",t.push(n);var a=document.createElement("option");a.setAttribute("id","is_not"),a.setAttribute("value","!="),a.innerHTML="is not",t.push(a)}if(!0===i[1]){var r=document.createElement("option");r.setAttribute("id","like"),r.setAttribute("value","%"),r.innerHTML="like",t.push(r);var l=document.createElement("option");l.setAttribute("id","not_like"),l.setAttribute("value","!%"),l.innerHTML="not like",t.push(l)}if(!0===i[2]){var d=document.createElement("option");d.setAttribute("id","empty"),d.setAttribute("value","="),d.innerHTML="empty",t.push(d);var _=document.createElement("option");_.setAttribute("id","not_empty"),_.setAttribute("value","!"),_.innerHTML="not empty",t.push(_)}if(!0===i[3]){var o=document.createElement("option");o.setAttribute("id","checked"),o.setAttribute("value","checked"),o.innerHTML="Checked",t.push(o);var s=document.createElement("option");s.setAttribute("id","unchecked"),s.setAttribute("value","unchecked"),s.innerHTML="Unchecked",t.push(s)}if(!0===i[4]){var m=document.createElement("option");m.setAttribute("id","in_range"),m.setAttribute("value","in_range"),m.innerHTML="In Range",t.push(m);var u=document.createElement("option");u.setAttribute("id","out_range"),u.setAttribute("value","out_range"),u.innerHTML="Out of range",t.push(u);var c=document.createElement("option");c.setAttribute("id","empty"),c.setAttribute("value","empty"),c.innerHTML="Empty",t.push(c)}return t}function supported_is_select_conditions_of_type(e){switch(e){case"type_range":available_conditions=[!1,!1,!1,!1,!0];break;case"type_send_copy":available_conditions=[!1,!1,!1,!0,!1];break;case"type_file_upload":available_conditions=[!1,!1,!0,!1,!1];break;case"type_slider":available_conditions=[!0,!0,!1,!1,!1];break;default:available_conditions=[!0,!0,!0,!1,!1]}return available_conditions}function add_condition_fields(n){var a=0,r=document.getElementById("fields"+n).value,l=(jQuery("#fm-condition-fields-"+n).data("conditions-field-ids-index"),jQuery("#fm-condition-fields-"+n).data("conditions-field-ids_for_match")),e=(jQuery("#fm-condition-fields-"+n).data("conditions-field-all-ids_for_match"),jQuery("#fm-condition-fields-"+n).data("conditions-field-labels_for_match")),d=jQuery("#fm-condition-fields-"+n).data("conditions-field-types_for_match"),t=jQuery("#fm-condition-fields-"+n).data("conditions-field-params_for_match");for(jQuery("#fields"+n).prop("disabled",!0),i=500;0<=i&&!document.getElementById("condition_div"+n+"_"+i);i--);m=i+1;var _=document.createElement("div");_.setAttribute("id","condition_div"+n+"_"+m),_.setAttribute("class","fm_condition_div");var o=document.createElement("select");o.setAttribute("id","field_labels"+n+"_"+m),o.setAttribute("onchange","change_choices(options[selectedIndex].id+'_"+m+"')"),o.setAttribute("class","fm_condition_field_labels");var s=0,u=[];jQuery.each(e,function(e,t){if(t=replaceQuote(t),r!=l[e]){u.push(d[Object.keys(d)[e]]),0==s&&(a=e);var i=document.createElement("option");i.setAttribute("id",n+"_"+e),i.setAttribute("value",l[e]),i.innerHTML=t,o.appendChild(i),s++}}),_.appendChild(o),_.appendChild(document.createTextNode(" "));var c=document.createElement("select");c.setAttribute("id","is_select"+n+"_"+m),c.setAttribute("class","fm_condition_is_select");var p=is_select_options_HTML_array(u[0]);switch(jQuery.each(p,function(e,t){c.appendChild(t)}),_.appendChild(c),_.appendChild(document.createTextNode(" ")),t[a]=replaceQuote(t[a]),d[a]){case"type_text":case"type_star_rating":case"type_password":case"type_textarea":case"type_name":case"type_submitter_mail":case"type_phone":case"type_number":case"type_paypal_price":case"type_paypal_price_new":case"type_spinner":case"type_date_new":case"type_phone_new":case"type_time":case"type_editor":case"type_send_copy":case"type_range":case"type_file_upload":case"type_slider":if("type_number"==d[a]||"type_phone"==d[a])var f="return check_isnum_space(event)";else if("type_paypal_price"==d[a]||"type_paypal_price_new"==d[a])f="return check_isnum_point(event)";else f="";var h=document.createElement("input");h.setAttribute("id","field_value"+n+"_"+m),h.setAttribute("type","text"),h.setAttribute("value",""),h.setAttribute("class","fm_condition_field_input_value");var y=supported_is_select_conditions_of_type(d[a]);if(!1===y[0]&&!1===y[1]&&h.setAttribute("style","display: none"),"type_range"==d[a]&&h.setAttribute("style","display: inline-block"),h.setAttribute("onKeyPress",f),_.appendChild(h),"type_time"==d[a]){var b=document.createElement("label");b.innerText="Please use HH:MM format for 24-hour time (e.g. 22:15), and HH:MM:AM or HH:MM:PM for 12-hour time (e.g. 05:20:AM / 07:30:PM).",b.style.margin="0 3px",_.appendChild(b)}break;case"type_checkbox":case"type_radio":case"type_own_select":for("type_own_select"==d[a]?w_size=t[a].split("*:*w_size*:*"):w_size=t[a].split("*:*w_flow*:*"),w_choices=w_size[1].split("*:*w_choices*:*"),w_choices_array=w_choices[0].split("***"),-1!==w_size[1].indexOf("*:*w_use_for_submission*:*")?(w_value_disabled=w_size[1].split("*:*w_use_for_submission*:*"),w_choices_value=w_value_disabled[1].split("*:*w_choices_value*:*"),w_choices_value_array=w_choices_value[0].split("***")):-1!==w_size[1].indexOf("*:*w_value_disabled*:*")?(w_value_disabled=w_size[1].split("*:*w_value_disabled*:*"),w_choices_value=w_value_disabled[1].split("*:*w_choices_value*:*"),w_choices_value_array=w_choices_value[0].split("***")):w_choices_value_array=w_choices_array,(g=document.createElement("select")).setAttribute("class","fm_condition_field_select_value"),g.setAttribute("id","field_value"+n+"_"+m),g.style.cssText="vertical-align: top; width:200px;","type_checkbox"==d[a]&&(g.setAttribute("multiple","multiple"),g.setAttribute("class","multiple_select")),k=0;k<w_choices_array.length;k++){(v=document.createElement("option")).setAttribute("id","choise_"+n+"_"+k),v.setAttribute("value",w_choices_value_array[k]),v.innerHTML=w_choices_array[k],-1===w_choices_array[k].indexOf("[")&&-1===w_choices_array[k].indexOf("]")&&g.appendChild(v)}_.appendChild(g);break;case"type_paypal_select":case"type_paypal_checkbox":case"type_paypal_radio":case"type_paypal_shipping":for("type_paypal_select"==d[a]?w_size=t[a].split("*:*w_size*:*"):w_size=t[a].split("*:*w_flow*:*"),w_choices=w_size[1].split("*:*w_choices*:*"),w_choices_array=w_choices[0].split("***"),w_choices_price=w_choices[1].split("*:*w_choices_price*:*"),w_choices_price_array=w_choices_price[0].split("***"),(g=document.createElement("select")).setAttribute("id","field_value"+n+"_"+m),g.style.cssText="vertical-align: top; width:200px;","type_paypal_checkbox"==d[a]&&(g.setAttribute("multiple","multiple"),g.setAttribute("class","multiple_select")),k=0;k<w_choices_array.length;k++){var v;(v=document.createElement("option")).setAttribute("id","choise_"+n+"_"+k),v.setAttribute("value",w_choices_array[k]+"*:*value*:*"+w_choices_price_array[k]),v.innerHTML=w_choices_array[k],-1===w_choices_array[k].indexOf("[")&&-1===w_choices_array[k].indexOf("]")&&g.appendChild(v)}_.appendChild(g);break;case"type_country":case"type_address":var g;countries=form_maker.countries,(g=document.createElement("select")).setAttribute("id","field_value"+n+"_"+m),g.setAttribute("class","fm_condition_field_select_value"),jQuery.each(countries,function(e,t){var i=document.createElement("option");i.setAttribute("id","choise_"+n+"_"+e),i.setAttribute("value",t),i.innerHTML=t,g.appendChild(i)}),_.appendChild(g)}_.appendChild(document.createTextNode(" "));var w=document.createElement("span");w.setAttribute("class","dashicons dashicons-trash"),w.setAttribute("id","delete_condition"+n+"_"+m),w.setAttribute("onClick",'delete_field_condition("'+n+"_"+m+'")'),w.style.cssText="vertical-align: middle",_.appendChild(w),document.getElementById("condition"+n).appendChild(_),jQuery(".fm_condition_is_select").change(function(){show_hide_condition_input_field(this)})}function change_choices(e){e=e.split("_"),global_index=e[0],id=e[1],index=e[2];var t=jQuery("#fm-condition-fields-"+global_index).data("conditions-field-ids"),i=jQuery("#fm-condition-fields-"+global_index).data("conditions-field-types"),n=jQuery("#fm-condition-fields-"+global_index).data("conditions-field-params");ids_array=t,types_array=i,params_array=n,jQuery("#is_select"+global_index+"_"+index).empty();var a=is_select_options_HTML_array(types_array[id]);switch(jQuery("#is_select"+global_index+"_"+index).html(a),show_hide_condition_input_field(jQuery("#is_select"+global_index+"_"+index)),types_array[id]){case"type_text":case"type_password":case"type_textarea":case"type_name":case"type_submitter_mail":case"type_number":case"type_phone":case"type_paypal_price":case"type_paypal_price_new":case"type_slider":case"type_spinner":case"type_range":case"type_date_new":case"type_phone_new":case"type_time":case"type_range":case"type_slider":case"type_editor":if("type_number"==types_array[id]||"type_phone"==types_array[id])var r="return check_isnum_space(event)";else if("type_paypal_price"==types_array[id]||"type_paypal_price_new"==types_array[id])r="return check_isnum_point(event)";else r="";if("SELECT"==document.getElementById("field_value"+global_index+"_"+index).tagName){document.getElementById("condition_div"+global_index+"_"+index).removeChild(document.getElementById("field_value"+global_index+"_"+index));var l=document.createElement("input");l.setAttribute("id","field_value"+global_index+"_"+index),l.setAttribute("type","text"),l.setAttribute("value",""),l.setAttribute("class","fm_condition_field_input_value"),l.setAttribute("onKeyPress",r),document.getElementById("condition_div"+global_index+"_"+index).insertBefore(l,document.getElementById("delete_condition"+global_index+"_"+index)),document.getElementById("condition_div"+global_index+"_"+index).insertBefore(document.createTextNode(" "),document.getElementById("delete_condition"+global_index+"_"+index))}else document.getElementById("field_value"+global_index+"_"+index).value="",document.getElementById("field_value"+global_index+"_"+index).setAttribute("onKeyPress",r);break;case"type_own_select":case"type_radio":case"type_checkbox":for("type_own_select"==types_array[id]?w_size=params_array[id].split("*:*w_size*:*"):w_size=params_array[id].split("*:*w_flow*:*"),w_choices=w_size[1].split("*:*w_choices*:*"),w_choices_array=w_choices[0].split("***"),-1!==w_size[1].indexOf("*:*w_use_for_submission*:*")?(w_value_disabled=w_size[1].split("*:*w_use_for_submission*:*"),w_choices_value=w_value_disabled[1].split("*:*w_choices_value*:*"),w_choices_value_array=w_choices_value[0].split("***")):-1!==w_size[1].indexOf("*:*w_value_disabled*:*")?(w_value_disabled=w_size[1].split("*:*w_value_disabled*:*"),w_choices_value=w_value_disabled[1].split("*:*w_choices_value*:*"),w_choices_value_array=w_choices_value[0].split("***")):w_choices_value_array=w_choices_array,(_=document.createElement("select")).setAttribute("id","field_value"+global_index+"_"+index),_.setAttribute("class","fm_condition_field_select_value"),"type_checkbox"==types_array[id]&&(_.setAttribute("multiple","multiple"),_.setAttribute("class","multiple_select")),k=0;k<w_choices_array.length;k++){(d=document.createElement("option")).setAttribute("id","choise_"+global_index+"_"+k),d.setAttribute("value",w_choices_value_array[k]),d.innerHTML=replaceQuote(w_choices_array[k]),-1===w_choices_array[k].indexOf("[")&&-1===w_choices_array[k].indexOf("]")&&_.appendChild(d)}document.getElementById("condition_div"+global_index+"_"+index).removeChild(document.getElementById("field_value"+global_index+"_"+index)),document.getElementById("condition_div"+global_index+"_"+index).insertBefore(_,document.getElementById("delete_condition"+global_index+"_"+index)),document.getElementById("condition_div"+global_index+"_"+index).insertBefore(document.createTextNode(" "),document.getElementById("delete_condition"+global_index+"_"+index));break;case"type_paypal_select":case"type_paypal_radio":case"type_paypal_checkbox":case"type_paypal_shipping":for("type_paypal_select"==types_array[id]?w_size=params_array[id].split("*:*w_size*:*"):w_size=params_array[id].split("*:*w_flow*:*"),w_choices=w_size[1].split("*:*w_choices*:*"),w_choices_array=w_choices[0].split("***"),w_choices_price=w_choices[1].split("*:*w_choices_price*:*"),w_choices_price_array=w_choices_price[0].split("***"),(_=document.createElement("select")).setAttribute("id","field_value"+global_index+"_"+index),_.setAttribute("class","fm_condition_field_select_value"),"type_paypal_checkbox"==types_array[id]&&(_.setAttribute("multiple","multiple"),_.setAttribute("class","multiple_select")),k=0;k<w_choices_array.length;k++){var d;(d=document.createElement("option")).setAttribute("id","choise_"+global_index+"_"+k),d.setAttribute("value",w_choices_array[k]+"*:*value*:*"+w_choices_price_array[k]),d.innerHTML=w_choices_array[k],-1===w_choices_array[k].indexOf("[")&&-1===w_choices_array[k].indexOf("]")&&_.appendChild(d)}document.getElementById("condition_div"+global_index+"_"+index).removeChild(document.getElementById("field_value"+global_index+"_"+index)),document.getElementById("condition_div"+global_index+"_"+index).insertBefore(_,document.getElementById("delete_condition"+global_index+"_"+index)),document.getElementById("condition_div"+global_index+"_"+index).insertBefore(document.createTextNode(" "),document.getElementById("delete_condition"+global_index+"_"+index));break;case"type_country":case"type_address":var _,o=form_maker.countries;(_=document.createElement("select")).setAttribute("id","field_value"+global_index+"_"+index),_.setAttribute("class","fm_condition_field_select_value"),jQuery.each(o,function(e,t){var i=document.createElement("option");_.setAttribute("id","field_value"+global_index+"_"+index),i.setAttribute("value",t),i.innerHTML=t,_.appendChild(i)}),document.getElementById("condition_div"+global_index+"_"+index).removeChild(document.getElementById("field_value"+global_index+"_"+index)),document.getElementById("condition_div"+global_index+"_"+index).insertBefore(_,document.getElementById("delete_condition"+global_index+"_"+index)),document.getElementById("condition_div"+global_index+"_"+index).insertBefore(document.createTextNode(" "),document.getElementById("delete_condition"+global_index+"_"+index))}}function acces_level(e){var t="";for(i=0;i<=parseInt(e);i++)document.getElementById("user_"+i).checked&&(t=t+document.getElementById("user_"+i).value+",");document.getElementById("user_id_wd").value=t}function check_isnum_space(e){var t=e.which||e.keyCode;return 32==t||!(31<t&&(t<48||57<t))}function check_isnum_point(e){var t=e.which||e.keyCode;return 46==t||!(31<t&&(t<48||57<t))}function check_stripe_required_fields(){if(jQuery("#paypal_mode2").prop("checked"))for("1"==jQuery("#stripemode").val()?(fields=["live_sec","live_pub"],fields_titles=["Live secret key","Live publishable key"]):(fields=["test_sec","test_pub"],fields_titles=["Test secret key","Test publishable key"]),i=0;i<fields.length;i++)if(!jQuery("#"+fields[i]).val())return jQuery("#"+fields[i]).focus(),alert(fields_titles[i]+" is required."),!0;return!1}function check_calculator_required_fields(){var i=0;return jQuery(jQuery("#wd_calculated_field_table").find('[id^="wdc_equation_"]')).each(function(){if(""==jQuery(this).val()){var e=jQuery(this).attr("id").replace("wdc_equation_",""),t=jQuery(jQuery("#wd_calculated_field_table").find("[data-field='"+e+"']")).html();i=1,jQuery(this).focus(),alert("Set equation for the field "+t)}if(1==i)return!1}),1==i}function set_theme(){theme_id="0"==jQuery("#theme").val()?default_theme:jQuery("#theme").val(),jQuery("#edit_css").attr("onclick","window.open('"+theme_edit_url+"&current_id="+theme_id+"'); return false;"),1==jQuery("#theme option:selected").attr("data-version")?jQuery("#old_theme_notice").show():jQuery("#old_theme_notice").hide()}function change_stripe_status(i){var e=jQuery(i),t=jQuery("#form_id").val();e.next(".fm-capture-loading").removeClass("fm-hidden"),e.next(".fm-error").remove(),e.prop("disabled",!0);var n=e.parents("tr").attr("id");n=n.replace("tr_",""),jQuery.ajax({type:"POST",url:ajaxurl,data:{form_id:t,group_id:n,action:"fm_stripe_status_update",nonce:fm_ajax.ajaxnonce},success:function(e){if(void 0!==(e=JSON.parse(e)).code&&200===e.code&&"OK"===e.message)jQuery(i).parents("td").empty().text(form_maker_stripe_statuses.succeeded);else if(void 0!==e.code&&200===e.code&&"Already exist"===e.message){var t=jQuery(i).parents("td");t.empty().text("Already succeeded"),setTimeout(function(){t.text(form_maker_stripe_statuses.succeeded)},1500)}else jQuery(i).parents("td").append('<span class="fm-error">'+form_maker_stripe_statuses.failed+"</span>")},complete:function(){jQuery(i).next(".fm-capture-loading").addClass("fm-hidden"),jQuery(i).prop("disabled",!1)},error:function(e,t){jQuery(i).parents("td").append('<span class="fm-error">'+form_maker_stripe_statuses.failed+"</span>")}})}jQuery(function(){fm_admin_ready()}),jQuery(document).on("fm_tab_loaded, fm_tab_email_loaded",function(){fm_admin_ready()}),jQuery(window).on("load",function(){jQuery("#fm_loading").hide(),jQuery("#fm_admin_container").show(),"function"==typeof add_scroll_width&&add_scroll_width(),set_no_items(),jQuery("#fm_ask_question").parent().attr("target","_blank")}),document.onkeypress=stopRKey,jQuery(function(){jQuery(".pp_display_on #pt0").click(function(){var e=jQuery(this).prop("checked");jQuery('.pp_display_on input[type="checkbox"]').prop("checked",e),e?jQuery(".fm-posts-show, .fm-pages-show, .fm-cat-show").removeClass("fm-hide").addClass("fm-show"):jQuery(".fm-posts-show, .fm-pages-show, .fm-cat-show").removeClass("fm-show").addClass("fm-hide")}),jQuery('.pp_display_on input[type="checkbox"]:not("#pt0")').click(function(){var e=jQuery(this).prop("checked");jQuery(".pp_display_on #pt0").prop("checked")&&!e&&jQuery(".pp_display_on #pt0").prop("checked",!1)}),jQuery(".pp_display_on #pt4").click(function(){fm_toggle_pages(this)}),jQuery(".pp_display_on #pt3").click(function(){fm_toggle_posts(this)}),jQuery("body").on("focusin",".pp_search_posts",function(){var e=jQuery(this);e.closest("ul").find(".pp_live_search").removeClass("fm-hide"),e.hasClass("already_triggered")||(e.addClass("already_triggered"),pp_live_search(e,500,!0))}),jQuery(document).click(function(){jQuery(".pp_live_search").addClass("fm-hide")}),jQuery("body").on("click",".fm-pp",function(){return!1}),jQuery("body").on("input",".pp_search_posts",function(){pp_live_search(jQuery(this),500,!0)}),jQuery("body").on("click",".pp_search_results li",function(){var e=jQuery(this);if(!e.hasClass("pp_no_res")){var t=e.text(),i=e.data("post_id"),n=e.closest(".fm-pp"),a=n.find(".pp_selected"),r=n.find(".pp_exclude"),l='<span data-post_id="'+i+'">'+t+'<span class="pp_selected_remove">x</span></span>';-1===a.html().indexOf('data-post_id="'+i+'"')&&(a.append(l),""===r.val()?r.val(i):r.val(function(e,t){return t+","+i}))}return!1}),jQuery("body").on("click",".pp_selected span.pp_selected_remove",function(){var e=jQuery(this).parent(),t=e.closest(".fm-pp").find(".pp_exclude"),i=t.val(),n=e.data("post_id");if(-1!==i.indexOf(n)){var a,r=-1!==i.indexOf(","+n)?","+n:n+",";r=-1!==i.indexOf(",")?r:n;a=i.replace(r,""),t.val(a)}return e.remove(),!1}),jQuery("body").on("click",'.pp_display_on_categories input[name="display_on_categories[]"]',function(){var e=jQuery('.pp_display_on_categories input[name="display_on_categories[]"]'),t=jQuery(".fm-display-all-categories");if("select_all_categories"==jQuery(this).val())jQuery(this).is(":checked")?e.prop("checked",!0):e.prop("checked",!1);else{var i=jQuery('input[name="display_on_categories[]"]:checked').length,n=parseInt(t.attr("data-categories-count"));jQuery(this).prop("checked")||(i-=1),t.prop("checked",!1),i==n&&t.prop("checked",!0)}})}),function(d){d.fn.serializeObject=function(){var a=this,r={},t={},l={validate:/^[a-zA-Z][a-zA-Z0-9_]*(?:\[(?:\d*|[a-zA-Z0-9_]+)\])*$/,key:/[a-zA-Z0-9_]+|(?=\[\])/g,push:/^$/,fixed:/^\d+$/,named:/^[a-zA-Z0-9_]+$/};return this.build=function(e,t,i){return e[t]=i,e},this.push_counter=function(e){return void 0===t[e]&&(t[e]=0),t[e]++},d.each(d(this).serializeArray(),function(){if(l.validate.test(this.name)){for(var e,t=this.name.match(l.key),i=this.value,n=this.name;void 0!==(e=t.pop());)n=n.replace(new RegExp("\\["+e+"\\]$"),""),e.match(l.push)?i=a.build([],a.push_counter(n),i):e.match(l.fixed)?i=a.build([],e,i):e.match(l.named)&&(i=a.build({},e,i));r=d.extend(!0,r,i)}}),r}}(jQuery),jQuery(document).on("dblclick",".wdform_row, .wdform_tr_section_break",function(){edit(jQuery(this).attr("wdid"))}),function(t){function i(e,t){if(!(1<e.originalEvent.touches.length)){e.preventDefault();var i=e.originalEvent.changedTouches[0],n=document.createEvent("MouseEvents");n.initMouseEvent(t,!0,!0,window,1,i.screenX,i.screenY,i.clientX,i.clientY,!1,!1,!1,!1,0,null),e.target.dispatchEvent(n)}}if(t.support.touch="ontouchend"in document,t.support.touch){var n,e=t.ui.mouse.prototype,a=e._mouseInit,r=e._mouseDestroy;e._touchStart=function(e){!n&&this._mouseCapture(e.originalEvent.changedTouches[0])&&(n=!0,this._touchMoved=!1,i(e,"mouseover"),i(e,"mousemove"),i(e,"mousedown"))},e._touchMove=function(e){n&&(this._touchMoved=!0,i(e,"mousemove"))},e._touchEnd=function(e){n&&(i(e,"mouseup"),i(e,"mouseout"),this._touchMoved||i(e,"click"),n=!1)},e._mouseInit=function(){var e=this;e.element.bind({touchstart:t.proxy(e,"_touchStart"),touchmove:t.proxy(e,"_touchMove"),touchend:t.proxy(e,"_touchEnd")}),a.call(e)},e._mouseDestroy=function(){var e=this;e.element.unbind({touchstart:t.proxy(e,"_touchStart"),touchmove:t.proxy(e,"_touchMove"),touchend:t.proxy(e,"_touchEnd")}),r.call(e)}}}(jQuery);var gmapdata=new Array,gmapmarker=new Array;function if_gmap_init(e){map=document.getElementById(e+"_elementform_id_temp");var t=parseInt(map.getAttribute("zoom")),i=map.getAttribute("center_x"),n=map.getAttribute("center_y"),a=new google.maps.LatLng(n,i);return gmapdata[e]=new google.maps.Map(document.getElementById(e+"_elementform_id_temp"),{center:a,zoom:t,mapTypeId:"roadmap"}),google.maps.event.addListener(gmapdata[e],"zoom_changed",function(){document.getElementById(e+"_elementform_id_temp").setAttribute("zoom",gmapdata[e].getZoom())}),gmapmarker[e]=new Array,!1}function update_position(e,i){var t=document.getElementById("longval"+i).value,n=document.getElementById("latval"+i).value;0<t.length?1==isNaN(parseFloat(t))&&(t=2.294254):t=2.294254,0<n.length?1==isNaN(parseFloat(n))&&(n=48.858334):n=48.858334;var a=new google.maps.LatLng(n,t);gmapmarker[e][i].setPosition(a),gmapdata[e].setCenter(a),cur_zoom=gmapdata[e].getZoom(),gmapdata[e].setZoom(cur_zoom),geocoder=new google.maps.Geocoder,geocoder.geocode({latLng:gmapmarker[e][i].getPosition()},function(e,t){t==google.maps.GeocoderStatus.OK&&e[0]&&document.getElementById("addrval"+i)&&(document.getElementById("addrval"+i).value=e[0].formatted_address)});var r=document.getElementById(e+"_elementform_id_temp");return r.setAttribute("long"+i,t),r.setAttribute("lat"+i,n),!1}function remove_marker(e,t){gmapmarker[e][t].setMap(null)}function add_marker_on_map(t,i,e,n,a,r){if(map=document.getElementById(t+"_elementform_id_temp"),null==e){var l=gmapdata[t].getCenter();n=gmapdata[t].getCenter().lat(),e=gmapdata[t].getCenter().lng()}else l=new google.maps.LatLng(n,e);return geocoder=new google.maps.Geocoder,gmapmarker[t][i]=new google.maps.Marker({map:gmapdata[t],position:l,draggable:r}),gmapmarker[t][i].setDraggable(r),infoW=new google.maps.InfoWindow,google.maps.event.addListener(gmapdata[t],"mouseover",function(e){document.getElementById("longval"+i)||gmapmarker[t][i].setDraggable(!1)}),google.maps.event.addListener(gmapmarker[t][i],"drag",function(){document.getElementById("longval"+i)&&(geocoder.geocode({latLng:gmapmarker[t][i].getPosition()},function(e,t){t==google.maps.GeocoderStatus.OK&&e[0]&&document.getElementById("addrval"+i)&&(document.getElementById("addrval"+i).value=e[0].formatted_address)}),map.setAttribute("long"+i,gmapmarker[t][i].getPosition().lng().toFixed(6)),map.setAttribute("lat"+i,gmapmarker[t][i].getPosition().lat().toFixed(6)),document.getElementById("latval"+i).value=gmapmarker[t][i].getPosition().lat().toFixed(6),document.getElementById("longval"+i).value=gmapmarker[t][i].getPosition().lng().toFixed(6))}),google.maps.event.addListener(gmapmarker[t][i],"click",function(){infoW.setContent('<div style="overflow: hidden;">'+document.getElementById(t+"_elementform_id_temp").getAttribute("info"+i)+"</div>");infoW.setOptions({maxWidth:"300"}),infoW.open(this.getMap(),this)}),document.getElementById("longval"+i)&&(document.getElementById("longval"+i).value=e,document.getElementById("latval"+i).value=n,geocoder.geocode({latLng:gmapmarker[t][i].getPosition()},function(e,t){t==google.maps.GeocoderStatus.OK&&e[0]&&document.getElementById("addrval"+i)&&(document.getElementById("addrval"+i).value=e[0].formatted_address)}),map.setAttribute("long"+i,e),map.setAttribute("lat"+i,n)),!1}function changeAddress(i,n){var e=document.getElementById("addrval"+n).value;geocoder.geocode({address:e},function(e,t){t==google.maps.GeocoderStatus.OK&&(gmapdata[i].setCenter(e[0].geometry.location),gmapmarker[i][n].setPosition(e[0].geometry.location),document.getElementById("latval"+n).value=gmapmarker[i][n].getPosition().lat().toFixed(6),document.getElementById("longval"+n).value=gmapmarker[i][n].getPosition().lng().toFixed(6),map.setAttribute("long"+n,gmapmarker[i][n].getPosition().lng().toFixed(6)),map.setAttribute("lat"+n,gmapmarker[i][n].getPosition().lat().toFixed(6)))})}function change_info(e,t,i){map=document.getElementById(t+"_elementform_id_temp"),map.setAttribute("info"+i,e)}function if_gmap_updateMap(e){map=document.getElementById(e+"_elementform_id_temp"),w_long=gmapdata[e].getCenter().lng(),w_lat=gmapdata[e].getCenter().lat(),map.setAttribute("center_x",w_long),map.setAttribute("center_y",w_lat)}!function(e){"object"==typeof module&&module.exports?module.exports=e():window.intlTelInput=e()}(function(u){"use strict";return function(){function n(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}for(var r=[["Afghanistan (‫افغانستان‬‎)","af","93"],["Albania (Shqipëri)","al","355"],["Algeria (‫الجزائر‬‎)","dz","213"],["American Samoa","as","1",5,["684"]],["Andorra","ad","376"],["Angola","ao","244"],["Anguilla","ai","1",6,["264"]],["Antigua and Barbuda","ag","1",7,["268"]],["Argentina","ar","54"],["Armenia (Հայաստան)","am","374"],["Aruba","aw","297"],["Ascension Island","ac","247"],["Australia","au","61",0],["Austria (Österreich)","at","43"],["Azerbaijan (Azərbaycan)","az","994"],["Bahamas","bs","1",8,["242"]],["Bahrain (‫البحرين‬‎)","bh","973"],["Bangladesh (বাংলাদেশ)","bd","880"],["Barbados","bb","1",9,["246"]],["Belarus (Беларусь)","by","375"],["Belgium (België)","be","32"],["Belize","bz","501"],["Benin (Bénin)","bj","229"],["Bermuda","bm","1",10,["441"]],["Bhutan (འབྲུག)","bt","975"],["Bolivia","bo","591"],["Bosnia and Herzegovina (Босна и Херцеговина)","ba","387"],["Botswana","bw","267"],["Brazil (Brasil)","br","55"],["British Indian Ocean Territory","io","246"],["British Virgin Islands","vg","1",11,["284"]],["Brunei","bn","673"],["Bulgaria (България)","bg","359"],["Burkina Faso","bf","226"],["Burundi (Uburundi)","bi","257"],["Cambodia (កម្ពុជា)","kh","855"],["Cameroon (Cameroun)","cm","237"],["Canada","ca","1",1,["204","226","236","249","250","289","306","343","365","387","403","416","418","431","437","438","450","506","514","519","548","579","581","587","604","613","639","647","672","705","709","742","778","780","782","807","819","825","867","873","902","905"]],["Cape Verde (Kabu Verdi)","cv","238"],["Caribbean Netherlands","bq","599",1,["3","4","7"]],["Cayman Islands","ky","1",12,["345"]],["Central African Republic (République centrafricaine)","cf","236"],["Chad (Tchad)","td","235"],["Chile","cl","56"],["China (中国)","cn","86"],["Christmas Island","cx","61",2,["89164"]],["Cocos (Keeling) Islands","cc","61",1,["89162"]],["Colombia","co","57"],["Comoros (‫جزر القمر‬‎)","km","269"],["Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)","cd","243"],["Congo (Republic) (Congo-Brazzaville)","cg","242"],["Cook Islands","ck","682"],["Costa Rica","cr","506"],["Côte d’Ivoire","ci","225"],["Croatia (Hrvatska)","hr","385"],["Cuba","cu","53"],["Curaçao","cw","599",0],["Cyprus (Κύπρος)","cy","357"],["Czech Republic (Česká republika)","cz","420"],["Denmark (Danmark)","dk","45"],["Djibouti","dj","253"],["Dominica","dm","1",13,["767"]],["Dominican Republic (República Dominicana)","do","1",2,["809","829","849"]],["Ecuador","ec","593"],["Egypt (‫مصر‬‎)","eg","20"],["El Salvador","sv","503"],["Equatorial Guinea (Guinea Ecuatorial)","gq","240"],["Eritrea","er","291"],["Estonia (Eesti)","ee","372"],["Eswatini","sz","268"],["Ethiopia","et","251"],["Falkland Islands (Islas Malvinas)","fk","500"],["Faroe Islands (Føroyar)","fo","298"],["Fiji","fj","679"],["Finland (Suomi)","fi","358",0],["France","fr","33"],["French Guiana (Guyane française)","gf","594"],["French Polynesia (Polynésie française)","pf","689"],["Gabon","ga","241"],["Gambia","gm","220"],["Georgia (საქართველო)","ge","995"],["Germany (Deutschland)","de","49"],["Ghana (Gaana)","gh","233"],["Gibraltar","gi","350"],["Greece (Ελλάδα)","gr","30"],["Greenland (Kalaallit Nunaat)","gl","299"],["Grenada","gd","1",14,["473"]],["Guadeloupe","gp","590",0],["Guam","gu","1",15,["671"]],["Guatemala","gt","502"],["Guernsey","gg","44",1,["1481","7781","7839","7911"]],["Guinea (Guinée)","gn","224"],["Guinea-Bissau (Guiné Bissau)","gw","245"],["Guyana","gy","592"],["Haiti","ht","509"],["Honduras","hn","504"],["Hong Kong (香港)","hk","852"],["Hungary (Magyarország)","hu","36"],["Iceland (Ísland)","is","354"],["India (भारत)","in","91"],["Indonesia","id","62"],["Iran (‫ایران‬‎)","ir","98"],["Iraq (‫العراق‬‎)","iq","964"],["Ireland","ie","353"],["Isle of Man","im","44",2,["1624","74576","7524","7924","7624"]],["Israel (‫ישראל‬‎)","il","972"],["Italy (Italia)","it","39",0],["Jamaica","jm","1",4,["876","658"]],["Japan (日本)","jp","81"],["Jersey","je","44",3,["1534","7509","7700","7797","7829","7937"]],["Jordan (‫الأردن‬‎)","jo","962"],["Kazakhstan (Казахстан)","kz","7",1,["33","7"]],["Kenya","ke","254"],["Kiribati","ki","686"],["Kosovo","xk","383"],["Kuwait (‫الكويت‬‎)","kw","965"],["Kyrgyzstan (Кыргызстан)","kg","996"],["Laos (ລາວ)","la","856"],["Latvia (Latvija)","lv","371"],["Lebanon (‫لبنان‬‎)","lb","961"],["Lesotho","ls","266"],["Liberia","lr","231"],["Libya (‫ليبيا‬‎)","ly","218"],["Liechtenstein","li","423"],["Lithuania (Lietuva)","lt","370"],["Luxembourg","lu","352"],["Macau (澳門)","mo","853"],["Macedonia (FYROM) (Македонија)","mk","389"],["Madagascar (Madagasikara)","mg","261"],["Malawi","mw","265"],["Malaysia","my","60"],["Maldives","mv","960"],["Mali","ml","223"],["Malta","mt","356"],["Marshall Islands","mh","692"],["Martinique","mq","596"],["Mauritania (‫موريتانيا‬‎)","mr","222"],["Mauritius (Moris)","mu","230"],["Mayotte","yt","262",1,["269","639"]],["Mexico (México)","mx","52"],["Micronesia","fm","691"],["Moldova (Republica Moldova)","md","373"],["Monaco","mc","377"],["Mongolia (Монгол)","mn","976"],["Montenegro (Crna Gora)","me","382"],["Montserrat","ms","1",16,["664"]],["Morocco (‫المغرب‬‎)","ma","212",0],["Mozambique (Moçambique)","mz","258"],["Myanmar (Burma) (မြန်မာ)","mm","95"],["Namibia (Namibië)","na","264"],["Nauru","nr","674"],["Nepal (नेपाल)","np","977"],["Netherlands (Nederland)","nl","31"],["New Caledonia (Nouvelle-Calédonie)","nc","687"],["New Zealand","nz","64"],["Nicaragua","ni","505"],["Niger (Nijar)","ne","227"],["Nigeria","ng","234"],["Niue","nu","683"],["Norfolk Island","nf","672"],["North Korea (조선 민주주의 인민 공화국)","kp","850"],["Northern Mariana Islands","mp","1",17,["670"]],["Norway (Norge)","no","47",0],["Oman (‫عُمان‬‎)","om","968"],["Pakistan (‫پاکستان‬‎)","pk","92"],["Palau","pw","680"],["Palestine (‫فلسطين‬‎)","ps","970"],["Panama (Panamá)","pa","507"],["Papua New Guinea","pg","675"],["Paraguay","py","595"],["Peru (Perú)","pe","51"],["Philippines","ph","63"],["Poland (Polska)","pl","48"],["Portugal","pt","351"],["Puerto Rico","pr","1",3,["787","939"]],["Qatar (‫قطر‬‎)","qa","974"],["Réunion (La Réunion)","re","262",0],["Romania (România)","ro","40"],["Russia (Россия)","ru","7",0],["Rwanda","rw","250"],["Saint Barthélemy","bl","590",1],["Saint Helena","sh","290"],["Saint Kitts and Nevis","kn","1",18,["869"]],["Saint Lucia","lc","1",19,["758"]],["Saint Martin (Saint-Martin (partie française))","mf","590",2],["Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)","pm","508"],["Saint Vincent and the Grenadines","vc","1",20,["784"]],["Samoa","ws","685"],["San Marino","sm","378"],["São Tomé and Príncipe (São Tomé e Príncipe)","st","239"],["Saudi Arabia (‫المملكة العربية السعودية‬‎)","sa","966"],["Senegal (Sénégal)","sn","221"],["Serbia (Србија)","rs","381"],["Seychelles","sc","248"],["Sierra Leone","sl","232"],["Singapore","sg","65"],["Sint Maarten","sx","1",21,["721"]],["Slovakia (Slovensko)","sk","421"],["Slovenia (Slovenija)","si","386"],["Solomon Islands","sb","677"],["Somalia (Soomaaliya)","so","252"],["South Africa","za","27"],["South Korea (대한민국)","kr","82"],["South Sudan (‫جنوب السودان‬‎)","ss","211"],["Spain (España)","es","34"],["Sri Lanka (ශ්‍රී ලංකාව)","lk","94"],["Sudan (‫السودان‬‎)","sd","249"],["Suriname","sr","597"],["Svalbard and Jan Mayen","sj","47",1,["79"]],["Sweden (Sverige)","se","46"],["Switzerland (Schweiz)","ch","41"],["Syria (‫سوريا‬‎)","sy","963"],["Taiwan (台灣)","tw","886"],["Tajikistan","tj","992"],["Tanzania","tz","255"],["Thailand (ไทย)","th","66"],["Timor-Leste","tl","670"],["Togo","tg","228"],["Tokelau","tk","690"],["Tonga","to","676"],["Trinidad and Tobago","tt","1",22,["868"]],["Tunisia (‫تونس‬‎)","tn","216"],["Turkey (Türkiye)","tr","90"],["Turkmenistan","tm","993"],["Turks and Caicos Islands","tc","1",23,["649"]],["Tuvalu","tv","688"],["U.S. Virgin Islands","vi","1",24,["340"]],["Uganda","ug","256"],["Ukraine (Україна)","ua","380"],["United Arab Emirates (‫الإمارات العربية المتحدة‬‎)","ae","971"],["United Kingdom","gb","44",0],["United States","us","1",0],["Uruguay","uy","598"],["Uzbekistan (Oʻzbekiston)","uz","998"],["Vanuatu","vu","678"],["Vatican City (Città del Vaticano)","va","39",1,["06698"]],["Venezuela","ve","58"],["Vietnam (Việt Nam)","vn","84"],["Wallis and Futuna (Wallis-et-Futuna)","wf","681"],["Western Sahara (‫الصحراء الغربية‬‎)","eh","212",1,["5288","5289"]],["Yemen (‫اليمن‬‎)","ye","967"],["Zambia","zm","260"],["Zimbabwe","zw","263"],["Åland Islands","ax","358",1,["18"]]],e=0;e<r.length;e++){var t=r[e];r[e]={name:t[0],iso2:t[1],dialCode:t[2],priority:t[3]||0,areaCodes:t[4]||null}}var i={getInstance:function(e){var t=e.getAttribute("data-intl-tel-input-id");return window.intlTelInputGlobals.instances[t]},instances:{},documentReady:function(){return"complete"===document.readyState}};"object"==typeof window&&(window.intlTelInputGlobals=i);var l=0,d={allowDropdown:!0,autoHideDialCode:!0,autoPlaceholder:"polite",customContainer:"",customPlaceholder:null,dropdownContainer:null,excludeCountries:[],formatOnDisplay:!0,geoIpLookup:null,hiddenInput:"",initialCountry:"",localizedCountries:null,nationalMode:!0,onlyCountries:[],placeholderNumberType:"MOBILE",preferredCountries:["us","gb"],separateDialCode:!1,utilsScript:""},_=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],o=function(e,t){for(var i=Object.keys(e),n=0;n<i.length;n++)t(i[n],e[i[n]])},s=function(t){o(window.intlTelInputGlobals.instances,function(e){window.intlTelInputGlobals.instances[e][t]()})},a=function(){function a(e,t){var i=this;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,a),this.id=l++,this.a=e,this.b=null,this.c=null;var n=t||{};this.d={},o(d,function(e,t){i.d[e]=n.hasOwnProperty(e)?n[e]:t}),this.e=Boolean(e.getAttribute("placeholder"))}return e=a,(t=[{key:"_init",value:function(){var i=this;if(this.d.nationalMode&&(this.d.autoHideDialCode=!1),this.d.separateDialCode&&(this.d.autoHideDialCode=this.d.nationalMode=!1),this.g=/Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),this.g&&(document.body.classList.add("iti-mobile"),this.d.dropdownContainer||(this.d.dropdownContainer=document.body)),"undefined"!=typeof Promise){var e=new Promise(function(e,t){i.h=e,i.i=t}),t=new Promise(function(e,t){i.i0=e,i.i1=t});this.promise=Promise.all([e,t])}else this.h=this.i=function(){},this.i0=this.i1=function(){};this.s={},this._b(),this._f(),this._h(),this._i(),this._i3()}},{key:"_b",value:function(){this._d(),this._d2(),this._e(),this.d.localizedCountries&&this._d0(),(this.d.onlyCountries.length||this.d.localizedCountries)&&this.p.sort(this._d1)}},{key:"_c",value:function(e,t,i){t.length>this.countryCodeMaxLen&&(this.countryCodeMaxLen=t.length),this.q.hasOwnProperty(t)||(this.q[t]=[]);for(var n=0;n<this.q[t].length;n++)if(this.q[t][n]===e)return;var a=i!==u?i:this.q[t].length;this.q[t][a]=e}},{key:"_d",value:function(){if(this.d.onlyCountries.length){var t=this.d.onlyCountries.map(function(e){return e.toLowerCase()});this.p=r.filter(function(e){return-1<t.indexOf(e.iso2)})}else if(this.d.excludeCountries.length){var i=this.d.excludeCountries.map(function(e){return e.toLowerCase()});this.p=r.filter(function(e){return-1===i.indexOf(e.iso2)})}else this.p=r}},{key:"_d0",value:function(){for(var e=0;e<this.p.length;e++){var t=this.p[e].iso2.toLowerCase();this.d.localizedCountries.hasOwnProperty(t)&&(this.p[e].name=this.d.localizedCountries[t])}}},{key:"_d1",value:function(e,t){return e.name.localeCompare(t.name)}},{key:"_d2",value:function(){this.countryCodeMaxLen=0,this.dialCodes={},this.q={};for(var e=0;e<this.p.length;e++){var t=this.p[e];this.dialCodes[t.dialCode]||(this.dialCodes[t.dialCode]=!0),this._c(t.iso2,t.dialCode,t.priority)}for(var i=0;i<this.p.length;i++){var n=this.p[i];if(n.areaCodes)for(var a=this.q[n.dialCode][0],r=0;r<n.areaCodes.length;r++){for(var l=n.areaCodes[r],d=1;d<l.length;d++){var _=n.dialCode+l.substr(0,d);this._c(a,_),this._c(n.iso2,_)}this._c(n.iso2,n.dialCode+l)}}}},{key:"_e",value:function(){this.preferredCountries=[];for(var e=0;e<this.d.preferredCountries.length;e++){var t=this.d.preferredCountries[e].toLowerCase(),i=this._y(t,!1,!0);i&&this.preferredCountries.push(i)}}},{key:"_e2",value:function(e,t,i){var n=document.createElement(e);return t&&o(t,function(e,t){return n.setAttribute(e,t)}),i&&i.appendChild(n),n}},{key:"_f",value:function(){this.a.hasAttribute("autocomplete")||this.a.form&&this.a.form.hasAttribute("autocomplete")||this.a.setAttribute("autocomplete","off");var e="iti";this.d.allowDropdown&&(e+=" iti--allow-dropdown"),this.d.separateDialCode&&(e+=" iti--separate-dial-code"),this.d.customContainer&&(e+=" ",e+=this.d.customContainer);var t=this._e2("div",{class:e});if(this.a.parentNode.insertBefore(t,this.a),this.k=this._e2("div",{class:"iti__flag-container"},t),t.appendChild(this.a),this.selectedFlag=this._e2("div",{class:"iti__selected-flag",role:"combobox","aria-controls":"iti-".concat(this.id,"__country-listbox"),"aria-owns":"iti-".concat(this.id,"__country-listbox"),"aria-expanded":"false"},this.k),this.l=this._e2("div",{class:"iti__flag"},this.selectedFlag),this.d.separateDialCode&&(this.t=this._e2("div",{class:"iti__selected-dial-code"},this.selectedFlag)),this.d.allowDropdown&&(this.selectedFlag.setAttribute("tabindex","0"),this.u=this._e2("div",{class:"iti__arrow"},this.selectedFlag),this.m=this._e2("ul",{class:"iti__country-list iti__hide",id:"iti-".concat(this.id,"__country-listbox"),role:"listbox","aria-label":"List of countries"}),this.preferredCountries.length&&(this._g(this.preferredCountries,"iti__preferred",!0),this._e2("li",{class:"iti__divider",role:"separator","aria-disabled":"true"},this.m)),this._g(this.p,"iti__standard"),this.d.dropdownContainer?(this.dropdown=this._e2("div",{class:"iti iti--container"}),this.dropdown.appendChild(this.m)):this.k.appendChild(this.m)),this.d.hiddenInput){var i=this.d.hiddenInput,n=this.a.getAttribute("name");if(n){var a=n.lastIndexOf("[");-1!==a&&(i="".concat(n.substr(0,a),"[").concat(i,"]"))}this.hiddenInput=this._e2("input",{type:"hidden",name:i}),t.appendChild(this.hiddenInput)}}},{key:"_g",value:function(e,t,i){for(var n="",a=0;a<e.length;a++){var r=e[a],l=i?"-preferred":"";n+="<li class='iti__country ".concat(t,"' tabIndex='-1' id='iti-").concat(this.id,"__item-").concat(r.iso2).concat(l,"' role='option' data-dial-code='").concat(r.dialCode,"' data-country-code='").concat(r.iso2,"' aria-selected='false'>"),n+="<div class='iti__flag-box'><div class='iti__flag iti__".concat(r.iso2,"'></div></div>"),n+="<span class='iti__country-name'>".concat(r.name,"</span>"),n+="<span class='iti__dial-code'>+".concat(r.dialCode,"</span>"),n+="</li>"}this.m.insertAdjacentHTML("beforeend",n)}},{key:"_h",value:function(){var e=this.a.getAttribute("value"),t=this.a.value,i=e&&"+"===e.charAt(0)&&(!t||"+"!==t.charAt(0))?e:t,n=this._5(i),a=this._w(i),r=this.d,l=r.initialCountry,d=r.nationalMode,_=r.autoHideDialCode,o=r.separateDialCode;n&&!a?this._v(i):"auto"!==l&&(l?this._z(l.toLowerCase()):n&&a?this._z("us"):(this.j=this.preferredCountries.length?this.preferredCountries[0].iso2:this.p[0].iso2,i||this._z(this.j)),i||d||_||o||(this.a.value="+".concat(this.s.dialCode))),i&&this._u(i)}},{key:"_i",value:function(){this._j(),this.d.autoHideDialCode&&this._l(),this.d.allowDropdown&&this._i2(),this.hiddenInput&&this._i0()}},{key:"_i0",value:function(){var e=this;this._a14=function(){e.hiddenInput.value=e.getNumber()},this.a.form&&this.a.form.addEventListener("submit",this._a14)}},{key:"_i1",value:function(){for(var e=this.a;e&&"LABEL"!==e.tagName;)e=e.parentNode;return e}},{key:"_i2",value:function(){var t=this;this._a9=function(e){t.m.classList.contains("iti__hide")?t.a.focus():e.preventDefault()};var e=this._i1();e&&e.addEventListener("click",this._a9),this._a10=function(){!t.m.classList.contains("iti__hide")||t.a.disabled||t.a.readOnly||t._n()},this.selectedFlag.addEventListener("click",this._a10),this._a11=function(e){t.m.classList.contains("iti__hide")&&-1!==["ArrowUp","Up","ArrowDown","Down"," ","Enter"].indexOf(e.key)&&(e.preventDefault(),e.stopPropagation(),t._n()),"Tab"===e.key&&t._2()},this.k.addEventListener("keydown",this._a11)}},{key:"_i3",value:function(){var e=this;this.d.utilsScript&&!window.intlTelInputUtils?window.intlTelInputGlobals.documentReady()?window.intlTelInputGlobals.loadUtils(this.d.utilsScript):window.addEventListener("load",function(){window.intlTelInputGlobals.loadUtils(e.d.utilsScript)}):this.i0(),"auto"===this.d.initialCountry?this._i4():this.h()}},{key:"_i4",value:function(){window.intlTelInputGlobals.autoCountry?this.handleAutoCountry():window.intlTelInputGlobals.startedLoadingAutoCountry||(window.intlTelInputGlobals.startedLoadingAutoCountry=!0,"function"==typeof this.d.geoIpLookup&&this.d.geoIpLookup(function(e){window.intlTelInputGlobals.autoCountry=e.toLowerCase(),setTimeout(function(){return s("handleAutoCountry")})},function(){return s("rejectAutoCountryPromise")}))}},{key:"_j",value:function(){var e=this;this._a12=function(){e._v(e.a.value)&&e._m2CountryChange()},this.a.addEventListener("keyup",this._a12),this._a13=function(){setTimeout(e._a12)},this.a.addEventListener("cut",this._a13),this.a.addEventListener("paste",this._a13)}},{key:"_j2",value:function(e){var t=this.a.getAttribute("maxlength");return t&&e.length>t?e.substr(0,t):e}},{key:"_l",value:function(){var e=this;this._a8=function(){e._l2()},this.a.form&&this.a.form.addEventListener("submit",this._a8),this.a.addEventListener("blur",this._a8)}},{key:"_l2",value:function(){if("+"===this.a.value.charAt(0)){var e=this._m(this.a.value);e&&this.s.dialCode!==e||(this.a.value="")}}},{key:"_m",value:function(e){return e.replace(/\D/g,"")}},{key:"_m2",value:function(e){var t=document.createEvent("Event");t.initEvent(e,!0,!0),this.a.dispatchEvent(t)}},{key:"_n",value:function(){this.m.classList.remove("iti__hide"),this.selectedFlag.setAttribute("aria-expanded","true"),this._o(),this.b&&(this._x(this.b,!1),this._3(this.b,!0)),this._p(),this.u.classList.add("iti__arrow--up"),this._m2("open:countrydropdown")}},{key:"_n2",value:function(e,t,i){i&&!e.classList.contains(t)?e.classList.add(t):!i&&e.classList.contains(t)&&e.classList.remove(t)}},{key:"_o",value:function(){var e=this;if(this.d.dropdownContainer&&this.d.dropdownContainer.appendChild(this.dropdown),!this.g){var t=this.a.getBoundingClientRect(),i=window.pageYOffset||document.documentElement.scrollTop,n=t.top+i,a=this.m.offsetHeight,r=n+this.a.offsetHeight+a<i+window.innerHeight,l=i<n-a;if(this._n2(this.m,"iti__country-list--dropup",!r&&l),this.d.dropdownContainer){var d=!r&&l?0:this.a.offsetHeight;this.dropdown.style.top="".concat(n+d,"px"),this.dropdown.style.left="".concat(t.left+document.body.scrollLeft,"px"),this._a4=function(){return e._2()},window.addEventListener("scroll",this._a4)}}}},{key:"_o2",value:function(e){for(var t=e;t&&t!==this.m&&!t.classList.contains("iti__country");)t=t.parentNode;return t===this.m?null:t}},{key:"_p",value:function(){var i=this;this._a0=function(e){var t=i._o2(e.target);t&&i._x(t,!1)},this.m.addEventListener("mouseover",this._a0),this._a1=function(e){var t=i._o2(e.target);t&&i._1(t)},this.m.addEventListener("click",this._a1);var e=!0;this._a2=function(){e||i._2(),e=!1},document.documentElement.addEventListener("click",this._a2);var t="",n=null;this._a3=function(e){e.preventDefault(),"ArrowUp"===e.key||"Up"===e.key||"ArrowDown"===e.key||"Down"===e.key?i._q(e.key):"Enter"===e.key?i._r():"Escape"===e.key?i._2():/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(e.key)&&(n&&clearTimeout(n),t+=e.key.toLowerCase(),i._s(t),n=setTimeout(function(){t=""},1e3))},document.addEventListener("keydown",this._a3)}},{key:"_q",value:function(e){var t="ArrowUp"===e||"Up"===e?this.c.previousElementSibling:this.c.nextElementSibling;t&&(t.classList.contains("iti__divider")&&(t="ArrowUp"===e||"Up"===e?t.previousElementSibling:t.nextElementSibling),this._x(t,!0))}},{key:"_r",value:function(){this.c&&this._1(this.c)}},{key:"_s",value:function(e){for(var t=0;t<this.p.length;t++)if(this._t(this.p[t].name,e)){var i=this.m.querySelector("#iti-".concat(this.id,"__item-").concat(this.p[t].iso2));this._x(i,!1),this._3(i,!0);break}}},{key:"_t",value:function(e,t){return e.substr(0,t.length).toLowerCase()===t}},{key:"_u",value:function(e){var t=e;if(this.d.formatOnDisplay&&window.intlTelInputUtils&&this.s){var i=!this.d.separateDialCode&&(this.d.nationalMode||"+"!==t.charAt(0)),n=intlTelInputUtils.numberFormat,a=n.NATIONAL,r=n.INTERNATIONAL,l=i?a:r;t=intlTelInputUtils.formatNumber(t,this.s.iso2,l)}t=this._7(t),this.a.value=t}},{key:"_v",value:function(e){var t=e,i=this.s.dialCode,n="1"===i;t&&this.d.nationalMode&&n&&"+"!==t.charAt(0)&&("1"!==t.charAt(0)&&(t="1".concat(t)),t="+".concat(t)),this.d.separateDialCode&&i&&"+"!==t.charAt(0)&&(t="+".concat(i).concat(t));var a=this._5(t,!0),r=this._m(t),l=null;if(a){var d=this.q[this._m(a)],_=-1!==d.indexOf(this.s.iso2)&&r.length<=a.length-1;if(!("1"===i&&this._w(r)||_))for(var o=0;o<d.length;o++)if(d[o]){l=d[o];break}}else"+"===t.charAt(0)&&r.length?l="":t&&"+"!==t||(l=this.j);return null!==l&&this._z(l)}},{key:"_w",value:function(e){var t=this._m(e);if("1"!==t.charAt(0))return!1;var i=t.substr(1,3);return-1!==_.indexOf(i)}},{key:"_x",value:function(e,t){var i=this.c;i&&i.classList.remove("iti__highlight"),this.c=e,this.c.classList.add("iti__highlight"),t&&this.c.focus()}},{key:"_y",value:function(e,t,i){for(var n=t?r:this.p,a=0;a<n.length;a++)if(n[a].iso2===e)return n[a];if(i)return null;throw new Error("No country data for '".concat(e,"'"))}},{key:"_z",value:function(e){var t=this.s.iso2?this.s:{};this.s=e?this._y(e,!1,!1):{},this.s.iso2&&(this.j=this.s.iso2),this.l.setAttribute("class","iti__flag iti__".concat(e));var i=e?"".concat(this.s.name,": +").concat(this.s.dialCode):"Unknown";if(this.selectedFlag.setAttribute("title",i),this.d.separateDialCode){var n=this.s.dialCode?"+".concat(this.s.dialCode):"";this.t.innerHTML=n;var a=this.selectedFlag.offsetWidth||this._z2();this.a.style.paddingLeft="".concat(a+6,"px")}if(this._0(),this.d.allowDropdown){var r=this.b;if(r&&(r.classList.remove("iti__active"),r.setAttribute("aria-selected","false")),e){var l=this.m.querySelector("#iti-".concat(this.id,"__item-").concat(e,"-preferred"))||this.m.querySelector("#iti-".concat(this.id,"__item-").concat(e));l.setAttribute("aria-selected","true"),l.classList.add("iti__active"),this.b=l,this.selectedFlag.setAttribute("aria-activedescendant",l.getAttribute("id"))}}return t.iso2!==e}},{key:"_z2",value:function(){var e=this.a.parentNode.cloneNode();e.style.visibility="hidden",document.body.appendChild(e);var t=this.k.cloneNode();e.appendChild(t);var i=this.selectedFlag.cloneNode(!0);t.appendChild(i);var n=i.offsetWidth;return e.parentNode.removeChild(e),n}},{key:"_0",value:function(){var e="aggressive"===this.d.autoPlaceholder||!this.e&&"polite"===this.d.autoPlaceholder;if(window.intlTelInputUtils&&e){var t=intlTelInputUtils.numberType[this.d.placeholderNumberType],i=this.s.iso2?intlTelInputUtils.getExampleNumber(this.s.iso2,this.d.nationalMode,t):"";i=this._7(i),"function"==typeof this.d.customPlaceholder&&(i=this.d.customPlaceholder(i,this.s)),this.a.setAttribute("placeholder",i)}}},{key:"_1",value:function(e){var t=this._z(e.getAttribute("data-country-code"));this._2(),this._4(e.getAttribute("data-dial-code"),!0),this.a.focus();var i=this.a.value.length;this.a.setSelectionRange(i,i),t&&this._m2CountryChange()}},{key:"_2",value:function(){this.m.classList.add("iti__hide"),this.selectedFlag.setAttribute("aria-expanded","false"),this.u.classList.remove("iti__arrow--up"),document.removeEventListener("keydown",this._a3),document.documentElement.removeEventListener("click",this._a2),this.m.removeEventListener("mouseover",this._a0),this.m.removeEventListener("click",this._a1),this.d.dropdownContainer&&(this.g||window.removeEventListener("scroll",this._a4),this.dropdown.parentNode&&this.dropdown.parentNode.removeChild(this.dropdown)),this._m2("close:countrydropdown")}},{key:"_3",value:function(e,t){var i=this.m,n=window.pageYOffset||document.documentElement.scrollTop,a=i.offsetHeight,r=i.getBoundingClientRect().top+n,l=r+a,d=e.offsetHeight,_=e.getBoundingClientRect().top+n,o=_+d,s=_-r+i.scrollTop,m=a/2-d/2;if(_<r)t&&(s-=m),i.scrollTop=s;else if(l<o){t&&(s+=m);var u=a-d;i.scrollTop=s-u}}},{key:"_4",value:function(e,t){var i,n=this.a.value,a="+".concat(e);if("+"===n.charAt(0)){var r=this._5(n);i=r?n.replace(r,a):a}else{if(this.d.nationalMode||this.d.separateDialCode)return;if(n)i=a+n;else{if(!t&&this.d.autoHideDialCode)return;i=a}}this.a.value=i}},{key:"_5",value:function(e,t){var i="";if("+"===e.charAt(0))for(var n="",a=0;a<e.length;a++){var r=e.charAt(a);if(!isNaN(parseInt(r,10))){if(n+=r,t)this.q[n]&&(i=e.substr(0,a+1));else if(this.dialCodes[n]){i=e.substr(0,a+1);break}if(n.length===this.countryCodeMaxLen)break}}return i}},{key:"_6",value:function(){var e=this.a.value.trim(),t=this.s.dialCode,i=this._m(e);return(this.d.separateDialCode&&"+"!==e.charAt(0)&&t&&i?"+".concat(t):"")+e}},{key:"_7",value:function(e){var t=e;if(this.d.separateDialCode){var i=this._5(t);if(i){var n=" "===t[(i="+".concat(this.s.dialCode)).length]||"-"===t[i.length]?i.length+1:i.length;t=t.substr(n)}}return this._j2(t)}},{key:"_m2CountryChange",value:function(){this._m2("countrychange")}},{key:"handleAutoCountry",value:function(){"auto"===this.d.initialCountry&&(this.j=window.intlTelInputGlobals.autoCountry,this.a.value||this.setCountry(this.j),this.h())}},{key:"handleUtils",value:function(){window.intlTelInputUtils&&(this.a.value&&this._u(this.a.value),this._0()),this.i0()}},{key:"destroy",value:function(){var e=this.a.form;if(this.d.allowDropdown){this._2(),this.selectedFlag.removeEventListener("click",this._a10),this.k.removeEventListener("keydown",this._a11);var t=this._i1();t&&t.removeEventListener("click",this._a9)}this.hiddenInput&&e&&e.removeEventListener("submit",this._a14),this.d.autoHideDialCode&&(e&&e.removeEventListener("submit",this._a8),this.a.removeEventListener("blur",this._a8)),this.a.removeEventListener("keyup",this._a12),this.a.removeEventListener("cut",this._a13),this.a.removeEventListener("paste",this._a13),this.a.removeAttribute("data-intl-tel-input-id");var i=this.a.parentNode;i.parentNode.insertBefore(this.a,i),i.parentNode.removeChild(i),delete window.intlTelInputGlobals.instances[this.id]}},{key:"getExtension",value:function(){return window.intlTelInputUtils?intlTelInputUtils.getExtension(this._6(),this.s.iso2):""}},{key:"getNumber",value:function(e){if(window.intlTelInputUtils){var t=this.s.iso2;return intlTelInputUtils.formatNumber(this._6(),t,e)}return""}},{key:"getNumberType",value:function(){return window.intlTelInputUtils?intlTelInputUtils.getNumberType(this._6(),this.s.iso2):-99}},{key:"getSelectedCountryData",value:function(){return this.s}},{key:"getValidationError",value:function(){if(window.intlTelInputUtils){var e=this.s.iso2;return intlTelInputUtils.getValidationError(this._6(),e)}return-99}},{key:"isValidNumber",value:function(){var e=this._6().trim(),t=this.d.nationalMode?this.s.iso2:"";return window.intlTelInputUtils?intlTelInputUtils.isValidNumber(e,t):null}},{key:"setCountry",value:function(e){var t=e.toLowerCase();this.l.classList.contains("iti__".concat(t))||(this._z(t),this._4(this.s.dialCode,!1),this._m2CountryChange())}},{key:"setNumber",value:function(e){var t=this._v(e);this._u(e),t&&this._m2CountryChange()}},{key:"setPlaceholderNumberType",value:function(e){this.d.placeholderNumberType=e,this._0()}}])&&n(e.prototype,t),i&&n(e,i),a;var e,t,i}();i.getCountryData=function(){return r};var m=function(e,t,i){var n=document.createElement("script");n.onload=function(){s("handleUtils"),t&&t()},n.onerror=function(){s("rejectUtilsScriptPromise"),i&&i()},n.className="iti-load-utils",n.async=!0,n.src=e,document.body.appendChild(n)};return i.loadUtils=function(i){if(!window.intlTelInputUtils&&!window.intlTelInputGlobals.startedLoadingUtilsScript){if(window.intlTelInputGlobals.startedLoadingUtilsScript=!0,"undefined"!=typeof Promise)return new Promise(function(e,t){return m(i,e,t)});m(i)}return null},i.defaults=d,i.version="17.0.13",function(e,t){var i=new a(e,t);return i._init(),e.setAttribute("data-intl-tel-input-id",i.id),window.intlTelInputGlobals.instances[i.id]=i}}()}),function(Q){function i(e,t){var r=this,l=Q.extend({},Q.fn.signaturePad.defaults,t),d=Q(e),i=Q(l.canvas,d),_=i.get(0),o=null,s={x:null,y:null},m=[],u=!1,n=!1,a=!1,c=!1,p=30,f=p,h=0;function y(){clearTimeout(u),n=u=!1}function b(e,t){var i,n,a;if(e.preventDefault(),i=Q(e.target).offset(),clearTimeout(u),u=!1,a=void 0!==e.targetTouches?(n=Math.floor(e.targetTouches[0].pageX-i.left),Math.floor(e.targetTouches[0].pageY-i.top)):(n=Math.floor(e.pageX-i.left),Math.floor(e.pageY-i.top)),s.x===n&&s.y===a)return!0;null===s.x&&(s.x=n),null===s.y&&(s.y=a),t&&(a+=t),o.beginPath(),o.moveTo(s.x,s.y),o.lineTo(n,a),o.lineCap=l.penCap,o.stroke(),o.closePath(),m.push({lx:n,ly:a,mx:s.x,my:s.y}),s.x=n,s.y=a,l.onDraw&&"function"==typeof l.onDraw&&l.onDraw.apply(r)}function v(){g()}function g(e){e?b(e,1):(a?i.each(function(){this.removeEventListener("touchmove",b)}):i.unbind("mousemove.signaturepad"),0<m.length&&l.onDrawEnd&&"function"==typeof l.onDrawEnd&&l.onDrawEnd.apply(r)),s.x=null,s.y=null,l.output&&0<m.length&&Q(l.output,d).val(JSON.stringify(m))}function w(){o.clearRect(0,0,_.width,_.height),o.fillStyle=l.bgColour,o.fillRect(0,0,_.width,_.height),l.displayOnly||l.lineWidth&&(o.beginPath(),o.lineWidth=l.lineWidth,o.strokeStyle=l.lineColour,o.moveTo(l.lineMargin,l.lineTop),o.lineTo(_.width-l.lineMargin,l.lineTop),o.stroke(),o.closePath()),o.lineWidth=l.penWidth,o.strokeStyle=l.penColour,Q(l.output,d).val(""),m=[],g()}function E(e,t){null==s.x?b(e,1):b(e,t)}function A(e,t){a?t.addEventListener("touchmove",E,!1):i.bind("mousemove.signaturepad",E),b(e,1)}function x(e){if(c)return!1;c=!0,Q("input").blur(),void 0!==e.targetTouches&&(a=!0),a?(i.each(function(){this.addEventListener("touchend",v,!1),this.addEventListener("touchcancel",v,!1)}),i.unbind("mousedown.signaturepad")):(Q(document).bind("mouseup.signaturepad",function(){n&&(g(),y())}),i.bind("mouseleave.signaturepad",function(e){n&&g(e),n&&!u&&(u=setTimeout(function(){g(),y()},500))}),i.each(function(){this.ontouchstart=null}))}function k(){Q(l.typed,d).hide(),w(),i.each(function(){this.addEventListener("touchstart",function(e){e.preventDefault(),n=!0,x(e),A(e,this)})}),i.bind("mousedown.signaturepad",function(e){if(e.preventDefault(),1<e.which)return!1;n=!0,x(e),A(e)}),Q(l.clear,d).bind("click.signaturepad",function(e){e.preventDefault(),w()}),Q(l.typeIt,d).bind("click.signaturepad",function(e){e.preventDefault(),j()}),Q(l.drawIt,d).unbind("click.signaturepad"),Q(l.drawIt,d).bind("click.signaturepad",function(e){e.preventDefault()}),Q(l.typeIt,d).removeClass(l.currentClass),Q(l.drawIt,d).addClass(l.currentClass),Q(l.sig,d).addClass(l.currentClass),Q(l.typeItDesc,d).hide(),Q(l.drawItDesc,d).show(),Q(l.clear,d).show()}function j(){w(),c=!1,i.each(function(){this.removeEventListener&&(this.removeEventListener("touchend",v),this.removeEventListener("touchcancel",v),this.removeEventListener("touchmove",b)),this.ontouchstart&&(this.ontouchstart=null)}),Q(document).unbind("mouseup.signaturepad"),i.unbind("mousedown.signaturepad"),i.unbind("mousemove.signaturepad"),i.unbind("mouseleave.signaturepad"),Q(l.clear,d).unbind("click.signaturepad"),Q(l.typed,d).show(),Q(l.drawIt,d).bind("click.signaturepad",function(e){e.preventDefault(),k()}),Q(l.typeIt,d).unbind("click.signaturepad"),Q(l.typeIt,d).bind("click.signaturepad",function(e){e.preventDefault()}),Q(l.output,d).val(""),Q(l.drawIt,d).removeClass(l.currentClass),Q(l.typeIt,d).addClass(l.currentClass),Q(l.sig,d).removeClass(l.currentClass),Q(l.drawItDesc,d).hide(),Q(l.clear,d).hide(),Q(l.typeItDesc,d).show(),f=p=Q(l.typed,d).css("font-size").replace(/px/,"")}function C(e){var t=Q(l.typed,d),i=Q.trim(e.replace(/>/g,"&gt;").replace(/</g,"&lt;")),n=h,a=.5*f;if(h=i.length,t.html(i),i){if(n<h&&t.outerWidth()>_.width)for(;t.outerWidth()>_.width;)f--,t.css("font-size",f+"px");if(h<n&&t.outerWidth()+a<_.width&&f<p)for(;t.outerWidth()+a<_.width&&f<p;)f++,t.css("font-size",f+"px")}else t.css("font-size",p+"px")}function I(){var e=!0,t={drawInvalid:!1,nameInvalid:!1},i=[d,l],n=[t,d,l];return l.onBeforeValidate&&"function"==typeof l.onBeforeValidate?l.onBeforeValidate.apply(r,i):function(e,t){Q("p."+t.errorClass,e).remove(),e.removeClass(t.errorClass),Q("input, label",e).removeClass(t.errorClass)}.apply(r,i),l.drawOnly&&m.length<1&&(e=!(t.drawInvalid=!0)),""===Q(l.name,d).val()&&(e=!(t.nameInvalid=!0)),l.onFormError&&"function"==typeof l.onFormError?l.onFormError.apply(r,n):function(e,t,i){e.nameInvalid&&(t.prepend(['<p class="',i.errorClass,'">',i.errorMessage,"</p>"].join("")),Q(i.name,t).focus(),Q(i.name,t).addClass(i.errorClass),Q("label[for="+Q(i.name).attr("id")+"]",t).addClass(i.errorClass)),e.drawInvalid&&t.prepend(['<p class="',i.errorClass,'">',i.errorMessageDraw,"</p>"].join(""))}.apply(r,n),e}function B(e,t,i){for(var n in e)"object"==typeof e[n]&&(t.beginPath(),t.moveTo(e[n].mx,e[n].my),t.lineTo(e[n].lx,e[n].ly),t.lineCap=l.penCap,t.stroke(),t.closePath(),i&&e[n].lx&&m.push({lx:e[n].lx,ly:e[n].ly,mx:e[n].mx,my:e[n].my}))}Q.extend(r,{signaturePad:"2.5.2",init:function(){parseFloat((/CPU.+OS ([0-9_]{3}).*AppleWebkit.*Mobile/i.exec(navigator.userAgent)||[0,"4_2"])[1].replace("_","."))<4.1&&(Q.fn.Oldoffset=Q.fn.offset,Q.fn.offset=function(){var e=Q(this).Oldoffset();return e.top-=window.scrollY,e.left-=window.scrollX,e}),Q(l.typed,d).bind("selectstart.signaturepad",function(e){return Q(e.target).is(":input")}),i.bind("selectstart.signaturepad",function(e){return Q(e.target).is(":input")}),!_.getContext&&FlashCanvas&&FlashCanvas.initElement(_),_.getContext&&(o=_.getContext("2d"),Q(l.sig,d).show(),l.displayOnly||(l.drawOnly||(Q(l.name,d).bind("keyup.signaturepad",function(){C(Q(this).val())}),Q(l.name,d).bind("blur.signaturepad",function(){C(Q(this).val())}),Q(l.drawIt,d).bind("click.signaturepad",function(e){e.preventDefault(),k()})),l.drawOnly||"drawIt"===l.defaultAction?k():j(),l.validateFields&&(Q(e).is("form")?Q(e).bind("submit.signaturepad",function(){return I()}):Q(e).parents("form").bind("submit.signaturepad",function(){return I()})),Q(l.sigNav,d).show()))},updateOptions:function(e){Q.extend(l,e)},regenerate:function(e){r.clearCanvas(),Q(l.typed,d).hide(),"string"==typeof e&&(e=JSON.parse(e)),B(e,o,!0),l.output&&0<Q(l.output,d).length&&Q(l.output,d).val(JSON.stringify(m))},clearCanvas:function(){w()},getSignature:function(){return m},getSignatureString:function(){return JSON.stringify(m)},getSignatureImage:function(){var e,t=document.createElement("canvas"),i=null;return t.style.position="absolute",t.style.top="-999em",t.width=_.width,t.height=_.height,document.body.appendChild(t),!t.getContext&&FlashCanvas&&FlashCanvas.initElement(t),(i=t.getContext("2d")).fillStyle=l.bgColour,i.fillRect(0,0,_.width,_.height),i.lineWidth=l.penWidth,i.strokeStyle=l.penColour,B(m,i),e=t.toDataURL.apply(t,arguments),document.body.removeChild(t),t=null,e},validateForm:function(){return I()}})}Q.fn.signaturePad=function(e){var t=null;return this.each(function(){Q.data(this,"plugin-signaturePad")?(t=Q.data(this,"plugin-signaturePad")).updateOptions(e):((t=new i(this,e)).init(),Q.data(this,"plugin-signaturePad",t))}),t},Q.fn.signaturePad.defaults={defaultAction:"typeIt",displayOnly:!1,drawOnly:!1,canvas:"canvas",sig:".sig",sigNav:".sigNav",bgColour:"#ffffff",penColour:"#145394",penWidth:2,penCap:"round",lineColour:"#ccc",lineWidth:2,lineMargin:5,lineTop:35,name:".name",typed:".typed",clear:".clearButton",typeIt:".typeIt a",drawIt:".drawIt a",typeItDesc:".typeItDesc",drawItDesc:".drawItDesc",output:".output",currentClass:"current",validateFields:!0,errorClass:"error",errorMessage:"Please enter your name",errorMessageDraw:"Please sign the document",onBeforeValidate:null,onFormError:null,onDraw:null,onDrawEnd:null}}(jQuery),j=2;var fm_need_enable=!0,is_addon_stripe_active,is_addon_calculator_active,nextID,editor;if(-1!=ajaxurl.indexOf("://"))var url_for_ajax=ajaxurl;else var url_for_ajax=location.protocol+"//"+location.host+ajaxurl;function isNumber(e){return!isNaN(parseFloat(e))&&isFinite(e)}function disable_past_days(e,t){document.getElementById(t+"_buttonform_id_temp").setAttribute("format",e)}function set_send(e){"yes"==document.getElementById(e).value?document.getElementById(e).setAttribute("value","no"):document.getElementById(e).setAttribute("value","yes")}function show_datepicker(e){jQuery("#"+e).datepicker("show")}function hide_time(e){"no"==document.getElementById(e+"form_id_temp").value?document.getElementById(e+"form_id_temp").value="yes":document.getElementById(e+"form_id_temp").value="no"}function show_week_days(id,week_day){var w_format=document.getElementById(id+"_buttonform_id_temp").getAttribute("format");week_day&&(1==document.getElementById("el_show_"+week_day).checked?document.getElementById(id+"_show_week_days").setAttribute(week_day,"yes"):document.getElementById(id+"_show_week_days").setAttribute(week_day,"no")),jQuery("input[name^="+id+"_elementform_id_temp]").datepicker("option","beforeShowDay",function(date){for(var w_hide_sunday="yes"==jQuery("#"+id+"_show_week_days").attr("sunday")?"true":"day != 0",w_hide_monday="yes"==jQuery("#"+id+"_show_week_days").attr("monday")?"true":"day != 1",w_hide_tuesday="yes"==jQuery("#"+id+"_show_week_days").attr("tuesday")?"true":"day != 2",w_hide_wednesday="yes"==jQuery("#"+id+"_show_week_days").attr("wednesday")?"true":"day != 3",w_hide_thursday="yes"==jQuery("#"+id+"_show_week_days").attr("thursday")?"true":"day != 4",w_hide_friday="yes"==jQuery("#"+id+"_show_week_days").attr("friday")?"true":"day != 5",w_hide_saturday="yes"==jQuery("#"+id+"_show_week_days").attr("saturday")?"true":"day != 6",invalid_dates=jQuery("#"+id+"_invalid_dates_id_temp").val(),invalid_dates_finish=[],invalid_dates_start=invalid_dates.split(","),invalid_date_range=[],i=0;i<invalid_dates_start.length;i++)if(invalid_dates_start[i]=invalid_dates_start[i].trim(),invalid_dates_start[i].length<11)invalid_dates_finish.push(invalid_dates_start[i]);else if(4<invalid_dates_start[i].indexOf("-"))invalid_date_range.push(invalid_dates_start[i].split("-"));else{var invalid_date_array=invalid_dates_start[i].split("-"),start_invalid_day=invalid_date_array[0]+"-"+invalid_date_array[1]+"-"+invalid_date_array[2],end_invalid_day=invalid_date_array[3]+"-"+invalid_date_array[4]+"-"+invalid_date_array[5];invalid_date_range.push([start_invalid_day,end_invalid_day])}jQuery.each(invalid_date_range,function(e,t){for(var i=new Date(t[0]);i<=new Date(t[1]);i.setDate(i.getDate()+1))invalid_dates_finish.push(jQuery.datepicker.formatDate(w_format,i))});var string_days=jQuery.datepicker.formatDate(w_format,date),day=date.getDay();return[-1==invalid_dates_finish.indexOf(string_days)&&eval(w_hide_sunday)&&eval(w_hide_monday)&&eval(w_hide_tuesday)&&eval(w_hide_wednesday)&&eval(w_hide_thursday)&&eval(w_hide_friday)&&eval(w_hide_saturday)]})}function set_sel_am_pm(e){e.options[0].selected?(e.options[0].setAttribute("selected","selected"),e.options[1].removeAttribute("selected")):(e.options[1].setAttribute("selected","selected"),e.options[0].removeAttribute("selected"))}function change_captcha_digit(e){captcha=document.getElementById("_wd_captchaform_id_temp"),document.getElementById("captcha_digit").value?(captcha.setAttribute("digit",e),captcha.setAttribute("src",url_for_ajax+"?action=formmakerwdcaptcha&digit="+e+"&i=form_id_temp"),document.getElementById("_wd_captcha_inputform_id_temp").style.width=10*document.getElementById("captcha_digit").value+15+"px"):(captcha.setAttribute("digit","6"),captcha.setAttribute("src",url_for_ajax+"?action=formmakerwdcaptcha&digit=6&i=form_id_temp"),document.getElementById("_wd_captcha_inputform_id_temp").style.width="75px")}function check_isnum_interval(e,t,i,n){var a=e.which||e.keyCode;return!(31<a&&(a<48||57<a))&&(val=""+document.getElementById(t).value+String.fromCharCode(a),!(2<val.length)&&("00"!=val&&!(val<i||val>n)))}function check_isnum_point(e){var t=e.which||e.keyCode;return 46==t||!(31<t&&(t<48||57<t))}function check_isnum_price(e,t){var i=e.which||e.keyCode;return!((""==t||-1<t.indexOf("."))&&31<i&&(i<48||57<i))&&!(31<i&&46!=i&&(i<48||57<i))}function check_isspacebar(e){return 32!=(e.which||e.keyCode)}function change_w_label(e,t){document.getElementById(e)&&(document.getElementById(e).innerHTML=t)}function change_w(e,t){document.getElementById(e).setAttribute("width",t)}function change_h(e,t){document.getElementById(e).setAttribute("height",t)}function change_key(e,t){document.getElementById("wd_recaptchaform_id_temp").setAttribute(t,e)}function captcha_refresh(e){srcArr=document.getElementById(e+"form_id_temp").src.split("&r="),document.getElementById(e+"form_id_temp").src=srcArr[0]+"&r="+Math.floor(100*Math.random()),document.getElementById(e+"_inputform_id_temp").value=""}function up_row(e){for("undefined"!=typeof event&&event.stopPropagation(),wdform_field=document.getElementById("wdform_field"+e),wdform_row=wdform_field.parentNode,wdform_column=wdform_row.parentNode,wdform_section=wdform_column.parentNode,wdform_page=wdform_section.parentNode,k=0;wdform_column.childNodes[k]&&(!wdform_column.childNodes[k].getAttribute("wdid")||e!=wdform_column.childNodes[k].getAttribute("wdid"));)k++;if(0!=k)return up=wdform_column.childNodes[k-1],down=wdform_column.childNodes[k],wdform_column.removeChild(down),void wdform_column.insertBefore(down,up);wdform_section.previousSibling&&wdform_section.previousSibling.getAttribute("type")?wdform_section.previousSibling.previousSibling.firstChild.appendChild(wdform_row):page_up(e)}function down_row(e){for("undefined"!=typeof event&&event.stopPropagation(),wdform_field=document.getElementById("wdform_field"+e),wdform_row=wdform_field.parentNode,wdform_column=wdform_row.parentNode,wdform_section=wdform_column.parentNode,wdform_page=wdform_section.parentNode,l=wdform_column.childNodes.length,k=0;wdform_column.childNodes[k]&&(!wdform_column.childNodes[k].getAttribute("wdid")||e!=wdform_column.childNodes[k].getAttribute("wdid"));)k++;if(k!=l-1)return up=wdform_column.childNodes[k],down=wdform_column.childNodes[k+2],wdform_column.removeChild(up),down||(down=null),void wdform_column.insertBefore(up,down);wdform_section.nextSibling.getAttribute("type")?wdform_section.nextSibling.nextSibling.firstChild.appendChild(wdform_row):page_down(e)}function right_row(e){if("undefined"!=typeof event&&event.stopPropagation(),wdform_field=document.getElementById("wdform_field"+e),wdform_row=wdform_field.parentNode,wdform_column=wdform_row.parentNode,wdform_section=wdform_column.parentNode,null!=wdform_column.nextSibling)wdform_column_next=wdform_column.nextSibling,wdform_column_next.appendChild(wdform_row);else{var t=document.createElement("div");t.setAttribute("class","wdform_column"),wdform_section.appendChild(t),t.appendChild(wdform_row)}sortable_columns()}function left_row(e){"undefined"!=typeof event&&event.stopPropagation(),wdform_field=document.getElementById("wdform_field"+e),wdform_row=wdform_field.parentNode,wdform_column=wdform_row.parentNode,wdform_section=wdform_column.parentNode,null!=wdform_column.previousSibling&&(wdform_column_next=wdform_column.previousSibling,wdform_column_next.appendChild(wdform_row)),sortable_columns()}function page_up(e){for("undefined"!=typeof event&&event.stopPropagation(),wdform_field=document.getElementById("wdform_field"+e),wdform_row=wdform_field.parentNode,wdform_column=wdform_row.parentNode,wdform_section=wdform_column.parentNode,wdform_page=wdform_section.parentNode,wdform_page_and_images=wdform_page.parentNode;wdform_page_and_images;){if(wdform_page_and_images=wdform_page_and_images.previousSibling,!wdform_page_and_images)return void alert("Unable to move");if(jQuery(wdform_page_and_images.firstChild).is(":visible"))break}n=wdform_page_and_images.getElementsByClassName("wdform_page")[0].childNodes.length,wdform_page_and_images.getElementsByClassName("wdform_page")[0].childNodes[n-2].firstChild.appendChild(wdform_row),refresh_pages(e)}function page_down(e){for("undefined"!=typeof event&&event.stopPropagation(),wdform_field=document.getElementById("wdform_field"+e),wdform_row=wdform_field.parentNode,wdform_column=wdform_row.parentNode,wdform_section=wdform_column.parentNode,wdform_page=wdform_section.parentNode,wdform_page_and_images=wdform_page.parentNode;wdform_page_and_images;){if(wdform_page_and_images=wdform_page_and_images.nextSibling,!wdform_page_and_images||"add_field_cont"==wdform_page_and_images.id)return void alert("Unable to move");if(jQuery(wdform_page_and_images.firstChild).is(":visible"))break}wdform_page_and_images.getElementsByClassName("wdform_page")[0].firstChild.firstChild.insertBefore(wdform_row,wdform_page_and_images.firstChild.firstChild.firstChild.firstChild),refresh_pages(e)}function remove_whitespace(e){var t;for(t=0;t<e.childNodes.length;t++)e.childNodes[t]&&"3"==e.childNodes[t].nodeType&&!/\S/.test(e.childNodes[t].nodeValue)?(e.removeChild(e.childNodes[t]),t--):e.childNodes[t].childNodes.length&&remove_whitespace(e.childNodes[t])}function Disable(){}function all_labels(){for(labels=new Array,k=1;k<=form_view_max;k++)if(document.getElementById("form_id_tempform_view"+k))for(wdform_page=document.getElementById("form_id_tempform_view"+k),remove_whitespace(wdform_page),n=wdform_page.childNodes.length-2,z=0;z<=n;z++)if(!wdform_page.childNodes[z].getAttribute("wdid"))for(wdform_section=wdform_page.childNodes[z],x=0;x<wdform_section.childNodes.length;x++)if(wdform_column=wdform_section.childNodes[x],wdform_column.firstChild)for(y=0;y<wdform_column.childNodes.length;y++)wdform_row=wdform_column.childNodes[y],3!=wdform_row.nodeType&&(wdid=wdform_row.getAttribute("wdid"),wdid&&labels.push(document.getElementById(wdid+"_element_labelform_id_temp").innerHTML));return labels}function set_checked(e,t){return checking=document.getElementById(e+"_elementform_id_temp"+t),jQuery(document).off("change").on("change",'#show_table input[type="checkbox"]',function(){limitOfChoice=document.getElementById(e+"_limitchoice_numform_id_temp").value,limitOfChoiceAlert=document.getElementById(e+"_limitchoicealert_numform_id_temp").value,numberOfChecked=document.querySelectorAll('#show_table input[type="checkbox"]:checked').length,""!=limitOfChoice&&numberOfChecked>limitOfChoice&&(this.checked=!1,alert(limitOfChoiceAlert))}),checking.checked&&checking.setAttribute("checked","checked"),!(!checking.checked&&(checking.removeAttribute("checked"),checking.getAttribute("other")&&1==checking.getAttribute("other")))||(document.getElementById(e+"_other_inputform_id_temp")&&(document.getElementById(e+"_other_inputform_id_temp").parentNode.removeChild(document.getElementById(e+"_other_brform_id_temp")),document.getElementById(e+"_other_inputform_id_temp").parentNode.removeChild(document.getElementById(e+"_other_inputform_id_temp"))),!1)}function set_default(e,t){for(k=0;k<100;k++)document.getElementById(e+"_elementform_id_temp"+k)&&(document.getElementById(e+"_elementform_id_temp"+k).checked?document.getElementById(e+"_elementform_id_temp"+t).setAttribute("checked","checked"):document.getElementById(e+"_elementform_id_temp"+k).removeAttribute("checked"));document.getElementById(e+"_other_inputform_id_temp")&&(document.getElementById(e+"_other_inputform_id_temp").parentNode.removeChild(document.getElementById(e+"_other_brform_id_temp")),document.getElementById(e+"_other_inputform_id_temp").parentNode.removeChild(document.getElementById(e+"_other_inputform_id_temp")))}function set_select(e){for(p=e.length-1;0<=p;p--)e.options[p].selected?e.options[p].setAttribute("selected","selected"):e.options[p].removeAttribute("selected")}function add_0(e){input=document.getElementById(e),1==input.value.length&&(input.value="0"+input.value,input.setAttribute("value",input.value))}function label_top_stripe(e){document.getElementById(e+"_label_sectionform_id_temp")&&document.getElementById(e+"_element_sectionform_id_temp")&&("no"==document.getElementById(e+"_hide_labelform_id_temp").value?document.getElementById(e+"_label_sectionform_id_temp").style.display="block":document.getElementById(e+"_label_sectionform_id_temp").style.display="none",document.getElementById(e+"_element_sectionform_id_temp").style.display="block")}function label_left_stripe(e){document.getElementById(e+"_label_sectionform_id_temp")&&document.getElementById(e+"_element_sectionform_id_temp")&&("no"==document.getElementById(e+"_hide_labelform_id_temp").value?document.getElementById(e+"_label_sectionform_id_temp").style.display="table-cell":document.getElementById(e+"_label_sectionform_id_temp").style.display="none",document.getElementById(e+"_element_sectionform_id_temp").style.display="table-cell")}function change_value_range(e,t,i){jQuery("#"+e).datepicker("option",t,i)}function change_func(e,t){document.getElementById(e).setAttribute("onclick",t)}function change_in_value(e,t){t=(t=t.replace(/(<([^>]+)>)/gi,"")).replace(/"/g,"&quot;"),document.getElementById(e).setAttribute("value",t)}function change_size(e,t){switch(document.getElementById(t+"_elementform_id_temp").style.width=e+"px",document.getElementById(t+"_element_input")&&(document.getElementById(t+"_element_input").style.width=e+"px"),e){case"111":document.getElementById(t+"_elementform_id_temp").setAttribute("rows","2");break;case"222":document.getElementById(t+"_elementform_id_temp").setAttribute("rows","4");break;case"444":document.getElementById(t+"_elementform_id_temp").setAttribute("rows","8")}}function getIFrameDocument(e){var t=null;return document.getElementById(e)&&document.getElementById(e).contentDocument?t=document.getElementById(e).contentDocument:document.getElementById(e)&&(t=document.frames[e].document),t}function format_extended(t,e,i,n,a){w_size=document.getElementById(t+"_element_firstform_id_temp").style.width,tr_name1=document.getElementById(t+"_tr_name1"),tr_name2=document.getElementById(t+"_tr_name2");var r=document.createElement("div");r.setAttribute("id",t+"_td_name_input_title"),r.style.display="table-cell";var l=document.createElement("div");l.setAttribute("id",t+"_td_name_input_middle"),l.style.display="table-cell";var d=document.createElement("div");d.setAttribute("id",t+"_td_name_label_title"),d.setAttribute("align","left"),d.style.display="table-cell";var _=document.createElement("div");_.setAttribute("id",t+"_td_name_label_middle"),_.setAttribute("align","left"),_.style.display="table-cell";var o=document.createElement("input");o.setAttribute("type","text"),o.style.cssText="margin: 0px 10px 0px 0px; padding: 0px; width:40px",o.setAttribute("id",t+"_element_titleform_id_temp"),o.setAttribute("name",t+"_element_titleform_id_temp"),e==n?o.setAttribute("value",n):o.setAttribute("value",e),o.setAttribute("title",n);var s=document.createElement("label");s.setAttribute("class","mini_label"),s.setAttribute("id",t+"_mini_label_title"),s.innerHTML=w_mini_labels[0];var m=document.createElement("input");m.setAttribute("type","text"),m.style.cssText="padding: 0px; width:"+w_size,m.setAttribute("id",t+"_element_middleform_id_temp"),m.setAttribute("name",t+"_element_middleform_id_temp"),i==a?m.setAttribute("value",a):m.setAttribute("value",i),m.setAttribute("title",a);var u=document.createElement("label");u.setAttribute("class","mini_label"),u.setAttribute("id",t+"_mini_label_middle"),u.innerHTML=w_mini_labels[3],first_input=document.getElementById(t+"_td_name_input_first"),last_input=document.getElementById(t+"_td_name_input_last"),first_label=document.getElementById(t+"_td_name_label_first"),last_label=document.getElementById(t+"_td_name_label_last"),r.appendChild(o),l.appendChild(m),tr_name1.insertBefore(r,first_input),tr_name1.insertBefore(l,null),d.appendChild(s),_.appendChild(u),tr_name2.insertBefore(d,first_label),tr_name2.insertBefore(_,null);var c=document.createTextNode("-"),p=document.createTextNode("-"),f=document.createElement("input");f.setAttribute("id","el_first_value_title"),f.setAttribute("type","text"),f.setAttribute("value",n),f.style.cssText="width:50px; margin-left:4px; margin-right:4px",f.setAttribute("onKeyUp","change_input_value(this.value,'"+t+"_element_titleform_id_temp')");var h=document.createElement("input");h.setAttribute("id","el_first_value_middle"),h.setAttribute("type","text"),h.setAttribute("value",a),h.style.cssText="width:100px; margin-left:4px",h.setAttribute("onKeyUp","change_input_value(this.value,'"+t+"_element_middleform_id_temp')"),el_first_value_first=document.getElementById("el_first_value_first"),parent=el_first_value_first.parentNode,parent.insertBefore(c,el_first_value_first),parent.insertBefore(f,c),parent.appendChild(p),parent.appendChild(h),refresh_attr(t,"type_name"),refresh_id_name(t,"type_name"),jQuery(function(){jQuery("label#"+t+"_mini_label_title").on("click",function(){if(0==jQuery(this).children("input").length){var e="<input type='text' class='title' size='10' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.title").focus(),jQuery("input.title").blur(function(){var e=jQuery(this).val();jQuery("#"+t+"_mini_label_title").text(e)})}}),jQuery("label#"+t+"_mini_label_middle").on("click",function(){if(0==jQuery(this).children("input").length){var e="<input type='text' class='middle' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.middle").focus(),jQuery("input.middle").blur(function(){var e=jQuery(this).val();jQuery("#"+t+"_mini_label_middle").text(e)})}})})}function format_normal(e){tr_name1=document.getElementById(e+"_tr_name1"),tr_name2=document.getElementById(e+"_tr_name2"),td_name_input1=document.getElementById(e+"_td_name_input_title"),td_name_input4=document.getElementById(e+"_td_name_input_middle"),td_name_label1=document.getElementById(e+"_td_name_label_title"),td_name_label4=document.getElementById(e+"_td_name_label_middle"),tr_name1.removeChild(td_name_input1),tr_name1.removeChild(td_name_input4),tr_name2.removeChild(td_name_label1),tr_name2.removeChild(td_name_label4),el_first_value_first=document.getElementById("el_first_value_first"),parent=el_first_value_first.parentNode,parent.removeChild(document.getElementById("el_first_value_title").nextSibling),parent.removeChild(document.getElementById("el_first_value_title")),parent.removeChild(document.getElementById("el_first_value_middle").previousSibling),parent.removeChild(document.getElementById("el_first_value_middle")),refresh_attr(e,"type_name"),refresh_id_name(e,"type_name")}function type_number(e,t,i,a,r,l,d,_,o,s,m,u){document.getElementById("element_type").value="type_number",delete_last_child();var c=document.createElement("div");c.setAttribute("id","edit_div");var p=document.createElement("table");p.setAttribute("id","edit_main_table"),p.setAttribute("cellpadding","3"),p.setAttribute("cellspacing","0");var f=document.createElement("tr"),h=document.createElement("tr"),y=document.createElement("tr"),b=document.createElement("tr"),v=document.createElement("tr"),g=document.createElement("tr"),w=document.createElement("tr"),E=document.createElement("tr"),A=document.createElement("tr"),x=document.createElement("td"),k=document.createElement("td"),C=document.createElement("td"),I=document.createElement("td"),B=document.createElement("td"),Q=document.createElement("td"),T=document.createElement("td"),M=document.createElement("td"),L=document.createElement("td"),z=document.createElement("td"),q=document.createElement("td"),S=document.createElement("td"),N=document.createElement("td"),H=(document.createElement("td"),document.createElement("td")),D=document.createElement("td"),O=document.createElement("td"),P=document.createElement("td"),F=document.createElement("label");F.setAttribute("class","fm-field-label"),F.setAttribute("for","edit_for_label"),F.innerHTML="Field label";var R=document.createElement("textarea");R.setAttribute("id","edit_for_label"),R.setAttribute("rows","4"),R.setAttribute("onKeyUp","change_label('"+e+"_element_labelform_id_temp', this.value)"),R.innerHTML=t;var W=document.createElement("label");W.setAttribute("class","fm-field-label"),W.setAttribute("for","edit_for_label_size"),W.innerHTML="Field label size(px) ";var K=document.createElement("input");K.setAttribute("id","edit_for_label_size"),K.setAttribute("type","text"),K.setAttribute("value",i),K.setAttribute("onKeyPress","return check_isnum(event)"),K.setAttribute("onKeyUp","change_w_style('"+e+"_label_sectionform_id_temp', this.value)");var U=document.createElement("label");U.setAttribute("class","fm-field-label"),U.innerHTML="Field label position";var V=document.createElement("input");V.setAttribute("id","edit_for_label_position_top"),V.setAttribute("type","radio"),V.setAttribute("name","edit_for_label_position"),V.setAttribute("onchange","label_left("+e+")");var $=document.createElement("label");$.setAttribute("for","edit_for_label_position_top"),$.innerHTML="Left";var G=document.createElement("input");G.setAttribute("id","edit_for_label_position_left"),G.setAttribute("type","radio"),G.setAttribute("name","edit_for_label_position"),G.setAttribute("onchange","label_top("+e+")");var Y=document.createElement("label");Y.setAttribute("for","edit_for_label_position_left"),Y.innerHTML="Top","top"==a?G.setAttribute("checked","checked"):V.setAttribute("checked","checked");var X=document.createElement("label");X.setAttribute("class","fm-field-label"),X.setAttribute("for","edit_for_input_size"),X.innerHTML="Field size(px) ";var Z=document.createElement("input");Z.setAttribute("id","edit_for_input_size"),Z.setAttribute("type","text"),Z.setAttribute("value",r),Z.setAttribute("onKeyPress","return check_isnum(event)"),Z.setAttribute("onKeyUp","change_w_style('"+e+"_elementform_id_temp', this.value)");var J=document.createElement("label");J.setAttribute("class","fm-field-label"),J.setAttribute("for","el_first_value_input"),J.innerHTML="Placeholder ";var ee=document.createElement("input");ee.setAttribute("id","el_first_value_input"),ee.setAttribute("type","text"),ee.setAttribute("value",d),ee.setAttribute("onKeyUp","change_input_value(this.value,'"+e+"_elementform_id_temp');");var te=document.createElement("label");te.setAttribute("class","fm-field-label"),te.setAttribute("for","el_required"),te.innerHTML="Required";var ie=document.createElement("input");ie.setAttribute("id","el_required"),ie.setAttribute("type","checkbox"),ie.setAttribute("onclick","set_required('"+e+"_required')"),"yes"==_&&ie.setAttribute("checked","checked");var ne=document.createElement("label");ne.setAttribute("class","fm-field-label"),ne.setAttribute("for","el_unique"),ne.innerHTML="Allow only unique values";var ae=document.createElement("input");ae.setAttribute("id","el_unique"),ae.setAttribute("type","checkbox"),ae.setAttribute("onclick","set_unique('"+e+"_uniqueform_id_temp')"),"yes"==o&&ae.setAttribute("checked","checked");var re=document.createElement("label");re.setAttribute("class","fm-field-label"),re.setAttribute("for","el_style_textarea"),re.innerHTML="Class name";var le=document.createElement("input");le.setAttribute("id","el_style_textarea"),le.setAttribute("type","text"),le.setAttribute("value",s),le.setAttribute("onChange","change_class(this.value,'"+e+"')");var de=document.createElement("label");de.setAttribute("class","fm-field-label"),de.innerHTML="Additional Attributes";var _e=document.createElement("img");_e.setAttribute("src",plugin_url+"/images/add.png?ver=1.8.0"),_e.style.cssText="cursor:pointer; margin-left:68px",_e.setAttribute("title","add"),_e.setAttribute("onClick","add_attr("+e+", 'type_text')");var oe=document.createElement("table");oe.setAttribute("id","attributes"),oe.setAttribute("border","0"),oe.style.cssText="margin-left:0px";var se=document.createElement("tr");se.setAttribute("idi","0");var me=document.createElement("th");me.style.cssText="width:100px";var ue=document.createElement("th");ue.style.cssText="width:100px";var ce=document.createElement("th");ce.style.cssText="width:10px";var pe=document.createElement("label");pe.style.cssText="color:#000; font-weight:bold; font-size: 11px",pe.innerHTML="Name";var fe=document.createElement("label");for(fe.style.cssText="color:#000; font-weight:bold; font-size: 11px",fe.innerHTML="Value",oe.appendChild(se),se.appendChild(me),se.appendChild(ue),se.appendChild(ce),me.appendChild(pe),ue.appendChild(fe),n=m.length,j=1;j<=n;j++){var he=document.createElement("tr");he.setAttribute("id","attr_row_"+j),he.setAttribute("idi",j);var ye=document.createElement("td");ye.style.cssText="width:100px";var be=document.createElement("td");be.style.cssText="width:100px";var ve=document.createElement("td"),ge=document.createElement("input");ge.setAttribute("type","text"),ge.setAttribute("class","fm-field-choice"),ge.setAttribute("value",m[j-1]),ge.setAttribute("id","attr_name"+j),ge.setAttribute("onChange","change_attribute_name("+e+", this, 'type_text')");var we=document.createElement("input");we.setAttribute("type","text"),we.setAttribute("class","fm-field-choice"),we.setAttribute("value",u[j-1]),we.setAttribute("id","attr_value"+j),we.setAttribute("onChange","change_attribute_value("+e+", "+j+", 'type_text')");var Ee=document.createElement("img");Ee.setAttribute("id","el_choices"+j+"_remove"),Ee.setAttribute("src",plugin_url+"/images/delete.png?ver=1.8.0"),Ee.style.cssText="cursor:pointer; vertical-align:middle; margin:2px",Ee.setAttribute("onClick","remove_attr("+j+", "+e+", 'type_text')"),oe.appendChild(he),he.appendChild(ye),he.appendChild(be),he.appendChild(ve),ye.appendChild(ge),be.appendChild(we),ve.appendChild(Ee)}var Ae=document.getElementById("edit_table"),xe=document.createElement("br"),ke=document.createElement("br");x.appendChild(F),k.appendChild(R),O.appendChild(W),P.appendChild(K),C.appendChild(U),I.appendChild(V),I.appendChild($),I.appendChild(xe),I.appendChild(G),I.appendChild(Y),B.appendChild(X),Q.appendChild(Z),T.appendChild(J),M.appendChild(ee),L.appendChild(re),z.appendChild(le),q.appendChild(te),S.appendChild(ie),H.appendChild(ne),D.appendChild(ae),N.appendChild(de),N.appendChild(_e),N.appendChild(ke),N.appendChild(oe),N.setAttribute("colspan","2"),f.appendChild(x),f.appendChild(k),A.appendChild(O),A.appendChild(P),h.appendChild(C),h.appendChild(I),y.appendChild(B),y.appendChild(Q),b.appendChild(T),b.appendChild(M),v.appendChild(L),v.appendChild(z),g.appendChild(q),g.appendChild(S),E.appendChild(H),E.appendChild(D),w.appendChild(N),p.appendChild(f),p.appendChild(A),p.appendChild(h),p.appendChild(y),p.appendChild(b),p.appendChild(v),p.appendChild(g),p.appendChild(E),p.appendChild(w),c.appendChild(p),Ae.appendChild(c),add_id_and_name(e,"type_text"),element="input",type="text";var je=document.createElement("input");je.setAttribute("type","hidden"),je.setAttribute("value","type_number"),je.setAttribute("name",e+"_typeform_id_temp"),je.setAttribute("id",e+"_typeform_id_temp");var Ce=document.createElement("input");Ce.setAttribute("type","hidden"),Ce.setAttribute("value",_),Ce.setAttribute("name",e+"_requiredform_id_temp"),Ce.setAttribute("id",e+"_requiredform_id_temp");var Ie=document.createElement("input");Ie.setAttribute("type","hidden"),Ie.setAttribute("value",o),Ie.setAttribute("name",e+"_uniqueform_id_temp"),Ie.setAttribute("id",e+"_uniqueform_id_temp");var Be=document.createElement(element);Be.setAttribute("type",type),Be.style.cssText="width:"+r+"px;",Be.setAttribute("id",e+"_elementform_id_temp"),Be.setAttribute("name",e+"_elementform_id_temp"),Be.setAttribute("value",l),Be.setAttribute("title",d),Be.setAttribute("placeholder",d),Be.setAttribute("onKeyPress","return check_isnum(event)");var Qe=document.createElement("div");Qe.setAttribute("id","main_div");var Te=document.createElement("div");Te.setAttribute("id",e+"_elemet_tableform_id_temp");var Me=document.createElement("div");Me.setAttribute("align","left"),Me.style.display="table-cell",Me.style.width=i+"px",Me.setAttribute("id",e+"_label_sectionform_id_temp");var Le=document.createElement("div");Le.setAttribute("align","left"),Le.style.display="table-cell",Le.setAttribute("id",e+"_element_sectionform_id_temp");var ze=document.createElement("span");ze.setAttribute("id",e+"_element_labelform_id_temp"),ze.innerHTML=t,ze.setAttribute("class","label"),ze.style.verticalAlign="top";var qe=document.createElement("span");qe.setAttribute("id",e+"_required_elementform_id_temp"),qe.innerHTML="",qe.setAttribute("class","required"),qe.style.verticalAlign="top","yes"==_&&(qe.innerHTML=" *");var Se=document.getElementById("show_table");Me.appendChild(ze),Me.appendChild(qe),Le.appendChild(je),Le.appendChild(Ce),Le.appendChild(Ie),Le.appendChild(Be),Te.appendChild(Me),Te.appendChild(Le),Qe.appendChild(Te),Se.appendChild(Qe),"top"==a&&label_top(e),change_class(s,e),refresh_attr(e,"type_text")}function type_wdeditor(e,t,i,a,r,l,d,_,o,s,m){document.getElementById("element_type").value="type_wdeditor",delete_last_child();var u=document.createElement("div");u.setAttribute("id","edit_div");var c=document.createElement("table");c.setAttribute("id","edit_main_table"),c.setAttribute("cellpadding","3"),c.setAttribute("cellspacing","0");var p=document.createElement("tr"),f=document.createElement("tr"),h=document.createElement("tr"),y=document.createElement("tr"),b=document.createElement("tr"),v=document.createElement("tr"),g=document.createElement("tr"),w=document.createElement("tr"),E=document.createElement("td"),A=document.createElement("td"),x=document.createElement("td"),k=document.createElement("td"),C=document.createElement("td"),I=document.createElement("td");I.style.cssText="padding-top:10px";var B=document.createElement("td"),Q=document.createElement("td");Q.style.cssText="padding-top:10px";var T=document.createElement("td"),M=document.createElement("td");M.style.cssText="padding-top:10px";var L=document.createElement("td"),z=document.createElement("td");z.style.cssText="padding-top:10px";var q=document.createElement("td"),S=document.createElement("td"),N=document.createElement("td"),H=document.createElement("td"),D=document.createElement("label");D.setAttribute("class","fm-field-label"),D.setAttribute("for","edit_for_label"),D.innerHTML="Field label";var O=document.createElement("textarea");O.setAttribute("id","edit_for_label"),O.setAttribute("rows","4"),O.setAttribute("onKeyUp","change_label('"+e+"_element_labelform_id_temp', this.value)"),O.innerHTML=t;var P=document.createElement("label");P.setAttribute("class","fm-field-label"),P.setAttribute("for","edit_for_label_size"),P.innerHTML="Field label size(px) ";var F=document.createElement("input");F.setAttribute("id","edit_for_label_size"),F.setAttribute("type","text"),F.setAttribute("value",i),F.setAttribute("onKeyPress","return check_isnum(event)"),F.setAttribute("onKeyUp","change_w_style('"+e+"_label_sectionform_id_temp', this.value)");var R=document.createElement("label");R.setAttribute("class","fm-field-label"),R.setAttribute("for","edit_for_label_position_top"),R.innerHTML="Field label position";var W=document.createElement("input");W.setAttribute("id","edit_for_label_position_top"),W.setAttribute("type","radio"),W.setAttribute("value","left"),W.setAttribute("name","edit_for_label_position"),W.setAttribute("onchange","label_left("+e+")"),Left=document.createTextNode("Left");var K=document.createElement("input");K.setAttribute("id","edit_for_label_position_left"),K.setAttribute("type","radio"),K.setAttribute("value","top"),K.setAttribute("name","edit_for_label_position"),K.setAttribute("onchange","label_top("+e+")"),Top=document.createTextNode("Top"),"top"==a?K.setAttribute("checked","checked"):W.setAttribute("checked","checked");var U=document.createElement("label");U.style.cssText="color:#000; font-weight:bold; font-size: 13px",U.innerHTML="Field size(px) ";var V=document.createElement("input");V.setAttribute("id","edit_for_input_size"),V.setAttribute("type","text"),V.setAttribute("value",r),V.style.cssText="margin-right:2px; width: 60px",V.setAttribute("name","edit_for_size"),V.setAttribute("onKeyPress","return check_isnum(event)"),V.setAttribute("onKeyUp","change_w_style('"+e+"_elementform_id_temp', this.value)"),X=document.createTextNode("x");var $=document.createElement("input");$.setAttribute("id","edit_for_input_size"),$.setAttribute("type","text"),$.setAttribute("value",l),$.style.cssText="margin-left:2px; width:60px",$.setAttribute("name","edit_for_size"),$.setAttribute("onKeyPress","return check_isnum(event)"),$.setAttribute("onKeyUp","change_h_style('"+e+"_elementform_id_temp', this.value)");var G=document.createElement("label");G.style.cssText="color:#000; font-weight:bold; font-size: 13px",G.innerHTML="Placeholder";var Y=document.createElement("input");Y.setAttribute("id","el_first_value_input"),Y.setAttribute("type","text"),Y.setAttribute("value",d),Y.setAttribute("onKeyUp","change_input_value(this.value,'"+e+"_elementform_id_temp')");var Z=document.createElement("label");Z.setAttribute("class","fm-field-label"),Z.setAttribute("for","el_send"),Z.innerHTML="Required";var J=document.createElement("input");J.setAttribute("id","el_send"),J.setAttribute("type","checkbox"),J.setAttribute("value","yes"),J.setAttribute("onclick","set_required('"+e+"_required')"),"yes"==_&&J.setAttribute("checked","checked");var ee=document.createElement("label");ee.setAttribute("class","fm-field-label"),ee.setAttribute("for","element_style"),ee.innerHTML="Class name";var te=document.createElement("input");te.setAttribute("id","element_style"),te.setAttribute("type","text"),te.setAttribute("value",o),te.setAttribute("onChange","change_class(this.value,'"+e+"')");var ie=document.createElement("label");ie.setAttribute("class","fm-field-label"),ie.setAttribute("for","el_choices_add"),ie.innerHTML="Additional Attributes";var ne=document.createElement("img");ne.setAttribute("id","el_choices_add"),ne.setAttribute("src",plugin_url+"/images/add.png?ver=1.8.0"),ne.style.cssText="cursor:pointer; margin-left:68px",ne.setAttribute("title","add"),ne.setAttribute("onClick","add_attr("+e+", 'type_text')");var ae=document.createElement("table");ae.setAttribute("id","attributes"),ae.setAttribute("border","0"),ae.style.cssText="margin-left:0px";var re=document.createElement("tr");re.setAttribute("idi","0");var le=document.createElement("th");le.style.cssText="width:100px";var de=document.createElement("th");de.style.cssText="width:100px";var _e=document.createElement("th");_e.style.cssText="width:10px";var oe=document.createElement("label");oe.style.cssText="color:#000; font-weight:bold; font-size: 11px",oe.innerHTML="Name";var se=document.createElement("label");for(se.style.cssText="color:#000; font-weight:bold; font-size: 11px",se.innerHTML="Value",ae.appendChild(re),re.appendChild(le),re.appendChild(de),re.appendChild(_e),le.appendChild(oe),de.appendChild(se),n=s.length,j=1;j<=n;j++){var me=document.createElement("tr");me.setAttribute("id","attr_row_"+j),me.setAttribute("idi",j);var ue=document.createElement("td");ue.style.cssText="width:100px";var ce=document.createElement("td");ce.style.cssText="width:100px";var pe=document.createElement("td"),fe=document.createElement("input");fe.setAttribute("type","text"),fe.setAttribute("class","fm-field-choice"),fe.setAttribute("value",s[j-1]),fe.setAttribute("id","attr_name"+j),fe.setAttribute("onChange","change_attribute_name("+e+", this, 'type_text')");var he=document.createElement("input");he.setAttribute("type","text"),he.setAttribute("class","fm-field-choice"),he.setAttribute("value",m[j-1]),he.setAttribute("id","attr_value"+j),he.setAttribute("onChange","change_attribute_value("+e+", "+j+", 'type_text')");var ye=document.createElement("img");ye.setAttribute("id","el_choices"+j+"_remove"),ye.setAttribute("src",plugin_url+"/images/delete.png?ver=1.8.0"),ye.style.cssText="cursor:pointer; vertical-align:middle; margin:2px",ye.setAttribute("align","top"),ye.setAttribute("onClick","remove_attr("+j+", "+e+", 'type_text')"),ae.appendChild(me),me.appendChild(ue),me.appendChild(ce),me.appendChild(pe),ue.appendChild(fe),ce.appendChild(he),pe.appendChild(ye)}var be=document.getElementById("edit_table"),ve=document.createElement("br"),ge=(document.createElement("br"),document.createElement("br"),document.createElement("br")),we=(document.createElement("br"),document.createElement("br"),document.createElement("br"));E.appendChild(D),A.appendChild(O),N.appendChild(P),H.appendChild(F),x.appendChild(R),k.appendChild(W),k.appendChild(el_label_left),k.appendChild(ve),k.appendChild(K),k.appendChild(el_label_top),C.appendChild(U),I.appendChild(V),I.appendChild(X),I.appendChild($),B.appendChild(G),Q.appendChild(Y),T.appendChild(ee),M.appendChild(te),L.appendChild(Z),z.appendChild(J),q.appendChild(ie),q.appendChild(ne),q.appendChild(we),q.appendChild(ae),q.setAttribute("colspan","2"),p.appendChild(E),p.appendChild(A),w.appendChild(N),w.appendChild(H),f.appendChild(x),f.appendChild(k),h.appendChild(C),h.appendChild(I),y.appendChild(B),y.appendChild(Q),b.appendChild(T),b.appendChild(M),v.appendChild(L),v.appendChild(z),g.appendChild(q),g.appendChild(S),c.appendChild(p),c.appendChild(w),c.appendChild(f),c.appendChild(h),c.appendChild(y),c.appendChild(b),c.appendChild(v),c.appendChild(g),u.appendChild(c),be.appendChild(u),add_id_and_name(e,"type_text"),element="editor";var Ee=document.createElement("input");Ee.setAttribute("type","hidden"),Ee.setAttribute("value","type_wdeditor"),Ee.setAttribute("name",e+"_typeform_id_temp"),Ee.setAttribute("id",e+"_typeform_id_temp");var Ae=document.createElement("input");Ae.setAttribute("type","hidden"),Ae.setAttribute("value",_),Ae.setAttribute("name",e+"_requiredform_id_temp"),Ae.setAttribute("id",e+"_requiredform_id_temp");var xe=document.createElement("div");xe.setAttribute("id","main_div");var ke=document.createElement("div");ke.setAttribute("id",e+"_elemet_tableform_id_temp");var je=document.createElement("div");je.setAttribute("align","left"),je.style.display="table-cell",je.style.width=i+"px",je.setAttribute("id",e+"_label_sectionform_id_temp");var Ce=document.createElement("div");Ce.setAttribute("align","left"),Ce.style.display="table-cell",Ce.setAttribute("id",e+"_element_sectionform_id_temp");document.createElement("br"),document.createElement("br"),ge=document.createElement("br"),document.createElement("br");var Ie=document.createElement("span");Ie.setAttribute("id",e+"_element_labelform_id_temp"),Ie.innerHTML=t,Ie.setAttribute("class","label");var Be=document.createElement("span");Be.setAttribute("id",e+"_required_elementform_id_temp"),Be.innerHTML="",Be.setAttribute("class","required"),"yes"==_&&(Be.innerHTML=" *");var Qe=document.createElement("input");Qe.setAttribute("id",e+"_elementform_id_temp"),Qe.setAttribute("name",e+"_elementform_id_temp"),Qe.setAttribute("type","hidden"),Qe.style.width=r+"px",Qe.style.height=l+"px",Qe.setAttribute("title",d);var Te=document.createElement("span");Te.style.color="red",Te.style.fontStyle="italic",Te.innerHTML="Editor doesn't display in back end",Left=document.createTextNode(e+"_editorform_id_temp");var Me=document.createElement("div");Me.style.display="none";var Le=document.getElementById("show_table");je.appendChild(Ie),je.appendChild(Be),Ce.appendChild(Ee),Ce.appendChild(Ae),Ce.appendChild(Qe),Ce.appendChild(Te),Me.appendChild(Left),Ce.appendChild(Me),ke.appendChild(je),ke.appendChild(Ce),xe.appendChild(ke),xe.appendChild(ge),Le.appendChild(xe),"top"==a&&label_top(e),change_class(o,e),refresh_attr(e,"type_text")}function change_input_range(e,t){var i="";""!=document.getElementById("el_range_"+e+"1").value&&(i=document.getElementById("el_range_"+e+"1").value),""!=document.getElementById("el_range_"+e+"2").value&&(""==document.getElementById("el_range_"+e+"1").value&&(i="0"),i=i+"."+document.getElementById("el_range_"+e+"2").value),document.getElementById(t+"_range_"+e+"form_id_temp").value=i}function explode(e,t){return 2!=arguments.length||void 0===e||void 0===t?null:""!==e&&!1!==e&&null!==e&&("function"==typeof e||"object"==typeof e||"function"==typeof t||"object"==typeof t?{0:""}:(!0===e&&(e="1"),t.toString().split(e.toString())))}function type_paypal_price(t,e,i,a,r,l,d,_,o,s,m,u,c,p,f){document.getElementById("element_type").value="type_paypal_price",delete_last_child();var h=document.createElement("div");h.setAttribute("id","edit_div");var y=document.createElement("table");y.setAttribute("id","edit_main_table"),y.setAttribute("cellpadding","3"),y.setAttribute("cellspacing","0");var b=document.createElement("tr"),v=document.createElement("tr"),g=document.createElement("tr"),w=document.createElement("tr"),E=document.createElement("tr"),A=document.createElement("tr"),x=document.createElement("tr"),k=document.createElement("tr"),C=document.createElement("tr"),I=document.createElement("tr"),B=document.createElement("td"),Q=document.createElement("td"),T=document.createElement("td"),M=document.createElement("td"),L=document.createElement("td"),z=document.createElement("td");z.style.cssText="line-height:20px";var q=document.createElement("td"),S=document.createElement("td"),N=document.createElement("td"),H=document.createElement("td"),D=document.createElement("td"),O=document.createElement("td"),P=document.createElement("td"),F=document.createElement("td"),R=document.createElement("td"),W=document.createElement("td"),K=document.createElement("td"),U=document.createElement("td"),V=document.createElement("td"),$=document.createElement("td"),G=document.createElement("label");G.setAttribute("class","fm-field-label"),G.setAttribute("for","edit_for_label"),G.innerHTML="Field label";var Y=document.createElement("textarea");Y.setAttribute("id","edit_for_label"),Y.setAttribute("rows","4"),Y.setAttribute("onKeyUp","change_label('"+t+"_element_labelform_id_temp', this.value)"),Y.innerHTML=e;var X=document.createElement("label");X.setAttribute("class","fm-field-label"),X.setAttribute("for","edit_for_label_size"),X.innerHTML="Field label size(px) ";var Z=document.createElement("input");Z.setAttribute("id","edit_for_label_size"),Z.setAttribute("type","text"),Z.setAttribute("value",i),Z.setAttribute("onKeyPress","return check_isnum(event)"),Z.setAttribute("onKeyUp","change_w_style('"+t+"_label_sectionform_id_temp', this.value)");var J=document.createElement("label");J.setAttribute("class","fm-field-label"),J.innerHTML="Field label position";var ee=document.createElement("input");ee.setAttribute("id","edit_for_label_position_top"),ee.setAttribute("type","radio"),ee.setAttribute("name","edit_for_label_position"),ee.setAttribute("onchange","label_left("+t+")");var te=document.createElement("label");te.setAttribute("for","edit_for_label_position_top"),te.innerHTML="Left";var ie=document.createElement("input");ie.setAttribute("id","edit_for_label_position_left"),ie.setAttribute("type","radio"),ie.setAttribute("name","edit_for_label_position"),ie.setAttribute("onchange","label_top("+t+")");var ne=document.createElement("label");ne.setAttribute("for","edit_for_label_position_left"),ne.innerHTML="Top","top"==a?ie.setAttribute("checked","checked"):ee.setAttribute("checked","checked"),w_range_minarray=explode(".",p),w_range_maxarray=explode(".",f);var ae=document.createElement("label");ae.setAttribute("class","fm-field-label"),ae.innerHTML="Range ";var re=document.createTextNode("Min"),le=document.createElement("input");le.setAttribute("type","text"),le.setAttribute("id","el_range_min1"),w_range_minarray[0]&&le.setAttribute("value",w_range_minarray[0]),le.style.cssText="width:60px; margin-right:4px;margin-left:8px",le.setAttribute("onKeyPress","return check_isnum(event)"),le.setAttribute("onChange","change_input_range('min', '"+t+"')");var de=document.createTextNode("."),_e=document.createElement("input");_e.setAttribute("type","text"),_e.setAttribute("id","el_range_min2"),w_range_minarray[1]&&_e.setAttribute("value",w_range_minarray[1]),_e.style.cssText="width:30px; margin-left:4px",_e.setAttribute("onKeyPress","return check_isnum(event)"),_e.setAttribute("onChange","change_input_range('min', '"+t+"')");var oe=document.createTextNode("Max"),se=document.createElement("input");se.setAttribute("type","text"),se.setAttribute("id","el_range_max1"),w_range_maxarray[0]&&se.setAttribute("value",w_range_maxarray[0]),se.style.cssText="width:60px; margin-right:4px; margin-left:7px",se.setAttribute("onKeyPress","return check_isnum(event)"),se.setAttribute("onChange","change_input_range('max', '"+t+"')");var me=document.createTextNode("."),ue=document.createElement("input");ue.setAttribute("type","text"),ue.setAttribute("id","el_range_max2"),w_range_maxarray[1]&&ue.setAttribute("value",w_range_maxarray[1]),ue.style.cssText="width:30px; margin-left:4px",ue.setAttribute("onKeyPress","return check_isnum(event)"),ue.setAttribute("onChange","change_input_range('max', '"+t+"')");var ce=document.createTextNode("-"),pe=document.createElement("label");pe.setAttribute("class","fm-field-label"),pe.setAttribute("for","el_first_value_first"),pe.innerHTML="Placeholder ";var fe=document.createElement("input");fe.setAttribute("id","el_first_value_first"),fe.setAttribute("type","text"),fe.setAttribute("value",l[0]),fe.style.cssText="width:120px; margin-right:4px",fe.setAttribute("onKeyPress","return check_isnum(event)"),fe.setAttribute("onKeyUp","change_input_value(this.value,'"+t+"_element_dollarsform_id_temp')");var he=document.createElement("input");he.setAttribute("id","el_first_value_last"),he.setAttribute("type","text"),he.setAttribute("value",l[1]),he.style.cssText="width:67px; margin-left:4px; margin-right:4px",he.setAttribute("onKeyPress","return check_isnum_interval(event,'"+t+"_element_centsform_id_temp',0,99)"),he.setAttribute("onKeyUp","change_input_value(this.value,'"+t+"_element_centsform_id_temp')");var ye=document.createElement("label");ye.setAttribute("class","fm-field-label"),ye.setAttribute("for","edit_for_input_size"),ye.innerHTML="Field size(px) ";var be=document.createElement("input");be.setAttribute("id","edit_for_input_size"),be.setAttribute("type","text"),be.setAttribute("value",_),be.setAttribute("onKeyPress","return check_isnum(event)"),be.setAttribute("onKeyUp","change_w_style('"+t+"_element_dollarsform_id_temp', this.value);");var ve=document.createElement("label");ve.setAttribute("class","fm-field-label"),ve.setAttribute("for","el_required"),ve.innerHTML="Required";var ge=document.createElement("input");ge.setAttribute("id","el_required"),ge.setAttribute("type","checkbox"),ge.setAttribute("onclick","set_required('"+t+"_required')"),"yes"==o&&ge.setAttribute("checked","checked");var we=document.createElement("label");we.setAttribute("class","fm-field-label"),we.setAttribute("for","el_hide_cents"),we.innerHTML="Hide Cents";var Ee=document.createElement("input");Ee.setAttribute("id","el_hide_cents"),Ee.setAttribute("type","checkbox"),Ee.setAttribute("onclick","hide_show_cents(this.checked, "+t+")"),"yes"==s&&Ee.setAttribute("checked","checked");var Ae=document.createElement("label");Ae.setAttribute("class","fm-field-label"),Ae.setAttribute("for","el_style_textarea"),Ae.innerHTML="Class name";var xe=document.createElement("input");xe.setAttribute("id","el_style_textarea"),xe.setAttribute("type","text"),xe.setAttribute("value",m),xe.setAttribute("onChange","change_class(this.value,'"+t+"')");var ke=document.createElement("label");ke.setAttribute("class","fm-field-label"),ke.innerHTML="Additional Attributes";var je=document.createElement("img");je.setAttribute("src",plugin_url+"/images/add.png?ver=1.8.0"),je.style.cssText="cursor:pointer; margin-left:68px",je.setAttribute("title","add"),je.setAttribute("onClick","add_attr("+t+", 'type_paypal_price')");var Ce=document.createElement("table");Ce.setAttribute("id","attributes"),Ce.setAttribute("border","0"),Ce.style.cssText="margin-left:0px";var Ie=document.createElement("tr");Ie.setAttribute("idi","0");var Be=document.createElement("th");Be.style.cssText="width:100px";var Qe=document.createElement("th");Qe.style.cssText="width:100px";var Te=document.createElement("th");Te.style.cssText="width:10px";var Me=document.createElement("label");Me.style.cssText="color:#000; font-weight:bold; font-size: 11px",Me.innerHTML="Name";var Le=document.createElement("label");for(Le.style.cssText="color:#000; font-weight:bold; font-size: 11px",Le.innerHTML="Value",Ce.appendChild(Ie),Ie.appendChild(Be),Ie.appendChild(Qe),Ie.appendChild(Te),Be.appendChild(Me),Qe.appendChild(Le),n=u.length,j=1;j<=n;j++){var ze=document.createElement("tr");ze.setAttribute("id","attr_row_"+j),ze.setAttribute("idi",j);var qe=document.createElement("td");qe.style.cssText="width:100px";var Se=document.createElement("td");Se.style.cssText="width:100px";var Ne=document.createElement("td"),He=document.createElement("input");He.setAttribute("type","text"),He.setAttribute("class","fm-field-choice"),He.setAttribute("value",u[j-1]),He.setAttribute("id","attr_name"+j),He.setAttribute("onChange","change_attribute_name("+t+", this, 'type_paypal_price')");var De=document.createElement("input");De.setAttribute("type","text"),De.setAttribute("class","fm-field-choice"),De.setAttribute("value",c[j-1]),De.setAttribute("id","attr_value"+j),De.setAttribute("onChange","change_attribute_value("+t+", "+j+", 'type_paypal_price')");var Oe=document.createElement("img");Oe.setAttribute("id","el_choices"+j+"_remove"),Oe.setAttribute("src",plugin_url+"/images/delete.png?ver=1.8.0"),Oe.style.cssText="cursor:pointer; vertical-align:middle; margin:2px",Oe.setAttribute("onClick","remove_attr("+j+", "+t+", 'type_paypal_price')"),Ce.appendChild(ze),ze.appendChild(qe),ze.appendChild(Se),ze.appendChild(Ne),qe.appendChild(He),Se.appendChild(De),Ne.appendChild(Oe)}var Pe=document.getElementById("edit_table"),Fe=document.createElement("br"),Re=document.createElement("br"),We=(document.createElement("br"),document.createElement("br"));document.createElement("br"),document.createElement("br"),document.createElement("br");B.appendChild(G),Q.appendChild(Y),V.appendChild(X),$.appendChild(Z),T.appendChild(J),M.appendChild(ee),M.appendChild(te),M.appendChild(Fe),M.appendChild(ie),M.appendChild(ne),L.appendChild(ae),z.appendChild(re),z.appendChild(le),z.appendChild(de),z.appendChild(_e),z.appendChild(Re),z.appendChild(oe),z.appendChild(se),z.appendChild(me),z.appendChild(ue),K.appendChild(pe),U.appendChild(fe),U.appendChild(ce),U.appendChild(he),P.appendChild(ye),F.appendChild(be),q.appendChild(Ae),S.appendChild(xe),N.appendChild(ve),H.appendChild(ge),R.appendChild(we),W.appendChild(Ee),D.appendChild(ke),D.appendChild(je),D.appendChild(We),D.appendChild(Ce),D.setAttribute("colspan","2"),b.appendChild(B),b.appendChild(Q),I.appendChild(V),I.appendChild($),v.appendChild(T),v.appendChild(M),g.appendChild(L),g.appendChild(z),x.appendChild(P),x.appendChild(F),w.appendChild(q),w.appendChild(S),E.appendChild(N),E.appendChild(H),A.appendChild(D),A.appendChild(O),k.appendChild(R),k.appendChild(W),C.appendChild(K),C.appendChild(U),y.appendChild(b),y.appendChild(I),y.appendChild(v),y.appendChild(g),y.appendChild(C),y.appendChild(x),y.appendChild(w),y.appendChild(E),y.appendChild(k),y.appendChild(A),h.appendChild(y),Pe.appendChild(h),add_id_and_name(t,"type_name");var Ke=document.createElement("input");Ke.setAttribute("type","hidden"),Ke.setAttribute("value","type_paypal_price"),Ke.setAttribute("name",t+"_typeform_id_temp"),Ke.setAttribute("id",t+"_typeform_id_temp");var Ue=document.createElement("input");Ue.setAttribute("type","hidden"),Ue.setAttribute("value",o),Ue.setAttribute("name",t+"_requiredform_id_temp"),Ue.setAttribute("id",t+"_requiredform_id_temp");var Ve=document.createElement("input");Ve.setAttribute("type","hidden"),Ve.setAttribute("value",p),Ve.setAttribute("name",t+"_range_minform_id_temp"),Ve.setAttribute("id",t+"_range_minform_id_temp");var $e=document.createElement("input");$e.setAttribute("type","hidden"),$e.setAttribute("value",f),$e.setAttribute("name",t+"_range_maxform_id_temp"),$e.setAttribute("id",t+"_range_maxform_id_temp");var Ge=document.createElement("div");Ge.setAttribute("id","main_div");var Ye=document.createElement("div");Ye.setAttribute("class","fm-editable-label"),edit_labels=document.createTextNode("The labels of the fields are editable. Please, click on the label to edit."),Ye.appendChild(edit_labels);var Xe=document.createElement("div");Xe.setAttribute("id",t+"_elemet_tableform_id_temp");var Ze=document.createElement("div");Ze.setAttribute("align","left"),Ze.style.display="table-cell",Ze.style.width=i+"px",Ze.setAttribute("id",t+"_label_sectionform_id_temp");var Je=document.createElement("div");Je.setAttribute("align","left"),Je.style.display="table-cell",Je.setAttribute("id",t+"_element_sectionform_id_temp");var et=document.createElement("div");et.setAttribute("id",t+"_table_price"),et.style.display="table";var tt=document.createElement("div");tt.setAttribute("id",t+"_tr_price1"),tt.style.display="table-row";var it=document.createElement("div");it.setAttribute("id",t+"_tr_price2"),it.style.display="table-row";var nt=document.createElement("div");nt.setAttribute("id",t+"_td_name_currency"),nt.style.display="table-cell";var at=document.createElement("div");at.setAttribute("id",t+"_td_name_dollars"),at.style.display="table-cell";var rt=document.createElement("div");rt.setAttribute("id",t+"_td_name_divider"),rt.style.display="table-cell";var lt=document.createElement("div");lt.setAttribute("id",t+"_td_name_cents"),lt.style.display="table-cell";var dt=document.createElement("div");dt.style.display="table-cell";var _t=document.createElement("div");_t.setAttribute("align","left"),_t.style.display="table-cell";var ot=document.createElement("div");ot.setAttribute("id",t+"_td_name_label_divider"),ot.style.display="table-cell";var st=document.createElement("div");st.setAttribute("align","left"),st.setAttribute("id",t+"_td_name_label_cents"),st.style.display="table-cell";var mt=document.createElement("span");mt.setAttribute("id",t+"_element_labelform_id_temp"),mt.innerHTML=e,mt.setAttribute("class","label"),mt.style.verticalAlign="top";var ut=document.createElement("span");ut.setAttribute("id",t+"_required_elementform_id_temp"),ut.innerHTML="",ut.setAttribute("class","required"),ut.style.verticalAlign="top","yes"==o&&(ut.innerHTML=" *");var ct=document.createElement("span");ct.setAttribute("class","wdform_colon"),ct.style.cssText="font-style:bold; vertical-align:middle",ct.innerHTML="\x3c!--repstart--\x3e&nbsp;$&nbsp;\x3c!--repend--\x3e";var pt=document.createElement("label");pt.setAttribute("class","mini_label");var ft=document.createElement("input");ft.setAttribute("type","text"),ft.style.cssText="width:"+_+"px",ft.setAttribute("id",t+"_element_dollarsform_id_temp"),ft.setAttribute("name",t+"_element_dollarsform_id_temp"),ft.setAttribute("value",r[0]),ft.setAttribute("title",l[0]),ft.setAttribute("onKeyPress","return check_isnum(event)");var ht=document.createElement("label");ht.setAttribute("class","mini_label"),ht.setAttribute("id",t+"_mini_label_dollars"),ht.innerHTML=d[0];var yt=document.createElement("span");yt.setAttribute("class","wdform_colon"),yt.style.cssText="font-style:bold; vertical-align:middle",yt.innerHTML="&nbsp;.&nbsp;";var bt=document.createElement("label");bt.setAttribute("class","mini_label");var vt=document.createElement("input");vt.setAttribute("type","text"),vt.style.cssText="width:30px",vt.setAttribute("id",t+"_element_centsform_id_temp"),vt.setAttribute("name",t+"_element_centsform_id_temp"),vt.setAttribute("value",r[1]),vt.setAttribute("title",l[1]),vt.setAttribute("onBlur",'add_0("'+t+'_element_centsform_id_temp")'),vt.setAttribute("onKeyPress","return check_isnum_interval(event,'"+t+"_element_centsform_id_temp',0,99)");var gt=document.createElement("label");gt.setAttribute("class","mini_label"),gt.setAttribute("id",t+"_mini_label_cents"),gt.innerHTML=d[1];var wt=document.getElementById("show_table");Ze.appendChild(mt),Ze.appendChild(ut),nt.appendChild(ct),at.appendChild(ft),rt.appendChild(yt),lt.appendChild(vt),tt.appendChild(nt),tt.appendChild(at),tt.appendChild(rt),tt.appendChild(lt),dt.appendChild(pt),_t.appendChild(ht),ot.appendChild(bt),st.appendChild(gt),it.appendChild(dt),it.appendChild(_t),it.appendChild(ot),it.appendChild(st),et.appendChild(tt),et.appendChild(it),Je.appendChild(Ke),Je.appendChild(Ue),Je.appendChild(Ve),Je.appendChild($e),Je.appendChild(et),Xe.appendChild(Ze),Xe.appendChild(Je),Ge.appendChild(Xe),Ge.appendChild(We),Ge.appendChild(Ye),wt.appendChild(Ge),"top"==a&&label_top(t),"yes"==s&&hide_show_cents(!0,t),change_class(m,t),refresh_attr(t,"type_paypal_price"),jQuery(function(){jQuery("label#"+t+"_mini_label_dollars").on("click",function(){if(0==jQuery(this).children("input").length){var e="<input type='text' class='dollars' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery(e).focus(),jQuery("input.dollars").blur(function(){var e=jQuery(this).val();jQuery("#"+t+"_mini_label_dollars").text(e)})}}),jQuery("label#"+t+"_mini_label_cents").on("click",function(){if(0==jQuery(this).children("input").length){var e="<input type='text' class='cents' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.cents").focus(),jQuery("input.cents").blur(function(){var e=jQuery(this).val();jQuery("#"+t+"_mini_label_cents").text(e)})}})})}function hide_show_cents(e,t){td_divider=document.getElementById(t+"_td_name_divider"),td_cents=document.getElementById(t+"_td_name_cents"),td_divider_label=document.getElementById(t+"_td_name_label_divider"),td_cents_label=document.getElementById(t+"_td_name_label_cents"),change_input_value("",t+"_element_centsform_id_temp"),document.getElementById("el_first_value_last").value="",document.getElementById(t+"_element_centsform_id_temp").value="",td_cents_label.style.display=e?(td_divider.style.display="none",td_cents.style.display="none",td_divider_label.style.display="none"):(td_divider.style.display="table-cell",td_cents.style.display="table-cell",td_divider_label.style.display="table-cell")}function type_date(e,t,i,a,r,l,d,_,o,s,m,u){document.getElementById("element_type").value="type_date",delete_last_child();var c=document.createElement("div");c.setAttribute("id","edit_div");var p=document.createElement("table");p.setAttribute("id","edit_main_table"),p.setAttribute("cellpadding","3"),p.setAttribute("cellspacing","0");var f=document.createElement("tr"),h=document.createElement("tr"),y=document.createElement("tr"),b=document.createElement("tr");b.style.cssText="display:none;";var v=document.createElement("tr"),g=document.createElement("tr"),w=document.createElement("tr"),E=document.createElement("tr"),A=document.createElement("tr"),x=document.createElement("td"),k=document.createElement("td"),C=document.createElement("td"),I=document.createElement("td"),B=document.createElement("td"),Q=document.createElement("td"),T=document.createElement("td"),M=document.createElement("td"),L=document.createElement("td"),z=document.createElement("td"),q=document.createElement("td"),S=document.createElement("td"),N=document.createElement("td"),H=document.createElement("td"),D=document.createElement("td"),O=document.createElement("td"),P=document.createElement("td"),F=document.createElement("td"),R=document.createElement("label");R.setAttribute("for","edit_for_label"),R.setAttribute("class","fm-field-label"),R.innerHTML="Field label";var W=document.createElement("textarea");W.setAttribute("id","edit_for_label"),W.setAttribute("rows","4"),W.setAttribute("onKeyUp","change_label('"+e+"_element_labelform_id_temp', this.value)"),W.innerHTML=t;var K=document.createElement("label");K.setAttribute("class","fm-field-label"),K.setAttribute("for","edit_for_label_size"),K.innerHTML="Field label size(px) ";var U=document.createElement("input");U.setAttribute("id","edit_for_label_size"),U.setAttribute("type","text"),U.setAttribute("value",i),U.setAttribute("onKeyPress","return check_isnum(event)"),U.setAttribute("onKeyUp","change_w_style('"+e+"_label_sectionform_id_temp', this.value)");var V=document.createElement("label");V.setAttribute("class","fm-field-label"),V.innerHTML="Field label position";var $=document.createElement("input");$.setAttribute("id","edit_for_label_position_top"),$.setAttribute("type","radio"),$.setAttribute("name","edit_for_label_position"),$.setAttribute("onchange","label_left("+e+")");var G=document.createElement("label");G.setAttribute("for","edit_for_label_position_top"),G.innerHTML="Left";var Y=document.createElement("input");Y.setAttribute("id","edit_for_label_position_left"),Y.setAttribute("type","radio"),Y.setAttribute("name","edit_for_label_position"),Y.setAttribute("onchange","label_top("+e+")");var X=document.createElement("label");X.setAttribute("for","edit_for_label_position_left"),X.innerHTML="Top","top"==a?Y.setAttribute("checked","checked"):$.setAttribute("checked","checked");var Z=document.createElement("label");Z.setAttribute("class","fm-field-label"),Z.setAttribute("for","date_format"),Z.innerHTML="Date format";var J=document.createElement("input");J.setAttribute("id","date_format"),J.setAttribute("type","text"),J.setAttribute("value",_),J.setAttribute("onChange","change_date_format(this.value,'"+e+"', 'format')");var ee=document.createElement("label");ee.setAttribute("class","fm-field-label"),ee.setAttribute("for","button_value"),ee.innerHTML="Date Picker label";var te=document.createElement("input");te.setAttribute("id","button_value"),te.setAttribute("type","text"),te.setAttribute("value",o),te.style.cssText="width:150px;",te.setAttribute("onKeyUp","change_file_value(this.value,'"+e+"_buttonform_id_temp')");var ie=document.createElement("label");ie.setAttribute("class","fm-field-label"),ie.setAttribute("for","el_disable_past_days"),ie.innerHTML="Allow selecting dates starting from current day";var ne=document.createElement("input");ne.setAttribute("id","el_disable_past_days"),ne.setAttribute("type","checkbox"),ne.setAttribute("onclick","change_date_format(this.checked, '"+e+"', 'dis_days')"),"yes"==u&&ne.setAttribute("checked","checked");var ae=document.createElement("label");ae.setAttribute("class","fm-field-label"),ae.setAttribute("for","el_style_textarea"),ae.innerHTML="Class name";var re=document.createElement("input");re.setAttribute("id","el_style_textarea"),re.setAttribute("type","text"),re.setAttribute("value",d),re.setAttribute("onChange","change_class(this.value,'"+e+"')");var le=document.createElement("label");le.setAttribute("class","fm-field-label"),le.setAttribute("for","el_required"),le.innerHTML="Required";var de=document.createElement("input");de.setAttribute("id","el_required"),de.setAttribute("type","checkbox"),de.setAttribute("onclick","set_required('"+e+"_required')"),"yes"==l&&de.setAttribute("checked","checked");var _e=document.createElement("label");_e.setAttribute("class","fm-field-label"),_e.innerHTML="Additional Attributes";var oe=document.createElement("img");oe.setAttribute("src",plugin_url+"/images/add.png?ver=1.8.0"),oe.style.cssText="cursor:pointer; margin-left:68px",oe.setAttribute("title","add"),oe.setAttribute("onClick","add_attr("+e+", 'type_date')");var se=document.createElement("table");se.setAttribute("id","attributes"),se.setAttribute("border","0"),se.style.cssText="margin-left:0px";var me=document.createElement("tr");me.setAttribute("idi","0");var ue=document.createElement("th");ue.style.cssText="width:100px";var ce=document.createElement("th");ce.style.cssText="width:100px";var pe=document.createElement("th");pe.style.cssText="width:10px";var fe=document.createElement("label");fe.style.cssText="color:#000; font-weight:bold; font-size: 11px",fe.innerHTML="Name";var he=document.createElement("label");for(he.style.cssText="color:#000; font-weight:bold; font-size: 11px",he.innerHTML="Value",se.appendChild(me),me.appendChild(ue),me.appendChild(ce),me.appendChild(pe),ue.appendChild(fe),ce.appendChild(he),n=s.length,j=1;j<=n;j++){var ye=document.createElement("tr");ye.setAttribute("id","attr_row_"+j),ye.setAttribute("idi",j);var be=document.createElement("td");be.style.cssText="width:100px";var ve=document.createElement("td");ve.style.cssText="width:100px";var ge=document.createElement("td"),we=document.createElement("input");we.setAttribute("type","text"),we.setAttribute("class","fm-field-choice"),we.setAttribute("value",s[j-1]),we.setAttribute("id","attr_name"+j),we.setAttribute("onChange","change_attribute_name("+e+", this, 'type_date')");var Ee=document.createElement("input");Ee.setAttribute("type","text"),Ee.setAttribute("class","fm-field-choice"),Ee.setAttribute("value",m[j-1]),Ee.setAttribute("id","attr_value"+j),Ee.setAttribute("onChange","change_attribute_value("+e+", "+j+", 'type_date')");var Ae=document.createElement("img");Ae.setAttribute("id","el_choices"+j+"_remove"),Ae.setAttribute("src",plugin_url+"/images/delete.png?ver=1.8.0"),Ae.style.cssText="cursor:pointer; vertical-align:middle; margin:2px",Ae.setAttribute("onClick","remove_attr("+j+", "+e+", 'type_date')"),se.appendChild(ye),ye.appendChild(be),ye.appendChild(ve),ye.appendChild(ge),be.appendChild(we),ve.appendChild(Ee),ge.appendChild(Ae)}var xe=document.getElementById("edit_table"),ke=document.createElement("br"),je=document.createElement("br");x.appendChild(R),k.appendChild(W),D.appendChild(K),O.appendChild(U),C.appendChild(V),I.appendChild($),I.appendChild(G),I.appendChild(ke),I.appendChild(Y),I.appendChild(X),B.appendChild(Z),Q.appendChild(J),T.appendChild(ee),M.appendChild(te),P.appendChild(ie),F.appendChild(ne),L.appendChild(ae),z.appendChild(re),q.appendChild(le),S.appendChild(de),N.appendChild(_e),N.appendChild(oe),N.appendChild(je),N.appendChild(se),N.setAttribute("colspan","2"),f.appendChild(x),f.appendChild(k),E.appendChild(D),E.appendChild(O),h.appendChild(C),h.appendChild(I),y.appendChild(B),y.appendChild(Q),b.appendChild(T),b.appendChild(M),A.appendChild(P),A.appendChild(F),v.appendChild(L),v.appendChild(z),g.appendChild(q),g.appendChild(S),w.appendChild(N),w.appendChild(H),p.appendChild(f),p.appendChild(E),p.appendChild(h),p.appendChild(y),p.appendChild(b),p.appendChild(A),p.appendChild(v),p.appendChild(g),p.appendChild(w),c.appendChild(p),xe.appendChild(c),add_id_and_name(e,"type_text");var Ce=document.createElement("input");Ce.setAttribute("type","hidden"),Ce.setAttribute("value","type_date"),Ce.setAttribute("name",e+"_typeform_id_temp"),Ce.setAttribute("id",e+"_typeform_id_temp");var Ie=document.createElement("input");Ie.setAttribute("type","hidden"),Ie.setAttribute("value",l),Ie.setAttribute("name",e+"_requiredform_id_temp"),Ie.setAttribute("id",e+"_requiredform_id_temp");var Be=document.createElement("input");Be.setAttribute("type","hidden"),Be.setAttribute("value",u),Be.setAttribute("id",e+"_dis_past_daysform_id_temp"),Be.setAttribute("name",e+"_dis_past_daysform_id_temp");var Qe=document.createElement("div");Qe.setAttribute("id","main_div");var Te=document.createElement("div");Te.setAttribute("id",e+"_elemet_tableform_id_temp");var Me=document.createElement("div");Me.setAttribute("align","left"),Me.style.display="table-cell",Me.style.width=i+"px",Me.setAttribute("id",e+"_label_sectionform_id_temp");var Le=document.createElement("div");Le.setAttribute("align","left"),Le.style.display="table-cell",Le.setAttribute("id",e+"_element_sectionform_id_temp");var ze=document.createElement("div");ze.setAttribute("id",e+"_table_date"),ze.style.display="table";var qe=document.createElement("div");qe.setAttribute("id",e+"_tr_date1"),qe.style.display="table-row";var Se=document.createElement("div");Se.setAttribute("id",e+"_tr_date2"),Se.style.display="table-row";var Ne=document.createElement("div");Ne.setAttribute("id",e+"_td_date_input1"),Ne.style.display="table-cell";var He=document.createElement("div");He.setAttribute("id",e+"_td_date_input2"),He.style.display="table-cell";var De=document.createElement("div");De.setAttribute("id",e+"_td_date_input3"),De.style.display="table-cell";var Oe=document.createElement("div");Oe.setAttribute("id",e+"_td_date_label1"),Oe.style.display="table-cell";var Pe=document.createElement("div");Pe.setAttribute("id",e+"_td_date_label2"),Pe.style.display="table-cell";var Fe=document.createElement("div");Fe.setAttribute("id",e+"_td_date_label3"),Fe.style.display="table-cell";var Re=document.createElement("br"),We=(document.createElement("br"),document.createElement("span"));We.setAttribute("id",e+"_element_labelform_id_temp"),We.innerHTML=t,We.setAttribute("class","label"),We.style.verticalAlign="top";var Ke=document.createElement("span");Ke.setAttribute("id",e+"_required_elementform_id_temp"),Ke.innerHTML="",Ke.setAttribute("class","required"),Ke.style.verticalAlign="top","yes"==l&&(Ke.innerHTML=" *");var Ue=document.createElement("input");Ue.setAttribute("type","text"),Ue.setAttribute("value",r),Ue.setAttribute("class","wdform-date"),Ue.setAttribute("id",e+"_elementform_id_temp"),Ue.setAttribute("name",e+"_elementform_id_temp"),Ue.setAttribute("maxlength","10"),Ue.setAttribute("size","10");var Ve=document.createElement("input");Ve.setAttribute("id",e+"_buttonform_id_temp"),Ve.setAttribute("class","button"),Ve.setAttribute("type","reset"),Ve.setAttribute("value",o),Ve.setAttribute("format",_);var $e=document.getElementById("show_table");Me.appendChild(We),Me.appendChild(Ke),Le.appendChild(Ce),Le.appendChild(Ie),Le.appendChild(Be),Le.appendChild(Ue),Le.appendChild(Ve),Te.appendChild(Me),Te.appendChild(Le),Qe.appendChild(Te),Qe.appendChild(Re),$e.appendChild(Qe),"top"==a&&label_top(e),change_class(d,e),refresh_attr(e,"type_date")}function form_maker_getElementsByAttribute(e,t,i,n){for(var a,r,l="*"==t&&e.all?e.all:e.getElementsByTagName(t),d=new Array,_=void 0!==n?new RegExp("(^|\\s)"+n+"(\\s|$)"):null,o=0;o<l.length;o++)"string"==typeof(a=(r=l[o]).getAttribute&&r.getAttribute(i))&&0<a.length&&(void 0===n||_&&_.test(a))&&d.push(r);return d}function change_element_attribute(e,t,i){"w_readonly"==i||"w_hide_field"==i?"yes"==document.getElementById(t+"_elementform_id_temp").getAttribute(i)?document.getElementById(t+"_elementform_id_temp").setAttribute(i,"no"):document.getElementById(t+"_elementform_id_temp").setAttribute(i,"yes"):document.getElementById(t+"_elementform_id_temp").setAttribute(i,e)}function change_input_style(e){document.getElementById(e+"_elementform_id_temp").getAttribute("readonly")?document.getElementById(e+"_elementform_id_temp").removeAttribute("readonly"):document.getElementById(e+"_elementform_id_temp").setAttribute("readonly","readonly")}function change_src(e,t,i){for(var n=0;n<=e;n++)document.getElementById(t+"_star_"+n).src=plugin_url+"/images/star_"+document.getElementById(t+"_star_colorform_id_temp").value+".png"}function reset_src(e,t){for(var i=0;i<=e;i++)document.getElementById(t+"_star_"+i).src=plugin_url+"/images/star.png"}function select_star_rating(e,t,i){}function change_range_width(e,t,i){document.getElementById(t+"_elementform_id_temp0").style.cssText="width:"+e+"px",document.getElementById(t+"_elementform_id_temp1").style.cssText="width:"+e+"px",document.getElementById(t+"_range_widthform_id_temp").value=e}function go_to_type_paypal_price(e){w_attr_name=[],w_attr_value=[],w_first_val=["",""],w_title=["",""],w_mini_labels=["Dollars","Cents"],type_paypal_price(e,"Amount","100","left",w_first_val,w_title,w_mini_labels,"100","no","no","",w_attr_name,w_attr_value,"","")}function go_to_type_number(e){w_attr_name=[],w_attr_value=[],type_number(e,"Number:","100","left","200","","","no","no","",w_attr_name,w_attr_value)}function go_to_type_wdeditor(e){w_attr_name=[],w_attr_value=[],type_wdeditor(e,"Editor:","100","left","380","200","","no","",w_attr_name,w_attr_value)}function go_to_type_date(e){w_attr_name=[],w_attr_value=[],type_date(e,"Date:","100","left","","no","","%Y-%m-%d","...",w_attr_name,w_attr_value,"no")}function remove_section_break(e){var t=jQuery("#wdform_field"+e).parent(),i=t.next(),n=t.prev();i.find(".wdform_column").each(function(e,t){var i=n.children().eq(e);!i||i.hasClass("wdform_column_empty")?n.find(".wdform_column_empty").before(t):jQuery(t).find(".wdform_row").each(function(e,t){i.append(t)})}),t.remove(),i.remove()}function fm_remove_section(e){var t=jQuery(".fm-row-deleting").first().closest(".wdform_section"),i=t.prev(".wdform_tr_section_break");if(!e){var n=t.prevAll(".wdform_section:first");if(n.length||(n=t.nextAll(".wdform_section:first")),!n.length)return;t.find(".wdform_column").each(function(e,t){n.append(t)})}i.remove(),t.remove()}function remove_row(e){var t=document.getElementById("wdform_field"+e).parentNode;t.parentNode.removeChild(t)}function destroyChildren(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function show_or_hide(e){jQuery("#form_id_tempform_view"+e).is(":visible")?hide_form_view(e):show_form_view(e)}function show_form_view(e){jQuery("#form_id_tempform_view"+e).show()}function hide_form_view(e){jQuery("#form_id_tempform_view"+e).hide()}function generate_buttons(e){var t;form_view_elemet=document.getElementById("form_id_tempform_view"+e),(t=document.createElement("div")).setAttribute("valign","middle"),t.setAttribute("align","left"),t.style.display="inline-block",t.style.width="40%",page_nav.appendChild(t),form_view_elemet.parentNode.previousSibling&&("DIV"==form_view_elemet.parentNode.previousSibling.tagName?table=!0:form_view_elemet.parentNode.previousSibling.previousSibling&&"DIV"==form_view_elemet.parentNode.previousSibling.previousSibling.tagName?table=!0:table=!1,table&&(form_view_elemet.getAttribute("previous_title")?(previous_title=form_view_elemet.getAttribute("previous_title"),previous_type=form_view_elemet.getAttribute("previous_type"),previous_class=form_view_elemet.getAttribute("previous_class")):(previous_title="Previous",previous_type="button",previous_class=""),next_or_previous="previous",previous=make_pagebreak_button(next_or_previous,previous_title,previous_type,previous_class,e),t.appendChild(previous))),(t=document.createElement("div")).setAttribute("id","page_numbersform_id_temp"+e),t.setAttribute("valign","middle"),t.setAttribute("align","center"),t.style.display="inline-block",t.style.width="20%",page_nav.appendChild(t),(t=document.createElement("div")).setAttribute("valign","middle"),t.setAttribute("align","right"),t.style.display="inline-block",t.style.width="40%",page_nav.appendChild(t),form_view_elemet.parentNode.nextSibling&&("DIV"==form_view_elemet.parentNode.nextSibling.tagName?table=!0:form_view_elemet.parentNode.nextSibling.nextSibling&&"DIV"==form_view_elemet.parentNode.nextSibling.nextSibling.tagName?table=!0:table=!1,table&&(form_view_elemet.getAttribute("previous_title")?(next_title=form_view_elemet.getAttribute("next_title"),next_type=form_view_elemet.getAttribute("next_type"),next_class=form_view_elemet.getAttribute("next_class")):(next_title="Next",next_type="button",next_class=""),next_or_previous="next",next=make_pagebreak_button(next_or_previous,next_title,next_type,next_class,e),t.appendChild(next)))}function generate_page_nav(e){form_view=e,document.getElementById("form_id_tempform_view"+e).parentNode.style.borderWidth="1px",jQuery(".wdform-page-and-images").each(function(){var e=jQuery(this).find(".form_id_tempform_view_img").attr("id").split("form_id_tempform_view_img");t=e[1],page_nav=document.getElementById("form_id_temppage_nav"+t),destroyChildren(page_nav),generate_buttons(t)}),generate_page_bar(),refresh_page_numbers()}function remove_page(e){jQuery("#fm_delete_page_id").val(e),fm_popup_toggle("fm_delete_page_popup_container")}function remove_field(e,t){jQuery("#fm_delete_field_id").val(e),fm_popup_toggle("fm_delete_field_popup_container"),void 0!==t&&(t.stopPropagation(),t.preventDefault())}function fm_remove_column_popup(e){jQuery(".wdform_column").removeClass("fm-column-deleting"),jQuery(e).closest(".wdform_column").addClass("fm-column-deleting"),fm_popup_toggle("fm_delete_column_popup_container")}function fm_remove_row_popup(e){jQuery(".wdform_section").removeClass("fm-row-deleting"),jQuery(e).closest(".wdform_section").addClass("fm-row-deleting"),jQuery(e).closest(".wdform_section").find(".wdform_row").length?fm_popup_toggle("fm_delete_row_popup_container"):fm_remove_section(!1)}function fm_remove_column(){jQuery(".fm-column-deleting").remove()}function remove_page_only(){id=jQuery("#fm_delete_page_id").val(),refresh_pages_without_deleting(id)}function remove_page_all(){id=jQuery("#fm_delete_page_id").val(),form_view_elemet=document.getElementById("form_id_tempform_view"+id);var e=jQuery(".wdform-page-and-images").length;if(2==e&&(jQuery(".form_id_tempform_view_img").removeClass("form_view_show").addClass("form_view_hide"),jQuery("*[id*=form_id_temppage_nav]").empty()),1==e)return form_view_elemet.innerHTML="",tbody=form_view_elemet,tr=document.createElement("div"),tr.setAttribute("class","wdform_section"),tr.style.display="table-row",tr_page_nav=document.createElement("div"),tr_page_nav.setAttribute("valign","top"),tr_page_nav.setAttribute("class","wdform_footer"),tr_page_nav.style.width="100%",td_page_nav=document.createElement("div"),td_page_nav.style.width="100%",table_min_page_nav=document.createElement("div"),table_min_page_nav.style.width="100%",table_min_page_nav.style.display="table",tbody_min_page_nav=document.createElement("div"),tbody_min_page_nav.style.display="table-row-group",tr_min_page_nav=document.createElement("div"),tr_min_page_nav.setAttribute("id","form_id_temppage_nav"+form_view),tr_min_page_nav.style.display="table-row",table_min=document.createElement("div"),table_min.setAttribute("class","wdform_column"),tr.appendChild(table_min),tbody_min_page_nav.appendChild(tr_min_page_nav),table_min_page_nav.appendChild(tbody_min_page_nav),td_page_nav.appendChild(table_min_page_nav),tr_page_nav.appendChild(td_page_nav),tbody.appendChild(tr),void tbody.appendChild(tr_page_nav);form_view_table=form_view_elemet.parentNode,document.getElementById("take").removeChild(form_view_table),refresh_pages(id)}function refresh_pages(e){temp=1,destroyChildren(document.getElementById("pages"));var t=jQuery(".wdform-page-and-images").length;generate_page_bar(),1<t?jQuery("#page_bar").removeClass("form_view_hide"):(destroyChildren(document.getElementById("edit_page_navigation")),jQuery("#page_bar").addClass("form_view_hide"),jQuery(".wdform_page").removeAttr("style"))}function refresh_pages_without_deleting(e){var t=jQuery("#form_id_tempform_view"+e);t.find(".wdform_row");2==jQuery(".wdform-page-and-images").length&&(jQuery(".form_id_tempform_view_img").removeClass("form_view_show").addClass("form_view_hide"),jQuery("*[id*=form_id_temppage_nav]").empty());var i=t.parent(),n=i.prevAll(".wdform-page-and-images:first");n.length||(n=i.nextAll(".wdform-page-and-images:first")),n.length&&(i.find(".wdform_section").each(function(e,t){var i=n.find(".wdform_section").eq(e);i.length?jQuery(t).find(".wdform_column:not(:empty)").each(function(e,t){i.append(t)}):n.find(".wdform_row_empty").before(t)}),i.remove(),refresh_pages(e),all_sortable_events())}function make_page_steps_front(){destroyChildren(document.getElementById("pages")),show_title=document.getElementById("el_show_title_input").checked,k=0,jQuery(".wdform-page-and-images").each(function(){var e=jQuery(this).find(".wdform_page").attr("id");j=e.split("form_id_tempform_view")[1],document.getElementById("form_id_tempform_view"+j).getAttribute("page_title")?w_pages=document.getElementById("form_id_tempform_view"+j).getAttribute("page_title"):w_pages="",k++,page_number=document.createElement("span"),page_number.setAttribute("id","page_"+j),page_number.setAttribute("onClick",'generate_page_nav("'+j+'")'),j==form_view?page_number.setAttribute("class","page_active"):page_number.setAttribute("class","page_deactive"),show_title?page_number.innerHTML=w_pages:page_number.innerHTML=k,document.getElementById("pages").appendChild(page_number)})}function make_page_percentage_front(){destroyChildren(document.getElementById("pages")),show_title=document.getElementById("el_show_title_input").checked;var e=document.createElement("div");e.setAttribute("class","page_percentage_deactive");var t=document.createElement("div");t.setAttribute("id","div_percentage"),t.setAttribute("class","page_percentage_active");var i=document.createElement("b");t.appendChild(i),k=0,cur_page_title="",jQuery(".wdform-page-and-images").each(function(){var e=jQuery(this).find(".wdform_page").attr("id");if(j=e.split("form_id_tempform_view")[1],document.getElementById("form_id_tempform_view"+j).getAttribute("page_title")?w_pages=document.getElementById("form_id_tempform_view"+j).getAttribute("page_title"):w_pages="",k++,j==form_view){if(show_title){var t=document.createElement("span");1==k?t.style.paddingLeft="30px":t.style.paddingLeft="5px",t.innerHTML=w_pages}page_number=k}}),i.innerHTML=Math.round((page_number-1)/k*100)+"%",t.style.width=(page_number-1)/k*100+"%",e.appendChild(t),cur_page_title&&e.appendChild(cur_page_title),document.getElementById("pages").appendChild(e)}function make_page_none_front(){var e=document.createElement("div");e.innerHTML="NO PAGE BAR",jQuery("#pages").empty(),jQuery("#pages").append(e)}function generate_page_bar(){fm_need_enable=!1,el_page_navigation(),add(0,!1),fm_need_enable=!0}function remove_add_(e){attr_name=new Array,attr_value=new Array;var t=document.getElementById(e);for(atr=t.attributes,v=0;v<30;v++)atr[v]&&0==atr[v].name.indexOf("add_")&&(attr_name.push(atr[v].name.replace("add_","")),attr_value.push(atr[v].value),t.removeAttribute(atr[v].name),v--);for(v=0;v<attr_name.length;v++)t.setAttribute(attr_name[v],attr_value[v])}function duplicate(e,a){if(jQuery("#wdform_field"+e).closest(".wdform_column").after("<div id='cur_column' class='wdform_column'></div>"),type=document.getElementById("wdform_field"+e).getAttribute("type"),document.getElementById(e+"_element_labelform_id_temp").innerHTML&&(w_field_label=document.getElementById(e+"_element_labelform_id_temp").innerHTML),labels=all_labels(),m=0,t=!0,"type_section_break"!=type){for(;t;)for(m++,k=0;k<labels.length&&(t=!0,labels[k]!=w_field_label+"("+m+")");k++)t=!1;w_field_label=w_field_label+"("+m+")"}switch(k=0,w_choices=new Array,w_choices_value=new Array,w_choices_params=new Array,w_choices_checked=new Array,w_choices_disabled=new Array,w_allow_other_num=0,w_property=new Array,w_property_values=new Array,w_choices_price=new Array,t=0,document.getElementById(e+"_label_sectionform_id_temp")&&("block"==document.getElementById(e+"_label_sectionform_id_temp").style.display?w_field_label_pos="top":w_field_label_pos="left"),document.getElementById(e+"_elementform_id_temp")&&(s=document.getElementById(e+"_elementform_id_temp").style.width,w_size=s.substring(0,s.length-2)),document.getElementById(e+"_label_sectionform_id_temp")&&(s=document.getElementById(e+"_label_sectionform_id_temp").style.width,w_field_label_size=s.substring(0,s.length-2)),document.getElementById(e+"_requiredform_id_temp")&&(w_required=document.getElementById(e+"_requiredform_id_temp").value),document.getElementById(e+"_uniqueform_id_temp")&&(w_unique=document.getElementById(e+"_uniqueform_id_temp").value),document.getElementById(e+"_label_sectionform_id_temp")&&(w_class=document.getElementById(e+"_label_sectionform_id_temp").getAttribute("class"),w_class||(w_class="")),type){case"type_editor":w_editor=document.getElementById("wdform_field"+e).innerHTML,type_editor(gen,w_editor);break;case"type_section_break":w_editor=document.getElementById(e+"_element_sectionform_id_temp").innerHTML,type_section_break(gen,w_editor);break;case"type_send_copy":h=document.getElementById(e+"_hide_labelform_id_temp").value,w_first_val=document.getElementById(e+"_elementform_id_temp").checked,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_send_copy(e,w_field_label,w_field_label_size,w_field_label_pos,h,w_first_val,w_required,w_attr_name,w_attr_value);break;case"type_text":w_first_val=document.getElementById(e+"_elementform_id_temp").value,w_title=document.getElementById(e+"_elementform_id_temp").title,w_regExp_status=document.getElementById(e+"_regExpStatusform_id_temp").value,w_regExp_value=unescape(document.getElementById(e+"_regExp_valueform_id_temp").value),w_regExp_common=document.getElementById(e+"_regExp_commonform_id_temp").value,w_regExp_arg=document.getElementById(e+"_regArgumentform_id_temp").value,w_regExp_alert=document.getElementById(e+"_regExp_alertform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],w_readonly=document.getElementById(e+"_readonlyform_id_temp").value,h=document.getElementById(e+"_hide_labelform_id_temp").value,type_text(gen,w_field_label,w_field_label_size,w_field_label_pos,h,w_size,w_first_val,w_title,w_required,w_regExp_status,w_regExp_value,w_regExp_common,w_regExp_arg,w_regExp_alert,w_unique,w_attr_name,w_attr_value,w_readonly);break;case"type_number":w_first_val=document.getElementById(e+"_elementform_id_temp").value,w_title=document.getElementById(e+"_elementform_id_temp").title,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_number(gen,w_field_label,w_field_label_size,w_field_label_pos,w_size,w_first_val,w_title,w_required,w_unique,w_class,w_attr_name,w_attr_value);break;case"type_password":w_placeholder_value=document.getElementById(e+"_elementform_id_temp").placeholder,w_verification=document.getElementById(e+"_verification_id_temp").value,document.getElementById(e+"_1_element_labelform_id_temp").innerHTML?w_verification_label=document.getElementById(e+"_1_element_labelform_id_temp").innerHTML:w_verification_label=" ",h=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_password(gen,w_field_label,w_field_label_size,w_field_label_pos,h,w_size,w_required,w_unique,w_class,w_verification,w_verification_label,w_placeholder_value,w_attr_name,w_attr_value);break;case"type_textarea":h=document.getElementById(e+"_hide_labelform_id_temp").value,w_first_val=document.getElementById(e+"_elementform_id_temp").value,w_characters_limit=document.getElementById(e+"_charlimitform_id_temp").value,w_title=document.getElementById(e+"_elementform_id_temp").title,s=document.getElementById(e+"_elementform_id_temp").style.height,w_size_h=s.substring(0,s.length-2),atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_textarea(gen,w_field_label,w_field_label_size,w_field_label_pos,h,w_size,w_size_h,w_first_val,w_characters_limit,w_title,w_required,w_unique,w_class,w_attr_name,w_attr_value);break;case"type_wdeditor":w_title=document.getElementById(e+"_elementform_id_temp").title,s=document.getElementById(e+"_elementform_id_temp").style.height,w_size_h=s.substring(0,s.length-2),w=document.getElementById(e+"_elementform_id_temp").style.width,w_size_w=w.substring(0,w.length-2),atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_wdeditor(gen,w_field_label,w_field_label_size,w_field_label_pos,w_size_w,w_size_h,w_title,w_required,w_class,w_attr_name,w_attr_value);break;case"type_phone":h=document.getElementById(e+"_hide_labelform_id_temp").value,w_first_val=[document.getElementById(e+"_element_firstform_id_temp").value,document.getElementById(e+"_element_lastform_id_temp").value],w_title=[document.getElementById(e+"_element_firstform_id_temp").title,document.getElementById(e+"_element_lastform_id_temp").title],s=document.getElementById(e+"_element_lastform_id_temp").style.width,w_size=s.substring(0,s.length-2),w_mini_labels=[document.getElementById(e+"_mini_label_area_code").innerHTML,document.getElementById(e+"_mini_label_phone_number").innerHTML],atrs=return_attributes(e+"_element_firstform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_phone(gen,w_field_label,w_field_label_size,w_field_label_pos,h,w_size,w_first_val,w_title,w_mini_labels,w_required,w_unique,w_class,w_attr_name,w_attr_value);break;case"type_phone_new":h=document.getElementById(e+"_hide_labelform_id_temp").value,w_first_val=document.getElementById(e+"_elementform_id_temp").value,w_top_country=document.getElementById(e+"_elementform_id_temp").getAttribute("top-country"),atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_phone_new(gen,w_field_label,w_field_label_size,w_field_label_pos,h,w_size,w_first_val,w_top_country,w_required,w_unique,w_class,w_attr_name,w_attr_value);break;case"type_name":if(document.getElementById(e+"_enable_fieldsform_id_temp")){w_name_format="normal",w_first_val=[document.getElementById(e+"_element_firstform_id_temp").value,document.getElementById(e+"_element_lastform_id_temp").value],w_title=[document.getElementById(e+"_element_firstform_id_temp").title,document.getElementById(e+"_element_lastform_id_temp").title];for(var r=["title","middle"],l=0;l<2;l++)w_first_val.push(document.getElementById(e+"_element_"+r[l]+"form_id_temp")?document.getElementById(e+"_element_"+r[l]+"form_id_temp").value:""),w_title.push(document.getElementById(e+"_element_"+r[l]+"form_id_temp")?document.getElementById(e+"_element_"+r[l]+"form_id_temp").title:"")}else document.getElementById(e+"_element_middleform_id_temp")?w_name_format="extended":w_name_format="normal","normal"==w_name_format?(w_first_val=[document.getElementById(e+"_element_firstform_id_temp").value,document.getElementById(e+"_element_lastform_id_temp").value],w_title=[document.getElementById(e+"_element_firstform_id_temp").title,document.getElementById(e+"_element_lastform_id_temp").title]):(w_first_val=[document.getElementById(e+"_element_firstform_id_temp").value,document.getElementById(e+"_element_lastform_id_temp").value,document.getElementById(e+"_element_titleform_id_temp").value,document.getElementById(e+"_element_middleform_id_temp").value],w_title=[document.getElementById(e+"_element_firstform_id_temp").title,document.getElementById(e+"_element_lastform_id_temp").title,document.getElementById(e+"_element_titleform_id_temp").title,document.getElementById(e+"_element_middleform_id_temp").title]);document.getElementById(e+"_mini_label_title")?w_mini_title=document.getElementById(e+"_mini_label_title").innerHTML:w_mini_title="Title",document.getElementById(e+"_mini_label_middle")?w_mini_middle=document.getElementById(e+"_mini_label_middle").innerHTML:w_mini_middle="Middle",h=document.getElementById(e+"_hide_labelform_id_temp").value,w_mini_labels=[w_mini_title,document.getElementById(e+"_mini_label_first").innerHTML,document.getElementById(e+"_mini_label_last").innerHTML,w_mini_middle],w_name_title=document.getElementById(e+"_enable_fieldsform_id_temp")?document.getElementById(e+"_enable_fieldsform_id_temp").getAttribute("title"):"normal"==w_name_format?"no":"yes",w_name_middle=document.getElementById(e+"_enable_fieldsform_id_temp")?document.getElementById(e+"_enable_fieldsform_id_temp").getAttribute("middle"):"normal"==w_name_format?"no":"yes",w_name_fields=[w_name_title,w_name_middle],w_autofill=document.getElementById(e+"_autofillform_id_temp").value,s=document.getElementById(e+"_element_firstform_id_temp").style.width,w_size=s.substring(0,s.length-2),atrs=return_attributes(e+"_element_firstform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_name(gen,w_field_label,w_field_label_size,w_field_label_pos,h,w_first_val,w_title,w_mini_labels,w_size,w_name_format,w_required,w_unique,w_class,w_attr_name,w_attr_value,w_name_fields,w_autofill);break;case"type_paypal_price":w_first_val=[document.getElementById(e+"_element_dollarsform_id_temp").value,document.getElementById(e+"_element_centsform_id_temp").value],w_title=[document.getElementById(e+"_element_dollarsform_id_temp").title,document.getElementById(e+"_element_centsform_id_temp").title],"none"==document.getElementById(e+"_td_name_cents").style.display?w_hide_cents="yes":w_hide_cents="no",s=document.getElementById(e+"_element_dollarsform_id_temp").style.width,w_size=s.substring(0,s.length-2),atrs=return_attributes(e+"_element_dollarsform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],w_range_min=document.getElementById(e+"_range_minform_id_temp").value,w_range_max=document.getElementById(e+"_range_maxform_id_temp").value,w_mini_labels=[document.getElementById(e+"_mini_label_dollars").innerHTML,document.getElementById(e+"_mini_label_cents").innerHTML],type_paypal_price(gen,w_field_label,w_field_label_size,w_field_label_pos,w_first_val,w_title,w_mini_labels,w_size,w_required,w_hide_cents,w_class,w_attr_name,w_attr_value,w_range_min,w_range_max);break;case"type_paypal_price_new":w_first_val=document.getElementById(e+"_elementform_id_temp").value,w_title=document.getElementById(e+"_elementform_id_temp").title,s=document.getElementById(e+"_elementform_id_temp").style.width,w_size=s.substring(0,s.length-2),atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],w_range_min=document.getElementById(e+"_range_minform_id_temp").value,w_range_max=document.getElementById(e+"_range_maxform_id_temp").value,w_readonly=document.getElementById(e+"_readonlyform_id_temp").value,h=document.getElementById(e+"_hide_labelform_id_temp").value,"none"==document.getElementById(e+"_td_name_currency").style.display?w_currency="yes":w_currency="no",type_paypal_price_new(gen,w_field_label,w_field_label_size,w_field_label_pos,h,w_first_val,w_title,w_size,w_required,w_class,w_attr_name,w_attr_value,w_range_min,w_range_max,w_readonly,w_currency);break;case"type_address":s=document.getElementById(e+"_div_address").style.width,w_size=s.substring(0,s.length-2),document.getElementById(e+"_mini_label_street1")?w_street1=document.getElementById(e+"_mini_label_street1").innerHTML:w_street1=document.getElementById(e+"_street1form_id_temp").value,document.getElementById(e+"_mini_label_street2")?w_street2=document.getElementById(e+"_mini_label_street2").innerHTML:w_street2=document.getElementById(e+"_street2form_id_temp").value,document.getElementById(e+"_mini_label_city")?w_city=document.getElementById(e+"_mini_label_city").innerHTML:w_city=document.getElementById(e+"_cityform_id_temp").value,document.getElementById(e+"_mini_label_state")?w_state=document.getElementById(e+"_mini_label_state").innerHTML:w_state=document.getElementById(e+"_stateform_id_temp").value,document.getElementById(e+"_mini_label_postal")?w_postal=document.getElementById(e+"_mini_label_postal").innerHTML:w_postal=document.getElementById(e+"_postalform_id_temp").value,document.getElementById(e+"_mini_label_country")?w_country=document.getElementById(e+"_mini_label_country").innerHTML:w_country=document.getElementById(e+"_countryform_id_temp").value,w_mini_labels=[w_street1,w_street2,w_city,w_state,w_postal,w_country];var d=document.getElementById(e+"_disable_fieldsform_id_temp");w_street1_dis=d.getAttribute("street1"),w_street2_dis=d.getAttribute("street2"),w_city_dis=d.getAttribute("city"),w_state_dis=d.getAttribute("state"),w_us_states_dis=d.getAttribute("us_states"),w_postal_dis=d.getAttribute("postal"),w_country_dis=d.getAttribute("country"),w_disabled_fields=[w_street1_dis,w_street2_dis,w_city_dis,w_state_dis,w_postal_dis,w_country_dis,w_us_states_dis],h=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_street1form_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_address(gen,w_field_label,w_field_label_size,w_field_label_pos,h,w_size,w_mini_labels,w_disabled_fields,w_required,w_class,w_attr_name,w_attr_value);break;case"type_submitter_mail":h=document.getElementById(e+"_hide_labelform_id_temp").value,w_first_val=document.getElementById(e+"_elementform_id_temp").value,w_title=document.getElementById(e+"_elementform_id_temp").title,w_autofill=document.getElementById(e+"_autofillform_id_temp").value,w_verification=document.getElementById(e+"_verification_id_temp").value,w_verification_placeholder=document.getElementById(e+"_1_elementform_id_temp").title,document.getElementById(e+"_1_element_labelform_id_temp").innerHTML?w_verification_label=document.getElementById(e+"_1_element_labelform_id_temp").innerHTML:w_verification_label=" ",atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_submitter_mail(gen,w_field_label,w_field_label_size,w_field_label_pos,h,w_size,w_first_val,w_title,w_required,w_unique,w_class,w_verification,w_verification_label,w_verification_placeholder,w_attr_name,w_attr_value,w_autofill);break;case"type_checkbox":if(w_randomize=document.getElementById(e+"_randomizeform_id_temp").value,w_allow_other=document.getElementById(e+"_allow_otherform_id_temp").value,w_limit_choice=document.getElementById(e+"_limitchoice_numform_id_temp").value,w_limit_choice_alert=document.getElementById(e+"_limitchoicealert_numform_id_temp").value,document.getElementById(e+"_rowcol_numform_id_temp").value?(document.getElementById(e+"_table_little").getAttribute("for_hor")?w_flow="hor":w_flow="ver",w_rowcol=document.getElementById(e+"_rowcol_numform_id_temp").value):(document.getElementById(e+"_hor")?w_flow="hor":w_flow="ver",w_rowcol=1),v=0,"ver"==w_flow){var _=document.getElementById(e+"_table_little");for(k=0;k<_.childNodes.length;k++){var o=_.childNodes[k];for(m=0;m<o.childNodes.length;m++){var u=o.childNodes[m].getAttribute("idi");document.getElementById(e+"_elementform_id_temp"+u).getAttribute("other")&&"1"==document.getElementById(e+"_elementform_id_temp"+u).getAttribute("other")&&(w_allow_other_num=t),w_choices[t]=document.getElementById(e+"_label_element"+u).innerHTML,w_choices_checked[t]=document.getElementById(e+"_elementform_id_temp"+u).checked,w_choices_value[t]=document.getElementById(e+"_elementform_id_temp"+u).value,document.getElementById(e+"_label_element"+u).getAttribute("where")?w_choices_params[t]=document.getElementById(e+"_label_element"+u).getAttribute("where")+"[where_order_by]"+document.getElementById(e+"_label_element"+u).getAttribute("order_by")+"[db_info]"+document.getElementById(e+"_label_element"+u).getAttribute("db_info"):w_choices_params[t]="",t++,v=u}}}else{var c=(p=(_=document.getElementById(e+"_table_little")).childNodes)[0].childNodes;for(k=0;k<c.length;k++)for(m=0;m<p.length;m++)if(p[m].childNodes[k]){u=(o=p[m].childNodes[k]).getAttribute("idi");document.getElementById(e+"_elementform_id_temp"+u).getAttribute("other")&&"1"==document.getElementById(e+"_elementform_id_temp"+u).getAttribute("other")&&(w_allow_other_num=t),w_choices[t]=document.getElementById(e+"_label_element"+u).innerHTML,w_choices_checked[t]=document.getElementById(e+"_elementform_id_temp"+u).checked,w_choices_value[t]=document.getElementById(e+"_elementform_id_temp"+u).value,document.getElementById(e+"_label_element"+u).getAttribute("where")?w_choices_params[t]=document.getElementById(e+"_label_element"+u).getAttribute("where")+"[where_order_by]"+document.getElementById(e+"_label_element"+u).getAttribute("order_by")+"[db_info]"+document.getElementById(e+"_label_element"+u).getAttribute("db_info"):w_choices_params[t]="",t++,v=u}}document.getElementById(e+"_option_left_right")?w_field_option_pos=document.getElementById(e+"_option_left_right").value:w_field_option_pos="left",w_value_disabled=document.getElementById(e+"_value_disabledform_id_temp").value,w_use_for_submission=document.getElementById(e+"_use_for_submissionform_id_temp").value,h=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"+v),w_attr_name=atrs[0],w_attr_value=atrs[1],type_checkbox(gen,w_field_label,w_field_label_size,w_field_label_pos,w_field_option_pos,h,w_flow,w_choices,w_choices_checked,w_rowcol,w_limit_choice,w_limit_choice_alert,w_required,w_randomize,w_allow_other,w_allow_other_num,w_class,w_attr_name,w_attr_value,w_value_disabled,w_choices_value,w_choices_params,w_use_for_submission);break;case"type_paypal_checkbox":for(document.getElementById(e+"_hor")?w_flow="hor":w_flow="ver",w_randomize=document.getElementById(e+"_randomizeform_id_temp").value,w_allow_other=document.getElementById(e+"_allow_otherform_id_temp").value,v=0,k=0;k<100;k++)if(document.getElementById(e+"_elementform_id_temp"+k)&&(document.getElementById(e+"_elementform_id_temp"+k).getAttribute("other")&&"1"==document.getElementById(e+"_elementform_id_temp"+k).getAttribute("other")&&(w_allow_other_num=t),w_choices[t]=document.getElementById(e+"_label_element"+k).innerHTML,w_choices_price[t]=document.getElementById(e+"_elementform_id_temp"+k).value,w_choices_checked[t]=document.getElementById(e+"_elementform_id_temp"+k).checked,document.getElementById(e+"_label_element"+k).getAttribute("where")?w_choices_params[t]=document.getElementById(e+"_label_element"+k).getAttribute("where")+"[where_order_by]"+document.getElementById(e+"_label_element"+k).getAttribute("order_by")+"[db_info]"+document.getElementById(e+"_label_element"+k).getAttribute("db_info"):w_choices_params[t]="",t++,v=k),document.getElementById(e+"_propertyform_id_temp"+k))if(w_property.push(document.getElementById(e+"_property_label_form_id_temp"+k).innerHTML),document.getElementById(e+"_propertyform_id_temp"+k).childNodes.length)for(w_property_values[w_property.length-1]=new Array,m=0;m<document.getElementById(e+"_propertyform_id_temp"+k).childNodes.length;m++)w_property_values[w_property.length-1].push(document.getElementById(e+"_propertyform_id_temp"+k).childNodes[m].value);else w_property_values.push("");w_quantity="no",w_quantity_value=1,document.getElementById(e+"_element_quantityform_id_temp")&&(w_quantity="yes",w_quantity_value=document.getElementById(e+"_element_quantityform_id_temp").value),document.getElementById(e+"_option_left_right")?w_field_option_pos=document.getElementById(e+"_option_left_right").value:w_field_option_pos="left",h=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"+v),w_attr_name=atrs[0],w_attr_value=atrs[1],type_paypal_checkbox(gen,w_field_label,w_field_label_size,w_field_label_pos,w_field_option_pos,h,w_flow,w_choices,w_choices_price,w_choices_checked,w_required,w_randomize,w_allow_other,w_allow_other_num,w_class,w_attr_name,w_attr_value,w_property,w_property_values,w_quantity,w_quantity_value,w_choices_params);break;case"type_radio":if(w_randomize=document.getElementById(e+"_randomizeform_id_temp").value,w_allow_other=document.getElementById(e+"_allow_otherform_id_temp").value,document.getElementById(e+"_rowcol_numform_id_temp").value?(document.getElementById(e+"_table_little").getAttribute("for_hor")?w_flow="hor":w_flow="ver",w_rowcol=document.getElementById(e+"_rowcol_numform_id_temp").value):(document.getElementById(e+"_table_little").getAttribute("for_hor")?w_flow="hor":w_flow="ver",w_rowcol=1),v=0,"ver"==w_flow){_=document.getElementById(e+"_table_little");for(k=0;k<_.childNodes.length;k++){o=_.childNodes[k];for(m=0;m<o.childNodes.length;m++){u=o.childNodes[m].getAttribute("idi");document.getElementById(e+"_elementform_id_temp"+u).getAttribute("other")&&"1"==document.getElementById(e+"_elementform_id_temp"+u).getAttribute("other")&&(w_allow_other_num=t),w_choices[t]=document.getElementById(e+"_label_element"+u).innerHTML,w_choices_checked[t]=document.getElementById(e+"_elementform_id_temp"+u).checked,w_choices_value[t]=document.getElementById(e+"_elementform_id_temp"+u).value,document.getElementById(e+"_label_element"+u).getAttribute("where")?w_choices_params[t]=document.getElementById(e+"_label_element"+u).getAttribute("where")+"[where_order_by]"+document.getElementById(e+"_label_element"+u).getAttribute("order_by")+"[db_info]"+document.getElementById(e+"_label_element"+u).getAttribute("db_info"):w_choices_params[t]="",t++,v=u}}}else{var p;c=(p=(_=document.getElementById(e+"_table_little")).childNodes)[0].childNodes;for(k=0;k<c.length;k++)for(m=0;m<p.length;m++)if(p[m].childNodes[k]){u=(o=p[m].childNodes[k]).getAttribute("idi");document.getElementById(e+"_elementform_id_temp"+u).getAttribute("other")&&"1"==document.getElementById(e+"_elementform_id_temp"+u).getAttribute("other")&&(w_allow_other_num=t),w_choices[t]=document.getElementById(e+"_label_element"+u).innerHTML,w_choices_checked[t]=document.getElementById(e+"_elementform_id_temp"+u).checked,w_choices_value[t]=document.getElementById(e+"_elementform_id_temp"+u).value,document.getElementById(e+"_label_element"+u).getAttribute("where")?w_choices_params[t]=document.getElementById(e+"_label_element"+u).getAttribute("where")+"[where_order_by]"+document.getElementById(e+"_label_element"+u).getAttribute("order_by")+"[db_info]"+document.getElementById(e+"_label_element"+u).getAttribute("db_info"):w_choices_params[t]="",t++,v=u}}document.getElementById(e+"_option_left_right")?w_field_option_pos=document.getElementById(e+"_option_left_right").value:w_field_option_pos="left",w_value_disabled=document.getElementById(e+"_value_disabledform_id_temp").value,w_use_for_submission=document.getElementById(e+"_use_for_submissionform_id_temp").value,h=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"+v),w_attr_name=atrs[0],w_attr_value=atrs[1],type_radio(gen,w_field_label,w_field_label_size,w_field_label_pos,w_field_option_pos,h,w_flow,w_choices,w_choices_checked,w_rowcol,w_required,w_randomize,w_allow_other,w_allow_other_num,w_class,w_attr_name,w_attr_value,w_value_disabled,w_choices_value,w_choices_params,w_use_for_submission);break;case"type_paypal_radio":for(document.getElementById(e+"_hor")?w_flow="hor":w_flow="ver",w_randomize=document.getElementById(e+"_randomizeform_id_temp").value,w_allow_other=document.getElementById(e+"_allow_otherform_id_temp").value,v=0,k=0;k<100;k++)if(document.getElementById(e+"_elementform_id_temp"+k)&&(document.getElementById(e+"_elementform_id_temp"+k).getAttribute("other")&&"1"==document.getElementById(e+"_elementform_id_temp"+k).getAttribute("other")&&(w_allow_other_num=t),w_choices[t]=document.getElementById(e+"_label_element"+k).innerHTML,w_choices_price[t]=document.getElementById(e+"_elementform_id_temp"+k).value,w_choices_checked[t]=document.getElementById(e+"_elementform_id_temp"+k).checked,document.getElementById(e+"_label_element"+k).getAttribute("where")?w_choices_params[t]=document.getElementById(e+"_label_element"+k).getAttribute("where")+"[where_order_by]"+document.getElementById(e+"_label_element"+k).getAttribute("order_by")+"[db_info]"+document.getElementById(e+"_label_element"+k).getAttribute("db_info"):w_choices_params[t]="",t++,v=k),document.getElementById(e+"_propertyform_id_temp"+k))if(w_property.push(document.getElementById(e+"_property_label_form_id_temp"+k).innerHTML),document.getElementById(e+"_propertyform_id_temp"+k).childNodes.length)for(w_property_values[w_property.length-1]=new Array,m=0;m<document.getElementById(e+"_propertyform_id_temp"+k).childNodes.length;m++)w_property_values[w_property.length-1].push(document.getElementById(e+"_propertyform_id_temp"+k).childNodes[m].value);else w_property_values.push("");w_quantity="no",w_quantity_value=1,document.getElementById(e+"_element_quantityform_id_temp")&&(w_quantity="yes",w_quantity_value=document.getElementById(e+"_element_quantityform_id_temp").value),document.getElementById(e+"_option_left_right")?w_field_option_pos=document.getElementById(e+"_option_left_right").value:w_field_option_pos="left",h=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"+v),w_attr_name=atrs[0],w_attr_value=atrs[1],type_paypal_radio(gen,w_field_label,w_field_label_size,w_field_label_pos,w_field_option_pos,h,w_flow,w_choices,w_choices_price,w_choices_checked,w_required,w_randomize,w_allow_other,w_allow_other_num,w_class,w_attr_name,w_attr_value,w_property,w_property_values,w_quantity,w_quantity_value,w_choices_params);break;case"type_paypal_shipping":for(document.getElementById(e+"_hor")?w_flow="hor":w_flow="ver",w_randomize=document.getElementById(e+"_randomizeform_id_temp").value,w_allow_other=document.getElementById(e+"_allow_otherform_id_temp").value,v=0,k=0;k<100;k++)if(document.getElementById(e+"_elementform_id_temp"+k)&&(document.getElementById(e+"_elementform_id_temp"+k).getAttribute("other")&&"1"==document.getElementById(e+"_elementform_id_temp"+k).getAttribute("other")&&(w_allow_other_num=t),w_choices[t]=document.getElementById(e+"_label_element"+k).innerHTML,w_choices_price[t]=document.getElementById(e+"_elementform_id_temp"+k).value,w_choices_checked[t]=document.getElementById(e+"_elementform_id_temp"+k).checked,document.getElementById(e+"_label_element"+k).getAttribute("where")?w_choices_params[t]=document.getElementById(e+"_label_element"+k).getAttribute("where")+"[where_order_by]"+document.getElementById(e+"_label_element"+k).getAttribute("order_by")+"[db_info]"+document.getElementById(e+"_label_element"+k).getAttribute("db_info"):w_choices_params[t]="",t++,v=k),document.getElementById(e+"_propertyform_id_temp"+k))if(w_property.push(document.getElementById(e+"_property_label_form_id_temp"+k).innerHTML),document.getElementById(e+"_propertyform_id_temp"+k).childNodes.length)for(w_property_values[w_property.length-1]=new Array,m=0;m<document.getElementById(e+"_propertyform_id_temp"+k).childNodes.length;m++)w_property_values[w_property.length-1].push(document.getElementById(e+"_propertyform_id_temp"+k).childNodes[m].value);else w_property_values.push("");document.getElementById(e+"_option_left_right")?w_field_option_pos=document.getElementById(e+"_option_left_right").value:w_field_option_pos="left",h=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"+v),w_attr_name=atrs[0],w_attr_value=atrs[1],type_paypal_shipping(gen,w_field_label,w_field_label_size,w_field_label_pos,w_field_option_pos,h,w_flow,w_choices,w_choices_price,w_choices_checked,w_required,w_randomize,w_allow_other,w_allow_other_num,w_class,w_attr_name,w_attr_value,w_property,w_property_values,w_choices_params);break;case"type_paypal_total":h=document.getElementById(e+"_hide_labelform_id_temp").value,w_size=jQuery("#"+e+"paypal_totalform_id_temp").css("width")?jQuery("#"+e+"paypal_totalform_id_temp").css("width").substring(0,jQuery("#"+e+"paypal_totalform_id_temp").css("width").length-2):"300",w_hide_total_currency=document.getElementById(e+"_hide_totalcurrency_id_temp").value,type_paypal_total(gen,w_field_label,w_field_label_size,w_field_label_pos,h,w_class,w_size,w_hide_total_currency);break;case"type_stripe":h=document.getElementById(e+"_hide_labelform_id_temp").value,type_stripe(gen,w_field_label,w_field_label_size,w_field_label_pos,h,w_size,w_class);break;case"type_star_rating":h=document.getElementById(e+"_hide_labelform_id_temp").value,w_star_amount=document.getElementById(e+"_star_amountform_id_temp").value,w_field_label_col=document.getElementById(e+"_star_colorform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_star_rating(gen,w_field_label,w_field_label_size,w_field_label_pos,h,w_field_label_col,w_star_amount,w_required,w_class,w_attr_name,w_attr_value);break;case"type_scale_rating":h=document.getElementById(e+"_hide_labelform_id_temp").value,w_mini_labels=[document.getElementById(e+"_mini_label_worst").innerHTML,document.getElementById(e+"_mini_label_best").innerHTML],w_scale_amount=document.getElementById(e+"_scale_amountform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_scale_rating(gen,w_field_label,w_field_label_size,w_field_label_pos,h,w_mini_labels,w_scale_amount,w_required,w_class,w_attr_name,w_attr_value);break;case"type_spinner":h=document.getElementById(e+"_hide_labelform_id_temp").value,w_field_min_value=document.getElementById(e+"_min_valueform_id_temp").value,w_field_max_value=document.getElementById(e+"_max_valueform_id_temp").value,w_field_width=document.getElementById(e+"_spinner_widthform_id_temp").value,w_field_step=document.getElementById(e+"_stepform_id_temp").value,w_field_value=document.getElementById(e+"_elementform_id_temp").getAttribute("aria-valuenow"),atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_spinner(gen,w_field_label,w_field_label_size,w_field_label_pos,h,w_field_width,w_field_min_value,w_field_max_value,w_field_step,w_field_value,w_required,w_class,w_attr_name,w_attr_value);break;case"type_slider":h=document.getElementById(e+"_hide_labelform_id_temp").value,w_field_min_value=document.getElementById(e+"_slider_min_valueform_id_temp").value,w_field_max_value=document.getElementById(e+"_slider_max_valueform_id_temp").value,w_field_step=document.getElementById(e+"_slider_stepform_id_temp")&&document.getElementById(e+"_slider_stepform_id_temp").value?document.getElementById(e+"_slider_stepform_id_temp").value:1,w_field_width=document.getElementById(e+"_slider_widthform_id_temp").value,w_field_value=document.getElementById(e+"_slider_valueform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_slider(gen,w_field_label,w_field_label_size,w_field_label_pos,h,w_field_width,w_field_min_value,w_field_max_value,w_field_step,w_field_value,w_required,w_class,w_attr_name,w_attr_value);break;case"type_range":h=document.getElementById(e+"_hide_labelform_id_temp").value,w_field_range_width=document.getElementById(e+"_range_widthform_id_temp").value,w_field_range_step=document.getElementById(e+"_range_stepform_id_temp").value,w_field_value1=document.getElementById(e+"_elementform_id_temp0").getAttribute("aria-valuenow"),w_field_value2=document.getElementById(e+"_elementform_id_temp1").getAttribute("aria-valuenow"),atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],w_mini_labels=[document.getElementById(e+"_mini_label_from").innerHTML,document.getElementById(e+"_mini_label_to").innerHTML],type_range(gen,w_field_label,w_field_label_size,w_field_label_pos,h,w_field_range_width,w_field_range_step,w_field_value1,w_field_value2,w_mini_labels,w_required,w_class,w_attr_name,w_attr_value);break;case"type_grading":for(w_total=document.getElementById(e+"_grading_totalform_id_temp").value,w_items=[],k=0;k<100;k++)document.getElementById(e+"_label_elementform_id_temp"+k)&&w_items.push(document.getElementById(e+"_label_elementform_id_temp"+k).innerHTML);h=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_grading(gen,w_field_label,w_field_label_size,w_field_label_pos,h,w_items,w_total,w_required,w_class,w_attr_name,w_attr_value),refresh_grading_items(e);break;case"type_matrix":for(w_rows=[],w_rows[0]="",k=1;k<100;k++)document.getElementById(e+"_label_elementform_id_temp"+k+"_0")&&w_rows.push(document.getElementById(e+"_label_elementform_id_temp"+k+"_0").innerHTML);for(w_columns=[],w_columns[0]="",k=1;k<100;k++)document.getElementById(e+"_label_elementform_id_temp0_"+k)&&w_columns.push(document.getElementById(e+"_label_elementform_id_temp0_"+k).innerHTML);h=document.getElementById(e+"_hide_labelform_id_temp").value,w_field_input_type=document.getElementById(e+"_input_typeform_id_temp").value,w_textbox_size=document.getElementById(e+"_textbox_sizeform_id_temp")?document.getElementById(e+"_textbox_sizeform_id_temp").value:"100",atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_matrix(gen,w_field_label,w_field_label_size,w_field_label_pos,h,w_field_input_type,w_rows,w_columns,w_required,w_class,w_attr_name,w_attr_value,w_textbox_size),refresh_matrix(e);break;case"type_time":h=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_hhform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],w_hh=document.getElementById(e+"_hhform_id_temp").value,w_mm=document.getElementById(e+"_mmform_id_temp").value,document.getElementById(e+"_ssform_id_temp")?(w_ss=document.getElementById(e+"_ssform_id_temp").value,w_sec="1",w_mini_label_ss=document.getElementById(e+"_mini_label_ss").innerHTML):(w_ss="",w_sec="0",w_mini_label_ss=""),document.getElementById(e+"_am_pm_select")?(w_am_pm=document.getElementById(e+"_am_pmform_id_temp").value,w_time_type="12",w_mini_labels=[document.getElementById(e+"_mini_label_hh").innerHTML,document.getElementById(e+"_mini_label_mm").innerHTML,w_mini_label_ss,document.getElementById(e+"_mini_label_am_pm").innerHTML]):(w_am_pm=0,w_time_type="24",w_mini_labels=[document.getElementById(e+"_mini_label_hh").innerHTML,document.getElementById(e+"_mini_label_mm").innerHTML,w_mini_label_ss,"AM/PM"]),type_time(gen,w_field_label,w_field_label_size,w_field_label_pos,h,w_time_type,w_am_pm,w_sec,w_hh,w_mm,w_ss,w_mini_labels,w_required,w_class,w_attr_name,w_attr_value);break;case"type_date":atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],w_date=document.getElementById(e+"_elementform_id_temp").value,w_format=document.getElementById(e+"_buttonform_id_temp").getAttribute("format"),w_but_val=document.getElementById(e+"_buttonform_id_temp").value,w_disable_past_days=document.getElementById(e+"_dis_past_daysform_id_temp")?document.getElementById(e+"_dis_past_daysform_id_temp").value:"no",type_date(gen,w_field_label,w_field_label_size,w_field_label_pos,w_date,w_required,w_class,w_format,w_but_val,w_attr_name,w_attr_value,w_disable_past_days);break;case"type_date_new":h=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],w_date=document.getElementById(e+"_elementform_id_temp").value,w_format=document.getElementById(e+"_buttonform_id_temp").getAttribute("format"),w_but_val=document.getElementById(e+"_buttonform_id_temp").value,w_start_day=document.getElementById(e+"_start_dayform_id_temp").value,w_default_date=document.getElementById(e+"_default_date_id_temp").value,w_min_date=document.getElementById(e+"_min_date_id_temp").value,w_max_date=document.getElementById(e+"_max_date_id_temp").value,w_invalid_dates=document.getElementById(e+"_invalid_dates_id_temp").value,w_hide_time=document.getElementById(e+"_hide_timeform_id_temp").value,w_show_image=document.getElementById(e+"_show_imageform_id_temp").value,w_disable_past_days=document.getElementById(e+"_dis_past_daysform_id_temp")?document.getElementById(e+"_dis_past_daysform_id_temp").value:"no";var f=document.getElementById(e+"_show_week_days");w_sunday=f.getAttribute("sunday"),w_monday=f.getAttribute("monday"),w_tuesday=f.getAttribute("tuesday"),w_wednesday=f.getAttribute("wednesday"),w_thursday=f.getAttribute("thursday"),w_friday=f.getAttribute("friday"),w_saturday=f.getAttribute("saturday"),w_show_days=[w_sunday,w_monday,w_tuesday,w_wednesday,w_thursday,w_friday,w_saturday],type_date_new(gen,w_field_label,w_field_label_size,w_field_label_pos,h,w_size,w_date,w_required,w_show_image,w_class,w_format,w_start_day,w_default_date,w_min_date,w_max_date,w_invalid_dates,w_show_days,w_hide_time,w_but_val,w_attr_name,w_attr_value,w_disable_past_days);break;case"type_date_range":atrs=return_attributes(e+"_elementform_id_temp0"),w_attr_name=atrs[0],w_attr_value=atrs[1],w_date="",w_format=document.getElementById(e+"_buttonform_id_temp").getAttribute("format"),w_but_val=document.getElementById(e+"_buttonform_id_temp").value,w_default_date_start=document.getElementById(e+"_default_date_id_temp_start").value,w_default_date_end=document.getElementById(e+"_default_date_id_temp_end").value,w_min_date=document.getElementById(e+"_min_date_id_temp").value,w_start_day=document.getElementById(e+"_start_dayform_id_temp").value,w_max_date=document.getElementById(e+"_max_date_id_temp").value,w_invalid_dates=document.getElementById(e+"_invalid_dates_id_temp").value,w_hide_time=document.getElementById(e+"_hide_timeform_id_temp").value,w_show_image=document.getElementById(e+"_show_imageform_id_temp").value,h=document.getElementById(e+"_hide_labelform_id_temp").value,s=document.getElementById(e+"_elementform_id_temp0").style.width,w_size=s.substring(0,s.length-2),w_disable_past_days=document.getElementById(e+"_dis_past_daysform_id_temp")?document.getElementById(e+"_dis_past_daysform_id_temp").value:"no";f=document.getElementById(e+"_show_week_days");w_sunday=f.getAttribute("sunday"),w_monday=f.getAttribute("monday"),w_tuesday=f.getAttribute("tuesday"),w_wednesday=f.getAttribute("wednesday"),w_thursday=f.getAttribute("thursday"),w_friday=f.getAttribute("friday"),w_saturday=f.getAttribute("saturday"),w_show_days=[w_sunday,w_monday,w_tuesday,w_wednesday,w_thursday,w_friday,w_saturday],type_date_range(gen,w_field_label,w_field_label_size,w_field_label_pos,h,w_size,w_date,w_required,w_show_image,w_class,w_format,w_start_day,w_default_date_start,w_default_date_end,w_min_date,w_max_date,w_invalid_dates,w_show_days,w_hide_time,w_but_val,w_attr_name,w_attr_value,w_disable_past_days);break;case"type_date_fields":atrs=return_attributes(e+"_dayform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],w_day=document.getElementById(e+"_dayform_id_temp").value,w_month=document.getElementById(e+"_monthform_id_temp").value,w_year=document.getElementById(e+"_yearform_id_temp").value,w_day_type=document.getElementById(e+"_dayform_id_temp").tagName,w_month_type=document.getElementById(e+"_monthform_id_temp").tagName,w_year_type=document.getElementById(e+"_yearform_id_temp").tagName,w_day_label=document.getElementById(e+"_day_label").innerHTML,w_month_label=document.getElementById(e+"_month_label").innerHTML,w_year_label=document.getElementById(e+"_year_label").innerHTML,w_min_day=document.getElementById(e+"_min_day_id_temp").value,w_min_month=document.getElementById(e+"_min_month_id_temp").value,w_min_year=document.getElementById(e+"_min_year_id_temp").value,w_min_dob_alert=document.getElementById(e+"_min_dob_alert_id_temp").value,s=document.getElementById(e+"_dayform_id_temp").style.width,w_day_size=s.substring(0,s.length-2),s=document.getElementById(e+"_monthform_id_temp").style.width,w_month_size=s.substring(0,s.length-2),s=document.getElementById(e+"_yearform_id_temp").style.width,w_year_size=s.substring(0,s.length-2),w_from=document.getElementById(e+"_yearform_id_temp").getAttribute("from"),w_to=document.getElementById(e+"_yearform_id_temp").getAttribute("to"),w_divider=document.getElementById(e+"_separator1").innerHTML,h=document.getElementById(e+"_hide_labelform_id_temp").value,type_date_fields(gen,w_field_label,w_field_label_size,w_field_label_pos,h,w_day,w_month,w_year,w_day_type,w_month_type,w_year_type,w_day_label,w_month_label,w_year_label,w_day_size,w_month_size,w_year_size,w_required,w_class,w_from,w_to,w_min_day,w_min_month,w_min_year,w_min_dob_alert,w_divider,w_attr_name,w_attr_value);break;case"type_own_select":jQuery("#"+e+"_elementform_id_temp option").each(function(){w_choices[t]=jQuery(this).html(),w_choices_value[t]=jQuery(this).val(),w_choices_checked[t]=jQuery(this)[0].selected,jQuery(this).attr("where")?w_choices_params[t]=jQuery(this).attr("where")+"[where_order_by]"+jQuery(this).attr("order_by")+"[db_info]"+jQuery(this).attr("db_info"):w_choices_params[t]="",jQuery(this).val()?w_choices_disabled[t]=!1:w_choices_disabled[t]=!0,t++}),w_value_disabled=document.getElementById(e+"_value_disabledform_id_temp").value,w_use_for_submission=document.getElementById(e+"_use_for_submissionform_id_temp").value,h=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_own_select(gen,w_field_label,w_field_label_size,w_field_label_pos,h,w_size,w_choices,w_choices_checked,w_required,w_value_disabled,w_class,w_attr_name,w_attr_value,w_choices_disabled,w_choices_value,w_choices_params,w_use_for_submission);break;case"type_paypal_select":for(jQuery("#"+e+"_elementform_id_temp option").each(function(){w_choices[t]=jQuery(this).html(),w_choices_price[t]=jQuery(this).val(),w_choices_checked[t]=jQuery(this)[0].selected,jQuery(this).attr("where")?w_choices_params[t]=jQuery(this).attr("where")+"[where_order_by]"+jQuery(this).attr("order_by")+"[db_info]"+jQuery(this).attr("db_info"):w_choices_params[t]="",""==jQuery(this)[0].value?w_choices_disabled[t]=!0:w_choices_disabled[t]=!1,t++}),k=0;k<100;k++)if(document.getElementById(e+"_propertyform_id_temp"+k))if(w_property.push(document.getElementById(e+"_property_label_form_id_temp"+k).innerHTML),document.getElementById(e+"_propertyform_id_temp"+k).childNodes.length)for(w_property_values[w_property.length-1]=new Array,m=0;m<document.getElementById(e+"_propertyform_id_temp"+k).childNodes.length;m++)w_property_values[w_property.length-1].push(document.getElementById(e+"_propertyform_id_temp"+k).childNodes[m].value);else w_property_values.push("");w_quantity="no",w_quantity_value=1,document.getElementById(e+"_element_quantityform_id_temp")&&(w_quantity="yes",w_quantity_value=document.getElementById(e+"_element_quantityform_id_temp").value),h=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_paypal_select(gen,w_field_label,w_field_label_size,w_field_label_pos,h,w_size,w_choices,w_choices_price,w_choices_checked,w_required,w_quantity,w_quantity_value,w_class,w_attr_name,w_attr_value,w_choices_disabled,w_property,w_property_values,w_choices_params);break;case"type_country":for(w_countries=[],select_=document.getElementById(e+"_elementform_id_temp"),n=select_.childNodes.length,i=0;i<n;i++)w_countries.push(select_.childNodes[i].value);h=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_country(gen,w_field_label,w_field_label_size,h,w_countries,w_field_label_pos,w_size,w_required,w_class,w_attr_name,w_attr_value);break;case"type_file_upload":h=document.getElementById(e+"_hide_labelform_id_temp").value,g=document.getElementById(e+"_destination").value.replace("***destinationverj"+e+"***","").replace("***destinationskizb"+e+"***",""),w_extension=document.getElementById(e+"_extension").value.replace("***extensionverj"+e+"***","").replace("***extensionskizb"+e+"***",""),w_max_size=document.getElementById(e+"_max_size").value.replace("***max_sizeverj"+e+"***","").replace("***max_sizeskizb"+e+"***",""),w_multiple=document.getElementById(e+"_elementform_id_temp").getAttribute("multiple")?"yes":"no",atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_file_upload(gen,w_field_label,w_field_label_size,w_field_label_pos,h,g,w_extension,w_max_size,w_required,w_multiple,w_class,w_attr_name,w_attr_value);break;case"type_map":for(w_lat=[],w_long=[],w_info=[],w_center_x=document.getElementById(e+"_elementform_id_temp").getAttribute("center_x"),w_center_y=document.getElementById(e+"_elementform_id_temp").getAttribute("center_y"),w_zoom=document.getElementById(e+"_elementform_id_temp").getAttribute("zoom"),y=parseInt(document.getElementById(e+"_elementform_id_temp").style.width),b=parseInt(document.getElementById(e+"_elementform_id_temp").style.height),j=0;j<=20;j++)document.getElementById(e+"_elementform_id_temp").getAttribute("lat"+j)&&(w_lat.push(document.getElementById(e+"_elementform_id_temp").getAttribute("lat"+j)),w_long.push(document.getElementById(e+"_elementform_id_temp").getAttribute("long"+j)),w_info.push(document.getElementById(e+"_elementform_id_temp").getAttribute("info"+j)));atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_map(gen,w_center_x,w_center_y,w_long,w_lat,w_zoom,y,b,w_class,w_info,w_attr_name,w_attr_value);break;case"type_mark_map":w_info=document.getElementById(e+"_elementform_id_temp").getAttribute("info0"),w_long=document.getElementById(e+"_elementform_id_temp").getAttribute("long0"),w_lat=document.getElementById(e+"_elementform_id_temp").getAttribute("lat0"),w_zoom=document.getElementById(e+"_elementform_id_temp").getAttribute("zoom"),y=parseInt(document.getElementById(e+"_elementform_id_temp").style.width),b=parseInt(document.getElementById(e+"_elementform_id_temp").style.height),w_center_x=document.getElementById(e+"_elementform_id_temp").getAttribute("center_x"),w_center_y=document.getElementById(e+"_elementform_id_temp").getAttribute("center_y"),h=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_mark_map(gen,w_field_label,w_field_label_size,w_field_label_pos,h,w_center_x,w_center_y,w_long,w_lat,w_zoom,y,b,w_class,w_info,w_attr_name,w_attr_value);break;case"type_submit_reset":atrs=return_attributes(e+"_element_submitform_id_temp"),w_act=!("none"==document.getElementById(e+"_element_resetform_id_temp").style.display),w_attr_name=atrs[0],w_attr_value=atrs[1],w_submit_title=document.getElementById(e+"_element_submitform_id_temp").value,w_reset_title=document.getElementById(e+"_element_resetform_id_temp").value,type_submit_reset(gen,w_submit_title,w_reset_title,w_class,w_act,w_attr_name,w_attr_value);break;case"type_button":for(w_title=new Array,w_func=new Array,t=0,v=0,k=0;k<100;k++)document.getElementById(e+"_elementform_id_temp"+k)&&(w_title[t]=document.getElementById(e+"_elementform_id_temp"+k).value,w_func[t]=document.getElementById(e+"_elementform_id_temp"+k).getAttribute("onclick"),t++,v=k);atrs=return_attributes(e+"_elementform_id_temp"+v),w_attr_name=atrs[0],w_attr_value=atrs[1],type_button(gen,w_title,w_func,w_class,w_attr_name,w_attr_value);break;case"type_hidden":w_value=document.getElementById(e+"_elementform_id_temp").value,w_name=document.getElementById(e+"_elementform_id_temp").name,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_hidden(gen,w_name,w_value,w_attr_name,w_attr_value);break;case"type_signature":var h=document.getElementById(e+"_hide_labelform_id_temp").value,y=document.getElementById(e+"_canvasform_id_temp").style.width,b=document.getElementById(e+"_canvasform_id_temp").style.height,g=document.getElementById(e+"_destination").value.replace("***destinationskizb"+e+"***","").replace("***destinationverj"+e+"***",""),E={field_type:"type_signature",field_label:w_field_label,field_label_pos:w_field_label_pos,field_label_hide:h,required:w_required,field_label_size:w_field_label_size,canvas:{width:parseInt(y),height:parseInt(b)},class:w_class,destination:g};type_signature(gen,E)}add(0,fm_need_enable=!1),fm_need_enable=!0,void 0!==a&&(a.stopPropagation(),a.preventDefault())}function fm_columns_refresh(){jQuery(".wdform_column:not(#add_field_cont):empty").remove(),jQuery(".fm-form-builder .wdform_column:not(#add_field_cont)").before(jQuery('<div class="wdform_column fm-hidden"></div>')),jQuery(".fm-form-builder .wdform_column:not(#add_field_cont):last-child").after(jQuery('<div class="wdform_column fm-hidden"></div>')),jQuery(".fm-form-builder .wdform_section").each(function(){var e=jQuery(this);0==e.find(".wdform_column").length&&e.append('<div class="wdform_column"></div>')}),sortable_columns()}function fm_rows_refresh(){jQuery(".wdform_page").each(function(){jQuery(this).children(".wdform_row_empty").remove(),0===jQuery(this).find(".wdform_row_empty").length&&jQuery(this).find(".wdform_footer").before(jQuery('<div class="wdform_row_empty"><div><span class="add_row_icon fm-ico-plus-circle"></span><span class="add_row_button">'+form_maker_manage.add_column+"</span></div></div>"))}),jQuery(".wdform_row_empty > div").off("click").on("click",function(){var e=jQuery('<div><div class="wdform_column"></div></div>').addClass("wdform_section");jQuery(this).closest(".wdform_row_empty").before(e),fm_row_handle(e),all_sortable_events()}),sortable_columns()}function fm_convert_form_structure(){jQuery(".wdform-page-and-images").each(function(){var e=jQuery(this);e.addClass("fm-form-builder");e.find(".wdform_section").length;e.find(".wdform_section").each(function(){var t=jQuery(this),n=t.find(".wdform_column").length;t.find(".wdform_column").each(function(){var e=jQuery(this),i=jQuery('<div class="wdform_section '+("fm-col-"+n)+'"></div>');e.find(".wdform_row").each(function(){var e=jQuery(this),t=jQuery('<div class="wdform_column"></div>').append(e);i.append(t)}),t.before(i),fm_row_handle(i)}),t.remove()})}),jQuery(".wdform_tr_section_break").remove(),all_sortable_events(),jQuery("#fm-edit-disable-overlay").remove()}function FormManageSubmitButton(i){for(null==i&&(i=!1,jQuery(window).off("beforeunload")),tox="",form_fields="",jQuery("#saving").html('<div class="fm-loading-container"><div class="fm-loading-content"></div></div>'),remove_whitespace(document.getElementById("take")),l_id_array=labels_id_array,l_label_array=labels_label_array,l_type_array=labels_type_array,l_id_removed=[],x=0;x<l_id_array.length;x++)l_id_removed[l_id_array[x]]=!0;if(jQuery(".wdform_page[id^='form_id_tempform_view']").each(function(){var e=jQuery(this).attr("id").replace("form_id_tempform_view","");if(document.getElementById("form_id_tempform_view"+e))for(wdform_page=document.getElementById("form_id_tempform_view"+e),remove_whitespace(wdform_page),n=wdform_page.childNodes.length-1,q=0;q<=n;q++)if(wdform_page.childNodes[q].getAttribute("wdid"))id=wdform_page.childNodes[q].getAttribute("wdid"),w_editor=document.getElementById(id+"_element_sectionform_id_temp").innerHTML,form_fields+=id+"*:*id*:*",form_fields+="type_section_break*:*type*:*",form_fields+="custom_"+id+"*:*w_field_label*:*",form_fields+=w_editor+"*:*w_editor*:*",form_fields+="*:*new_field*:*",i||(wdform_page.childNodes[q].innerHTML="%"+id+" - custom_"+id+"%");else if(-1==wdform_page.className.indexOf("fm-form-builder")||-1!=wdform_page.childNodes[q].className.indexOf("wdform_section"))for(wdform_section=wdform_page.childNodes[q],x=0;x<wdform_section.childNodes.length;x++)if(wdform_column=wdform_section.childNodes[x],wdform_column.firstChild)for(y=0;y<wdform_column.childNodes.length;y++)if(is_in_old=!1,wdform_row=wdform_column.childNodes[y],3!=wdform_row.nodeType&&(wdid=wdform_row.getAttribute("wdid"),wdid&&jQuery("#"+wdid+"_element_labelform_id_temp").length)){l_id=wdid,l_label=document.getElementById(wdid+"_element_labelform_id_temp").innerHTML,l_label=l_label.replace(/(\r\n|\n|\r)/gm," "),wdtype=wdform_row.firstChild.getAttribute("type");for(var t=0;t<l_id_array.length;t++)"type_address"==l_type_array[t]?(document.getElementById(l_id+"_mini_label_street1")||document.getElementById(l_id+"_mini_label_street2")||document.getElementById(l_id+"_mini_label_city")||document.getElementById(l_id+"_mini_label_state")||document.getElementById(l_id+"_mini_label_postal")||document.getElementById(l_id+"_mini_label_country"))&&(l_id_removed[l_id_array[t]]=!1):l_id_array[t]==wdid&&(l_id_removed[l_id]=!1);"type_address"==wdtype?(addr_id=parseInt(wdid),id_for_country=addr_id,document.getElementById(id_for_country+"_mini_label_street1")&&(tox=tox+addr_id+"#**id**#"+document.getElementById(id_for_country+"_mini_label_street1").innerHTML+"#**label**#type_address#****#"),addr_id++,document.getElementById(id_for_country+"_mini_label_street2")&&(tox=tox+addr_id+"#**id**#"+document.getElementById(id_for_country+"_mini_label_street2").innerHTML+"#**label**#type_address#****#"),addr_id++,document.getElementById(id_for_country+"_mini_label_city")&&(tox=tox+addr_id+"#**id**#"+document.getElementById(id_for_country+"_mini_label_city").innerHTML+"#**label**#type_address#****#"),addr_id++,document.getElementById(id_for_country+"_mini_label_state")&&(tox=tox+addr_id+"#**id**#"+document.getElementById(id_for_country+"_mini_label_state").innerHTML+"#**label**#type_address#****#"),addr_id++,document.getElementById(id_for_country+"_mini_label_postal")&&(tox=tox+addr_id+"#**id**#"+document.getElementById(id_for_country+"_mini_label_postal").innerHTML+"#**label**#type_address#****#"),addr_id++,document.getElementById(id_for_country+"_mini_label_country")&&(tox=tox+addr_id+"#**id**#"+document.getElementById(id_for_country+"_mini_label_country").innerHTML+"#**label**#type_address#****#")):tox=tox+wdid+"#**id**#"+l_label+"#**label**#"+wdtype+"#****#",id=wdid,form_fields+=wdid+"*:*id*:*",form_fields+=wdtype+"*:*type*:*",w_choices=new Array,w_choices_value=new Array,w_choices_checked=new Array,w_choices_disabled=new Array,w_choices_params=new Array,w_allow_other_num=0,w_property=new Array,w_property_type=new Array,w_property_values=new Array,w_choices_price=new Array,document.getElementById(id+"_element_labelform_id_temp").innerHTML?w_field_label=document.getElementById(id+"_element_labelform_id_temp").innerHTML.replace(/(\r\n|\n|\r)/gm," "):w_field_label=" ",document.getElementById(id+"_label_sectionform_id_temp")&&("block"==document.getElementById(id+"_label_sectionform_id_temp").style.display?w_field_label_pos="top":w_field_label_pos="left"),document.getElementById(id+"_elementform_id_temp")&&(s=document.getElementById(id+"_elementform_id_temp").style.width,w_size=s.substring(0,s.length-2)),document.getElementById(id+"_label_sectionform_id_temp")&&(s=document.getElementById(id+"_label_sectionform_id_temp").style.width,w_field_label_size=s.substring(0,s.length-2)),document.getElementById(id+"_requiredform_id_temp")&&(w_required=document.getElementById(id+"_requiredform_id_temp").value),document.getElementById(id+"_uniqueform_id_temp")&&(w_unique=document.getElementById(id+"_uniqueform_id_temp").value),document.getElementById(id+"_label_sectionform_id_temp")&&(w_class=document.getElementById(id+"_label_sectionform_id_temp").getAttribute("class"),w_class||(w_class="")),gen_form_fields(),i||(wdform_row.innerHTML="%"+id+" - "+l_label+"%")}}),(""==tox||""==form_fields)&&jQuery(".wdform_page .wdform_row").length)return alert("Form state you are trying to save is corrupted.\nPlease review your changes to identify the problem and try to save it again.\nThe form will reset now."),location.reload(),!1;for(i||(document.getElementById("label_order_current").value=fm_base64EncodeUnicode(fm_htmlentities(tox))),x=0;x<l_id_array.length;x++)l_id_removed[l_id_array[x]]&&(tox=tox+l_id_array[x]+"#**id**#"+l_label_array[x]+"#**label**#"+l_type_array[x]+"#****#");if(i||(document.getElementById("take").style.display="none",document.getElementById("page_bar").style.display="none",jQuery(".wdform_section").each(function(){var e=this;jQuery(e).find(".wdform_column").each(function(){!jQuery(this).html()&&1<jQuery(e).children().length&&jQuery(this).remove(),jQuery(this).find(".wdform_section_handle").remove()}),jQuery(this).find(".wdform_row_handle").remove(),jQuery(this).find(".wdform_column_empty").remove()}),jQuery(".wdform_row_empty").remove(),jQuery(".wdform_column:empty").remove(),jQuery(".fm-section-overlay").remove()),i||(document.getElementById("label_order").value=fm_base64EncodeUnicode(fm_htmlentities(tox)),document.getElementById("form_fields").value=fm_base64EncodeUnicode(fm_htmlentities(form_fields)),refresh_(),document.getElementById("pagination").value=document.getElementById("pages").getAttribute("type"),document.getElementById("show_title").value=document.getElementById("pages").getAttribute("show_title"),document.getElementById("show_numbers").value=document.getElementById("pages").getAttribute("show_numbers")),form_changed=!1,i){form_fields!=form_fields_initial&&(form_changed=!0),jQuery(".fm-check-change").each(function(){jQuery(this).val()!=jQuery(this).attr("data-initial-value")&&(form_changed=!0)}),"undefined"!=typeof tinyMCE&&null!=tinyMCE.get("header_description")&&tinyMCE.get("header_description").isDirty()&&(form_changed=!0);var e=decodeURIComponent(jQuery("#header_description_initial_value").val()),t=jQuery("#header_description").val();jQuery("<span>"+e+"</span>").html()!=jQuery("<span>"+t+"</span>").html()&&(form_changed=!0),jQuery("#header_hide_image").prop("checked")!=(1==jQuery("#header_hide_image").attr("data-initial-value"))&&(form_changed=!0)}return!i||!form_changed}function fm_base64EncodeUnicode(e){return utf8Bytes=encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}),btoa(utf8Bytes)}function fm_htmlentities(e){var t=document.createElement("div"),i=document.createTextNode(e);return t.style.cssText="display:none",t.appendChild(i),t.innerHTML}function formOnload(rows){for(t=0;t<rows;t++)if(document.getElementById(t+"_typeform_id_temp"))if("type_map"==document.getElementById(t+"_typeform_id_temp").value||"type_mark_map"==document.getElementById(t+"_typeform_id_temp").value)for(if_gmap_init(t),q=0;q<20;q++)document.getElementById(t+"_elementform_id_temp").getAttribute("long"+q)&&(w_long=parseFloat(document.getElementById(t+"_elementform_id_temp").getAttribute("long"+q)),w_lat=parseFloat(document.getElementById(t+"_elementform_id_temp").getAttribute("lat"+q)),w_info=parseFloat(document.getElementById(t+"_elementform_id_temp").getAttribute("info"+q)),add_marker_on_map(t,q,w_long,w_lat,w_info,!1));else if("type_name"==document.getElementById(t+"_typeform_id_temp").value){var myu=t;jQuery(function(){jQuery("#"+myu+"_mini_label_first").on("click",function(){if(0==jQuery(this).children("input").length){var e="<input type='text' id='first' class='first' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.first").focus(),jQuery("input.first").blur(function(){var e=document.getElementById("first").parentNode.id.split("_"),t=jQuery(this).val();jQuery("#"+e[0]+"_mini_label_first").text(t)})}}),jQuery("label#"+myu+"_mini_label_last").on("click",function(){if(0==jQuery(this).children("input").length){var e="<input type='text' id='last' class='last' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.last").focus(),jQuery("input.last").blur(function(){var e=document.getElementById("last").parentNode.id.split("_"),t=jQuery(this).val();jQuery("#"+e[0]+"_mini_label_last").text(t)})}}),jQuery("label#"+myu+"_mini_label_title").on("click",function(){if(0==jQuery(this).children("input").length){var e="<input type='text' id='title_' class='title_' style='outline:none; border:none; background:none; width:50px;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.title_").focus(),jQuery("input.title_").blur(function(){var e=document.getElementById("title_").parentNode.id.split("_"),t=jQuery(this).val();jQuery("#"+e[0]+"_mini_label_title").text(t)})}}),jQuery("label#"+myu+"_mini_label_middle").on("click",function(){if(0==jQuery(this).children("input").length){var e="<input type='text' id='middle' class='middle' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.middle").focus(),jQuery("input.middle").blur(function(){var e=document.getElementById("middle").parentNode.id.split("_"),t=jQuery(this).val();jQuery("#"+e[0]+"_mini_label_middle").text(t)})}})})}else if("type_phone"==document.getElementById(t+"_typeform_id_temp").value){var myu=t;jQuery(function(){jQuery("label#"+myu+"_mini_label_area_code").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' id='area_code' class='area_code' size='10' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.area_code").focus(),jQuery("input.area_code").blur(function(){var e=document.getElementById("area_code").parentNode.id.split("_"),t=jQuery(this).val();jQuery("#"+e[0]+"_mini_label_area_code").text(t)})}}),jQuery("label#"+myu+"_mini_label_phone_number").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' id='phone_number' class='phone_number' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.phone_number").focus(),jQuery("input.phone_number").blur(function(){var e=document.getElementById("phone_number").parentNode.id.split("_"),t=jQuery(this).val();jQuery("#"+e[0]+"_mini_label_phone_number").text(t)})}})})}else if("type_date_fields"==document.getElementById(t+"_typeform_id_temp").value){var myu=t;jQuery(function(){jQuery("label#"+myu+"_day_label").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' id='day' class='day' size='8' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.day").focus(),jQuery("input.day").blur(function(){var e=document.getElementById("day").parentNode.id.split("_"),t=jQuery(this).val();jQuery("#"+e[0]+"_day_label").text(t)})}}),jQuery("label#"+myu+"_month_label").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' id='month' class='month' size='8' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.month").focus(),jQuery("input.month").blur(function(){var e=document.getElementById("month").parentNode.id.split("_"),t=jQuery(this).val();jQuery("#"+e[0]+"_month_label").text(t)})}}),jQuery("label#"+myu+"_year_label").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' id='year' class='year' size='8' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.year").focus(),jQuery("input.year").blur(function(){var e=document.getElementById("year").parentNode.id.split("_"),t=jQuery(this).val();jQuery("#"+e[0]+"_year_label").text(t)})}})})}else if("type_time"==document.getElementById(t+"_typeform_id_temp").value){var myu=t;jQuery(function(){jQuery("label#"+myu+"_mini_label_hh").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' id='hh' class='hh' size='4' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.hh").focus(),jQuery("input.hh").blur(function(){var e=document.getElementById("hh").parentNode.id.split("_"),t=jQuery(this).val();jQuery("#"+e[0]+"_mini_label_hh").text(t)})}}),jQuery("label#"+myu+"_mini_label_mm").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' id='mm' class='mm' size='4' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.mm").focus(),jQuery("input.mm").blur(function(){var e=document.getElementById("mm").parentNode.id.split("_"),t=jQuery(this).val();jQuery("#"+e[0]+"_mini_label_mm").text(t)})}}),jQuery("label#"+myu+"_mini_label_ss").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' id='ss' class='ss' size='4' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.ss").focus(),jQuery("input.ss").blur(function(){var e=document.getElementById("ss").parentNode.id.split("_"),t=jQuery(this).val();jQuery("#"+e[0]+"_mini_label_ss").text(t)})}}),jQuery("label#"+myu+"_mini_label_am_pm").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' id='am_pm' class='am_pm' size='4' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.am_pm").focus(),jQuery("input.am_pm").blur(function(){var e=document.getElementById("am_pm").parentNode.id.split("_"),t=jQuery(this).val();jQuery("#"+e[0]+"_mini_label_am_pm").text(t)})}})})}else if("type_paypal_price"==document.getElementById(t+"_typeform_id_temp").value){var myu=t;jQuery(function(){jQuery("#"+myu+"_mini_label_dollars").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' id='dollars' class='dollars' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.dollars").focus(),jQuery("input.dollars").blur(function(){var e=document.getElementById("dollars").parentNode.id.split("_"),t=jQuery(this).val();jQuery("#"+e[0]+"_mini_label_dollars").text(t)})}}),jQuery("label#"+myu+"_mini_label_cents").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' id='cents' class='cents' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.cents").focus(),jQuery("input.cents").blur(function(){var e=document.getElementById("cents").parentNode.id.split("_"),t=jQuery(this).val();jQuery("#"+e[0]+"_mini_label_cents").text(t)})}})})}else if("type_address"==document.getElementById(t+"_typeform_id_temp").value){var myu=t;jQuery(function(){jQuery("label#"+myu+"_mini_label_street1").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' id='street1' class='street1' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.street1").focus(),jQuery("input.street1").blur(function(){var e=document.getElementById("street1").parentNode.id.split("_"),t=jQuery(this).val();jQuery("#"+e[0]+"_mini_label_street1").text(t)})}}),jQuery("label#"+myu+"_mini_label_street2").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' id='street2' class='street2' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.street2").focus(),jQuery("input.street2").blur(function(){var e=document.getElementById("street2").parentNode.id.split("_"),t=jQuery(this).val();jQuery("#"+e[0]+"_mini_label_street2").text(t)})}}),jQuery("label#"+myu+"_mini_label_city").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' id='city' class='city' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.city").focus(),jQuery("input.city").blur(function(){var e=document.getElementById("city").parentNode.id.split("_"),t=jQuery(this).val();jQuery("#"+e[0]+"_mini_label_city").text(t)})}}),jQuery("label#"+myu+"_mini_label_state").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' id='state' class='state' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.state").focus(),jQuery("input.state").blur(function(){var e=document.getElementById("state").parentNode.id.split("_"),t=jQuery(this).val();jQuery("#"+e[0]+"_mini_label_state").text(t)})}}),jQuery("label#"+myu+"_mini_label_postal").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' id='postal' class='postal' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.postal").focus(),jQuery("input.postal").blur(function(){var e=document.getElementById("postal").parentNode.id.split("_"),t=jQuery(this).val();jQuery("#"+e[0]+"_mini_label_postal").text(t)})}}),jQuery("label#"+myu+"_mini_label_country").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='country' id='country' class='country' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.country").focus(),jQuery("input.country").blur(function(){var e=document.getElementById("country").parentNode.id.split("_"),t=jQuery(this).val();jQuery("#"+e[0]+"_mini_label_country").text(t)})}})})}else if("type_scale_rating"==document.getElementById(t+"_typeform_id_temp").value){var myu=t;jQuery(function(){jQuery("#"+myu+"_mini_label_worst").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' id='worst' class='worst' size='6' style='outline:none; border:none; background:none; font-size:11px;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.worst").focus(),jQuery("input.worst").blur(function(){var e=document.getElementById("worst").parentNode.id.split("_"),t=jQuery(this).val();jQuery("#"+e[0]+"_mini_label_worst").text(t)})}}),jQuery("label#"+myu+"_mini_label_best").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' id='best' class='best' size='6' style='outline:none; border:none; background:none; font-size:11px;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.best").focus(),jQuery("input.best").blur(function(){var e=document.getElementById("best").parentNode.id.split("_"),t=jQuery(this).val();jQuery("#"+e[0]+"_mini_label_best").text(t)})}})})}else if("type_spinner"==document.getElementById(t+"_typeform_id_temp").value){var spinner_value=document.getElementById(t+"_elementform_id_temp").value,spinner_min_value=document.getElementById(t+"_min_valueform_id_temp").value,spinner_max_value=document.getElementById(t+"_max_valueform_id_temp").value,spinner_step=document.getElementById(t+"_stepform_id_temp").value;jQuery("#"+t+"_elementform_id_temp")[0].spin=null,spinner=jQuery("#"+t+"_elementform_id_temp").spinner(),null==spinner_value&&spinner.spinner("value",""),jQuery("#"+t+"_elementform_id_temp").spinner({min:spinner_min_value}),jQuery("#"+t+"_elementform_id_temp").spinner({max:spinner_max_value}),jQuery("#"+t+"_elementform_id_temp").spinner({step:spinner_step})}else if("type_slider"==document.getElementById(t+"_typeform_id_temp").value){var slider_value=document.getElementById(t+"_slider_valueform_id_temp").value,slider_min_value=document.getElementById(t+"_slider_min_valueform_id_temp").value,slider_max_value=document.getElementById(t+"_slider_max_valueform_id_temp").value,slider_element_value=document.getElementById(t+"_element_valueform_id_temp"),slider_value_save=document.getElementById(t+"_slider_valueform_id_temp");jQuery("#"+t+"_elementform_id_temp")[0].slide=null,jQuery(function(){jQuery("#"+t+"_elementform_id_temp").slider({range:"min",value:eval(slider_value),min:eval(slider_min_value),max:eval(slider_max_value),slide:function(e,t){slider_element_value.innerHTML=""+t.value,slider_value_save.value=""+t.value}})})}else if("type_range"==document.getElementById(t+"_typeform_id_temp").value){var spinner_value0=document.getElementById(t+"_elementform_id_temp0").value,spinner_step=document.getElementById(t+"_range_stepform_id_temp").value;jQuery("#"+t+"_elementform_id_temp0")[0].spin=null,jQuery("#"+t+"_elementform_id_temp1")[0].spin=null,spinner0=jQuery("#"+t+"_elementform_id_temp0").spinner(),null==spinner_value0&&spinner0.spinner("value",""),jQuery("#"+t+"_elementform_id_temp0").spinner({step:spinner_step});var spinner_value1=document.getElementById(t+"_elementform_id_temp1").value;spinner1=jQuery("#"+t+"_elementform_id_temp1").spinner(),null==spinner_value1&&spinner1.spinner("value",""),jQuery("#"+t+"_elementform_id_temp1").spinner({step:spinner_step});var myu=t;jQuery(function(){jQuery("#"+myu+"_mini_label_from").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' id='from' class='from' size='6' style='outline:none; border:none; background:none; font-size:11px;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.from").focus(),jQuery("input.from").blur(function(){var e=document.getElementById("from").parentNode.id.split("_"),t=jQuery(this).val();jQuery("#"+e[0]+"_mini_label_from").text(t)})}}),jQuery("label#"+myu+"_mini_label_to").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' id='to' class='to' size='6' style='outline:none; border:none; background:none; font-size:11px;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.to").focus(),jQuery("input.to").blur(function(){var e=document.getElementById("to").parentNode.id.split("_"),t=jQuery(this).val();jQuery("#"+e[0]+"_mini_label_to").text(t)})}})})}else if("type_date_range"==document.getElementById(t+"_typeform_id_temp").value){var default_date_start=jQuery("#"+t+"_default_date_id_temp_start").val(),default_date_end=jQuery("#"+t+"_default_date_id_temp_end").val(),date_format=jQuery("#"+t+"_buttonform_id_temp").attr("format");jQuery("#"+t+"_elementform_id_temp0").datepicker(),jQuery("#"+t+"_elementform_id_temp1").datepicker(),jQuery("#"+t+"_elementform_id_temp0").datepicker("option","dateFormat",date_format),jQuery("#"+t+"_elementform_id_temp1").datepicker("option","dateFormat",date_format),"today"==default_date_start?jQuery("#"+t+"_elementform_id_temp0").datepicker("setDate",new Date):-1==default_date_start.indexOf("d")&&-1==default_date_start.indexOf("m")&&-1==default_date_start.indexOf("y")&&-1==default_date_start.indexOf("w")?""!==default_date_start&&jQuery("#"+t+"_elementform_id_temp0").datepicker("setDate",default_date_start):jQuery("#"+t+"_elementform_id_temp0").datepicker("setDate",default_date_start),"today"==default_date_end?jQuery("#"+t+"_elementform_id_temp1").datepicker("setDate",new Date):-1==default_date_end.indexOf("d")&&-1==default_date_end.indexOf("m")&&-1==default_date_end.indexOf("y")&&-1==default_date_end.indexOf("w")?""!==default_date_end&&jQuery("#"+t+"_elementform_id_temp1").datepicker("setDate",default_date_end):jQuery("#"+t+"_elementform_id_temp1").datepicker("setDate",default_date_end)}else if("type_date_new"==document.getElementById(t+"_typeform_id_temp").value){var default_date=jQuery("#"+t+"_default_date_id_temp").val(),date_format=jQuery("#"+t+"_buttonform_id_temp").attr("format");jQuery("#"+t+"_elementform_id_temp").datepicker(),jQuery("#"+t+"_elementform_id_temp").datepicker("option","dateFormat",date_format),"today"==default_date?jQuery("#"+t+"_elementform_id_temp").datepicker("setDate",new Date):-1==default_date.indexOf("d")&&-1==default_date.indexOf("m")&&-1==default_date.indexOf("y")&&-1==default_date.indexOf("w")?""!==default_date&&jQuery("#"+t+"_elementform_id_temp").datepicker("setDate",default_date):jQuery("#"+t+"_elementform_id_temp").datepicker("setDate",default_date)}else if("type_phone_new"==document.getElementById(t+"_typeform_id_temp").value){var telinput=jQuery("#"+t+"_elementform_id_temp"),iti=window.intlTelInput(telinput[0],{nationalMode:!1,formatOnDisplay:!0,preferredCountries:[telinput.attr("top-country")],initialCountry:telinput.attr("top-country"),utilsScript:form_maker.plugin_url+"/js/intlTelInput-utils.js"});iti.setNumber(telinput.val())}remove_whitespace(document.getElementById("take")),form_view=1,form_view_max=1;var form_view_count=jQuery(".wdform-page-and-images").length;if(jQuery(".wdform-page-and-images").each(function(){var e=jQuery(this).find(".wdform_page").attr("id").split("form_id_tempform_view"),t=parseInt(e[1]);form_view_max=t>form_view_max?t:form_view_max,page_toolbar_wrap=document.createElement("div"),page_toolbar_wrap.setAttribute("id","form_id_tempform_view_img"+t),page_toolbar_wrap.setAttribute("class","form_id_tempform_view_img"),page_title=document.createElement("div"),page_title.setAttribute("class","wdform_page_title"),page_title.innerHTML='<span class="fm-ico-draggable"></span>'+document.getElementById("form_id_tempform_view"+t).getAttribute("page_title"),page_toolbar_wrap.appendChild(page_title),page_toolbar=document.createElement("div");var i="none"==document.getElementById("form_id_tempform_view"+t).style.display?"fm-ico-expand":"fm-ico-collapse",n=document.createElement("span");n.setAttribute("title","Show or hide the page"),n.setAttribute("class","page_toolbar dashicons "+i),n.setAttribute("id","show_page_img_"+t),n.setAttribute("onClick",'show_or_hide("'+t+'"); change_show_hide_icon(this);');var a=document.createElement("span");a.setAttribute("title","Delete the page"),a.setAttribute("class","page_toolbar fm-ico-delete"),a.setAttribute("onclick",'remove_page("'+t+'")');var r=document.createElement("span");r.setAttribute("title","Edit the page"),r.setAttribute("class","page_toolbar fm-ico-edit"),r.setAttribute("onclick",'edit_page_break("'+t+'")'),page_toolbar.appendChild(a),page_toolbar.appendChild(r),page_toolbar.appendChild(n),page_toolbar_wrap.appendChild(page_toolbar);var l=document.getElementById("form_id_tempform_view"+t).parentNode;l.insertBefore(page_toolbar_wrap,l.childNodes[0])}),1<form_view_count){firstid=jQuery(".wdform_page").first().attr("id"),firstid=firstid.split("form_id_tempform_view"),first_form_view=firstid[1],form_view=form_view_max,fm_need_enable=!1,generate_page_nav(first_form_view);var icon_edit=document.createElement("span");icon_edit.setAttribute("class","fm-ico-edit"),icon_edit.setAttribute("onclick","el_page_navigation()");var edit_page_navigation=document.getElementById("edit_page_navigation");edit_page_navigation.appendChild(icon_edit),document.getElementById("page_navigation").appendChild(edit_page_navigation),jQuery("#page_bar").removeClass("form_view_hide")}else jQuery("#page_bar").addClass("form_view_hide");1==form_view_count&&jQuery(".form_id_tempform_view_img").addClass("form_view_hide")}function change_show_hide_icon(e){jQuery(e).toggleClass("fm-ico-collapse").toggleClass("fm-ico-expand")}function edit_page_break(e){enable2(),document.getElementById("editing_id").value=e,form_view_element=document.getElementById("form_id_tempform_view"+e),page_title=form_view_element.getAttribute("page_title"),form_view_element.getAttribute("next_title")?(next_title=form_view_element.getAttribute("next_title"),next_type=form_view_element.getAttribute("next_type"),next_class=form_view_element.getAttribute("next_class"),next_checkable=form_view_element.getAttribute("next_checkable"),previous_title=form_view_element.getAttribute("previous_title"),previous_type=form_view_element.getAttribute("previous_type"),previous_class=form_view_element.getAttribute("previous_class"),previous_checkable=form_view_element.getAttribute("previous_checkable"),w_title=[next_title,previous_title],w_type=[next_type,previous_type],w_class=[next_class,previous_class],w_check=[next_checkable,previous_checkable]):(w_title=["Next","Previous"],w_type=["text","text"],w_class=["",""],w_check=["true","true"]),w_attr_name=[],w_attr_value=[],type_page_break(e,page_title,w_title,w_type,w_class,w_check,w_attr_name,w_attr_value)}function fm_popup_toggle(e){jQuery("#"+e).toggleClass("hidden"),jQuery("body").toggleClass("fm-disable-scroll")}function storageAvailable(e){try{var t=window[e],i="__storage_test__";return t.setItem(i,i),t.removeItem(i),!0}catch(e){return e instanceof DOMException&&(22===e.code||1014===e.code||"QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name)&&0!==t.length}}function fm_check_something_really_important(){return is7=jQuery(".wdform_field:not([type=type_section_break])").length,9<=is7&&(fm_limitation_alert(!0),!0)}function filter(e){var t=jQuery(e).val().toLowerCase();if(jQuery(".filtered-fields .inside").html(""),""!=t){var i=!1;jQuery(".field_types_cont .postbox").addClass("hide"),jQuery(".field_types .postbox:not(.filtered-fields) .wd-button").each(function(){"-1"!=jQuery(this).html().toLowerCase().indexOf(t)&&(jQuery(".filtered-fields .inside").append(jQuery(this).clone()),i=!0)}),i||jQuery(".filtered-fields .inside").html(form_maker.nothing_found),jQuery(".field_types_cont .filtered-fields").removeClass("hide")}else jQuery(".field_types_cont .postbox").removeClass("hide"),jQuery(".field_types_cont .filtered-fields").addClass("hide")}function Enable(){for(k=1;k<=form_view_max;k++)if(document.getElementById("form_id_tempform_view"+k))for(wdform_page=document.getElementById("form_id_tempform_view"+k),remove_whitespace(wdform_page),n=wdform_page.childNodes.length-2,z=0;z<=n;z++)if(!wdform_page.childNodes[z].getAttribute("wdid"))for(wdform_section=wdform_page.childNodes[z],x=0;x<wdform_section.childNodes.length;x++)if(wdform_column=wdform_section.childNodes[x],wdform_column.firstChild)for(y=0;y<wdform_column.childNodes.length;y++)wdform_row=wdform_column.childNodes[y],wdid=wdform_row.getAttribute("wdid"),wdid}function enable2(){fm_add_field_button(),jQuery(".add-popup").slideToggle(200),jQuery(".popup-title").html(form_maker.edit_field),jQuery(".wd-add-button").html(form_maker.update),jQuery(".field_types").hide(),jQuery("#field_container").addClass("field_container_full")}function edit(e,a){switch(fm_need_enable&&enable2(),document.getElementById("editing_id").value=e,type=document.getElementById("wdform_field"+e).getAttribute("type"),k=0,w_choices=new Array,w_choices_value=new Array,w_choices_params=new Array,w_choices_checked=new Array,w_choices_disabled=new Array,f=0,y=new Array,b=new Array,w_choices_price=new Array,t=0,document.getElementById(e+"_element_labelform_id_temp").innerHTML?w_field_label=document.getElementById(e+"_element_labelform_id_temp").innerHTML:w_field_label=" ",document.getElementById(e+"_label_sectionform_id_temp")&&("block"==document.getElementById(e+"_label_sectionform_id_temp").style.display?w_field_label_pos="top":w_field_label_pos="left"),document.getElementById(e+"_elementform_id_temp")&&(s=document.getElementById(e+"_elementform_id_temp").style.width,""==s?w_size=s:w_size=s.substring(0,s.length-2)),document.getElementById(e+"_label_sectionform_id_temp")&&(s=document.getElementById(e+"_label_sectionform_id_temp").style.width,""==s?w_field_label_size=s:w_field_label_size=s.substring(0,s.length-2)),document.getElementById(e+"_requiredform_id_temp")&&(w_required=document.getElementById(e+"_requiredform_id_temp").value),document.getElementById(e+"_uniqueform_id_temp")&&(w_unique=document.getElementById(e+"_uniqueform_id_temp").value),document.getElementById(e+"_label_sectionform_id_temp")&&(w_class=document.getElementById(e+"_label_sectionform_id_temp").getAttribute("class"),w_class||(w_class="")),type){case"type_editor":w_editor=document.getElementById("wdform_field"+e).innerHTML,type_editor(e,w_editor);break;case"type_section_break":w_editor=document.getElementById(e+"_element_sectionform_id_temp").innerHTML,type_section_break(e,w_editor);break;case"type_send_copy":E=document.getElementById(e+"_hide_labelform_id_temp").value,w_first_val=document.getElementById(e+"_elementform_id_temp").checked,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_send_copy(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_first_val,w_required,w_attr_name,w_attr_value);break;case"type_text":w_first_val=document.getElementById(e+"_elementform_id_temp").value,w_title=document.getElementById(e+"_elementform_id_temp").title,w_regExp_status=document.getElementById(e+"_regExpStatusform_id_temp").value,w_regExp_value=unescape(document.getElementById(e+"_regExp_valueform_id_temp").value),w_regExp_common=document.getElementById(e+"_regExp_commonform_id_temp").value,w_regExp_arg=document.getElementById(e+"_regArgumentform_id_temp").value,w_regExp_alert=document.getElementById(e+"_regExp_alertform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],w_readonly=document.getElementById(e+"_readonlyform_id_temp").value,E=document.getElementById(e+"_hide_labelform_id_temp").value,type_text(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_size,w_first_val,w_title,w_required,w_regExp_status,w_regExp_value,w_regExp_common,w_regExp_arg,w_regExp_alert,w_unique,w_attr_name,w_attr_value,w_readonly,w_class);break;case"type_number":w_first_val=document.getElementById(e+"_elementform_id_temp").value,w_title=document.getElementById(e+"_elementform_id_temp").title,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_number(e,w_field_label,w_field_label_size,w_field_label_pos,w_size,w_first_val,w_title,w_required,w_unique,w_class,w_attr_name,w_attr_value);break;case"type_password":w_placeholder_value=document.getElementById(e+"_elementform_id_temp").placeholder,w_verification=document.getElementById(e+"_verification_id_temp").value,document.getElementById(e+"_1_element_labelform_id_temp").innerHTML?w_verification_label=document.getElementById(e+"_1_element_labelform_id_temp").innerHTML:w_verification_label=" ",E=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_password(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_size,w_required,w_unique,w_class,w_verification,w_verification_label,w_placeholder_value,w_attr_name,w_attr_value);break;case"type_textarea":E=document.getElementById(e+"_hide_labelform_id_temp").value,w_first_val=document.getElementById(e+"_elementform_id_temp").value,w_characters_limit=document.getElementById(e+"_charlimitform_id_temp").value,w_title=document.getElementById(e+"_elementform_id_temp").title,s=document.getElementById(e+"_elementform_id_temp").style.height,w_size_h=s.substring(0,s.length-2),atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_textarea(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_size,w_size_h,w_first_val,w_characters_limit,w_title,w_required,w_unique,w_class,w_attr_name,w_attr_value);break;case"type_wdeditor":w_title=document.getElementById(e+"_elementform_id_temp").title,s=document.getElementById(e+"_elementform_id_temp").style.height,w_size_h=s.substring(0,s.length-2),w=document.getElementById(e+"_elementform_id_temp").style.width,w_size_w=w.substring(0,w.length-2),atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_wdeditor(e,w_field_label,w_field_label_size,w_field_label_pos,w_size_w,w_size_h,w_title,w_required,w_class,w_attr_name,w_attr_value);break;case"type_phone":E=document.getElementById(e+"_hide_labelform_id_temp").value,w_first_val=[document.getElementById(e+"_element_firstform_id_temp").value,document.getElementById(e+"_element_lastform_id_temp").value],w_title=[document.getElementById(e+"_element_firstform_id_temp").title,document.getElementById(e+"_element_lastform_id_temp").title],s=document.getElementById(e+"_element_lastform_id_temp").style.width,w_size=s.substring(0,s.length-2),w_mini_labels=[document.getElementById(e+"_mini_label_area_code").innerHTML,document.getElementById(e+"_mini_label_phone_number").innerHTML],atrs=return_attributes(e+"_element_firstform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_phone(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_size,w_first_val,w_title,w_mini_labels,w_required,w_unique,w_class,w_attr_name,w_attr_value);break;case"type_phone_new":var r=jQuery("#"+e+"_elementform_id_temp");w_top_country=r.attr("top-country"),window.intlTelInput(r[0],{nationalMode:!1,formatOnDisplay:!0,initialCountry:w_top_country,utilsScript:form_maker.plugin_url+"/js/intlTelInput-utils.js"}),E=document.getElementById(e+"_hide_labelform_id_temp").value,w_first_val=document.getElementById(e+"_elementform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_phone_new(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_size,w_first_val,w_top_country,w_required,w_unique,w_class,w_attr_name,w_attr_value);break;case"type_name":if(document.getElementById(e+"_enable_fieldsform_id_temp")){w_name_format="normal",w_first_val=[document.getElementById(e+"_element_firstform_id_temp").value,document.getElementById(e+"_element_lastform_id_temp").value],w_title=[document.getElementById(e+"_element_firstform_id_temp").title,document.getElementById(e+"_element_lastform_id_temp").title];for(var l=["title","middle"],d=0;d<2;d++)w_first_val.push(document.getElementById(e+"_element_"+l[d]+"form_id_temp")?document.getElementById(e+"_element_"+l[d]+"form_id_temp").value:""),w_title.push(document.getElementById(e+"_element_"+l[d]+"form_id_temp")?document.getElementById(e+"_element_"+l[d]+"form_id_temp").title:"")}else document.getElementById(e+"_element_middleform_id_temp")?w_name_format="extended":w_name_format="normal","normal"==w_name_format?(w_first_val=[document.getElementById(e+"_element_firstform_id_temp").value,document.getElementById(e+"_element_lastform_id_temp").value],w_title=[document.getElementById(e+"_element_firstform_id_temp").title,document.getElementById(e+"_element_lastform_id_temp").title]):(w_first_val=[document.getElementById(e+"_element_firstform_id_temp").value,document.getElementById(e+"_element_lastform_id_temp").value,document.getElementById(e+"_element_titleform_id_temp").value,document.getElementById(e+"_element_middleform_id_temp").value],w_title=[document.getElementById(e+"_element_firstform_id_temp").title,document.getElementById(e+"_element_lastform_id_temp").title,document.getElementById(e+"_element_titleform_id_temp").title,document.getElementById(e+"_element_middleform_id_temp").title]);document.getElementById(e+"_mini_label_title")?w_mini_title=document.getElementById(e+"_mini_label_title").innerHTML:w_mini_title="Title",document.getElementById(e+"_mini_label_middle")?w_mini_middle=document.getElementById(e+"_mini_label_middle").innerHTML:w_mini_middle="Middle",E=document.getElementById(e+"_hide_labelform_id_temp").value,w_mini_labels=[w_mini_title,document.getElementById(e+"_mini_label_first").innerHTML,document.getElementById(e+"_mini_label_last").innerHTML,w_mini_middle],w_name_title=document.getElementById(e+"_enable_fieldsform_id_temp")?document.getElementById(e+"_enable_fieldsform_id_temp").getAttribute("title"):"normal"==w_name_format?"no":"yes",w_name_middle=document.getElementById(e+"_enable_fieldsform_id_temp")?document.getElementById(e+"_enable_fieldsform_id_temp").getAttribute("middle"):"normal"==w_name_format?"no":"yes",w_name_fields=[w_name_title,w_name_middle],w_autofill=document.getElementById(e+"_autofillform_id_temp").value,s=document.getElementById(e+"_element_firstform_id_temp").style.width,w_size=s.substring(0,s.length-2),atrs=return_attributes(e+"_element_firstform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_name(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_first_val,w_title,w_mini_labels,w_size,w_name_format,w_required,w_unique,w_class,w_attr_name,w_attr_value,w_name_fields,w_autofill);break;case"type_paypal_price":w_first_val=[document.getElementById(e+"_element_dollarsform_id_temp").value,document.getElementById(e+"_element_centsform_id_temp").value],w_title=[document.getElementById(e+"_element_dollarsform_id_temp").title,document.getElementById(e+"_element_centsform_id_temp").title],"none"==document.getElementById(e+"_td_name_cents").style.display?w_hide_cents="yes":w_hide_cents="no",s=document.getElementById(e+"_element_dollarsform_id_temp").style.width,w_size=s.substring(0,s.length-2),atrs=return_attributes(e+"_element_dollarsform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],w_range_min=document.getElementById(e+"_range_minform_id_temp").value,w_range_max=document.getElementById(e+"_range_maxform_id_temp").value,w_mini_labels=[document.getElementById(e+"_mini_label_dollars").innerHTML,document.getElementById(e+"_mini_label_cents").innerHTML],type_paypal_price(e,w_field_label,w_field_label_size,w_field_label_pos,w_first_val,w_title,w_mini_labels,w_size,w_required,w_hide_cents,w_class,w_attr_name,w_attr_value,w_range_min,w_range_max);break;case"type_paypal_price_new":w_first_val=document.getElementById(e+"_elementform_id_temp").value,w_title=document.getElementById(e+"_elementform_id_temp").title,s=document.getElementById(e+"_elementform_id_temp").style.width,w_size=s.substring(0,s.length-2),atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],w_range_min=document.getElementById(e+"_range_minform_id_temp").value,w_range_max=document.getElementById(e+"_range_maxform_id_temp").value,w_readonly=document.getElementById(e+"_readonlyform_id_temp").value,E=document.getElementById(e+"_hide_labelform_id_temp").value,"none"==document.getElementById(e+"_td_name_currency").style.display?w_currency="yes":w_currency="no",type_paypal_price_new(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_first_val,w_title,w_size,w_required,w_class,w_attr_name,w_attr_value,w_range_min,w_range_max,w_readonly,w_currency);break;case"type_address":s=document.getElementById(e+"_div_address").style.width,w_size=s.substring(0,s.length-2),document.getElementById(e+"_mini_label_street1")?w_street1=document.getElementById(e+"_mini_label_street1").innerHTML:w_street1=document.getElementById(e+"_street1form_id_temp").value,document.getElementById(e+"_mini_label_street2")?w_street2=document.getElementById(e+"_mini_label_street2").innerHTML:w_street2=document.getElementById(e+"_street2form_id_temp").value,document.getElementById(e+"_mini_label_city")?w_city=document.getElementById(e+"_mini_label_city").innerHTML:w_city=document.getElementById(e+"_cityform_id_temp").value,document.getElementById(e+"_mini_label_state")?w_state=document.getElementById(e+"_mini_label_state").innerHTML:w_state=document.getElementById(e+"_stateform_id_temp").value,document.getElementById(e+"_mini_label_postal")?w_postal=document.getElementById(e+"_mini_label_postal").innerHTML:w_postal=document.getElementById(e+"_postalform_id_temp").value,document.getElementById(e+"_mini_label_country")?w_country=document.getElementById(e+"_mini_label_country").innerHTML:w_country=document.getElementById(e+"_countryform_id_temp").value,w_mini_labels=[w_street1,w_street2,w_city,w_state,w_postal,w_country];var _=document.getElementById(e+"_disable_fieldsform_id_temp");w_street1_dis=_.getAttribute("street1"),w_street2_dis=_.getAttribute("street2"),w_city_dis=_.getAttribute("city"),w_state_dis=_.getAttribute("state"),w_us_states_dis=_.getAttribute("us_states"),w_postal_dis=_.getAttribute("postal"),w_country_dis=_.getAttribute("country"),w_disabled_fields=[w_street1_dis,w_street2_dis,w_city_dis,w_state_dis,w_postal_dis,w_country_dis,w_us_states_dis],E=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_street1form_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_address(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_size,w_mini_labels,w_disabled_fields,w_required,w_class,w_attr_name,w_attr_value);break;case"type_submitter_mail":E=document.getElementById(e+"_hide_labelform_id_temp").value,w_first_val=document.getElementById(e+"_elementform_id_temp").value,w_title=document.getElementById(e+"_elementform_id_temp").title,w_autofill=document.getElementById(e+"_autofillform_id_temp").value,w_verification=document.getElementById(e+"_verification_id_temp").value,w_verification_placeholder=document.getElementById(e+"_1_elementform_id_temp").title,document.getElementById(e+"_1_element_labelform_id_temp").innerHTML?w_verification_label=document.getElementById(e+"_1_element_labelform_id_temp").innerHTML:w_verification_label=" ",atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_submitter_mail(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_size,w_first_val,w_title,w_required,w_unique,w_class,w_verification,w_verification_label,w_verification_placeholder,w_attr_name,w_attr_value,w_autofill);break;case"type_checkbox":if(w_randomize=document.getElementById(e+"_randomizeform_id_temp").value,w_allow_other=document.getElementById(e+"_allow_otherform_id_temp").value,w_limit_choice=document.getElementById(e+"_limitchoice_numform_id_temp").value,w_limit_choice_alert=document.getElementById(e+"_limitchoicealert_numform_id_temp").value,document.getElementById(e+"_rowcol_numform_id_temp").value?(document.getElementById(e+"_table_little").getAttribute("for_hor")?w_flow="hor":w_flow="ver",w_rowcol=document.getElementById(e+"_rowcol_numform_id_temp").value):(document.getElementById(e+"_hor")?w_flow="hor":w_flow="ver",w_rowcol=1),v=0,"ver"==w_flow){var o=document.getElementById(e+"_table_little");for(k=0;k<o.childNodes.length;k++){var u=o.childNodes[k];for(m=0;m<u.childNodes.length;m++){var c=u.childNodes[m].getAttribute("idi");document.getElementById(e+"_elementform_id_temp"+c).getAttribute("other")&&"1"==document.getElementById(e+"_elementform_id_temp"+c).getAttribute("other")&&(f=t),w_choices[t]=document.getElementById(e+"_label_element"+c).innerHTML,w_choices_checked[t]=document.getElementById(e+"_elementform_id_temp"+c).checked,w_choices_value[t]=document.getElementById(e+"_elementform_id_temp"+c).value,w_choices_value[t]=w_choices_value[t].replace(/[\'\"]/g,""),document.getElementById(e+"_label_element"+c).getAttribute("where")?w_choices_params[t]=document.getElementById(e+"_label_element"+c).getAttribute("where")+"[where_order_by]"+document.getElementById(e+"_label_element"+c).getAttribute("order_by")+"[db_info]"+document.getElementById(e+"_label_element"+c).getAttribute("db_info"):w_choices_params[t]="",t++,v=c}}}else{var p=(h=(o=document.getElementById(e+"_table_little")).childNodes)[0].childNodes;for(k=0;k<p.length;k++)for(m=0;m<h.length;m++)if(h[m].childNodes[k]){c=(u=h[m].childNodes[k]).getAttribute("idi");document.getElementById(e+"_elementform_id_temp"+c).getAttribute("other")&&"1"==document.getElementById(e+"_elementform_id_temp"+c).getAttribute("other")&&(f=t),w_choices[t]=document.getElementById(e+"_label_element"+c).innerHTML,w_choices_checked[t]=document.getElementById(e+"_elementform_id_temp"+c).checked,w_choices_value[t]=document.getElementById(e+"_elementform_id_temp"+c).value,w_choices_value[t]=w_choices_value[t].replace(/[\'\"]/g,""),document.getElementById(e+"_label_element"+c).getAttribute("where")?w_choices_params[t]=document.getElementById(e+"_label_element"+c).getAttribute("where")+"[where_order_by]"+document.getElementById(e+"_label_element"+c).getAttribute("order_by")+"[db_info]"+document.getElementById(e+"_label_element"+c).getAttribute("db_info"):w_choices_params[t]="",t++,v=c}}document.getElementById(e+"_option_left_right")?w_field_option_pos=document.getElementById(e+"_option_left_right").value:w_field_option_pos="left",w_value_disabled=document.getElementById(e+"_value_disabledform_id_temp").value,w_use_for_submission=document.getElementById(e+"_use_for_submissionform_id_temp").value,E=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"+v),w_attr_name=atrs[0],w_attr_value=atrs[1],type_checkbox(e,w_field_label,w_field_label_size,w_field_label_pos,w_field_option_pos,E,w_flow,w_choices,w_choices_checked,w_rowcol,w_limit_choice,w_limit_choice_alert,w_required,w_randomize,w_allow_other,f,w_class,w_attr_name,w_attr_value,w_value_disabled,w_choices_value,w_choices_params,w_use_for_submission);break;case"type_paypal_checkbox":document.getElementById(e+"_hor")?w_flow="hor":w_flow="ver",w_randomize=document.getElementById(e+"_randomizeform_id_temp").value,w_allow_other=document.getElementById(e+"_allow_otherform_id_temp").value;var f=v=0;o=document.getElementById(e+"_table_little");for(k=0;k<o.childNodes.length;k++){u=o.childNodes[k];for(m=0;m<u.childNodes.length;m++){c=u.childNodes[m].getAttribute("idi");w_choices[t]=document.getElementById(e+"_label_element"+c).innerHTML,w_choices_price[t]=document.getElementById(e+"_elementform_id_temp"+c).value,w_choices_checked[t]=document.getElementById(e+"_elementform_id_temp"+c).checked,document.getElementById(e+"_label_element"+c).getAttribute("where")?w_choices_params[t]=document.getElementById(e+"_label_element"+c).getAttribute("where")+"[where_order_by]"+document.getElementById(e+"_label_element"+c).getAttribute("order_by")+"[db_info]"+document.getElementById(e+"_label_element"+c).getAttribute("db_info"):w_choices_params[t]="",t++,v=c}}for("hor"==w_flow&&flow_hor(e),k=0;k<100;k++)if(document.getElementById(e+"_propertyform_id_temp"+k))if(y.push(document.getElementById(e+"_property_label_form_id_temp"+k).innerHTML),document.getElementById(e+"_propertyform_id_temp"+k).childNodes.length)for(b[y.length-1]=new Array,m=0;m<document.getElementById(e+"_propertyform_id_temp"+k).childNodes.length;m++)b[y.length-1].push(document.getElementById(e+"_propertyform_id_temp"+k).childNodes[m].value);else b.push("");w_quantity="no",w_quantity_value=1,document.getElementById(e+"_element_quantityform_id_temp")&&(w_quantity="yes",w_quantity_value=document.getElementById(e+"_element_quantityform_id_temp").value),document.getElementById(e+"_option_left_right")?w_field_option_pos=document.getElementById(e+"_option_left_right").value:w_field_option_pos="left",E=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"+v),w_attr_name=atrs[0],w_attr_value=atrs[1],type_paypal_checkbox(e,w_field_label,w_field_label_size,w_field_label_pos,w_field_option_pos,E,w_flow,w_choices,w_choices_price,w_choices_checked,w_required,w_randomize,w_allow_other,f,w_class,w_attr_name,w_attr_value,y,b,w_quantity,w_quantity_value,w_choices_params);break;case"type_radio":if(w_randomize=document.getElementById(e+"_randomizeform_id_temp").value,w_allow_other=document.getElementById(e+"_allow_otherform_id_temp").value,document.getElementById(e+"_rowcol_numform_id_temp").value?(document.getElementById(e+"_table_little").getAttribute("for_hor")?w_flow="hor":w_flow="ver",w_rowcol=document.getElementById(e+"_rowcol_numform_id_temp").value):(document.getElementById(e+"_table_little").getAttribute("for_hor")?w_flow="hor":w_flow="ver",w_rowcol=1),v=0,"ver"==w_flow){o=document.getElementById(e+"_table_little");for(k=0;k<o.childNodes.length;k++){u=o.childNodes[k];for(m=0;m<u.childNodes.length;m++){c=u.childNodes[m].getAttribute("idi");document.getElementById(e+"_elementform_id_temp"+c).getAttribute("other")&&"1"==document.getElementById(e+"_elementform_id_temp"+c).getAttribute("other")&&(f=t),w_choices[t]=document.getElementById(e+"_label_element"+c).innerHTML,w_choices_checked[t]=document.getElementById(e+"_elementform_id_temp"+c).checked,w_choices_value[t]=document.getElementById(e+"_elementform_id_temp"+c).value,w_choices_value[t]=w_choices_value[t].replace(/[\'\"]/g,""),document.getElementById(e+"_label_element"+c).getAttribute("where")?w_choices_params[t]=document.getElementById(e+"_label_element"+c).getAttribute("where")+"[where_order_by]"+document.getElementById(e+"_label_element"+c).getAttribute("order_by")+"[db_info]"+document.getElementById(e+"_label_element"+c).getAttribute("db_info"):w_choices_params[t]="",t++,v=c}}}else{var h;p=(h=(o=document.getElementById(e+"_table_little")).childNodes)[0].childNodes;for(k=0;k<p.length;k++)for(m=0;m<h.length;m++)if(h[m].childNodes[k]){c=(u=h[m].childNodes[k]).getAttribute("idi");document.getElementById(e+"_elementform_id_temp"+c).getAttribute("other")&&"1"==document.getElementById(e+"_elementform_id_temp"+c).getAttribute("other")&&(f=t),w_choices[t]=document.getElementById(e+"_label_element"+c).innerHTML,w_choices_checked[t]=document.getElementById(e+"_elementform_id_temp"+c).checked,w_choices_value[t]=document.getElementById(e+"_elementform_id_temp"+c).value,w_choices_value[t]=w_choices_value[t].replace(/[\'\"]/g,""),document.getElementById(e+"_label_element"+c).getAttribute("where")?w_choices_params[t]=document.getElementById(e+"_label_element"+c).getAttribute("where")+"[where_order_by]"+document.getElementById(e+"_label_element"+c).getAttribute("order_by")+"[db_info]"+document.getElementById(e+"_label_element"+c).getAttribute("db_info"):w_choices_params[t]="",t++,v=c}}document.getElementById(e+"_option_left_right")?w_field_option_pos=document.getElementById(e+"_option_left_right").value:w_field_option_pos="left",w_value_disabled=document.getElementById(e+"_value_disabledform_id_temp").value,w_use_for_submission=document.getElementById(e+"_use_for_submissionform_id_temp").value,E=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"+v),w_attr_name=atrs[0],w_attr_value=atrs[1],type_radio(e,w_field_label,w_field_label_size,w_field_label_pos,w_field_option_pos,E,w_flow,w_choices,w_choices_checked,w_rowcol,w_required,w_randomize,w_allow_other,f,w_class,w_attr_name,w_attr_value,w_value_disabled,w_choices_value,w_choices_params,w_use_for_submission);break;case"type_paypal_radio":document.getElementById(e+"_hor")?w_flow="hor":w_flow="ver",w_randomize=document.getElementById(e+"_randomizeform_id_temp").value,w_allow_other=document.getElementById(e+"_allow_otherform_id_temp").value;f=v=0,o=document.getElementById(e+"_table_little");for(k=0;k<o.childNodes.length;k++){u=o.childNodes[k];for(m=0;m<u.childNodes.length;m++){c=u.childNodes[m].getAttribute("idi");w_choices[t]=document.getElementById(e+"_label_element"+c).innerHTML,w_choices_price[t]=document.getElementById(e+"_elementform_id_temp"+c).value,w_choices_checked[t]=document.getElementById(e+"_elementform_id_temp"+c).checked,document.getElementById(e+"_label_element"+c).getAttribute("where")?w_choices_params[t]=document.getElementById(e+"_label_element"+c).getAttribute("where")+"[where_order_by]"+document.getElementById(e+"_label_element"+c).getAttribute("order_by")+"[db_info]"+document.getElementById(e+"_label_element"+c).getAttribute("db_info"):w_choices_params[t]="",t++,v=c}}for("hor"==w_flow&&flow_hor(e),k=0;k<100;k++)if(document.getElementById(e+"_propertyform_id_temp"+k))if(y.push(document.getElementById(e+"_property_label_form_id_temp"+k).innerHTML),document.getElementById(e+"_propertyform_id_temp"+k).childNodes.length)for(b[y.length-1]=new Array,m=0;m<document.getElementById(e+"_propertyform_id_temp"+k).childNodes.length;m++)b[y.length-1].push(document.getElementById(e+"_propertyform_id_temp"+k).childNodes[m].value);else b.push("");w_quantity="no",w_quantity_value=1,document.getElementById(e+"_element_quantityform_id_temp")&&(w_quantity="yes",w_quantity_value=document.getElementById(e+"_element_quantityform_id_temp").value),document.getElementById(e+"_option_left_right")?w_field_option_pos=document.getElementById(e+"_option_left_right").value:w_field_option_pos="left",E=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"+v),w_attr_name=atrs[0],w_attr_value=atrs[1],type_paypal_radio(e,w_field_label,w_field_label_size,w_field_label_pos,w_field_option_pos,E,w_flow,w_choices,w_choices_price,w_choices_checked,w_required,w_randomize,w_allow_other,f,w_class,w_attr_name,w_attr_value,y,b,w_quantity,w_quantity_value,w_choices_params);break;case"type_paypal_shipping":document.getElementById(e+"_hor")?w_flow="hor":w_flow="ver",w_randomize=document.getElementById(e+"_randomizeform_id_temp").value,w_allow_other=document.getElementById(e+"_allow_otherform_id_temp").value;f=v=0,o=document.getElementById(e+"_table_little");for(k=0;k<o.childNodes.length;k++){u=o.childNodes[k];for(m=0;m<u.childNodes.length;m++){c=u.childNodes[m].getAttribute("idi");w_choices[t]=document.getElementById(e+"_label_element"+c).innerHTML,w_choices_price[t]=document.getElementById(e+"_elementform_id_temp"+c).value,w_choices_checked[t]=document.getElementById(e+"_elementform_id_temp"+c).checked,document.getElementById(e+"_label_element"+c).getAttribute("where")?w_choices_params[t]=document.getElementById(e+"_label_element"+c).getAttribute("where")+"[where_order_by]"+document.getElementById(e+"_label_element"+c).getAttribute("order_by")+"[db_info]"+document.getElementById(e+"_label_element"+c).getAttribute("db_info"):w_choices_params[t]="",t++,v=c}}"hor"==w_flow&&flow_hor(e);var y=[],b=[];document.getElementById(e+"_option_left_right")?w_field_option_pos=document.getElementById(e+"_option_left_right").value:w_field_option_pos="left",E=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"+v),w_attr_name=atrs[0],w_attr_value=atrs[1],type_paypal_shipping(e,w_field_label,w_field_label_size,w_field_label_pos,w_field_option_pos,E,w_flow,w_choices,w_choices_price,w_choices_checked,w_required,w_randomize,w_allow_other,f,w_class,w_attr_name,w_attr_value,y,b,w_choices_params);break;case"type_paypal_total":E=document.getElementById(e+"_hide_labelform_id_temp").value,w_size=jQuery("#"+e+"paypal_totalform_id_temp").css("width")?jQuery("#"+e+"paypal_totalform_id_temp").css("width").substring(0,jQuery("#"+e+"paypal_totalform_id_temp").css("width").length-2):"300",w_hide_total_currency=document.getElementById(e+"_hide_totalcurrency_id_temp").value,type_paypal_total(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_class,w_size,w_hide_total_currency);break;case"type_stripe":E=document.getElementById(e+"_hide_labelform_id_temp").value,type_stripe(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_size,w_class);break;case"type_star_rating":E=document.getElementById(e+"_hide_labelform_id_temp").value,w_star_amount=document.getElementById(e+"_star_amountform_id_temp").value,w_field_label_col=document.getElementById(e+"_star_colorform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_star_rating(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_field_label_col,w_star_amount,w_required,w_class,w_attr_name,w_attr_value);break;case"type_scale_rating":E=document.getElementById(e+"_hide_labelform_id_temp").value,w_mini_labels=[document.getElementById(e+"_mini_label_worst").innerHTML,document.getElementById(e+"_mini_label_best").innerHTML],w_scale_amount=document.getElementById(e+"_scale_amountform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_scale_rating(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_mini_labels,w_scale_amount,w_required,w_class,w_attr_name,w_attr_value);break;case"type_spinner":E=document.getElementById(e+"_hide_labelform_id_temp").value,w_field_min_value=document.getElementById(e+"_min_valueform_id_temp").value,w_field_max_value=document.getElementById(e+"_max_valueform_id_temp").value,w_field_width=document.getElementById(e+"_spinner_widthform_id_temp").value,w_field_step=document.getElementById(e+"_stepform_id_temp").value,w_field_value=document.getElementById(e+"_elementform_id_temp").getAttribute("aria-valuenow"),atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_spinner(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_field_width,w_field_min_value,w_field_max_value,w_field_step,w_field_value,w_required,w_class,w_attr_name,w_attr_value);break;case"type_slider":E=document.getElementById(e+"_hide_labelform_id_temp").value,w_field_min_value=document.getElementById(e+"_slider_min_valueform_id_temp").value,w_field_max_value=document.getElementById(e+"_slider_max_valueform_id_temp").value,w_field_step=document.getElementById(e+"_slider_stepform_id_temp")&&document.getElementById(e+"_slider_stepform_id_temp").value?document.getElementById(e+"_slider_stepform_id_temp").value:1,w_field_width=document.getElementById(e+"_slider_widthform_id_temp").value,w_field_value=document.getElementById(e+"_slider_valueform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_slider(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_field_width,w_field_min_value,w_field_max_value,w_field_step,w_field_value,w_required,w_class,w_attr_name,w_attr_value);break;case"type_range":E=document.getElementById(e+"_hide_labelform_id_temp").value,w_field_range_width=document.getElementById(e+"_range_widthform_id_temp").value,w_field_range_step=document.getElementById(e+"_range_stepform_id_temp").value,w_field_value1=document.getElementById(e+"_elementform_id_temp0").getAttribute("aria-valuenow"),w_field_value1=w_field_value1||"",w_field_value2=document.getElementById(e+"_elementform_id_temp1").getAttribute("aria-valuenow"),w_field_value2=w_field_value2||"",atrs=return_attributes(e+"_elementform_id_temp0"),w_attr_name=atrs[0],w_attr_value=atrs[1],w_mini_labels=[document.getElementById(e+"_mini_label_from").innerHTML,document.getElementById(e+"_mini_label_to").innerHTML],type_range(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_field_range_width,w_field_range_step,w_field_value1,w_field_value2,w_mini_labels,w_required,w_class,w_attr_name,w_attr_value);break;case"type_grading":for(w_total=document.getElementById(e+"_grading_totalform_id_temp").value,w_items=[],k=0;k<100;k++)document.getElementById(e+"_label_elementform_id_temp"+k)&&w_items.push(document.getElementById(e+"_label_elementform_id_temp"+k).innerHTML);E=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_grading(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_items,w_total,w_required,w_class,w_attr_name,w_attr_value),refresh_grading_items(e);break;case"type_matrix":for(w_rows=[],w_rows[0]="",k=1;k<100;k++)document.getElementById(e+"_label_elementform_id_temp"+k+"_0")&&w_rows.push(document.getElementById(e+"_label_elementform_id_temp"+k+"_0").innerHTML);for(w_columns=[],w_columns[0]="",k=1;k<100;k++)document.getElementById(e+"_label_elementform_id_temp0_"+k)&&w_columns.push(document.getElementById(e+"_label_elementform_id_temp0_"+k).innerHTML);E=document.getElementById(e+"_hide_labelform_id_temp").value,w_field_input_type=document.getElementById(e+"_input_typeform_id_temp").value,w_textbox_size=document.getElementById(e+"_textbox_sizeform_id_temp")?document.getElementById(e+"_textbox_sizeform_id_temp").value:"100",atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_matrix(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_field_input_type,w_rows,w_columns,w_required,w_class,w_attr_name,w_attr_value,w_textbox_size),refresh_matrix(e);break;case"type_time":E=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_hhform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],w_hh=document.getElementById(e+"_hhform_id_temp").value,w_mm=document.getElementById(e+"_mmform_id_temp").value,document.getElementById(e+"_ssform_id_temp")?(w_ss=document.getElementById(e+"_ssform_id_temp").value,w_sec="1",w_mini_label_ss=document.getElementById(e+"_mini_label_ss").innerHTML):(w_ss="",w_sec="0",w_mini_label_ss=""),document.getElementById(e+"_am_pm_select")?(w_am_pm=document.getElementById(e+"_am_pmform_id_temp").value,w_time_type="12",w_mini_labels=[document.getElementById(e+"_mini_label_hh").innerHTML,document.getElementById(e+"_mini_label_mm").innerHTML,w_mini_label_ss,document.getElementById(e+"_mini_label_am_pm").innerHTML]):(w_am_pm=0,w_time_type="24",w_mini_labels=[document.getElementById(e+"_mini_label_hh").innerHTML,document.getElementById(e+"_mini_label_mm").innerHTML,w_mini_label_ss,"AM/PM"]),type_time(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_time_type,w_am_pm,w_sec,w_hh,w_mm,w_ss,w_mini_labels,w_required,w_class,w_attr_name,w_attr_value);break;case"type_date":atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],w_date=document.getElementById(e+"_elementform_id_temp").value,w_format=document.getElementById(e+"_buttonform_id_temp").getAttribute("format"),w_but_val=document.getElementById(e+"_buttonform_id_temp").value,w_disable_past_days=document.getElementById(e+"_dis_past_daysform_id_temp")?document.getElementById(e+"_dis_past_daysform_id_temp").value:"no",type_date(e,w_field_label,w_field_label_size,w_field_label_pos,w_date,w_required,w_class,w_format,w_but_val,w_attr_name,w_attr_value,w_disable_past_days);break;case"type_date_new":E=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],w_date=document.getElementById(e+"_elementform_id_temp").value,w_format=document.getElementById(e+"_buttonform_id_temp").getAttribute("format"),w_but_val=document.getElementById(e+"_buttonform_id_temp").value,w_start_day=document.getElementById(e+"_start_dayform_id_temp").value,w_default_date=document.getElementById(e+"_default_date_id_temp").value,w_min_date=document.getElementById(e+"_min_date_id_temp").value,w_max_date=document.getElementById(e+"_max_date_id_temp").value,w_invalid_dates=document.getElementById(e+"_invalid_dates_id_temp").value,w_hide_time=document.getElementById(e+"_hide_timeform_id_temp").value,w_show_image=document.getElementById(e+"_show_imageform_id_temp").value,w_disable_past_days=document.getElementById(e+"_dis_past_daysform_id_temp")?document.getElementById(e+"_dis_past_daysform_id_temp").value:"no";var g=document.getElementById(e+"_show_week_days");w_sunday=g.getAttribute("sunday"),w_monday=g.getAttribute("monday"),w_tuesday=g.getAttribute("tuesday"),w_wednesday=g.getAttribute("wednesday"),w_thursday=g.getAttribute("thursday"),w_friday=g.getAttribute("friday"),w_saturday=g.getAttribute("saturday"),w_show_days=[w_sunday,w_monday,w_tuesday,w_wednesday,w_thursday,w_friday,w_saturday],type_date_new(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_size,w_date,w_required,w_show_image,w_class,w_format,w_start_day,w_default_date,w_min_date,w_max_date,w_invalid_dates,w_show_days,w_hide_time,w_but_val,w_attr_name,w_attr_value,w_disable_past_days);break;case"type_date_range":E=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp0"),w_attr_name=atrs[0],w_attr_value=atrs[1],w_date="",w_format=document.getElementById(e+"_buttonform_id_temp").getAttribute("format"),w_but_val=document.getElementById(e+"_buttonform_id_temp").value,s=document.getElementById(e+"_elementform_id_temp0").style.width,w_size=s.substring(0,s.length-2),w_start_day=document.getElementById(e+"_start_dayform_id_temp").value,w_default_date_start=document.getElementById(e+"_default_date_id_temp_start").value,w_default_date_end=document.getElementById(e+"_default_date_id_temp_end").value,w_min_date=document.getElementById(e+"_min_date_id_temp").value,w_max_date=document.getElementById(e+"_max_date_id_temp").value,w_invalid_dates=document.getElementById(e+"_invalid_dates_id_temp").value,w_hide_time=document.getElementById(e+"_hide_timeform_id_temp").value,w_show_image=document.getElementById(e+"_show_imageform_id_temp").value,w_disable_past_days=document.getElementById(e+"_dis_past_daysform_id_temp")?document.getElementById(e+"_dis_past_daysform_id_temp").value:"no";g=document.getElementById(e+"_show_week_days");w_sunday=g.getAttribute("sunday"),w_monday=g.getAttribute("monday"),w_tuesday=g.getAttribute("tuesday"),w_wednesday=g.getAttribute("wednesday"),w_thursday=g.getAttribute("thursday"),w_friday=g.getAttribute("friday"),w_saturday=g.getAttribute("saturday"),w_show_days=[w_sunday,w_monday,w_tuesday,w_wednesday,w_thursday,w_friday,w_saturday],type_date_range(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_size,w_date,w_required,w_show_image,w_class,w_format,w_start_day,w_default_date_start,w_default_date_end,w_min_date,w_max_date,w_invalid_dates,w_show_days,w_hide_time,w_but_val,w_attr_name,w_attr_value,w_disable_past_days);break;case"type_date_fields":atrs=return_attributes(e+"_dayform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],w_day=document.getElementById(e+"_dayform_id_temp").value,w_month=document.getElementById(e+"_monthform_id_temp").value,w_year=document.getElementById(e+"_yearform_id_temp").value,w_day_type=document.getElementById(e+"_dayform_id_temp").tagName,w_month_type=document.getElementById(e+"_monthform_id_temp").tagName,w_year_type=document.getElementById(e+"_yearform_id_temp").tagName,w_day_label=document.getElementById(e+"_day_label").innerHTML,w_month_label=document.getElementById(e+"_month_label").innerHTML,w_year_label=document.getElementById(e+"_year_label").innerHTML,w_min_day=document.getElementById(e+"_min_day_id_temp").value,w_min_month=document.getElementById(e+"_min_month_id_temp").value,w_min_year=document.getElementById(e+"_min_year_id_temp").value,w_min_dob_alert=document.getElementById(e+"_min_dob_alert_id_temp").value,s=document.getElementById(e+"_dayform_id_temp").style.width,w_day_size=s.substring(0,s.length-2),s=document.getElementById(e+"_monthform_id_temp").style.width,w_month_size=s.substring(0,s.length-2),s=document.getElementById(e+"_yearform_id_temp").style.width,w_year_size=s.substring(0,s.length-2),w_from=document.getElementById(e+"_yearform_id_temp").getAttribute("from"),w_to=document.getElementById(e+"_yearform_id_temp").getAttribute("to"),w_divider=document.getElementById(e+"_separator1").innerHTML,E=document.getElementById(e+"_hide_labelform_id_temp").value,type_date_fields(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_day,w_month,w_year,w_day_type,w_month_type,w_year_type,w_day_label,w_month_label,w_year_label,w_day_size,w_month_size,w_year_size,w_required,w_class,w_from,w_to,w_min_day,w_min_month,w_min_year,w_min_dob_alert,w_divider,w_attr_name,w_attr_value);break;case"type_own_select":jQuery("#"+e+"_elementform_id_temp option").each(function(){w_choices[t]=jQuery(this).html(),w_choices_value[t]=jQuery(this).val(),w_choices_checked[t]=jQuery(this)[0].selected,jQuery(this).attr("where")?w_choices_params[t]=jQuery(this).attr("where")+"[where_order_by]"+jQuery(this).attr("order_by")+"[db_info]"+jQuery(this).attr("db_info"):w_choices_params[t]="",jQuery(this).val()?w_choices_disabled[t]=!1:w_choices_disabled[t]=!0,t++}),w_value_disabled=document.getElementById(e+"_value_disabledform_id_temp").value,w_use_for_submission=document.getElementById(e+"_use_for_submissionform_id_temp").value,E=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_own_select(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_size,w_choices,w_choices_checked,w_required,w_value_disabled,w_class,w_attr_name,w_attr_value,w_choices_disabled,w_choices_value,w_choices_params,w_use_for_submission);break;case"type_paypal_select":for(jQuery("#"+e+"_elementform_id_temp option").each(function(){w_choices[t]=jQuery(this).html(),w_choices_price[t]=jQuery(this).val(),w_choices_checked[t]=jQuery(this)[0].selected,jQuery(this).attr("where")?w_choices_params[t]=jQuery(this).attr("where")+"[where_order_by]"+jQuery(this).attr("order_by")+"[db_info]"+jQuery(this).attr("db_info"):w_choices_params[t]="",""==jQuery(this)[0].value?w_choices_disabled[t]=!0:w_choices_disabled[t]=!1,t++}),k=0;k<100;k++)if(document.getElementById(e+"_propertyform_id_temp"+k))if(y.push(document.getElementById(e+"_property_label_form_id_temp"+k).innerHTML),document.getElementById(e+"_propertyform_id_temp"+k).childNodes.length)for(b[y.length-1]=new Array,m=0;m<document.getElementById(e+"_propertyform_id_temp"+k).childNodes.length;m++)b[y.length-1].push(document.getElementById(e+"_propertyform_id_temp"+k).childNodes[m].value);else b.push("");w_quantity="no",w_quantity_value=1,document.getElementById(e+"_element_quantityform_id_temp")&&(w_quantity="yes",w_quantity_value=document.getElementById(e+"_element_quantityform_id_temp").value),E=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_paypal_select(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_size,w_choices,w_choices_price,w_choices_checked,w_required,w_quantity,w_quantity_value,w_class,w_attr_name,w_attr_value,w_choices_disabled,y,b,w_choices_params);break;case"type_country":for(w_countries=[],select_=document.getElementById(e+"_elementform_id_temp"),n=select_.childNodes.length,i=0;i<n;i++)w_countries.push(select_.childNodes[i].value);E=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_country(e,w_field_label,w_field_label_size,E,w_countries,w_field_label_pos,w_size,w_required,w_class,w_attr_name,w_attr_value);break;case"type_file_upload":E=document.getElementById(e+"_hide_labelform_id_temp").value,C=document.getElementById(e+"_destination").value.replace("***destinationverj"+e+"***","").replace("***destinationskizb"+e+"***",""),w_extension=document.getElementById(e+"_extension").value.replace("***extensionverj"+e+"***","").replace("***extensionskizb"+e+"***",""),w_max_size=document.getElementById(e+"_max_size").value.replace("***max_sizeverj"+e+"***","").replace("***max_sizeskizb"+e+"***",""),w_multiple=document.getElementById(e+"_elementform_id_temp").getAttribute("multiple")?"yes":"no",atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_file_upload(e,w_field_label,w_field_label_size,w_field_label_pos,E,C,w_extension,w_max_size,w_required,w_multiple,w_class,w_attr_name,w_attr_value);break;case"type_captcha":E=document.getElementById(e+"_hide_labelform_id_temp").value,w_digit=document.getElementById("_wd_captchaform_id_temp").getAttribute("digit"),atrs=return_attributes("_wd_captchaform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_captcha(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_digit,w_class,w_attr_name,w_attr_value);break;case"type_arithmetic_captcha":E=document.getElementById(e+"_hide_labelform_id_temp").value,w_count=document.getElementById("_wd_arithmetic_captchaform_id_temp").getAttribute("operations_count"),w_operations=document.getElementById("_wd_arithmetic_captchaform_id_temp").getAttribute("operations"),w_input_size=document.getElementById("_wd_arithmetic_captchaform_id_temp").getAttribute("input_size"),atrs=return_attributes("_wd_captchaform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_arithmetic_captcha(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_count,w_operations,w_class,w_input_size,w_attr_name,w_attr_value);break;case"type_recaptcha":E=document.getElementById(e+"_hide_labelform_id_temp").value,w_type=document.getElementById("wd_recaptchaform_id_temp").getAttribute("w_type"),w_position=document.getElementById("wd_recaptchaform_id_temp").getAttribute("position"),type_recaptcha(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_type,w_position);break;case"type_map":for(w_lat=[],w_long=[],w_info=[],w_center_x=document.getElementById(e+"_elementform_id_temp").getAttribute("center_x"),w_center_y=document.getElementById(e+"_elementform_id_temp").getAttribute("center_y"),w_zoom=document.getElementById(e+"_elementform_id_temp").getAttribute("zoom"),A=""==document.getElementById(e+"_elementform_id_temp").style.width?"":parseInt(document.getElementById(e+"_elementform_id_temp").style.width),x=parseInt(document.getElementById(e+"_elementform_id_temp").style.height),j=0;j<=20;j++)document.getElementById(e+"_elementform_id_temp").getAttribute("lat"+j)&&(w_lat.push(document.getElementById(e+"_elementform_id_temp").getAttribute("lat"+j)),w_long.push(document.getElementById(e+"_elementform_id_temp").getAttribute("long"+j)),w_info.push(document.getElementById(e+"_elementform_id_temp").getAttribute("info"+j)));atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_map(e,w_center_x,w_center_y,w_long,w_lat,w_zoom,A,x,w_class,w_info,w_attr_name,w_attr_value);break;case"type_mark_map":w_info=document.getElementById(e+"_elementform_id_temp").getAttribute("info0"),w_long=document.getElementById(e+"_elementform_id_temp").getAttribute("long0"),w_lat=document.getElementById(e+"_elementform_id_temp").getAttribute("lat0"),w_zoom=document.getElementById(e+"_elementform_id_temp").getAttribute("zoom"),A=""==document.getElementById(e+"_elementform_id_temp").style.width?"":parseInt(document.getElementById(e+"_elementform_id_temp").style.width),x=parseInt(document.getElementById(e+"_elementform_id_temp").style.height),w_center_x=document.getElementById(e+"_elementform_id_temp").getAttribute("center_x"),w_center_y=document.getElementById(e+"_elementform_id_temp").getAttribute("center_y"),E=document.getElementById(e+"_hide_labelform_id_temp").value,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_mark_map(e,w_field_label,w_field_label_size,w_field_label_pos,E,w_center_x,w_center_y,w_long,w_lat,w_zoom,A,x,w_class,w_info,w_attr_name,w_attr_value);break;case"type_submit_reset":atrs=return_attributes(e+"_element_submitform_id_temp"),w_act=!("none"==document.getElementById(e+"_element_resetform_id_temp").style.display),w_attr_name=atrs[0],w_attr_value=atrs[1],w_submit_title=document.getElementById(e+"_element_submitform_id_temp").value,w_reset_title=document.getElementById(e+"_element_resetform_id_temp").value,type_submit_reset(e,w_submit_title,w_reset_title,w_class,w_act,w_attr_name,w_attr_value);break;case"type_button":for(w_title=new Array,w_func=new Array,t=0,v=0,k=0;k<100;k++)document.getElementById(e+"_elementform_id_temp"+k)&&(w_title[t]=document.getElementById(e+"_elementform_id_temp"+k).value,w_func[t]=document.getElementById(e+"_elementform_id_temp"+k).getAttribute("onclick"),t++,v=k);atrs=return_attributes(e+"_elementform_id_temp"+v),w_attr_name=atrs[0],w_attr_value=atrs[1],type_button(e,w_title,w_func,w_class,w_attr_name,w_attr_value);break;case"type_hidden":w_value=document.getElementById(e+"_elementform_id_temp").value,w_name=document.getElementById(e+"_elementform_id_temp").name,atrs=return_attributes(e+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],type_hidden(e,w_name,w_value,w_attr_name,w_attr_value);break;case"type_signature":var E=document.getElementById(e+"_hide_labelform_id_temp").value,A=document.getElementById(e+"_canvasform_id_temp").style.width,x=document.getElementById(e+"_canvasform_id_temp").style.height,C=document.getElementById(e+"_destination").value;type_signature(e,{field_type:"type_signature",field_label:w_field_label,field_label_pos:w_field_label_pos,field_label_hide:E,required:w_required,field_label_size:w_field_label_size,canvas:{width:parseInt(A),height:parseInt(x)},class:w_class,destination:C})}void 0!==a&&(a.stopPropagation(),a.preventDefault())}function fm_add_page(){for(t=form_view_max;0<t;t--)if(document.getElementById("form_id_tempform_view"+t)){form_view=t;break}if(form_view_count=jQuery(".wdform-page-and-images").length,1==form_view_count){(n=document.createElement("span")).setAttribute("title","Edit the pagination options"),n.setAttribute("class","page_toolbar fm-ico-edit"),n.setAttribute("onclick","el_page_navigation()");var e=document.getElementById("edit_page_navigation");e.appendChild(n),document.getElementById("page_navigation").appendChild(e)}jQuery("#page_bar").removeClass("form_view_hide"),old_to_gen=form_view,form_view_max++,form_view=form_view_max,1<form_view&&jQuery(".form_id_tempform_view_img").removeClass("form_view_hide"),table=document.createElement("div"),table.setAttribute("class","wdform-page-and-images fm-form-builder"),form_tempform_view=document.createElement("div"),form_tempform_view.setAttribute("id","form_id_tempform_view"+form_view),form_tempform_view.setAttribute("page_title","Untitled Page"),form_tempform_view.setAttribute("class","wdform_page"),page_toolbar_wrap=document.createElement("div"),page_toolbar_wrap.setAttribute("id","form_id_tempform_view_img"+form_view),page_toolbar_wrap.setAttribute("class","form_id_tempform_view_img"),page_title_div=document.createElement("div"),page_title_div.setAttribute("class","wdform_page_title"),page_toolbar_wrap.appendChild(page_title_div),page_toolbar=document.createElement("div");var i=document.createElement("span");i.setAttribute("title","Show or hide the page"),i.setAttribute("class","page_toolbar fm-ico-collapse"),i.setAttribute("id","show_page_img_"+form_view),i.setAttribute("onClick",'show_or_hide("'+form_view+'"); change_show_hide_icon(this);');var n,a=document.createElement("span");a.setAttribute("title","Delete the page"),a.setAttribute("class","page_toolbar fm-ico-delete"),a.setAttribute("onclick",'remove_page("'+form_view+'")'),(n=document.createElement("span")).setAttribute("title","Edit the page"),n.setAttribute("class","page_toolbar fm-ico-edit"),n.setAttribute("onclick",'edit_page_break("'+form_view+'")'),page_toolbar.appendChild(a),page_toolbar.appendChild(n),page_toolbar.appendChild(i),page_toolbar_wrap.appendChild(page_toolbar),tr=document.createElement("div"),tr.setAttribute("class","wdform_section"),tr_page_nav=document.createElement("div"),tr_page_nav.setAttribute("valign","top"),tr_page_nav.setAttribute("class","wdform_footer"),tr_page_nav.style.width="100%",td_page_nav=document.createElement("div"),td_page_nav.style.width="100%",table_min_page_nav=document.createElement("div"),table_min_page_nav.style.width="100%",table_min_page_nav.style.display="table",tbody_min_page_nav=document.createElement("div"),tbody_min_page_nav.style.display="table-row-group",tr_min_page_nav=document.createElement("div"),tr_min_page_nav.setAttribute("id","form_id_temppage_nav"+form_view),tr_min_page_nav.style.display="table-row",table_min=document.createElement("div"),table_min.setAttribute("class","wdform_column"),table_min1=document.createElement("div"),table_min1.setAttribute("class","wdform_column"),tr.appendChild(table_min),tbody_min_page_nav.appendChild(tr_min_page_nav),table_min_page_nav.appendChild(tbody_min_page_nav),td_page_nav.appendChild(table_min_page_nav),tr_page_nav.appendChild(td_page_nav),form_tempform_view.appendChild(tr),form_tempform_view.appendChild(tr_page_nav),table.appendChild(page_toolbar_wrap),table.appendChild(form_tempform_view),document.getElementById("take").insertBefore(table,document.getElementById("add_field_cont")),form_view_element=document.getElementById("form_id_tempform_view"+form_view),form_view_element.setAttribute("next_title","Next"),form_view_element.setAttribute("next_type","text"),form_view_element.setAttribute("next_class","wdform-page-button"),form_view_element.setAttribute("next_checkable","true"),form_view_element.setAttribute("previous_title","Previous"),form_view_element.setAttribute("previous_type","text"),form_view_element.setAttribute("previous_class","wdform-page-button"),form_view_element.setAttribute("previous_checkable","false"),form_view_element.setAttribute("page_title","Untitled Page"),page_title_div.innerHTML='<span class="fm-ico-draggable"></span>Untitled Page',2==form_view_count?(generate_page_nav(form_view),generate_page_nav(old_to_gen)):generate_page_nav(form_view),all_sortable_events(),jQuery(".wdform_arrows").hide(),draggable_page_break(nextID,form_view_max),nextID="",form_view_element.scrollIntoView()}function add(e,a,r){if("type_grading"==document.getElementById("element_type").value){for(k=100;0<k&&!document.getElementById("el_items"+k);k--);m=k;var d="";for(i=0;i<=m;i++)document.getElementById("el_items"+i)&&(d=d+document.getElementById("el_items"+i).value+":");d+=document.getElementById("element_total").value,document.getElementById("editing_id").value?id=document.getElementById("editing_id").value:id=gen;var _=document.createElement("input");_.setAttribute("id",id+"_hidden_itemform_id_temp"),_.setAttribute("name",id+"_hidden_itemform_id_temp"),_.setAttribute("type","hidden"),_.setAttribute("value",d),(p=document.getElementById(id+"_element_sectionform_id_temp")).appendChild(_)}if("type_matrix"==document.getElementById("element_type").value){for(i=100;0<i&&!document.getElementById("el_rows"+i);i--);for(m=i,i=100;0<i&&!document.getElementById("el_columns"+i);i--);n=i;var o="",s="",u="",c="";for(i=1;i<=m;i++)document.getElementById("el_rows"+i)&&(o=o+document.getElementById("el_rows"+i).value+"***",u+=i+",");for(i=1;i<=n;i++)document.getElementById("el_columns"+i)&&(s=s+document.getElementById("el_columns"+i).value+"***",c+=i+",");document.getElementById("editing_id").value?id=document.getElementById("editing_id").value:id=gen;var p=document.getElementById(id+"_element_sectionform_id_temp"),f=document.createElement("input");f.setAttribute("id",id+"_hidden_rowform_id_temp"),f.setAttribute("name",id+"_hidden_rowform_id_temp"),f.setAttribute("type","hidden"),f.setAttribute("value",o);var h=document.createElement("input");h.setAttribute("id",id+"_row_idsform_id_temp"),h.setAttribute("name",id+"_row_idsform_id_temp"),h.setAttribute("type","hidden"),h.setAttribute("value",u);var y=document.createElement("input");y.setAttribute("id",id+"_hidden_columnform_id_temp"),y.setAttribute("name",id+"_hidden_columnform_id_temp"),y.setAttribute("type","hidden"),y.setAttribute("value",s);var b=document.createElement("input");b.setAttribute("id",id+"_column_idsform_id_temp"),b.setAttribute("name",id+"_column_idsform_id_temp"),b.setAttribute("type","hidden"),b.setAttribute("value",c),p.appendChild(f),p.appendChild(h),p.appendChild(y),p.appendChild(b)}if("type_section_break"==document.getElementById("element_type").value){for(form_view=0,t=form_view_max;0<t;t--)if(document.getElementById("form_id_tempform_view"+t)&&jQuery("#form_id_tempform_view"+t).is(":visible")){form_view=t;break}if(0==form_view)return void alert("The pages are closed");if(document.getElementById("editing_id").value)i=document.getElementById("editing_id").value,document.getElementById("editing_id").value="",wdform_field_in_editor=document.getElementById(i+"_element_sectionform_id_temp"),ifr_id="form_maker_editor_ifr",ifr=getIFrameDocument(ifr_id),"none"==document.getElementById("form_maker_editor").style.display?wdform_field_in_editor.innerHTML=ifr.body.innerHTML:wdform_field_in_editor.innerHTML=document.getElementById("form_maker_editor").value;else{i=gen,gen++,(L=document.createElement("div")).setAttribute("wdid",i),L.setAttribute("type","type_section_break"),L.setAttribute("class","wdform_tr_section_break"),(z=document.createElement("div")).setAttribute("id","wdform_field"+i),z.setAttribute("type","type_section_break"),z.setAttribute("class","wdform_field_section_break"),(q=document.createElement("div")).setAttribute("id","wdform_arrows"+i),q.setAttribute("class","wdform_arrows"),q.style.display="none",z.appendChild(q),L.appendChild(z),(x=document.createElement("div")).setAttribute("id",i+"_element_labelform_id_temp"),x.style.color="red",x.innerHTML="Section Break",L.appendChild(x),wdform_page=document.getElementById("form_id_tempform_view"+form_view);var g='<span class="wdform_arrows_basic wdform_arrows_container"><span id="edit_'+i+'" valign="middle" class="element_toolbar"><span title="Edit the field" class="page_toolbar fm-ico-edit" ontouchend="edit(&quot;'+i+'&quot;, event)" onclick="edit(&quot;'+i+'&quot;, event)"></span></span><span id="duplicate_'+i+'" valign="middle" class="element_toolbar"><span title="Duplicate the field" class="page_toolbar fm-ico-duplicate" ontouchend="duplicate(&quot;'+i+'&quot;, event)" onclick="duplicate(&quot;'+i+'&quot;, event)"></span></span><span id="X_'+i+'" valign="middle" align="right" class="element_toolbar"><span title="Remove the field" class="page_toolbar fm-ico-delete" onclick="remove_section_break(&quot;'+i+'&quot;)"></span></span></span>';q.innerHTML=g;var E=document.createElement("div");E.setAttribute("id",i+"_element_sectionform_id_temp"),E.setAttribute("align","left"),E.setAttribute("class","wdform_section_break"),ifr_id="form_maker_editor_ifr",ifr=getIFrameDocument(ifr_id),"none"==document.getElementById("form_maker_editor").style.display?E.innerHTML=ifr.body.innerHTML:E.innerHTML=document.getElementById("form_maker_editor").value,(C=document.createElement("span")).setAttribute("id",i+"_element_labelform_id_temp"),C.innerHTML="Custom HTML"+i,C.style.cssText="display:none",z.appendChild(E),beforeTr=wdform_page.lastChild,wdform_page.insertBefore(L,beforeTr),wdform_section_new=document.createElement("div"),wdform_section_new.setAttribute("class","wdform_section"),wdform_column_new=document.createElement("div"),wdform_column_new.setAttribute("class","wdform_column"),wdform_column_new1=document.createElement("div"),wdform_column_new1.setAttribute("class","wdform_column"),wdform_section_new.appendChild(wdform_column_new1),draggable_section_break(nextID,L),nextID="",j=2}return jQuery(".wdform_arrows").hide(),close_window(),void all_sortable_events()}if("type_page_navigation"==document.getElementById("element_type").value)return document.getElementById("pages").setAttribute("show_title",document.getElementById("el_show_title_input").checked),document.getElementById("pages").setAttribute("show_numbers",document.getElementById("el_show_numbers_input").checked),document.getElementById("el_pagination_steps").checked?(document.getElementById("pages").setAttribute("type","steps"),make_page_steps_front()):document.getElementById("el_pagination_percentage").checked?(document.getElementById("pages").setAttribute("type","percentage"),make_page_percentage_front()):(document.getElementById("pages").setAttribute("type","none"),make_page_none_front()),refresh_page_numbers(),void close_window();if("type_page_break"==document.getElementById("element_type").value&&document.getElementById("editing_id").value){i=document.getElementById("editing_id").value,form_view_element=document.getElementById("form_id_tempform_view"+i),page_title=document.getElementById("_div_between").getAttribute("page_title"),next_title=document.getElementById("_div_between").getAttribute("next_title"),next_type=document.getElementById("_div_between").getAttribute("next_type"),next_class=document.getElementById("_div_between").getAttribute("next_class"),next_checkable=document.getElementById("_div_between").getAttribute("next_checkable"),previous_title=document.getElementById("_div_between").getAttribute("previous_title"),previous_type=document.getElementById("_div_between").getAttribute("previous_type"),previous_class=document.getElementById("_div_between").getAttribute("previous_class"),previous_checkable=document.getElementById("_div_between").getAttribute("previous_checkable"),form_view_element.setAttribute("next_title",next_title),form_view_element.setAttribute("next_type",next_type),form_view_element.setAttribute("next_class",next_class),form_view_element.setAttribute("next_checkable",next_checkable),form_view_element.setAttribute("previous_title",previous_title),form_view_element.setAttribute("previous_type",previous_type),form_view_element.setAttribute("previous_class",previous_class),form_view_element.setAttribute("previous_checkable",previous_checkable),form_view_element.setAttribute("page_title",page_title),document.getElementById("form_id_tempform_view_img"+i).firstChild.innerHTML='<span class="fm-ico-draggable"></span>'+page_title;var A=document.getElementById("_div_between");for(atr=A.attributes,v=0;v<30;v++)atr[v]&&0==atr[v].name.indexOf("add_")&&form_view_element.setAttribute(atr[v].name,atr[v].value);return form_view_count=jQuery(".wdform-page-and-images").length,1!=form_view_count&&generate_page_nav(form_view),sortable_columns(),jQuery(".wdform_arrows").hide(),void close_window()}for(form_view=0,t=form_view_max;0<t;t--)if(document.getElementById("form_id_tempform_view"+t)&&jQuery("#form_id_tempform_view"+t).is(":visible")){form_view=t;break}if(0!=form_view){if(document.getElementById("editing_id").value||0!=e||!fm_check_something_really_important(e)){if("block"==document.getElementById("main_editor").style.display){if(document.getElementById("editing_id").value)i=document.getElementById("editing_id").value,document.getElementById("editing_id").value="",destroyChildren(z=document.getElementById("wdform_field"+i)),ifr_id="form_maker_editor_ifr",ifr=getIFrameDocument(ifr_id),"none"==document.getElementById("form_maker_editor").style.display?z.innerHTML=ifr.body.innerHTML:z.innerHTML=document.getElementById("form_maker_editor").value,j=2;else{var x;i=gen,gen++,(x=document.createElement("option")).setAttribute("id",i+"_sel_el_pos"),x.setAttribute("value",i),x.innerHTML="Custom HTML"+i,l=document.getElementById("form_id_tempform_view"+form_view).childNodes.length,wdform_column=document.getElementById("form_id_tempform_view"+form_view).childNodes[l-2].firstChild,(L=document.createElement("div")).setAttribute("wdid",i),L.setAttribute("class","wdform_row ui-sortable-handle"),(z=document.createElement("div")).setAttribute("id","wdform_field"+i),z.setAttribute("type","type_editor"),z.setAttribute("class","wdform_field"),z.style.cssText="margin-top:0px",(q=document.createElement("div")).setAttribute("id","wdform_arrows"+i),q.setAttribute("class","wdform_arrows"),q.style.display="none",L.appendChild(z),L.appendChild(q);var C;g='<span class="wdform_arrows_advanced wdform_arrows_container"><span id="left_'+i+'" valign="middle" class="element_toolbar"><span title="Move the field to the left" class="page_toolbar dashicons dashicons-arrow-left-alt" onclick="left_row(&quot;'+i+'&quot;)"></span></span><span id="up_'+i+'" valign="middle" class="element_toolbar"><span title="Move the field up" class="page_toolbar dashicons dashicons-arrow-up-alt" onclick="up_row(&quot;'+i+'&quot;)"></span></span><span id="down_'+i+'" valign="middle" class="element_toolbar"><span title="Move the field down" class="page_toolbar dashicons dashicons-arrow-down-alt" onclick="down_row(&quot;'+i+'&quot;)"></span></span><span id="right_'+i+'" valign="middle" class="element_toolbar"><span title="Move the field to the right" class="page_toolbar dashicons dashicons-arrow-right-alt" onclick="right_row(&quot;'+i+'&quot;)"></span></span><span id="page_up_'+i+'" valign="middle" class="element_toolbar"><span title="Move the field to the upper page" class="page_toolbar dashicons dashicons-upload" onclick="page_up(&quot;'+i+'&quot;)"></span></span><span id="page_down_'+i+'" valign="middle" class="element_toolbar"><span title="Move the field to the lower page" class="page_toolbar dashicons dashicons-download" onclick="page_down(&quot;'+i+'&quot;)"></span></span></span><span class="wdform_arrows_basic wdform_arrows_container"><span id="edit_'+i+'" valign="middle" class="element_toolbar"><span title="Edit the field" class="page_toolbar fm-ico-edit" ontouchend="edit(&quot;'+i+'&quot;, event)" onclick="edit(&quot;'+i+'&quot;, event)"></span></span><span id="duplicate_'+i+'" valign="middle" class="element_toolbar"><span title="Duplicate the field" class="page_toolbar fm-ico-duplicate" ontouchend="duplicate(duplicate(&quot;'+i+'&quot;, event))" onclick="duplicate(&quot;'+i+'&quot;, event)"></span></span><span id="X_'+i+'" valign="middle" align="right" class="element_toolbar"><span title="Remove the field" class="page_toolbar fm-ico-delete" ontouchend="remove_field(&quot;'+i+'&quot;, event)" onclick="remove_field(&quot;'+i+'&quot;, event)"></span></span></span>';q.innerHTML=g,ifr_id="form_maker_editor_ifr",ifr=getIFrameDocument(ifr_id),"none"==document.getElementById("form_maker_editor").style.display?z.innerHTML=ifr.body.innerHTML:z.innerHTML=document.getElementById("form_maker_editor").value,(C=document.createElement("span")).setAttribute("id",i+"_element_labelform_id_temp"),C.innerHTML="Custom HTML"+i,C.style.color="red",L.appendChild(C),add_field_in_position(nextID,L),nextID="",j=2}close_window()}else if(document.getElementById("show_table").innerHTML){if(document.getElementById("editing_id").value?i=document.getElementById("editing_id").value:i=gen,type=document.getElementById("element_type").value,"type_hidden"==type&&""==document.getElementById(i+"_elementform_id_temp").name)return void alert("The name of the field is required.");if("type_map"==type){if(void 0===gmapdata[i]||void 0===gmapdata[i].getCenter())return alert("Please go to Global Options to setup the Map API key. It may take up to 5 minutes for API key change to take effect."),!1;if_gmap_updateMap(i)}if("type_mark_map"==type){if(void 0===gmapdata[i]||void 0===gmapdata[i].getCenter())return alert("Please go to Global Options to setup the Map API key. It may take up to 5 minutes for API key change to take effect."),!1;if_gmap_updateMap(i)}if("type_date_fields"==type&&(w_min_day=document.getElementById("edit_for_min_day").value,w_min_month=document.getElementById("edit_for_min_month").value,w_min_year=document.getElementById("edit_for_min_year").value,year_interval_from=document.getElementById("edit_for_year_interval_from").value,year_interval_to=document.getElementById("edit_for_year_interval_to").value,""!=w_min_day||""!=w_min_month||""!=w_min_year)){if(w_min_day.length<1||w_min_month.length<1||w_min_year.length<1)return alert("Please fill in all 3 fields of Min Value of Date."),!1;if(w_min_year<year_interval_from||w_min_year>year_interval_to)return alert("Min Year does not correspond with Year Interval."),!1;if("00"==w_min_day||2!=w_min_day.length||"00"==w_min_month||2!=w_min_month.length||4!=w_min_year.length)return alert("Wrong format of min date"),!1}if(!document.getElementById(i+"_element_labelform_id_temp").innerHTML)return void alert("The field label is required.");if(document.getElementById("editing_id").value){for(Disable(),i=document.getElementById("editing_id").value,in_lab=!1,labels_array=new Array,w=0;w<gen;w++)w!=i&&document.getElementById(w+"_element_labelform_id_temp")&&labels_array.push(document.getElementById(w+"_element_labelform_id_temp").innerHTML);for(t=0;t<labels_array.length;t++)if(document.getElementById(i+"_element_labelform_id_temp").innerHTML==labels_array[t]){in_lab=!0;break}if(in_lab)return void alert("Sorry, the labels must be unique.");document.getElementById("editing_id").value="",z=document.getElementById("wdform_field"+i),q=document.getElementById("wdform_arrows"+i),destroyChildren(z);var I=document.getElementById(i+"_label_sectionform_id_temp"),B=document.getElementById(i+"_element_sectionform_id_temp");if(z.appendChild(q),z.appendChild(I),z.appendChild(B),"type_submitter_mail"==type||"type_password"==type){var Q=document.createElement("br"),T=document.getElementById(i+"_1_label_sectionform_id_temp"),M=document.getElementById(i+"_1_element_sectionform_id_temp");z.appendChild(Q),z.appendChild(T),z.appendChild(M)}j=2,close_window(),call(i,e)}else{for(i=gen,in_lab=!1,labels_array=new Array,w=0;w<gen;w++)document.getElementById(w+"_element_labelform_id_temp")&&labels_array.push(document.getElementById(w+"_element_labelform_id_temp").innerHTML);for(t=0;t<labels_array.length;t++)if(document.getElementById(i+"_element_labelform_id_temp").innerHTML==labels_array[t]){in_lab=!0;break}if(in_lab)return void alert("Sorry, the labels must be unique.");var L,z,q;"type_address"==type?gen+=6:gen++,l=document.getElementById("form_id_tempform_view"+form_view).childNodes.length,wdform_column=document.getElementById("form_id_tempform_view"+form_view).childNodes[l-2].firstChild,(L=document.createElement("div")).setAttribute("wdid",i),L.setAttribute("class","wdform_row ui-sortable-handle"),(z=document.createElement("div")).setAttribute("id","wdform_field"+i),z.setAttribute("type",type),z.setAttribute("class","wdform_field"),z.style.display="table-cell",(q=document.createElement("div")).setAttribute("id","wdform_arrows"+i),q.setAttribute("class","wdform_arrows"),q.style.display="none",L.appendChild(q),L.appendChild(z);g='<span class="wdform_arrows_advanced wdform_arrows_container"><span id="left_'+i+'" valign="middle" class="element_toolbar"><span title="Move the field to the left" class="page_toolbar dashicons dashicons-arrow-left-alt" onclick="left_row(&quot;'+i+'&quot;)"></span></span><span id="up_'+i+'" valign="middle" class="element_toolbar"><span title="Move the field up" class="page_toolbar dashicons dashicons-arrow-up-alt" onclick="up_row(&quot;'+i+'&quot;)"></span></span><span id="down_'+i+'" valign="middle" class="element_toolbar"><span title="Move the field down" class="page_toolbar dashicons dashicons-arrow-down-alt" onclick="down_row(&quot;'+i+'&quot;)"></span></span><span id="right_'+i+'" valign="middle" class="element_toolbar"><span title="Move the field to the right" class="page_toolbar dashicons dashicons-arrow-right-alt" onclick="right_row(&quot;'+i+'&quot;)"></span></span><span id="page_up_'+i+'" valign="middle" class="element_toolbar"><span title="Move the field to the upper page" class="page_toolbar dashicons dashicons-upload" onclick="page_up(&quot;'+i+'&quot;)"></span></span><span id="page_down_'+i+'" valign="middle" class="element_toolbar"><span title="Move the field to the lower page" class="page_toolbar dashicons dashicons-download" onclick="page_down(&quot;'+i+'&quot;)"></span></span></span><span class="wdform_arrows_basic wdform_arrows_container"><span id="edit_'+i+'" valign="middle" class="element_toolbar"><span title="Edit the field" class="page_toolbar fm-ico-edit" ontouchend="edit(&quot;'+i+'&quot;, event)" onclick="edit(&quot;'+i+'&quot;, event)"></span></span>'+("type_captcha"!=type&&"type_arithmetic_captcha"!=type&&"type_recaptcha"!=type&&"type_send_copy"!=type&&"type_stripe"!=type?'<span id="duplicate_'+i+'" valign="middle" class="element_toolbar"><span title="Duplicate the field" class="page_toolbar fm-ico-duplicate" ontouchend="duplicate(&quot;'+i+'&quot;, event)" onclick="duplicate(&quot;'+i+'&quot;, event)"></span></span>':"")+'<span id="X_'+i+'" valign="middle" align="right" class="element_toolbar"><span title="Remove the field" class="page_toolbar fm-ico-delete" ontouchend="remove_field(&quot;'+i+'&quot;, event)" onclick="remove_field(&quot;'+i+'&quot;, event)"></span></span></span>';q.innerHTML=g;I=document.getElementById(i+"_label_sectionform_id_temp"),B=document.getElementById(i+"_element_sectionform_id_temp");if(z.appendChild(I),z.appendChild(B),"type_submitter_mail"==type||"type_password"==type){Q=document.createElement("br"),T=document.getElementById(i+"_1_label_sectionform_id_temp"),M=document.getElementById(i+"_1_element_sectionform_id_temp");z.appendChild(Q),z.appendChild(T),z.appendChild(M)}add_field_in_position(nextID,L),nextID="",j=2,close_window(),call(i,e)}}else alert("Please select an element to add.");jQuery(".wdform_arrows_advanced").hide(),jQuery(".wdform_page input[type='text'], .wdform_page input[type='password'], .wdform_page input[type='file'], .wdform_page textarea, .wdform_page input[type='checkbox'], .wdform_page input[type='radio'], .wdform_page select").prop("disabled",!0),all_sortable_events()}}else alert("The pages are closed")}function move_submit_to_end(e){var t=jQuery(e).children(":not(.fm-hidden)").last();return!!t.find("[type=type_submit_reset]").length&&t}function add_field_in_position(e,t){if(null==e||""==e){var i=jQuery("#cur_column");if(1==i.val()){var n=jQuery('<div class="wdform_column"></div>').append(t),a=move_submit_to_end(i);!1!==a?jQuery(n).insertBefore(a):i.append(n)}else i.append(t)}else beforeTr=document.getElementById("wdform_field"+e).parentNode,wdform_column=beforeTr.parentNode,wdform_column.insertBefore(t,beforeTr);jQuery(window).scrollTop(jQuery(t).offset().top-100),jQuery("#cur_column").removeAttr("id")}function draggable_page_break(e,t){var i=jQuery(".wdform_row[wdid='"+e+"']"),n="form_id_tempform_view"+t;if(!(null==e||""==e||2<get_child_count())){var a=jQuery("#cur_column").parent().parent().attr("id"),r=parseInt(a.substr(a.indexOf("form_id_tempform_view")+21));if(2==t)jQuery("#form_id_tempform_view"+t+" .wdform_section .wdform_column:first-child").append(jQuery(i.nextAll().andSelf()));else if(a==n)jQuery("#form_id_tempform_view"+t+" .wdform_section .wdform_column:first-child").append(jQuery(i.nextAll().andSelf()));else{for(var l=t-r,d=t,_=1;_<l;_++)jQuery("#form_id_tempform_view"+d+" .wdform_section .wdform_column:first-child").append(jQuery("#form_id_tempform_view"+(d-1)+" .wdform_section .wdform_column:first-child .wdform_row")),d--;jQuery("#form_id_tempform_view"+d+" .wdform_section .wdform_column:first-child").append(jQuery(i.nextAll().andSelf()))}jQuery("#cur_column").removeAttr("id")}}function get_child_count(){var e=document.getElementById("cur_column").parentNode;return child=e.children,child.length}function draggable_section_break(e,t){if(null==e||""==e)return beforeTr=wdform_page.lastChild,void wdform_page.insertBefore(wdform_section_new,beforeTr);if(2<get_child_count())return beforeTr=wdform_page.lastChild,void wdform_page.insertBefore(wdform_section_new,beforeTr);beforeTr=document.getElementById("wdform_field"+e).parentNode,wdform_column=beforeTr.parentNode,wdform_section=wdform_column.parentNode,wdform_column.insertBefore(t,beforeTr);var n=jQuery("#cur_column").find("[wdid='"+i+"']");jQuery("<div class='wdform_section curr'><div class='wdform_column ui-sortable'>").insertAfter(n.parent().parent()).append(n.nextAll().andSelf()),jQuery(".wdform_section .wdform_tr_section_break").each(function(){jQuery(this).insertBefore(jQuery(this).parent())}),jQuery("#cur_column").removeAttr("id"),jQuery(".curr").children().appendTo(".curr .wdform_column"),jQuery(".curr").append("<div class='wdform_column ui-sortable'></div>"),jQuery(".curr").removeClass("curr")}function call(e,t){fm_need_enable=!1,after_edit=!1,0==t&&(after_edit=!0,edit(e),add("1",after_edit,e)),fm_need_enable=!0}function popup_ready(){jQuery(".popup-title").html(form_maker.add_field),jQuery("#add-button-cont").html(""),jQuery("#field_container .fm-free-message").addClass("fm-hidden"),jQuery(".field-types-filter").val(""),filter(jQuery(".field-types-filter")),jQuery(".field_types .postbox button.wd-button").removeClass("button-primary"),jQuery(".field_types").show(),jQuery("#field_container").removeClass("field_container_full"),jQuery(".add-popup").slideToggle(200)}function close_window(){fm_need_enable&&popup_ready(),fm_need_enable=!0,document.getElementById("edit_table").innerHTML="",document.getElementById("show_table").innerHTML="",document.getElementById("main_editor").style.display="none",document.getElementById("form_maker_editor_ifr")&&(ifr_id="form_maker_editor_ifr",ifr=getIFrameDocument(ifr_id),ifr.body.innerHTML=""),document.getElementById("form_maker_editor").value="",document.getElementById("editing_id").value="",document.getElementById("element_type").value=""}function addRow(e,t,i,n){if(jQuery(".field_types .postbox button.wd-button").removeClass("button-primary"),jQuery(t).addClass("button-primary"),void 0===n)n="";document.getElementById("show_table").innerHTML&&(document.getElementById("show_table").innerHTML="",document.getElementById("edit_table").innerHTML="");var a=""==jQuery("#editing_id").val()?gen:jQuery("#editing_id").val();window["el_"+i](n,a),fm_add_field_button(t,n)}function fm_add_field_button(e,t){jQuery(e).hasClass("wd-pro-fields")&&"stripe"!=t?(jQuery("#edit_main_table input").prop("disabled",!0),jQuery("#edit_main_table textarea").prop("disabled",!0),jQuery("#edit_main_table .fm-input-container span.dashicons").attr("onclick",""),jQuery("#add-button-cont").removeClass("add-button-cont").html(""),jQuery("#premium_message").removeClass("fm-hidden"),jQuery("#stripe_message").addClass("fm-hidden"),jQuery("#field_container .popup-body-col").addClass("fm-opacity-40")):"stripe"!=t||0!=is_addon_stripe_active&&0!=is_stripe_enabled?(jQuery("#add-button-cont").addClass("add-button-cont").html('<button class="button button-primary button-hero wd-add-button" onclick="add(0, false); return false;">'+form_maker.add+"</button>"),jQuery("#premium_message").addClass("fm-hidden"),jQuery("#stripe_message").addClass("fm-hidden"),jQuery("#field_container .popup-body-col").removeClass("fm-opacity-40")):(jQuery("#edit_main_table input").prop("disabled",!0),jQuery("#edit_main_table textarea").prop("disabled",!0),jQuery("#edit_main_table .fm-input-container span.dashicons").attr("onclick",""),jQuery(e).hasClass("wd-pro-fields")||0!=is_stripe_enabled||1!=is_addon_stripe_active?(jQuery("#add-button-cont").removeClass("add-button-cont").html(""),jQuery("#premium_message").addClass("fm-hidden"),jQuery("#stripe_message").removeClass("fm-hidden"),jQuery("#field_container .popup-body-col").addClass("fm-opacity-40")):(jQuery("#add-button-cont").removeClass("add-button-cont").html('<div class="error"><p>'+form_maker.stripe3+"</p></div>"),jQuery("#premium_message").addClass("fm-hidden"),jQuery("#stripe_message").addClass("fm-hidden"),jQuery("#field_container .popup-body-col").removeClass("fm-opacity-40")))}function el_text(e,t){window["go_to_type_"+e](t)}function el_checkbox(e,t){w_choices=["option 1","option 2"],w_choices_checked=[!1,!1],w_choices_value=["option 1","option 2"],w_choices_params=["",""],w_attr_name=[],w_attr_value=[],type_checkbox(t,"Multiple Choice","","top","right","no","ver",w_choices,w_choices_checked,"1","","You have exceeded the selection limit.","no","no","no","0","",w_attr_name,w_attr_value,"no",w_choices_value,w_choices_params,"no")}function el_radio(e,t){w_choices=["option 1","option 2"],w_choices_checked=[!1,!1],w_choices_value=["option 1","option 2"],w_choices_params=["",""],w_attr_name=[],w_attr_value=[],type_radio(t,"Single Choice","","top","right","no","ver",w_choices,w_choices_checked,"1","no","no","no","0","",w_attr_name,w_attr_value,"no",w_choices_value,w_choices_params,"no")}function el_survey(e,t){window["go_to_type_"+e](t)}function el_time_and_date(e,t){window["go_to_type_"+e](t)}function el_select(e,t){window["go_to_type_"+e](t)}function el_file_upload(e,t){w_attr_name=[],w_attr_value=[],type_file_upload(t,"Upload a File","","top","no","form-maker","jpg, jpeg, png, gif, bmp, tif, tiff, svg, pdf, txt, log, doc, docx, csv, xls, xlsx, pps, ppt, pptx, xml, mp3, mp4, wma, wav, mpg, wmv","2000","no","no","",w_attr_name,w_attr_value)}function el_section_break(e,t){type_section_break(t,"<div class='wdform-section-break-div' style='min-width: 300px; border-top:1px solid'></div>")}function el_page_break(e,t){w_page_title="Untitled Page",w_title=["Next","Previous"],w_type=["text","text"],w_class=["wdform-page-button","wdform-page-button"],w_check=["true","false"],w_attr_name=[],w_attr_value=[],type_page_break("0",w_page_title,w_title,w_type,w_class,w_check,w_attr_name,w_attr_value)}function el_map(e,t){w_long=["2.294254"],w_lat=["48.858334"],w_info=[""],w_attr_name=[],w_attr_value=[],type_map(t,"2.294254","48.858334",w_long,w_lat,"13","370","300","wdform_map",w_info,w_attr_name,w_attr_value)}function el_paypal(e,t){window["go_to_type_"+e](t)}function el_captcha(e,t){document.getElementById("_wd_captchaform_id_temp")||document.getElementById("_wd_arithmetic_captchaform_id_temp")||document.getElementById("wd_recaptchaform_id_temp")?alert(form_maker.captcha_created):window["go_to_type_"+e](t)}function el_button(e,t){window["go_to_type_"+e](t)}function el_editor(e,t){type_editor(t,"")}function el_signature(e,t){type_signature(t,{field_type:"type_signature",field_label:"Signature",field_label_pos:"top",field_label_hide:"no",required:"no",field_label_size:"",canvas:{width:200,height:150},class:"",destination:"form-maker"})}function create_option_container(e,t,i,n){var a=jQuery('<div class="fm-option-container"'+(void 0!==i?' id="'+i+'"':"")+(0==n?' style="display: none;"':"")+"></div>");if(null!=e){var r=jQuery('<div class="fm-label-container"></div>');r.append(e),a.append(r)}if(null!=t){var l=jQuery('<div class="wd-group fm-input-container wd-has-placeholder'+(null==e?" fm-width-100":"")+'"></div>');l.append(t),a.append(l)}return a}function create_double_option_container(e,t,i,n,a){var r=jQuery('<div class="fm-option-container fm-double-option-container"></div>'),l=jQuery('<div class="fm-option-wrapper1"></div>'),d=jQuery('<div class="fm-option-wrapper2" '+("yes"===a?"":'style="display:none;"')+"></div>");if(null!=e){var _=jQuery('<div class="fm-label-container"></div>');l.append(_),_.append(e),r.append(l)}if(null!=t){var o=jQuery('<div class="wd-group fm-input-container wd-has-placeholder'+(null==e?" fm-width-100":"")+'"></div>');l.append(o),o.append(t),r.append(l)}if(null!=i){var s=jQuery('<div class="fm-label-container"></div>');d.append(s),s.append(i),r.append(d)}if(null!=n){var m=jQuery('<div class="wd-group fm-input-container wd-has-placeholder'+(null==i?" fm-width-100":"")+'"></div>');d.append(m),m.append(n),r.append(d)}return r}function create_advanced_options_container(e,t,i){var n=jQuery("<div"+(null!=t?' id="'+t+'"':"")+' class="postbox closed"'+(0==i?' style="display: none;"':"")+"></div>"),a=jQuery('<button class="handlediv" type="button" aria-expanded="true" onclick="fm_toggle_postbox(this);"><span class="screen-reader-text">Toggle panel</span><span class="toggle-indicator" aria-hidden="true"></span></button><h2 class="hndle ui-sortable-handle" onclick="fm_toggle_postbox(this);"><span>Advanced options</span></h2>');return n.append(a),n.append(e),n}function create_field_type(e){return create_option_container(null,jQuery('<span class="fm-field-label">'+jQuery(".wd-button[data-type="+e+"]").first().text()+"</span>"))}function create_label(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_label">Label</label>'),jQuery('<textarea class="fm-width-100" id="edit_for_label" rows="4" onKeyUp="change_label(\''+e+"_element_labelform_id_temp', this.value)\">"+t+"</textarea>"))}function change_label(e,t,i){if(t=t.replace(/<\/?(?!(?:\/*b|\/*p|\/*a|\/*strong|\/*span|\/*br|\/*ul|\/*ol|\/*li|\/*i)\b)(?:[^>"']|"[^"]*"|'[^']*')*>/gi,""),i)t=t.replaceAll('"',"'"),document.getElementById(i).innerHTML=t;else{var n=t.replace(/[\'\"]/g,"");document.getElementById(e).innerHTML=t,document.getElementById(e).value=n}}function create_label_position(e,t){var i=jQuery('<label class="fm-field-label">Label position</label>'),n=jQuery('<input type="radio" id="edit_for_label_position_left" name="edit_for_label_position" onchange="label_left('+e+')"'+("top"==t?"":' checked="checked"')+" />"),a=jQuery('<label for="edit_for_label_position_left">Left</label>'),r=jQuery('<input type="radio" id="edit_for_label_position_top" name="edit_for_label_position" onchange="label_top('+e+')"'+("top"==t?' checked="checked"':"")+" />"),l=jQuery('<label for="edit_for_label_position_top">Top</label>'),d=n;return create_option_container(i,d=(d=(d=d.add(a)).add(r)).add(l))}function create_label_position_stripe(e,t){var i=jQuery('<label class="fm-field-label">Label position</label>'),n=jQuery('<input type="radio" id="edit_for_label_position_left" name="edit_for_label_position" onchange="label_left_stripe('+e+')"'+("top"==t?"":' checked="checked"')+" />"),a=jQuery('<label for="edit_for_label_position_left">Left</label>'),r=jQuery('<input type="radio" id="edit_for_label_position_top" name="edit_for_label_position" onchange="label_top_stripe('+e+')"'+("top"==t?' checked="checked"':"")+" />"),l=jQuery('<label for="edit_for_label_position_top">Top</label>'),d=n;return create_option_container(i,d=(d=(d=d.add(a)).add(r)).add(l))}function label_left(e){"no"==document.getElementById(e+"_hide_labelform_id_temp").value?document.getElementById(e+"_label_sectionform_id_temp").style.display="table-cell":document.getElementById(e+"_label_sectionform_id_temp").style.display="none",document.getElementById(e+"_element_sectionform_id_temp").style.display="table-cell",document.getElementById(e+"_1_label_sectionform_id_temp")&&("yes"==document.getElementById(e+"_verification_id_temp").value?(document.getElementById(e+"_1_label_sectionform_id_temp").style.display=document.getElementById(e+"_label_sectionform_id_temp").style.display,document.getElementById(e+"_1_element_sectionform_id_temp").style.display=document.getElementById(e+"_element_sectionform_id_temp").style.display):(document.getElementById(e+"_1_label_sectionform_id_temp").style.display="none",document.getElementById(e+"_1_element_sectionform_id_temp").style.display="none"))}function label_top(e){"no"==document.getElementById(e+"_hide_labelform_id_temp").value?(document.getElementById(e+"_label_sectionform_id_temp").style.display="block",document.getElementById(e+"_element_sectionform_id_temp").style.display="block",document.getElementById(e+"_1_label_sectionform_id_temp")&&("yes"==document.getElementById(e+"_verification_id_temp").value?(document.getElementById(e+"_1_label_sectionform_id_temp").style.display=document.getElementById(e+"_label_sectionform_id_temp").style.display,document.getElementById(e+"_1_element_sectionform_id_temp").style.display=document.getElementById(e+"_element_sectionform_id_temp").style.display):(document.getElementById(e+"_1_label_sectionform_id_temp").style.display="none",document.getElementById(e+"_1_element_sectionform_id_temp").style.display="none"))):(document.getElementById(e+"_label_sectionform_id_temp").style.display="none",document.getElementById(e+"_element_sectionform_id_temp").style.display="block",document.getElementById(e+"_1_label_sectionform_id_temp")&&("yes"==document.getElementById(e+"_verification_id_temp").value?(document.getElementById(e+"_1_label_sectionform_id_temp").style.display="none",document.getElementById(e+"_1_element_sectionform_id_temp").style.display="block"):(document.getElementById(e+"_1_label_sectionform_id_temp").style.display="none",document.getElementById(e+"_1_element_sectionform_id_temp").style.display="none")))}function create_hide_label(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_hide_label">Hide label</label>'),jQuery('<input type="checkbox" id="el_hide_label" onchange="hide_label('+e+')"'+("yes"==t?' checked="checked"':"")+" />"))}function hide_label(e){"no"==document.getElementById(e+"_hide_labelform_id_temp").value?(document.getElementById(e+"_hide_labelform_id_temp").value="yes",document.getElementById(e+"_label_sectionform_id_temp").style.display="none",document.getElementById(e+"_1_elementform_id_temp")&&document.getElementById(e+"_1_elementform_id_temp").offsetParent&&(document.getElementById(e+"_1_label_sectionform_id_temp").style.display="none")):(document.getElementById("edit_for_label_position_left").checked?(document.getElementById(e+"_label_sectionform_id_temp").style.display="table-cell",document.getElementById(e+"_element_sectionform_id_temp").style.display="table-cell",document.getElementById(e+"_1_elementform_id_temp")&&document.getElementById(e+"_1_elementform_id_temp").offsetParent&&(document.getElementById(e+"_1_label_sectionform_id_temp").style.display="table-cell",document.getElementById(e+"_1_element_sectionform_id_temp").style.display="table-cell")):(document.getElementById(e+"_label_sectionform_id_temp").style.display="block",document.getElementById(e+"_element_sectionform_id_temp").style.display="block",document.getElementById(e+"_1_elementform_id_temp")&&document.getElementById(e+"_1_elementform_id_temp").offsetParent&&(document.getElementById(e+"_1_label_sectionform_id_temp").style.display="block",document.getElementById(e+"_1_element_sectionform_id_temp").style.display="block")),document.getElementById(e+"_hide_labelform_id_temp").value="no")}function create_placeholder(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_first_value_input">Placeholder</label>'),jQuery('<input type="text" class="fm-width-100" id="el_first_value_input" onKeyUp="change_input_value(this.value,\''+e+'_elementform_id_temp\')" value="'+t.replace(/"/g,"&quot;")+'" />'))}function change_input_value(e,t){input=document.getElementById(t),input.title=e,input.placeholder=e}function create_required(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_required">Required</label>'),jQuery('<input type="checkbox" id="el_required" onchange="set_required(\''+e+"_required')\""+("yes"==t?' checked="checked"':"")+" />"))}function set_required(e,t){"yes"==document.getElementById(e+"form_id_temp").value?(document.getElementById(e+"form_id_temp").setAttribute("value","no"),document.getElementById(e+"_elementform_id_temp").innerHTML="",void 0!==t&&(document.getElementById(t+"_elementform_id_temp").innerHTML="")):(document.getElementById(e+"form_id_temp").setAttribute("value","yes"),document.getElementById(e+"_elementform_id_temp").innerHTML=" *",void 0!==t&&(document.getElementById(t+"_elementform_id_temp").innerHTML=" *"))}function create_field_size(e,t,i,n){return null==i&&(i="'"+e+"_elementform_id_temp'"),create_option_container(jQuery('<label class="fm-field-label" for="edit_for_input_size">Width(px)</label>'),jQuery('<input class="fm-width-100" type="text" id="edit_for_input_size" onKeyPress="return check_isnum(event)" onKeyUp="change_w_style('+i+", this.value, "+n+')" value="'+t+'" /><p class="description">'+form_maker.leave_empty+"</p>"))}function create_field_label_size(e,t,i,n){return null==i&&(i="'"+e+"_label_sectionform_id_temp'"),create_option_container(jQuery('<label class="fm-field-label" for="edit_for_label_size">Label width(px)</label>'),jQuery('<input class="fm-width-100" type="text" id="edit_for_label_size" onKeyPress="return check_isnum(event)" onKeyUp="change_w_style('+i+", this.value, "+n+')" value="'+t+'" /><p class="description">'+form_maker.leave_empty+"</p>"))}function change_w_style(e,t,i){""==t?jQuery("#"+e).css("width",t):(jQuery("#"+e).css("width",t+"px"),i&&(document.getElementById(i).style.width=t+"px"))}function change_h_style(e,t){document.getElementById(e).style.height=t+"px"}function create_readonly(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_readonly">Readonly</label>'),jQuery('<input type="checkbox" id="el_readonly" onchange="set_readonly('+e+')"'+("yes"==t?' checked="checked"':"")+" />"))}function set_readonly(e){"no"==document.getElementById(e+"_readonlyform_id_temp").value?(document.getElementById(e+"_readonlyform_id_temp").value="yes",document.getElementById(e+"_elementform_id_temp").setAttribute("readonly","readonly")):(document.getElementById(e+"_elementform_id_temp").removeAttribute("readonly"),document.getElementById(e+"_readonlyform_id_temp").value="no")}function create_unique_values(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_unique">Allow only unique values</label>'),jQuery('<input type="checkbox" id="el_unique" onchange="set_unique(\''+e+"_uniqueform_id_temp')\""+("yes"==t?' checked="checked"':"")+" />"))}function set_unique(e){"yes"==document.getElementById(e).value?document.getElementById(e).setAttribute("value","no"):document.getElementById(e).setAttribute("value","yes")}function create_regexp(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_regExp_'+e+'">Validation (RegExp.)</label>'),jQuery('<input type="checkbox" id="el_regExp_'+e+'" onchange="set_regExpStatus(\''+e+"_regExpStatus')\""+("yes"==t?' checked="checked"':"")+" />"))}function set_regExpStatus(e){jQuery("#edit_main_tr12, #edit_main_tr13, #edit_main_tr14, #edit_main_tr15").toggle(200),"yes"==document.getElementById(e+"form_id_temp").value?document.getElementById(e+"form_id_temp").setAttribute("value","no"):document.getElementById(e+"form_id_temp").setAttribute("value","yes")}function create_custom_regexp(e,t,i){return create_option_container(jQuery('<label class="fm-field-label regExp_cell" for="regExp_value'+e+'">Regular Expression</label>'),jQuery('<textarea id="regExp_value'+e+'" class="regExp_cell fm-width-100" onKeyUp="change_regExpValue('+e+", this.value , '"+e+"_regExp_valueform_id_temp', '')\">"+i+"</textarea>"),"edit_main_tr12","yes"==t)}function change_regExpValue(e,t,i,n){0<n.length?(document.getElementById("regExp_value"+e).value=n,document.getElementById(i).value=n,document.getElementById(e+"_regExp_commonform_id_temp").value=document.getElementById("common_RegExp"+e).selectedIndex):(document.getElementById(i).value=t,document.getElementById(e+"_regExp_commonform_id_temp").value=t)}function create_common_regexp(e,t,i){var n=jQuery('<label class="fm-field-label regExp_cell">Common Regular Expressions</label>'),a=jQuery('<select class="fm-width-100" id="common_RegExp'+e+'" name="common_RegExp'+e+'" onChange="change_regExpValue('+e+", ' + w_regExp_value + ', '"+e+"_regExp_valueform_id_temp', this.value)\"></select>"),r=0,l=[];for(var d in l.Select="",l["Name(Latin letters and some symbols)"]="^[a-zA-Z'-'\\s]+$",l["Phone Number(Digits and dashes)"]="^(\\+)?[0-9]+(-[0-9]+)?(-[0-9]+)?(-[0-9]+)?$",l["Integer Number"]="^(-)?[0-9]+$",l["Decimal Number"]="^(-)?[0-9]+(\\.[0-9]+)?$",l["Latin letters and Numbers"]="^[a-z&A-Z0-9]*$",l["Credit Card (16 Digits)"]="^([0-9](\\.)?){15}[0-9]$",l["Zip Code"]="^(\\d{5}-\\d{4}|\\d{5}|\\d{9})$|^([a-zA-Z]\\d[a-zA-Z] \\d[a-zA-Z]\\d)$",l["IP Address"]="^((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})$",l["Date m/d/y (e.g. 12/21/2013)"]="^([0-9]|1[0,1,2])/([0-9]|[0,1,2][0-9]|3[0,1])/[0-9]{4}$",l["Date d.m.y (e.g. 21.12.2013)"]="^([0-9]|[0,1,2][0-9]|3[0,1])\\.([0-9]|1[0,1,2])\\.[0-9]{4}$",l["MySQL Date Format (2013-12-21)"]="^\\d{4}-(0[0-9]|1[0,1,2])-([0,1,2][0-9]|3[0,1])$",l)if(l.hasOwnProperty(d)){var _=jQuery('<option id="edit_for_label_common'+r+'" value="'+l[d]+'"'+(i==r?' selected="selected"':"")+">"+d+"</option>");a.append(_),r++}return create_option_container(n,a,"edit_main_tr13","yes"==t)}function create_case_sensitive(e,t,i){return create_option_container(jQuery('<label class="fm-field-label" for="el_regArg_'+e+'">Case Insensitive</label>'),jQuery('<input type="checkbox" id="el_regArg_'+e+'" onchange="set_regExpArgument(\''+e+"_regArgument')\""+("i"==i?' checked="checked"':"")+" />"),"edit_main_tr14","yes"==t)}function set_regExpArgument(e){document.getElementById(e+"form_id_temp").value.length<=0?document.getElementById(e+"form_id_temp").setAttribute("value","i"):document.getElementById(e+"form_id_temp").setAttribute("value","")}function create_alert_message(e,t,i){return create_option_container(jQuery('<label class="fm-field-label regExp_cell" for="regExp_alert'+e+'">Alert Message</label>'),jQuery('<textarea id="regExp_alert'+e+'" class="regExp_cell fm-width-100" onKeyUp="change_regExpAlert(this.value, \''+e+"_regExp_alertform_id_temp')\">"+i+"</textarea>"),"edit_main_tr15","yes"==t)}function change_regExpAlert(e,t){document.getElementById(t).value=e}function create_additional_attributes(e,t,i){var a=jQuery('<label class="fm-field-label">Additional Attributes</label>'),r=jQuery('<span class="fm-add-attribute dashicons dashicons-plus-alt" onClick="add_attr('+e+", '"+i+'\')" title="Add"></span>'),l=jQuery('<div id="attributes" class="fm-width-100"></div>'),d=jQuery('<div idi="0" class="fm-width-100"><div class="fm-header-label fm-width-45">Name</div><div class="fm-header-label fm-width-45">Value</div><div></div></div>');for(l.append(d),l.hide(),n=t.length,j=1;j<=n;j++){var _=jQuery('<div idi="'+j+'" id="attr_row_'+j+'" class="fm-width-100"><div class="fm-table-col fm-width-45"><input type="text" class="fm-field-choice" id="attr_name'+j+'" value="'+t[j-1]+'" onChange="change_attribute_name(\''+e+"', this, '"+i+'\')" /></div><div class="fm-table-col fm-width-45"><input type="text" class="fm-field-choice" id="attr_value'+j+'" value="'+w_attr_value[j-1]+'" onChange="change_attribute_value('+e+", "+j+", '"+i+'\')" /></div><div class="fm-table-col"><span class="fm-remove-attribute dashicons dashicons-dismiss" id="el_choices'+j+'_remove" onClick="remove_attr('+j+", "+e+", '"+i+"')\"></span></div></div>");l.append(_),l.show()}var o=a;return create_option_container(null,o=(o=o.add(r)).add(l))}function add_attr(e,t){var i=jQuery("#attributes");i.show(),j=parseInt(i.children().last().attr("idi"))+1,w_attr_name="attribute",w_attr_value="value";var n=jQuery('<div idi="'+j+'" id="attr_row_'+j+'" class="fm-width-100"><div class="fm-table-col fm-width-45"><input type="text" class="fm-field-choice" id="attr_name'+j+'" value="'+w_attr_name+'" onChange="change_attribute_name(\''+e+"', this, '"+t+'\')" /></div><div class="fm-table-col fm-width-45"><input type="text" class="fm-field-choice" id="attr_value'+j+'" value="'+w_attr_value+'" onChange="change_attribute_value('+e+", "+j+", '"+t+'\')" /></div><div class="fm-table-col"><span class="fm-remove-attribute dashicons dashicons-dismiss" id="el_choices'+j+'_remove" onClick="remove_attr('+j+", "+e+", '"+t+"')\"></span></div></div>");i.append(n),refresh_attr(e,t),jQuery("#edit_table").scrollTop(jQuery("#attributes").offset().top)}function change_attribute_name(e,t,i){if(value=t.value,value)if("style"!=value.toLowerCase())if(value!=parseInt(value)){if(-1!=value.indexOf(" ")){return value=value.replace(/\s+/g,""),t.value=value,alert("The name of the attribute cannot contain a space."),void refresh_attr(e,i)}refresh_attr(e,i)}else alert("The name of the attribute cannot be a number.");else alert('Sorry, you cannot add a style attribute here. Use "Class name" instead.');else alert("The name of the attribute is required.")}function change_attribute_value(e,t,i){document.getElementById("attr_name"+t).value?"style"!=document.getElementById("attr_name"+t).value.toLowerCase()?refresh_attr(e,i):alert('Sorry, you cannot add a style attribute here. Use "Class name" instead.'):alert("The name of the attribute is required.")}function remove_attr(e,t,i){tr=jQuery("#attr_row_"+e),table=jQuery("#attributes"),tr.remove(),1==table.children().length&&table.hide(),refresh_attr(t,i)}function refresh_attr(e,t){switch(t){case"type_text":case"type_paypal_price_new":case"type_star_rating":case"type_scale_rating":case"type_spinner":case"type_slider":case"type_grading":case"type_matrix":id_array=Array(),id_array[0]=e+"_elementform_id_temp";break;case"type_paypal_price":id_array=Array(),id_array[0]=e+"_element_dollarsform_id_temp",id_array[1]=e+"_element_centsform_id_temp";break;case"type_range":id_array=Array(),id_array[0]=e+"_elementform_id_temp0",id_array[1]=e+"_elementform_id_temp1";break;case"type_name":id_array=Array(),id_array[0]=e+"_element_firstform_id_temp",id_array[1]=e+"_element_lastform_id_temp",id_array[2]=e+"_element_titleform_id_temp",id_array[3]=e+"_element_middleform_id_temp";break;case"type_address":id_array=Array(),id_array[0]=e+"_street1form_id_temp",id_array[1]=e+"_street2form_id_temp",id_array[2]=e+"_cityform_id_temp",id_array[3]=e+"_stateform_id_temp",id_array[4]=e+"_postalform_id_temp",id_array[5]=e+"_countryform_id_temp";break;case"type_checkbox":case"type_radio":for(id_array=Array(),z=0;z<50;z++)id_array[z]=e+"_elementform_id_temp"+z;break;case"type_time":id_array=Array(),id_array[0]=e+"_hhform_id_temp",id_array[1]=e+"_mmform_id_temp",id_array[2]=e+"_ssform_id_temp",id_array[3]=e+"_am_pmform_id_temp";break;case"type_date":id_array=Array(),id_array[0]=e+"_elementform_id_temp",id_array[1]=e+"_buttonform_id_temp";break;case"type_date_fields":id_array=Array(),id_array[0]=e+"_dayform_id_temp",id_array[1]=e+"_monthform_id_temp",id_array[2]=e+"_yearform_id_temp";break;case"type_captcha":id_array=Array(),id_array[0]="_wd_captchaform_id_temp",id_array[1]="_wd_captcha_inputform_id_temp",id_array[2]="_element_refreshform_id_temp";break;case"type_arithmetic_captcha":id_array=Array(),id_array[0]="_wd_arithmetic_captchaform_id_temp",id_array[1]="_wd_arithmetic_captcha_inputform_id_temp",id_array[2]="_element_refreshform_id_temp";break;case"type_recaptcha":id_array=Array(),id_array[0]="wd_recaptchaform_id_temp";break;case"type_submit_reset":id_array=Array(),id_array[0]=e+"_element_submitform_id_temp",id_array[1]=e+"_element_resetform_id_temp";break;case"type_page_break":id_array=Array(),id_array[0]="_div_between"}for(q=0;q<id_array.length;q++){id=id_array[q];var n=document.getElementById(id);if(n){for(atr=n.attributes,i=0;i<30;i++)atr[i]&&0==atr[i].name.indexOf("add_")&&(n.removeAttribute(atr[i].name),i--);for(i=0;i<10;i++)if(document.getElementById("attr_name"+i))try{n.setAttribute("add_"+document.getElementById("attr_name"+i).value,document.getElementById("attr_value"+i).value)}catch(e){alert("Only letters, numbers, hyphens and underscores are allowed.")}}}}function return_attributes(e){attr_names=new Array,attr_values=new Array;var t=document.getElementById(e);if(t)for(atr=t.attributes,i=0;i<30;i++)atr[i]&&0==atr[i].name.indexOf("add_")&&(attr_names.push(atr[i].name.replace("add_","")),attr_values.push(atr[i].value));return Array(attr_names,attr_values)}function go_to_type_text(e){w_attr_name=[],w_attr_value=[],type_text(e,"Text","","top","no","","","","no","no","","","","Incorrect Value","no",w_attr_name,w_attr_value,"no","")}function delete_last_child(){document.getElementById("form_maker_editor_ifr")&&(ifr_id="form_maker_editor_ifr",ifr=getIFrameDocument(ifr_id),ifr.body.innerHTML=""),document.getElementById("main_editor").style.display="none",jQuery("#form_maker_editor").val(""),jQuery("#show_table").empty(),jQuery("#edit_table").empty()}function type_text(e,t,i,n,a,r,l,d,_,o,s,m,u,c,p,f,h,y,b){jQuery("#element_type").val("type_text"),delete_last_child();var v=jQuery("#edit_table"),g=jQuery('<div id="edit_div"></div>');v.append(g);var w=jQuery('<div id="edit_main_table"></div>');g.append(w),w.append(create_field_type("type_text")),w.append(create_label(e,t)),w.append(create_label_position(e,n)),w.append(create_hide_label(e,a)),w.append(create_required(e,_)),w.append(create_placeholder(e,d)),w.append(create_field_size(e,r));var E=jQuery('<div class="inside"></div>');w.append(create_advanced_options_container(E)),E.append(create_field_label_size(e,i)),E.append(create_readonly(e,y)),E.append(create_unique_values(e,p)),E.append(create_regexp(e,o)),E.append(create_common_regexp(e,o,m)),E.append(create_custom_regexp(e,o,s)),E.append(create_case_sensitive(e,o,u)),E.append(create_alert_message(e,o,c)),E.append(create_class(e,b)),E.append(create_additional_attributes(e,f,"type_text")),element="input",cur_type="text";var A=document.createElement("input");A.setAttribute("type","hidden"),A.setAttribute("value","type_text"),A.setAttribute("name",e+"_typeform_id_temp"),A.setAttribute("id",e+"_typeform_id_temp");var x=document.createElement("input");x.setAttribute("type","hidden"),x.setAttribute("value",_),x.setAttribute("name",e+"_requiredform_id_temp"),x.setAttribute("id",e+"_requiredform_id_temp");var k=document.createElement("input");k.setAttribute("type","hidden"),k.setAttribute("value",y),k.setAttribute("name",e+"_readonlyform_id_temp"),k.setAttribute("id",e+"_readonlyform_id_temp");var j=document.createElement("input");j.setAttribute("type","hidden"),j.setAttribute("value",a),j.setAttribute("name",e+"_hide_labelform_id_temp"),j.setAttribute("id",e+"_hide_labelform_id_temp");var C=document.createElement("input");C.setAttribute("type","hidden"),C.setAttribute("value",p),C.setAttribute("name",e+"_uniqueform_id_temp"),C.setAttribute("id",e+"_uniqueform_id_temp");var I=document.createElement(element);I.setAttribute("type",cur_type),I.style.cssText="width:"+r+"px;",I.setAttribute("id",e+"_elementform_id_temp"),I.setAttribute("name",e+"_elementform_id_temp"),I.setAttribute("value",l),I.setAttribute("title",d),I.setAttribute("placeholder",d),"yes"==y&&I.setAttribute("readonly","readonly");var B=document.createElement("input");B.setAttribute("type","hidden"),B.setAttribute("value",o),B.setAttribute("name",e+"_regExpStatusform_id_temp"),B.setAttribute("id",e+"_regExpStatusform_id_temp");var Q=document.createElement("input");Q.setAttribute("type","hidden"),Q.setAttribute("value",u),Q.setAttribute("name",e+"_regArgumentform_id_temp"),Q.setAttribute("id",e+"_regArgumentform_id_temp");var T=document.createElement("input");T.setAttribute("type","hidden"),T.setAttribute("value",m),T.setAttribute("name",e+"_regExp_commonform_id_temp"),T.setAttribute("id",e+"_regExp_commonform_id_temp");var M=document.createElement("input");M.setAttribute("type","hidden"),M.setAttribute("value",escape(s)),M.setAttribute("name",e+"_regExp_valueform_id_temp"),M.setAttribute("id",e+"_regExp_valueform_id_temp");var L=document.createElement("input");L.setAttribute("type","hidden"),L.setAttribute("value",c),L.setAttribute("name",e+"_regExp_alertform_id_temp"),L.setAttribute("id",e+"_regExp_alertform_id_temp");var z=document.createElement("div");z.setAttribute("id","main_div");var q=document.createElement("div");q.setAttribute("id",e+"_elemet_tableform_id_temp");var S="yes"==a?"none":"table-cell",N=document.createElement("div");N.setAttribute("align","left"),N.style.cssText="display:"+S,N.style.width=i+"px",N.setAttribute("id",e+"_label_sectionform_id_temp");var H=document.createElement("div");H.setAttribute("align","left"),H.style.display="table-cell",H.setAttribute("id",e+"_element_sectionform_id_temp");var D=document.createElement("br"),O=document.createElement("span");O.setAttribute("id",e+"_element_labelform_id_temp"),O.innerHTML=t,O.setAttribute("class","label"),O.style.verticalAlign="top";var P=document.createElement("span");P.setAttribute("id",e+"_required_elementform_id_temp"),P.innerHTML="",P.setAttribute("class","required"),P.style.verticalAlign="top","yes"==_&&(P.innerHTML=" *");var F=document.getElementById("show_table");N.appendChild(O),N.appendChild(P),H.appendChild(A),H.appendChild(x),H.appendChild(k),H.appendChild(j),H.appendChild(B),H.appendChild(M),H.appendChild(T),H.appendChild(L),H.appendChild(Q),H.appendChild(C),H.appendChild(I),q.appendChild(N),q.appendChild(H),z.appendChild(q),z.appendChild(D),F.appendChild(z),jQuery("#main_div").append(form_maker.type_text_description),"top"==n&&label_top(e),change_class(b,e),refresh_attr(e,"type_text")}function create_upload_max_size(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_max_size">Maximum size(KB)</label>'),jQuery('<input type="text" class="fm-width-100" id="edit_for_max_size" onKeyPress="return check_isnum(event)" onChange="change_file_value(this.value,\''+e+"_max_size', '***max_sizeskizb"+e+"***', '***max_sizeverj"+e+'***\')" value="'+t+'" /><p class="description">'+form_maker.upload_max_size+"</p>"))}function change_file_value(e,t,i,n){void 0===i&&(n=i=""),input=document.getElementById(t),input.value=i+e+n,input.setAttribute("value",i+e+n)}function create_upload_destination(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_destination_input">Destination</label>'),jQuery('<b id="el_destination_input_info">'+upload_url.replace(fm_site_url,"")+'/</b><input type="text" class="fm-width-100" id="el_destination_input" onChange="change_file_value(this.value,\''+e+"_destination', '***destinationskizb"+e+"***', '***destinationverj"+e+'***\')" value="'+t.replace(upload_url,"")+'" />'))}function create_upload_extensions(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_extension">Allowed file extensions</label>'),jQuery('<textarea class="fm-width-100" id="edit_for_extension" rows="4" onChange="change_file_value(this.value,\''+e+"_extension', '***extensionskizb"+e+"***', '***extensionverj"+e+"***')\">"+t+"</textarea>"))}function create_class(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_style_textarea">Class name</label>'),jQuery('<input type="text" class="fm-width-100" id="el_style_textarea" onChange="change_class(this.value,'+e+')" value="'+t+'" />'))}function change_class(e,t){document.getElementById(t+"_label_sectionform_id_temp")&&document.getElementById(t+"_label_sectionform_id_temp").setAttribute("class",e),document.getElementById(t+"_element_sectionform_id_temp")&&document.getElementById(t+"_element_sectionform_id_temp").setAttribute("class",e)}function create_multiple_upload(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_multiple">Allow Uploading Multiple Files</label>'),jQuery('<input type="checkbox" id="el_multiple" onchange="set_multiple('+e+', this.checked)"'+("yes"==t?' checked="checked"':"")+" />"))}function set_multiple(e,t){t?document.getElementById(e+"_elementform_id_temp").setAttribute("multiple","multiple"):document.getElementById(e+"_elementform_id_temp").removeAttribute("multiple")}function type_file_upload(e,t,i,n,a,r,l,d,_,o,s,m,u){jQuery("#element_type").val("type_file_upload"),delete_last_child();var c=jQuery("#edit_table"),p=jQuery('<div id="edit_div"></div>');c.append(p);var f=jQuery('<div id="edit_main_table"></div>');p.append(f),f.append(create_field_type("type_file_upload")),f.append(create_label(e,t)),f.append(create_label_position(e,n)),f.append(create_hide_label(e,a)),f.append(create_required(e,_)),f.append(create_upload_extensions(e,l));var h=jQuery('<div class="inside"></div>');f.append(create_advanced_options_container(h)),h.append(create_field_label_size(e,i)),h.append(create_upload_max_size(e,d)),h.append(create_upload_destination(e,r)),h.append(create_class(e,s)),h.append(create_multiple_upload(e,o)),h.append(create_additional_attributes(e,m,"type_file_upload")),element="input",type="file";var y=document.createElement("input");y.setAttribute("type","hidden"),y.setAttribute("value","type_file_upload"),y.setAttribute("name",e+"_typeform_id_temp"),y.setAttribute("id",e+"_typeform_id_temp");var b=document.createElement("input");b.setAttribute("type","hidden"),b.setAttribute("value",_),b.setAttribute("name",e+"_requiredform_id_temp"),b.setAttribute("id",e+"_requiredform_id_temp");var v=document.createElement("input");v.setAttribute("type","hidden"),v.setAttribute("value",a),v.setAttribute("name",e+"_hide_labelform_id_temp"),v.setAttribute("id",e+"_hide_labelform_id_temp");var g=document.createElement(element);g.setAttribute("type",type),g.setAttribute("class","file_upload"),g.setAttribute("id",e+"_elementform_id_temp"),g.setAttribute("name",e+"_fileform_id_temp"),"yes"==o&&g.setAttribute("multiple","multiple");var w=document.createElement("input");w.setAttribute("type","hidden"),w.setAttribute("value","***max_sizeskizb"+e+"***"+d+"***max_sizeverj"+e+"***"),w.setAttribute("id",e+"_max_size"),w.setAttribute("name",e+"_max_size");var E=document.createElement("input");E.setAttribute("type","hidden"),E.setAttribute("value","***destinationskizb"+e+"***"+r+"***destinationverj"+e+"***"),E.setAttribute("id",e+"_destination"),E.setAttribute("name",e+"_destination");var A=document.createElement("input");A.setAttribute("type","hidden"),A.setAttribute("value","***extensionskizb"+e+"***"+l+"***extensionverj"+e+"***"),A.setAttribute("id",e+"_extension"),A.setAttribute("name",e+"_extension");var x=document.createElement("div");x.setAttribute("id","main_div");var k=document.createElement("div");k.setAttribute("id",e+"_elemet_tableform_id_temp");var j="yes"==a?"none":"table-cell",C=document.createElement("div");C.setAttribute("align","left"),C.style.display=j,C.style.width=i+"px",C.setAttribute("id",e+"_label_sectionform_id_temp");var I=document.createElement("div");I.setAttribute("align","left"),I.style.display="table-cell",I.setAttribute("id",e+"_element_sectionform_id_temp");document.createElement("br"),document.createElement("br");var B=document.createElement("br"),Q=(document.createElement("br"),document.createElement("span"));Q.setAttribute("id",e+"_element_labelform_id_temp"),Q.innerHTML=t,Q.setAttribute("class","label"),Q.style.verticalAlign="top";var T=document.createElement("span");T.setAttribute("id",e+"_required_elementform_id_temp"),T.innerHTML="",T.setAttribute("class","required"),T.style.verticalAlign="top","yes"==_&&(T.innerHTML=" *");var M=document.getElementById("show_table");C.appendChild(Q),C.appendChild(T),I.appendChild(v),I.appendChild(y),I.appendChild(b),I.appendChild(w),I.appendChild(E),I.appendChild(A),I.appendChild(g),k.appendChild(C),k.appendChild(I),x.appendChild(k),x.appendChild(B),M.appendChild(x),jQuery("#main_div").append(form_maker.type_file_upload_description),"top"==n&&label_top(e),change_class(s,e),refresh_attr(e,"type_text")}function go_to_type_stripe(e){if(document.getElementById("is_stripe"))return!1;type_stripe(e,"Stripe","","top","yes","","")}function type_stripe(e,t,i,n,a,r,l){jQuery("#element_type").val("type_stripe"),delete_last_child();var d=jQuery("#edit_table"),_=jQuery('<div id="edit_div"></div>');d.append(_);var o=jQuery('<div id="edit_main_table"></div>');_.append(o),o.append(create_field_type("type_stripe")),o.append(create_label(e,t)),o.append(create_label_position_stripe(e,n)),o.append(create_hide_label(e,a)),o.append(create_field_size(e,r));var s=jQuery('<div class="inside"></div>');o.append(create_advanced_options_container(s)),s.append(create_field_label_size(e,i)),s.append(create_class(e,l));var m=document.createElement("input");m.setAttribute("type","hidden"),m.setAttribute("value","type_stripe"),m.setAttribute("name",e+"_typeform_id_temp"),m.setAttribute("id",e+"_typeform_id_temp");var u=document.createElement("div");u.setAttribute("id","main_div");var c=document.createElement("div");c.setAttribute("id",e+"_elemet_tableform_id_temp");var p="yes"==a?"none":"table-cell",f=document.createElement("div");f.setAttribute("align","left"),f.style.cssText="display:"+p,f.style.width=i+"px",f.setAttribute("id",e+"_label_sectionform_id_temp");var h=document.createElement("input");h.setAttribute("type","hidden"),h.setAttribute("value",a),h.setAttribute("name",e+"_hide_labelform_id_temp"),h.setAttribute("id",e+"_hide_labelform_id_temp");var y=document.createElement("div");y.setAttribute("align","left"),y.style.display="table-cell",y.setAttribute("id",e+"_element_sectionform_id_temp");document.createElement("br"),document.createElement("br");var b=document.createElement("br"),v=(document.createElement("br"),document.createElement("span"));v.setAttribute("id",e+"_element_labelform_id_temp"),v.innerHTML=t,v.setAttribute("class","label"),v.style.verticalAlign="top";var g=document.getElementById("show_table");f.appendChild(v),y.innerHTML="<div id='"+e+"_elementform_id_temp' style='width:"+r+"px; margin:10px; border: 1px solid #000; min-width:80px;text-align:center;'> Stripe Section</div><input type='hidden' id='is_stripe' />",y.appendChild(m),y.appendChild(h),c.appendChild(f),c.appendChild(y),u.appendChild(c),u.appendChild(b),g.appendChild(u),jQuery("#main_div").append(form_maker.type_stripe_description),"top"==n?label_top_stripe(e):label_left_stripe(),change_class(l,e)}function create_field_size_2(e,t,i){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_input_size">Size(px)</label>'),jQuery('<input type="text" class="fm-width-40" id="edit_for_input_size" onKeyPress="return check_isnum(event)" onKeyUp="change_w_style(\''+e+'_elementform_id_temp\', this.value)" value="'+t+'" />x<input type="text" class="fm-width-40" id="edit_for_input_size" onKeyPress="return check_isnum(event)" onKeyUp="change_h_style(\''+e+'_elementform_id_temp\', this.value)" value="'+i+'" /><p class="description">'+form_maker.leave_empty+"</p>"))}function go_to_type_textarea(e){w_attr_name=[],w_attr_value=[],type_textarea(e,"Textarea","","top","no","","100","","","","no","no","",w_attr_name,w_attr_value)}function type_textarea(e,t,i,n,a,r,l,d,_,o,s,m,u,c,p){jQuery("#element_type").val("type_textarea"),delete_last_child();var f=jQuery("#edit_table"),h=jQuery('<div id="edit_div"></div>');f.append(h);var y=jQuery('<div id="edit_main_table"></div>');h.append(y),y.append(create_field_type("type_textarea")),y.append(create_label(e,t)),y.append(create_label_position(e,n)),y.append(create_hide_label(e,a)),y.append(create_required(e,s)),y.append(create_placeholder(e,o)),y.append(create_field_size_2(e,r,l));var b=jQuery('<div class="inside"></div>');y.append(create_advanced_options_container(b)),b.append(create_field_label_size(e,i)),b.append(create_unique_values(e,m)),b.append(create_class(e,u)),b.append(create_characters_limit(e,_,"type_textarea")),b.append(create_additional_attributes(e,c,"type_textarea")),element="textarea";var v=document.createElement("input");v.setAttribute("type","hidden"),v.setAttribute("value","type_textarea"),v.setAttribute("name",e+"_typeform_id_temp"),v.setAttribute("id",e+"_typeform_id_temp");var g=document.createElement("input");g.setAttribute("type","hidden"),g.setAttribute("value",s),g.setAttribute("name",e+"_requiredform_id_temp"),g.setAttribute("id",e+"_requiredform_id_temp");var w=document.createElement("input");w.setAttribute("type","hidden"),w.setAttribute("value",a),w.setAttribute("name",e+"_hide_labelform_id_temp"),w.setAttribute("id",e+"_hide_labelform_id_temp");var E=document.createElement("input");E.setAttribute("type","hidden"),E.setAttribute("value",_),E.setAttribute("name",e+"_charlimitform_id_temp"),E.setAttribute("id",e+"_charlimitform_id_temp");var A=document.createElement("input");A.setAttribute("type","hidden"),A.setAttribute("value",m),A.setAttribute("name",e+"_uniqueform_id_temp"),A.setAttribute("id",e+"_uniqueform_id_temp");var x=document.createElement("div");x.setAttribute("id","main_div");var k=document.createElement("div");k.setAttribute("id",e+"_elemet_tableform_id_temp");var j="yes"==a?"none":"table-cell",C=document.createElement("div");C.setAttribute("align","left"),C.style.display=j,C.style.width=i+"px",C.style.verticalAlign="top",C.setAttribute("id",e+"_label_sectionform_id_temp");var I=document.createElement("div");I.setAttribute("align","left"),I.style.display="table-cell",I.setAttribute("id",e+"_element_sectionform_id_temp");var B=document.createElement("span");B.setAttribute("id",e+"_element_labelform_id_temp"),B.innerHTML=t,B.setAttribute("class","label"),B.style.verticalAlign="top";var Q=document.createElement("span");Q.setAttribute("id",e+"_required_elementform_id_temp"),Q.innerHTML="",Q.setAttribute("class","required"),Q.style.verticalAlign="top","yes"==s&&(Q.innerHTML=" *");var T=document.createElement(element);T.style.cssText="width:"+r+"px; height:"+l+"px;",T.setAttribute("id",e+"_elementform_id_temp"),T.setAttribute("name",e+"_elementform_id_temp"),T.setAttribute("title",o),T.setAttribute("placeholder",o),T.setAttribute("value",d),T.setAttribute("maxlength",_),T.innerHTML=d;var M=document.getElementById("show_table");C.appendChild(B),C.appendChild(Q),I.appendChild(v),I.appendChild(g),I.appendChild(E),I.appendChild(w),I.appendChild(A),I.appendChild(T),k.appendChild(C),k.appendChild(I),x.appendChild(k),M.appendChild(x),jQuery("#main_div").append("<br>"+form_maker.type_textarea_description),"top"==n&&label_top(e),change_class(u,e),refresh_attr(e,"type_text")}function create_spinner_width(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_spinner_width">Width(px)</label>'),jQuery('<input class="fm-width-100" type="text" id="edit_for_spinner_width" onKeyPress="return check_isnum(event)" onKeyUp="change_spinner_width(this.value,'+e+",'form_id_temp')\" value=\""+t+'" /><p class="description">'+form_maker.leave_empty+"</p>"))}function change_spinner_width(e,t,i){document.getElementById(t+"_elementform_id_temp").style.cssText="width:"+e+"px",document.getElementById(t+"_spinner_widthform_id_temp").value=e}function create_spinner_step(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_spinner_step">Step</label>'),jQuery('<input class="fm-width-100" type="text" id="edit_for_spinner_step" onKeyPress="return check_isnum(event)" onKeyUp="change_spinner_step(this.value,'+e+",'form_id_temp')\" value=\""+t+'" />'))}function change_spinner_step(e,t,i){jQuery("#"+t+"_elementform_id_temp").spinner({step:e}),document.getElementById(t+"_stepform_id_temp").value=e}function create_spinner_minvalue(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_spinner_min_value">Min Value</label>'),jQuery('<input class="fm-width-100" type="text" id="edit_for_spinner_min_value" onKeyPress="return check_isnum_or_minus(event)" onKeyUp="change_spinner_min_value(this.value,'+e+",'form_id_temp')\" value=\""+t+'" />'))}function change_spinner_min_value(e,t,i){jQuery("#"+t+"_elementform_id_temp").spinner({min:e}),document.getElementById(t+"_min_valueform_id_temp").value=e}function create_spinner_maxvalue(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_spinner_max_value">Max Value</label>'),jQuery('<input class="fm-width-100" type="text" id="edit_for_spinner_max_value" onKeyPress="return check_isnum_or_minus(event)" onKeyUp="change_spinner_max_value(this.value,'+e+",'form_id_temp')\" value=\""+t+'" />'))}function change_spinner_max_value(e,t,i){jQuery("#"+t+"_elementform_id_temp").spinner({max:e}),document.getElementById(t+"_max_valueform_id_temp").value=e}function go_to_type_spinner(e){w_attr_name=[],w_attr_value=[],type_spinner(e,"Number","","top","no","60","","","1","","no","",w_attr_name,w_attr_value)}function type_spinner(e,t,i,n,a,r,l,d,_,o,s,m,u,c){jQuery("#element_type").val("type_spinner"),delete_last_child();var p=jQuery("#edit_table"),f=jQuery('<div id="edit_div"></div>');p.append(f);var h=jQuery('<div id="edit_main_table"></div>');f.append(h),h.append(create_field_type("type_spinner")),h.append(create_label(e,t)),h.append(create_label_position(e,n)),h.append(create_hide_label(e,a)),h.append(create_required(e,s)),h.append(create_spinner_step(e,_)),h.append(create_spinner_minvalue(e,l)),h.append(create_spinner_maxvalue(e,d)),h.append(create_spinner_width(e,r));var y=jQuery('<div class="inside"></div>');h.append(create_advanced_options_container(y)),y.append(create_field_label_size(e,i)),y.append(create_class(e,m)),y.append(create_additional_attributes(e,u,"type_spinner"));var b=document.createElement("input");b.setAttribute("type","hidden"),b.setAttribute("value","type_spinner"),b.setAttribute("name",e+"_typeform_id_temp"),b.setAttribute("id",e+"_typeform_id_temp");var v=document.createElement("input");v.setAttribute("type","hidden"),v.setAttribute("value",s),v.setAttribute("name",e+"_requiredform_id_temp"),v.setAttribute("id",e+"_requiredform_id_temp");var g=document.createElement("input");g.setAttribute("type","hidden"),g.setAttribute("value",a),g.setAttribute("name",e+"_hide_labelform_id_temp"),g.setAttribute("id",e+"_hide_labelform_id_temp");var w=document.createElement("input");w.setAttribute("type","hidden"),w.setAttribute("value",r),w.setAttribute("name",e+"_spinner_widthform_id_temp"),w.setAttribute("id",e+"_spinner_widthform_id_temp");var E=document.createElement("input");E.setAttribute("type","hidden"),E.setAttribute("value",l),E.setAttribute("id",e+"_min_valueform_id_temp"),E.setAttribute("name",e+"_min_valueform_id_temp");var A=document.createElement("input");A.setAttribute("type","hidden"),A.setAttribute("value",d),A.setAttribute("name",e+"_max_valueform_id_temp"),A.setAttribute("id",e+"_max_valueform_id_temp");var x=document.createElement("input");x.setAttribute("type","hidden"),x.setAttribute("value",_),x.setAttribute("name",e+"_stepform_id_temp"),x.setAttribute("id",e+"_stepform_id_temp");var k=document.createElement("input");k.setAttribute("type",""),k.style.cssText="width:"+r+"px",k.setAttribute("name",e+"_elementform_id_temp"),k.setAttribute("id",e+"_elementform_id_temp"),k.setAttribute("value",o),k.setAttribute("onClick","check_isnum_or_minus(event)"),k.setAttribute("onKeyPress","return check_isnum_or_minus(event)");var j=document.createElement("div");j.setAttribute("id","main_div");var C=document.createElement("div");C.setAttribute("id",e+"_elemet_tableform_id_temp");var I="yes"==a?"none":"table-cell",B=document.createElement("div");B.setAttribute("align","left"),B.style.display=I,B.style.width=i+"px",B.setAttribute("id",e+"_label_sectionform_id_temp");var Q=document.createElement("div");Q.setAttribute("align","left"),Q.style.display="table-cell",Q.setAttribute("id",e+"_element_sectionform_id_temp");var T=document.createElement("br"),M=document.createElement("span");M.setAttribute("id",e+"_element_labelform_id_temp"),M.innerHTML=t,M.setAttribute("class","label");var L=document.createElement("span");L.setAttribute("id",e+"_required_elementform_id_temp"),L.innerHTML="",L.setAttribute("class","required"),"yes"==s&&(L.innerHTML=" *");var z=document.getElementById("show_table");B.appendChild(M),B.appendChild(L),Q.appendChild(g),Q.appendChild(b),Q.appendChild(v),Q.appendChild(w),Q.appendChild(E),Q.appendChild(A),Q.appendChild(x),Q.appendChild(k),C.appendChild(B),C.appendChild(Q),j.appendChild(C),j.appendChild(T),z.appendChild(j),"top"==n&&label_top(e),change_class(m,e),refresh_attr(e,"type_spinner"),jQuery("#"+e+"_elementform_id_temp").spinner();var q=jQuery("#"+e+"_elementform_id_temp").spinner();null==o&&q.spinner("value",""),jQuery("#"+e+"_elementform_id_temp").spinner({min:l}),jQuery("#"+e+"_elementform_id_temp").spinner({max:d}),jQuery("#"+e+"_elementform_id_temp").spinner({step:_}),jQuery("#main_div").append(form_maker.type_number_description)}function create_date_format(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="date_format">Date Format</label>'),jQuery('<input class="fm-width-100" type="text" id="date_format" onChange="change_date_format(this.value, '+e+", 'format')\" value=\""+t+'" />'))}function change_date_format(e,t,i){var n=document.getElementById(t+"_buttonform_id_temp"),a=document.getElementById("default_date_start"),r=document.getElementById("default_date_end"),l=document.getElementById("min_date"),d=document.getElementById("max_date");if("format"==i){document.getElementById(t+"_dis_past_daysform_id_temp").value;n.setAttribute("format",e),l.setAttribute("placeholder",e),d.setAttribute("placeholder",e),(a||a)&&(a.setAttribute("placeholder",e),r.setAttribute("placeholder",e))}else{document.getElementById(t+"_dis_past_daysform_id_temp").value=1==e?"yes":"no";e=document.getElementById("date_format").value}jQuery("[name^="+t+"_elementform_id_temp]").datepicker("option","dateFormat",e)}function create_week_start(e,t){var i=jQuery('<label class="fm-field-label">First Day of the Week</label>'),n=jQuery('<select class="fm-width-100" id="start_day" name="start_day" onChange="change_start_day(this.value,'+e+')"></select>'),a=0,r=[];for(var l in r[0]=form_maker.sunday,r[1]=form_maker.monday,r[2]=form_maker.tuesday,r[3]=form_maker.wednesday,r[4]=form_maker.thursday,r[5]=form_maker.friday,r[6]=form_maker.saturday,r)if(r.hasOwnProperty(l)){var d=jQuery('<option value="'+l+'"'+(t==a?' selected="selected"':"")+">"+r[l]+"</option>");n.append(d),a++}return create_option_container(i,n)}function change_start_day(e,t){document.getElementById(t+"_start_dayform_id_temp").value=e,jQuery("input[name^="+t+"_elementform_id_temp]").datepicker("option","firstDay",e)}function create_default_date(e,t){var i=jQuery("#date_format").val();return create_option_container(jQuery('<label class="fm-field-label" for="default_date">Default Date</label>'),jQuery('<input class="fm-width-100" type="text" id="default_date" placeholder="'+i+"\" onChange=\"change_hidden_input_value(this.value, 'default_date', "+e+", '"+e+'_default_date_id_temp\')" value="'+t+'" />'))}function change_hidden_input_value(element_value,date_fields,id_int,id){document.getElementById(id).value=element_value;var date_format=jQuery("#"+id_int+"_buttonform_id_temp").attr("format");"default_date"==date_fields?"today"==element_value?jQuery("#"+id_int+"_elementform_id_temp").datepicker("setDate",new Date):(-1==element_value.indexOf("d")&&-1==element_value.indexOf("m")&&-1==element_value.indexOf("y")&&-1==element_value.indexOf("w")&&""!==element_value&&(element_value=jQuery.datepicker.formatDate(date_format,new Date(element_value))),jQuery("#"+id_int+"_elementform_id_temp").datepicker("setDate",element_value)):"minDate"==date_fields||"maxDate"==date_fields?"today"==element_value?jQuery("#"+id_int+"_elementform_id_temp").datepicker("option",date_fields,new Date):(-1==element_value.indexOf("d")&&-1==element_value.indexOf("m")&&-1==element_value.indexOf("y")&&-1==element_value.indexOf("w")&&""!==element_value&&(element_value=jQuery.datepicker.formatDate(date_format,new Date(element_value))),jQuery("#"+id_int+"_elementform_id_temp").datepicker("option",date_fields,element_value)):jQuery("#"+id_int+"_elementform_id_temp").datepicker("option","beforeShowDay",function(date){for(var invalid_dates=element_value,invalid_dates_finish=[],invalid_dates_start=invalid_dates.split(","),invalid_date_range=[],i=0;i<invalid_dates_start.length;i++)if(invalid_dates_start[i]=invalid_dates_start[i].trim(),invalid_dates_start[i].length<11)invalid_dates_finish.push(invalid_dates_start[i]);else if(4<invalid_dates_start[i].indexOf("-"))invalid_date_range.push(invalid_dates_start[i].split("-"));else{var invalid_date_array=invalid_dates_start[i].split("-"),start_invalid_day=invalid_date_array[0]+"-"+invalid_date_array[1]+"-"+invalid_date_array[2],end_invalid_day=invalid_date_array[3]+"-"+invalid_date_array[4]+"-"+invalid_date_array[5];invalid_date_range.push([start_invalid_day,end_invalid_day])}jQuery.each(invalid_date_range,function(e,t){for(var i=new Date(t[0]);i<=new Date(t[1]);i.setDate(i.getDate()+1))invalid_dates_finish.push(jQuery.datepicker.formatDate(date_format,i))});var w_hide_sunday="yes"==jQuery("#"+id_int+"_show_week_days").attr("sunday")?"true":"day != 0",w_hide_monday="yes"==jQuery("#"+id_int+"_show_week_days").attr("monday")?"true":"day != 1",w_hide_tuesday="yes"==jQuery("#"+id_int+"_show_week_days").attr("tuesday")?"true":"day != 2",w_hide_wednesday="yes"==jQuery("#"+id_int+"_show_week_days").attr("wednesday")?"true":"day != 3",w_hide_thursday="yes"==jQuery("#"+id_int+"_show_week_days").attr("thursday")?"true":"day != 4",w_hide_friday="yes"==jQuery("#"+id_int+"_show_week_days").attr("friday")?"true":"day != 5",w_hide_saturday="yes"==jQuery("#"+id_int+"_show_week_days").attr("saturday")?"true":"day != 6",day=date.getDay(),string_days=jQuery.datepicker.formatDate(date_format,date);return[-1==invalid_dates_finish.indexOf(string_days)&&eval(w_hide_sunday)&&eval(w_hide_monday)&&eval(w_hide_tuesday)&&eval(w_hide_wednesday)&&eval(w_hide_thursday)&&eval(w_hide_friday)&&eval(w_hide_saturday)]})}function create_minimum_date(e,t,i){var n=jQuery("#date_format").val();return create_option_container(jQuery('<label class="fm-field-label" for="min_date">Minimum Date</label>'),jQuery('<input class="fm-width-100" type="text" id="min_date" placeholder="'+n+'" onChange="'+(1==i?"change_hidden_input_value_range(this.value, 'minDate', 'start', '"+e+"', '"+e+"_min_date_id_temp')":"change_hidden_input_value(this.value, 'minDate', "+e+", '"+e+"_min_date_id_temp')")+'" value="'+t+'" />'))}function create_maximum_date(e,t,i){var n=jQuery("#date_format").val();return create_option_container(jQuery('<label class="fm-field-label" for="max_date">Maximum Date</label>'),jQuery('<input class="fm-width-100" type="text" id="max_date" placeholder="'+n+'" onChange="'+(1==i?"change_hidden_input_value_range(this.value, 'maxDate', 'end', "+e+", '"+e+"_max_date_id_temp')":"change_hidden_input_value(this.value, 'maxDate', "+e+", '"+e+"_max_date_id_temp')")+'" value="'+t+'" />'))}function create_excluded_dates(e,t,i){return create_option_container(jQuery('<label class="fm-field-label" for="invalid_dates">Dates to Exclude</label>'),jQuery('<textarea class="fm-width-100" id="invalid_dates" rows="4" onChange="'+(1==i?"change_hidden_input_value_range(this.value, 'invalide_date', '', "+e+", '"+e+"_invalid_dates_id_temp')":"change_hidden_input_value(this.value, 'invalide_date', "+e+", '"+e+"_invalid_dates_id_temp')")+'">'+t+"</textarea>"))}function create_show_date_picker_button(e,t,i){return create_option_container(jQuery('<label class="fm-field-label" for="el_show_image">Show Date Picker Button</label>'),jQuery('<input type="checkbox" id="el_show_image" onchange="show_image_datepicker(\''+e+"_show_image', '"+i+"')\""+("yes"==t?' checked="checked"':"")+" />"))}function show_image_datepicker(e,t){"yes"==document.getElementById(e+"form_id_temp").value?("date_range"==t?(jQuery("#"+e+"dateform_id_temp0").removeClass("wd-inline-block"),jQuery("#"+e+"dateform_id_temp0").addClass("wd-hidden"),jQuery("#"+e+"dateform_id_temp1").removeClass("wd-inline-block"),jQuery("#"+e+"dateform_id_temp1").addClass("wd-hidden")):(jQuery("#"+e+"dateform_id_temp").removeClass("wd-inline-block"),jQuery("#"+e+"dateform_id_temp").addClass("wd-hidden")),document.getElementById(e+"form_id_temp").setAttribute("value","no")):("date_range"==t?(jQuery("#"+e+"dateform_id_temp0").removeClass("wd-hidden"),jQuery("#"+e+"dateform_id_temp0").addClass("wd-inline-block"),jQuery("#"+e+"dateform_id_temp1").removeClass("wd-hidden"),jQuery("#"+e+"dateform_id_temp1").addClass("wd-inline-block")):(jQuery("#"+e+"dateform_id_temp").removeClass("wd-hidden"),jQuery("#"+e+"dateform_id_temp").addClass("wd-inline-block")),document.getElementById(e+"form_id_temp").setAttribute("value","yes"))}function create_selectable_week_days(e,t){var i=jQuery('<label class="fm-field-label">Selectable Week Days</label>'),n=jQuery('<input type="checkbox" id="el_show_sunday" onclick="show_week_days('+e+", 'sunday')\""+("yes"==t[0]?' checked="checked"':"")+" />"),a=jQuery('<label for="el_show_sunday">'+form_maker.sunday+"</label>"),r=jQuery('<input type="checkbox" id="el_show_monday" onclick="show_week_days('+e+", 'monday')\""+("yes"==t[1]?' checked="checked"':"")+" />"),l=jQuery('<label for="el_show_monday">'+form_maker.monday+"</label>"),d=jQuery('<input type="checkbox" id="el_show_tuesday" onclick="show_week_days('+e+", 'tuesday')\""+("yes"==t[2]?' checked="checked"':"")+" />"),_=jQuery('<label for="el_show_tuesday">'+form_maker.tuesday+"</label>"),o=jQuery('<input type="checkbox" id="el_show_wednesday" onclick="show_week_days('+e+", 'wednesday')\""+("yes"==t[3]?' checked="checked"':"")+" />"),s=jQuery('<label for="el_show_wednesday">'+form_maker.wednesday+"</label>"),m=jQuery('<input type="checkbox" id="el_show_thursday" onclick="show_week_days('+e+", 'thursday')\""+("yes"==t[4]?' checked="checked"':"")+" />"),u=jQuery('<label for="el_show_thursday">'+form_maker.thursday+"</label>"),c=jQuery('<input type="checkbox" id="el_show_friday" onclick="show_week_days('+e+", 'friday')\""+("yes"==t[5]?' checked="checked"':"")+" />"),p=jQuery('<label for="el_show_friday">'+form_maker.friday+"</label>"),f=jQuery('<input type="checkbox" id="el_show_saturday" onclick="show_week_days('+e+", 'saturday')\""+("yes"==t[6]?' checked="checked"':"")+" />"),h=jQuery('<label for="el_show_saturday">'+form_maker.saturday+"</label>"),y=n;return create_option_container(i,y=(y=(y=(y=(y=(y=(y=(y=(y=(y=(y=(y=(y=(y=(y=(y=(y=(y=(y=y.add(a)).add(jQuery("<br />"))).add(r)).add(l)).add(jQuery("<br />"))).add(d)).add(_)).add(jQuery("<br />"))).add(o)).add(s)).add(jQuery("<br />"))).add(m)).add(u)).add(jQuery("<br />"))).add(c)).add(p)).add(jQuery("<br />"))).add(f)).add(h))}function go_to_type_date_new(e){w_attr_name=[],w_attr_value=[],w_show_days=["yes","yes","yes","yes","yes","yes","yes"],type_date_new(e,"Date","","top","no","","","no","no","","mm/dd/yy","0","","","","",w_show_days,"yes","...",w_attr_name,w_attr_value,"no")}function type_date_new(i,w_field_label,w_field_label_size,w_field_label_pos,w_hide_label,w_size,w_date,w_required,w_show_image,w_class,w_format,w_start_day,w_default_date,w_min_date,w_max_date,w_invalid_dates,w_show_days,w_hide_time,w_but_val,w_attr_name,w_attr_value,w_disable_past_days){jQuery("#element_type").val("type_date_new"),delete_last_child();var t=jQuery("#edit_table"),edit_div=jQuery('<div id="edit_div"></div>');t.append(edit_div);var edit_main_table=jQuery('<div id="edit_main_table"></div>');edit_div.append(edit_main_table),edit_main_table.append(create_field_type("type_date_new")),edit_main_table.append(create_label(i,w_field_label)),edit_main_table.append(create_label_position(i,w_field_label_pos)),edit_main_table.append(create_hide_label(i,w_hide_label)),edit_main_table.append(create_required(i,w_required)),edit_main_table.append(create_field_size(i,w_size)),edit_main_table.append(create_date_format(i,w_format)),edit_main_table.append(create_week_start(i,w_start_day));var advanced_options_container=jQuery('<div class="inside"></div>');edit_main_table.append(create_advanced_options_container(advanced_options_container)),advanced_options_container.append(create_default_date(i,w_default_date)),advanced_options_container.append(create_minimum_date(i,w_min_date)),advanced_options_container.append(create_maximum_date(i,w_max_date)),advanced_options_container.append(create_excluded_dates(i,w_invalid_dates)),advanced_options_container.append(create_selectable_week_days(i,w_show_days)),advanced_options_container.append(create_field_label_size(i,w_field_label_size)),advanced_options_container.append(create_class(i,w_class)),advanced_options_container.append(create_show_date_picker_button(i,w_show_image,"new_date")),advanced_options_container.append(create_additional_attributes(i,w_attr_name,"type_date_new"));var adding_type=document.createElement("input");adding_type.setAttribute("type","hidden"),adding_type.setAttribute("value","type_date_new"),adding_type.setAttribute("name",i+"_typeform_id_temp"),adding_type.setAttribute("id",i+"_typeform_id_temp");var adding_required=document.createElement("input");adding_required.setAttribute("type","hidden"),adding_required.setAttribute("value",w_required),adding_required.setAttribute("name",i+"_requiredform_id_temp"),adding_required.setAttribute("id",i+"_requiredform_id_temp");var adding_hide_label=document.createElement("input");adding_hide_label.setAttribute("type","hidden"),adding_hide_label.setAttribute("value",w_hide_label),adding_hide_label.setAttribute("name",i+"_hide_labelform_id_temp"),adding_hide_label.setAttribute("id",i+"_hide_labelform_id_temp");var adding_dis_past_days=document.createElement("input");adding_dis_past_days.setAttribute("type","hidden"),adding_dis_past_days.setAttribute("value",w_disable_past_days),adding_dis_past_days.setAttribute("id",i+"_dis_past_daysform_id_temp"),adding_dis_past_days.setAttribute("name",i+"_dis_past_daysform_id_temp");var adding_start_day=document.createElement("input");adding_start_day.setAttribute("type","hidden"),adding_start_day.setAttribute("value",w_start_day),adding_start_day.setAttribute("name",i+"_start_dayform_id_temp"),adding_start_day.setAttribute("id",i+"_start_dayform_id_temp");var adding_default_date=document.createElement("input");adding_default_date.setAttribute("type","hidden"),adding_default_date.setAttribute("name",i+"_default_date_id_temp"),adding_default_date.setAttribute("id",i+"_default_date_id_temp"),adding_default_date.setAttribute("value",w_default_date);var adding_min_date=document.createElement("input");adding_min_date.setAttribute("type","hidden"),adding_min_date.setAttribute("name",i+"_min_date_id_temp"),adding_min_date.setAttribute("id",i+"_min_date_id_temp"),adding_min_date.setAttribute("value",w_min_date);var adding_max_date=document.createElement("input");adding_max_date.setAttribute("type","hidden"),adding_max_date.setAttribute("name",i+"_max_date_id_temp"),adding_max_date.setAttribute("id",i+"_max_date_id_temp"),adding_max_date.setAttribute("value",w_max_date);var adding_invalid_dates=document.createElement("input");adding_invalid_dates.setAttribute("type","hidden"),adding_invalid_dates.setAttribute("name",i+"_invalid_dates_id_temp"),adding_invalid_dates.setAttribute("id",i+"_invalid_dates_id_temp"),adding_invalid_dates.setAttribute("value",w_invalid_dates);var adding_show_days=document.createElement("input");adding_show_days.setAttribute("type","hidden"),adding_show_days.setAttribute("name",i+"_show_week_days"),adding_show_days.setAttribute("id",i+"_show_week_days"),adding_show_days.setAttribute("sunday",w_show_days[0]),adding_show_days.setAttribute("monday",w_show_days[1]),adding_show_days.setAttribute("tuesday",w_show_days[2]),adding_show_days.setAttribute("wednesday",w_show_days[3]),adding_show_days.setAttribute("thursday",w_show_days[4]),adding_show_days.setAttribute("friday",w_show_days[5]),adding_show_days.setAttribute("saturday",w_show_days[6]);var adding_show_image=document.createElement("input");adding_show_image.setAttribute("type","hidden"),adding_show_image.setAttribute("value",w_show_image),adding_show_image.setAttribute("name",i+"_show_imageform_id_temp"),adding_show_image.setAttribute("id",i+"_show_imageform_id_temp");var adding_hide_time=document.createElement("input");adding_hide_time.setAttribute("type","hidden"),adding_hide_time.setAttribute("value",w_hide_time),adding_hide_time.setAttribute("name",i+"_hide_timeform_id_temp"),adding_hide_time.setAttribute("id",i+"_hide_timeform_id_temp");var div=document.createElement("div");div.setAttribute("id","main_div");var div_field=document.createElement("div");div_field.setAttribute("id",i+"_elemet_tableform_id_temp");var display_label_div="yes"==w_hide_label?"none":"table-cell",div_label=document.createElement("div");div_label.setAttribute("align","left"),div_label.style.display=display_label_div,div_label.style.width=w_field_label_size+"px",div_label.setAttribute("id",i+"_label_sectionform_id_temp");var div_element=document.createElement("div");div_element.setAttribute("align","left"),div_element.style.display="table-cell",div_element.style.position="relative",div_element.setAttribute("id",i+"_element_sectionform_id_temp");var table_date=document.createElement("div");table_date.setAttribute("id",i+"_table_date"),table_date.style.display="table";var tr_date1=document.createElement("div");tr_date1.setAttribute("id",i+"_tr_date1"),tr_date1.style.display="table-row";var tr_date2=document.createElement("div");tr_date2.setAttribute("id",i+"_tr_date2"),tr_date2.style.display="table-row";var td_date_input1=document.createElement("div");td_date_input1.setAttribute("id",i+"_td_date_input1"),td_date_input1.style.display="table-cell";var td_date_input2=document.createElement("div");td_date_input2.setAttribute("id",i+"_td_date_input2"),td_date_input2.style.display="table-cell";var td_date_input3=document.createElement("div");td_date_input3.setAttribute("id",i+"_td_date_input3"),td_date_input3.style.display="table-cell";var td_date_label1=document.createElement("div");td_date_label1.setAttribute("id",i+"_td_date_label1"),td_date_label1.style.display="table-cell";var td_date_label2=document.createElement("div");td_date_label2.setAttribute("id",i+"_td_date_label2"),td_date_label2.style.display="table-cell";var td_date_label3=document.createElement("div");td_date_label3.setAttribute("id",i+"_td_date_label3"),td_date_label3.style.display="table-cell";var br3=document.createElement("br"),br4=document.createElement("br"),label=document.createElement("span");label.setAttribute("id",i+"_element_labelform_id_temp"),label.innerHTML=w_field_label,label.setAttribute("class","label"),label.style.verticalAlign="top";var required=document.createElement("span");required.setAttribute("id",i+"_required_elementform_id_temp"),required.innerHTML="",required.setAttribute("class","required"),required.style.verticalAlign="top","yes"==w_required&&(required.innerHTML=" *");var adding=document.createElement("input");adding.setAttribute("type","text"),adding.setAttribute("value",w_date),adding.setAttribute("id",i+"_elementform_id_temp"),adding.setAttribute("name",i+"_elementform_id_temp"),adding.style.cssText="width:"+w_size+"px;";var adding_image=document.createElement("span");adding_image.setAttribute("id",i+"_show_imagedateform_id_temp"),adding_image.setAttribute("class","dashicons dashicons-calendar-alt wd-calendar-button "+("yes"==w_show_image?"wd-inline-block":"wd-hidden")),adding_image.setAttribute("onClick","show_datepicker('"+i+"_elementform_id_temp')");var adding_desc_p=document.createElement("p"),adding_desc_b=document.createElement("b"),text_format_1=document.createTextNode("The format can be combinations of the following:"),text_format_2=document.createTextNode("d - day of month (no leading zero)"),text_format_3=document.createTextNode("dd - day of month (two digit)"),text_format_4=document.createTextNode("o - day of the year (no leading zeros)"),text_format_5=document.createTextNode("oo - day of the year (three digit)"),text_format_6=document.createTextNode("D - day name short"),text_format_7=document.createTextNode("DD - day name long"),text_format_8=document.createTextNode("m - month of year (no leading zero)"),text_format_9=document.createTextNode("mm - month of year (two digit)"),text_format_10=document.createTextNode("M - month name short"),text_format_11=document.createTextNode("MM - month name long"),text_format_12=document.createTextNode("y - year (two digit)"),text_format_13=document.createTextNode("yy - year (four digit)"),format_br_1=document.createElement("br"),format_br_2=document.createElement("br"),format_br_3=document.createElement("br"),format_br_4=document.createElement("br"),format_br_5=document.createElement("br"),format_br_6=document.createElement("br"),format_br_7=document.createElement("br"),format_br_8=document.createElement("br"),format_br_9=document.createElement("br"),format_br_10=document.createElement("br"),format_br_11=document.createElement("br"),format_br_12=document.createElement("br"),format_br_13=document.createElement("br"),adding_desc_p_2=document.createElement("p"),adding_desc_b_2=document.createElement("b"),text_default_1=document.createTextNode("Accepted values of Default, Minimum and Maximum:"),text_default_2=document.createTextNode("Empty: No default / minimum / maximum"),text_default_4=document.createTextNode("Current date : 'today'"),text_default_5=document.createTextNode("Relative date: A number of days/weeks/months/years from today, e.g. '-1d' will be yesterday, '+1y+3m+2w+3d' will be 1 year, 3 months, 2 weeks and 3 days from today."),adding_desc_p_3=document.createElement("p"),adding_desc_b_3=document.createElement("b"),text_default_6=document.createTextNode("Dates to exclude:"),text_default_7=document.createTextNode("Enter comma-separated list of dates and date ranges using the date format 'mm/dd/yy', e.g. 08/15/2016, 06/15/2016-06/20/2016"),default_br_1=document.createElement("br"),default_br_2=document.createElement("br"),default_br_4=document.createElement("br"),default_br_5=document.createElement("br"),default_br_6=document.createElement("br"),default_br_7=document.createElement("br"),dis_past_days="yes"==w_disable_past_days,adding_button=document.createElement("input");adding_button.setAttribute("id",i+"_buttonform_id_temp"),adding_button.setAttribute("class","button"),adding_button.setAttribute("type","hidden"),adding_button.setAttribute("value",w_but_val),adding_button.setAttribute("format",w_format);var main_td=document.getElementById("show_table");div_label.appendChild(label),div_label.appendChild(required),div_element.appendChild(adding_type),div_element.appendChild(adding_required),div_element.appendChild(adding_hide_label),div_element.appendChild(adding_show_image),div_element.appendChild(adding_dis_past_days),div_element.appendChild(adding),div_element.appendChild(adding_image),adding_desc_b.appendChild(text_format_1),adding_desc_p.appendChild(adding_desc_b),adding_desc_p.appendChild(format_br_1),adding_desc_p.appendChild(text_format_2),adding_desc_p.appendChild(format_br_2),adding_desc_p.appendChild(text_format_3),adding_desc_p.appendChild(format_br_3),adding_desc_p.appendChild(text_format_4),adding_desc_p.appendChild(format_br_4),adding_desc_p.appendChild(text_format_5),adding_desc_p.appendChild(format_br_5),adding_desc_p.appendChild(text_format_6),adding_desc_p.appendChild(format_br_6),adding_desc_p.appendChild(text_format_7),adding_desc_p.appendChild(format_br_7),adding_desc_p.appendChild(text_format_8),adding_desc_p.appendChild(format_br_8),adding_desc_p.appendChild(text_format_9),adding_desc_p.appendChild(format_br_9),adding_desc_p.appendChild(text_format_10),adding_desc_p.appendChild(format_br_10),adding_desc_p.appendChild(text_format_11),adding_desc_p.appendChild(format_br_11),adding_desc_p.appendChild(text_format_12),adding_desc_p.appendChild(format_br_12),adding_desc_p.appendChild(text_format_13),adding_desc_p.appendChild(format_br_13),adding_desc_b_2.appendChild(text_default_1),adding_desc_p_2.appendChild(adding_desc_b_2),adding_desc_p_2.appendChild(default_br_1),adding_desc_p_2.appendChild(text_default_2),adding_desc_p_2.appendChild(default_br_2),adding_desc_p_2.appendChild(text_default_4),adding_desc_p_2.appendChild(default_br_4),adding_desc_p_2.appendChild(text_default_5),adding_desc_b_3.appendChild(text_default_6),adding_desc_p_3.appendChild(adding_desc_b_3),adding_desc_p_3.appendChild(default_br_6),adding_desc_p_3.appendChild(text_default_7),adding_desc_p_3.appendChild(default_br_7),div_element.appendChild(adding_default_date),div_element.appendChild(adding_start_day),div_element.appendChild(adding_min_date),div_element.appendChild(adding_max_date),div_element.appendChild(adding_invalid_dates),div_element.appendChild(adding_hide_time),div_element.appendChild(adding_show_days),div_element.appendChild(adding_button),div_field.appendChild(div_label),div_field.appendChild(div_element),div.appendChild(div_field),div.appendChild(br3),div.appendChild(adding_desc_p),div.appendChild(adding_desc_p_2),div.appendChild(adding_desc_p_3),main_td.appendChild(div),"top"==w_field_label_pos&&label_top(i),change_class(w_class,i),refresh_attr(i,"type_text"),jQuery("#"+i+"_elementform_id_temp").datepicker({dateFormat:w_format,minDate:w_min_date,maxDate:w_max_date,firstDay:w_start_day,changeMonth:!0,changeYear:!0,yearRange:"-100:+50",showOtherMonths:!0,selectOtherMonths:!0,beforeShowDay:function(date){for(var invalid_dates=w_invalid_dates,invalid_dates_finish=[],invalid_dates_start=invalid_dates.split(","),invalid_date_range=[],i=0;i<invalid_dates_start.length;i++)if(invalid_dates_start[i]=invalid_dates_start[i].trim(),invalid_dates_start[i].length<11)invalid_dates_finish.push(invalid_dates_start[i]);else if(4<invalid_dates_start[i].indexOf("-"))invalid_date_range.push(invalid_dates_start[i].split("-"));else{var invalid_date_array=invalid_dates_start[i].split("-"),start_invalid_day=invalid_date_array[0]+"-"+invalid_date_array[1]+"-"+invalid_date_array[2],end_invalid_day=invalid_date_array[3]+"-"+invalid_date_array[4]+"-"+invalid_date_array[5];invalid_date_range.push([start_invalid_day,end_invalid_day])}jQuery.each(invalid_date_range,function(e,t){for(var i=new Date(t[0]);i<=new Date(t[1]);i.setDate(i.getDate()+1))invalid_dates_finish.push(jQuery.datepicker.formatDate(w_format,i))});var string_days=jQuery.datepicker.formatDate(w_format,date),day=date.getDay(),w_hide_sunday="yes"==w_show_days[0]?"true":"day != 0",w_hide_monday="yes"==w_show_days[1]?"true":"day != 1",w_hide_tuesday="yes"==w_show_days[2]?"true":"day != 2",w_hide_wednesday="yes"==w_show_days[3]?"true":"day != 3",w_hide_thursday="yes"==w_show_days[4]?"true":"day != 4",w_hide_friday="yes"==w_show_days[5]?"true":"day != 5",w_hide_saturday="yes"==w_show_days[6]?"true":"day != 6";return[-1==invalid_dates_finish.indexOf(string_days)&&eval(w_hide_sunday)&&eval(w_hide_monday)&&eval(w_hide_tuesday)&&eval(w_hide_wednesday)&&eval(w_hide_thursday)&&eval(w_hide_friday)&&eval(w_hide_saturday)]}}),jQuery("#"+i+"_elementform_id_temp").datepicker("option","dateFormat",w_format),"today"==w_default_date?jQuery("#"+i+"_elementform_id_temp").datepicker("setDate",new Date):(-1==w_default_date.indexOf("d")&&-1==w_default_date.indexOf("m")&&-1==w_default_date.indexOf("y")&&-1==w_default_date.indexOf("w")&&""!==w_default_date&&(w_default_date=jQuery.datepicker.formatDate(w_format,new Date(w_default_date))),jQuery("#"+i+"_elementform_id_temp").datepicker("setDate",w_default_date))}function create_enable_options_value(e,t,i,n){return create_double_option_container(jQuery('<label class="fm-field-label" for="el_disable_value">Enable option\'s value</label>'),jQuery('<input type="checkbox" id="el_disable_value" onchange="refresh_sel_options('+e+", '"+n+"')\""+("yes"==t?' checked="checked"':"")+" />"),jQuery('<label class="fm-field-label" for="el_use_for_submission">Use for submission</label>'),jQuery('<input type="checkbox" id="el_use_for_submission" onchange="refresh_for_sub_options('+e+", '"+n+"')\""+("yes"==i?' checked="checked"':"")+" />"),t)}function refresh_sel_options(i,e){if("checkbox"!=e&&"radio"!=e||(jQuery("#el_disable_value").prop("checked")?(jQuery("#"+i+"_value_disabledform_id_temp").val("yes"),jQuery(".el_option_value").prop("disabled",!1),jQuery(".fm-option-wrapper2").show()):(jQuery("#"+i+"_value_disabledform_id_temp").val("no"),jQuery(".el_option_value").prop("disabled",!0),jQuery(".fm-option-wrapper2").hide()),refresh_rowcol(i,e)),"select"==e){jQuery("#el_disable_value").prop("checked")?(jQuery("#"+i+"_value_disabledform_id_temp").val("yes"),jQuery(".el_option_value").prop("disabled",!1),jQuery(".el_option_dis").prop("disabled",!0),jQuery(".fm-option-wrapper2").show()):(jQuery("#"+i+"_value_disabledform_id_temp").val("no"),jQuery(".el_option_value").prop("disabled",!0),jQuery(".el_option_dis").prop("disabled",!1),jQuery(".fm-option-wrapper2").hide());var n=document.getElementById(i+"_elementform_id_temp");n.innerHTML="",jQuery(".change_pos").each(function(){var e=jQuery(this)[0].id,t=document.createElement("option");t.setAttribute("id",i+"_option"+e),jQuery("#el_disable_value").prop("checked")?t.setAttribute("value",jQuery(this).find(jQuery("input[type='text']"))[1].value):jQuery(this).find(jQuery("input[type='checkbox']")).prop("checked")?t.value="":t.setAttribute("value",jQuery(this).find(jQuery("input[type='text']"))[0].value),jQuery(this).find(jQuery(".el_option_params")).val()&&(w_params=jQuery(this).find(jQuery(".el_option_params")).val().split("[where_order_by]"),t.setAttribute("where",w_params[0]),w_params=w_params[1].split("[db_info]"),t.setAttribute("order_by",w_params[0]),t.setAttribute("db_info",w_params[1])),t.setAttribute("onselect","set_select('"+i+"_option"+e+"')"),t.innerHTML=jQuery(this).find(jQuery("input[type='text']"))[0].value,n.appendChild(t)})}form_maker.is_demo?jQuery("#el_choices_add").next().attr("onclick","alert('This feature is disabled in demo.')"):jQuery("#el_choices_add").next().attr("onclick","tb_show('', 'admin-ajax.php?action=select_data_from_db&field_id="+i+"&nonce="+fm_ajax.ajaxnonce+"&field_type="+e+"&value_disabled="+jQuery("#"+i+"_value_disabledform_id_temp").val()+"&width=530&height=370&TB_iframe=1');return false;")}function refresh_for_sub_options(i,e){if("checkbox"!=e&&"radio"!=e||(jQuery("#el_use_for_submission").prop("checked")?jQuery("#"+i+"_use_for_submissionform_id_temp").val("yes"):jQuery("#"+i+"_use_for_submissionform_id_temp").val("no"),refresh_rowcol(i,e)),"select"==e){jQuery("#el_use_for_submission").prop("checked")?jQuery("#"+i+"_use_for_submissionform_id_temp").val("yes"):jQuery("#"+i+"_use_for_submissionform_id_temp").val("no");var n=document.getElementById(i+"_elementform_id_temp");n.innerHTML="",jQuery(".change_pos").each(function(){var e=jQuery(this)[0].id,t=document.createElement("option");t.setAttribute("id",i+"_option"+e),jQuery("#el_disable_value").prop("checked")?t.setAttribute("value",jQuery(this).find(jQuery("input[type='text']"))[1].value):jQuery(this).find(jQuery("input[type='checkbox']")).prop("checked")?t.value="":t.setAttribute("value",jQuery(this).find(jQuery("input[type='text']"))[0].value),jQuery(this).find(jQuery(".el_option_params")).val()&&(w_params=jQuery(this).find(jQuery(".el_option_params")).val().split("[where_order_by]"),t.setAttribute("where",w_params[0]),w_params=w_params[1].split("[db_info]"),t.setAttribute("order_by",w_params[0]),t.setAttribute("db_info",w_params[1])),t.setAttribute("onselect","set_select('"+i+"_option"+e+"')"),t.innerHTML=jQuery(this).find(jQuery("input[type='text']"))[0].value,n.appendChild(t)})}form_maker.is_demo?jQuery("#el_choices_add").next().attr("onclick","alert('This feature is disabled in demo.')"):jQuery("#el_choices_add").next().attr("onclick","tb_show('', 'admin-ajax.php?action=select_data_from_db&field_id="+i+"&nonce="+fm_ajax.ajaxnonce+"&field_type="+e+"&value_disabled="+jQuery("#"+i+"_value_disabledform_id_temp").val()+"&width=530&height=370&TB_iframe=1');return false;")}function create_select_options(e,t,i,a,r,l){var d=jQuery('<label class="fm-field-label">Options</label>'),_=jQuery('<button id="el_choices_add" class="fm-add-option button-secondary" onClick="add_choise(\'select\', '+e+'); return false;" title="Add option"><span class="field-type-button fm-add-attribute dashicons dashicons-plus-alt"></span>Option</button>');if(form_maker.is_demo)var o=jQuery('<button class="fm-add-option button-secondary" onClick="alert(\'This feature is disabled in demo.\') return false;" title="Add options from database"><span class="field-type-button fm-add-attribute dashicons dashicons-plus-alt"></span>From Database</button>');else o=jQuery("<button class=\"fm-add-option button-secondary\" onClick=\"tb_show('', 'admin-ajax.php?action=select_data_from_db&nonce="+fm_ajax.ajaxnonce+"&field_id="+e+"&field_type=select&value_disabled="+t+'&width=530&height=370&TB_iframe=1\'); return false;" title="Add options from database"><span class="field-type-button fm-add-attribute dashicons dashicons-plus-alt"></span>From Database</button>');var s=jQuery('<div class="fm-width-100 error">IMPORTANT! Check the "Empty value" checkbox only if you want the option to be considered as empty.</div>'),m=jQuery('<div id="choices" class="fm-width-100 ui-sortable"></div>'),u=jQuery('<div class="fm-width-100"><div class="fm-header-label fm-width-30">Name</div><div class="fm-header-label fm-width-30">Value</div><div class="fm-header-label fm-width-20">Empty value</div><div class="fm-header-label fm-width-10">Delete</div><div class="fm-header-label fm-width-10">Move</div></div>');for(m.append(u),n=i.length,j=0;j<n;j++){var c=jQuery('<div id="'+j+'" class="change_pos fm-width-100"><div class="fm-table-col fm-width-30"><input type="text" class="fm-field-choice" id="el_option'+j+'" value="'+i[j].replace(/"/g,"&quot;")+'" onKeyUp="change_label_name('+j+", '"+e+"_option"+j+"', this.value, 'select')\" onpaste=\"elem=this; change_label_name_on_paste("+j+", '"+e+"_option"+j+"', 'select')\""+(a[j]?' disabled="disabled"':"")+' /></div><div class="fm-table-col fm-width-30"><input type="text" class="fm-field-choice'+(a[j]?"":" el_option_value")+'" id="el_option_value'+j+'" value="'+r[j].replace(/"/g,"&quot;")+'" onKeyUp="change_label_value(\''+e+"_option"+j+"', this.value)\" onpaste=\"change_label_value_on_paste('"+e+"_option"+j+"', this)\""+("no"==t||a[j]?' disabled="disabled"':"")+' /></div><div class="fm-table-col fm-width-20"><input type="checkbox" title="Empty value" class="el_option_dis" id="el_option'+j+'_dis" onClick="dis_option(\''+e+"_option"+j+"', this.checked, "+j+')"'+("yes"==t?' disabled="disabled"':"")+(l[j]?' checked="checked"':"")+' /></div><div class="fm-table-col fm-width-10"><span class="fm-remove-attribute dashicons dashicons-dismiss" id="el_option'+j+'_remove" onClick="remove_option('+j+", "+e+')"></span></div><div class="fm-table-col fm-width-10"><span class="fm-move-attribute fm-ico-draggable el_choices_sortable"></span></div><input type="hidden" class="el_option_params" id="el_option_params'+j+'" value="'+a[j]+'" /></div>');m.append(c)}var p=d;return create_option_container(null,p=(p=(p=(p=p.add(_)).add(o)).add(m)).add(s))}function add_choise(e,t){var i=0;if(jQuery(".change_pos").each(function(){var e=parseInt(jQuery(this)[0].id);i=i<e?e:i}),i+=1,"radio"==e||"checkbox"==e){var n=jQuery("#choices"),a=jQuery('<div id="'+i+'" class="change_pos fm-width-100"><div class="fm-table-col fm-width-40"><input type="text" class="fm-field-choice" id="el_choices'+i+'" value="" onKeyUp="change_label_name(\''+i+"', '"+t+"_label_element"+i+"', this.value, '"+e+"'); change_label_value('"+t+"_elementform_id_temp"+i+"', jQuery('#el_option_value"+i+'\').val())" onpaste="elem=this; change_label_name_on_paste('+i+", '"+t+"_label_element"+i+"', '"+e+"'); change_label_value_on_paste('"+t+"_elementform_id_temp"+i+'\', this)" /></div><div class="fm-table-col fm-width-40"><input type="text" class="fm-field-choice el_option_value" id="el_option_value'+i+'" value="" onKeyUp="change_label_value(\''+t+"_elementform_id_temp"+i+"', this.value)\" onpaste=\"change_label_value_on_paste('"+t+"_elementform_id_temp"+i+"', this)\""+(jQuery("#el_disable_value").prop("checked")?"":'disabled="disabled"')+' /></div><div class="fm-table-col fm-width-10"><span class="fm-remove-attribute dashicons dashicons-dismiss" id="el_choices'+i+'_remove" onClick="remove_choise('+i+","+t+",'"+e+'\')"></span></div><div class="fm-table-col fm-width-10"><span class="fm-move-attribute fm-ico-draggable el_choices_sortable"></span></div></div>');n.append(a),refresh_rowcol(t,e)}if("select"==e){var r=jQuery("#"+t+"_elementform_id_temp"),l=jQuery('<option id="'+t+"_option"+i+'"></option>');r.append(l);n=jQuery("#choices"),a=jQuery('<div id="'+i+'" class="change_pos fm-width-100"><div class="fm-table-col fm-width-30"><input type="text" class="fm-field-choice" id="el_option'+i+'" value="" onKeyUp="change_label_name('+i+", '"+t+"_option"+i+"', this.value, 'select')\" onpaste=\"elem=this; change_label_name_on_paste("+i+", '"+t+"_option"+i+'\', \'select\')" /></div><div class="fm-table-col fm-width-30"><input type="text" class="fm-field-choice el_option_value" id="el_option_value'+i+'" value="" onKeyUp="change_label_value(\''+t+"_option"+i+"', this.value)\" onpaste=\"change_label_value_on_paste('"+t+"_option"+i+"', this)\""+(jQuery("#el_disable_value").prop("checked")?"":'disabled="disabled"')+' /></div><div class="fm-table-col fm-width-20"><input type="checkbox" title="Empty value" class="el_option_dis" id="el_option'+i+'_dis" onClick="dis_option(\''+t+"_option"+i+"', this.checked, "+i+')"'+(jQuery("#el_disable_value").prop("checked")?'disabled="disabled"':"")+' /></div><div class="fm-table-col fm-width-10"><span class="fm-remove-attribute dashicons dashicons-dismiss" id="el_option'+i+'_remove" onClick="remove_option('+i+", "+t+')"></span></div><div class="fm-table-col fm-width-10"><span class="fm-move-attribute fm-ico-draggable el_choices_sortable"></span></div><input type="hidden" id="el_option_params'+i+'" class="el_option_params" value=""></div>');n.append(a)}}function change_label_name(e,t,i,n){jQuery("#"+t).html(i),jQuery("#el_disable_value").prop("checked")||(jQuery("#el_choices"+e).attr("other")||jQuery("#el_option_value"+e).val(i),"select"==n&&jQuery("#"+t).val(i))}function change_label_name_on_paste(e,t,i,n){setTimeout(function(){i=elem.value,jQuery("#"+t).html(i),jQuery("#el_disable_value").prop("checked")||(jQuery("#el_choices"+e).attr("other")||jQuery("#el_option_value"+e).val(i),"select"==n&&jQuery("#"+t).val(i))},100)}function change_label_value(e,t){var i=t.replaceAll("'","");jQuery(this).val(i),document.getElementById(e).value=i}function change_label_value_on_paste(e,t){setTimeout(function(){label=t.value,document.getElementById(e).value=label},100)}function dis_option(e,t,i){t?(jQuery("#"+e).val(""),jQuery("#el_option_value"+i).val("")):(jQuery("#"+e).val(jQuery("#"+e).html()),jQuery("#el_option_value"+i).val(jQuery("#el_option"+i).val()))}function remove_option(e,t){var i=document.getElementById(t+"_elementform_id_temp"),n=document.getElementById(t+"_option"+e);i.removeChild(n);var a=document.getElementById("choices"),r=document.getElementById(e);a.removeChild(r)}function go_to_type_own_select(e){w_choices=["Select value","option 1","option 2"],w_choices_value=["","option 1","option 2"],w_choices_params=["","",""],w_choices_checked=["1","0","0"],w_choices_disabled=[!0,!1,!1],w_attr_name=[],w_attr_value=[],type_own_select(e,"Select","","top","no","",w_choices,w_choices_checked,"no","no","wdform_select",w_attr_name,w_attr_value,w_choices_disabled,w_choices_value,w_choices_params,"no")}function type_own_select(i,e,t,a,r,l,d,_,o,s,m,u,c,p,f,h,y){jQuery("#element_type").val("type_own_select"),delete_last_child();var b=jQuery("#edit_table"),v=jQuery('<div id="edit_div"></div>');b.append(v);var g=jQuery('<div id="edit_main_table"></div>');v.append(g),g.append(create_field_type("type_own_select")),g.append(create_label(i,e)),g.append(create_label_position(i,a)),g.append(create_hide_label(i,r)),g.append(create_required(i,o)),g.append(create_field_size(i,l)),g.append(create_select_options(i,s,d,h,f,p));var w=jQuery('<div class="inside"></div>');g.append(create_advanced_options_container(w)),w.append(create_field_label_size(i,t)),w.append(create_class(i,m)),w.append(create_enable_options_value(i,s,y,"select")),w.append(create_additional_attributes(i,u,"type_own_select")),n=d.length;var E=document.createElement("input");E.setAttribute("type","hidden"),E.setAttribute("value","type_own_select"),E.setAttribute("name",i+"_typeform_id_temp"),E.setAttribute("id",i+"_typeform_id_temp");var A=document.createElement("input");A.setAttribute("type","hidden"),A.setAttribute("value",o),A.setAttribute("name",i+"_requiredform_id_temp"),A.setAttribute("id",i+"_requiredform_id_temp");var x=document.createElement("input");x.setAttribute("type","hidden"),x.setAttribute("value",r),x.setAttribute("name",i+"_hide_labelform_id_temp"),x.setAttribute("id",i+"_hide_labelform_id_temp");var k=document.createElement("input");k.setAttribute("type","hidden"),k.setAttribute("value",s),k.setAttribute("name",i+"_value_disabledform_id_temp"),k.setAttribute("id",i+"_value_disabledform_id_temp");var C=document.createElement("input");C.setAttribute("type","hidden"),C.setAttribute("value",y),C.setAttribute("name",i+"_use_for_submissionform_id_temp"),C.setAttribute("id",i+"_use_for_submissionform_id_temp");var I=document.createElement("div");I.setAttribute("id","main_div");var B=document.createElement("div");B.setAttribute("id",i+"_elemet_tableform_id_temp");var Q="yes"==r?"none":"table-cell",T=document.createElement("div");T.setAttribute("align","left"),T.style.display=Q,T.style.width=t+"px",T.setAttribute("id",i+"_label_sectionform_id_temp");var M=document.createElement("div");M.setAttribute("align","left"),M.style.display="table-cell",M.setAttribute("id",i+"_element_sectionform_id_temp");document.createElement("br"),document.createElement("br");var L=document.createElement("br"),z=(document.createElement("br"),document.createElement("div"));z.setAttribute("id",i+"_table_little"),z.style.display="table";var q=document.createElement("div");q.setAttribute("id",i+"_element_tr1"),q.style.display="table-row";var S=document.createElement("div");S.setAttribute("id",i+"_element_tr2"),S.style.display="table-row";var N=document.createElement("div");N.setAttribute("valign","top"),N.setAttribute("id",i+"_td_little1"),N.style.display="table-cell";var H=document.createElement("div");H.setAttribute("valign","top"),H.setAttribute("id",i+"_td_little2"),H.style.display="table-cell";var D=document.createElement("span");D.setAttribute("id",i+"_element_labelform_id_temp"),D.innerHTML=e,D.setAttribute("class","label"),D.style.verticalAlign="top";var O=document.createElement("span");O.setAttribute("id",i+"_required_elementform_id_temp"),O.innerHTML="",O.setAttribute("class","required"),O.style.verticalAlign="top","yes"==o&&(O.innerHTML=" *");var P=document.createElement("select");for(P.setAttribute("id",i+"_elementform_id_temp"),P.setAttribute("name",i+"_elementform_id_temp"),P.style.cssText="width:"+l+"px",P.setAttribute("onchange","set_select(this)"),j=0;j<n;j++){var F=document.createElement("option");F.setAttribute("id",i+"_option"+j),"yes"==s?F.setAttribute("value",f[j].replace(/[\'\"]/g,"")):p[j]?F.value="":F.setAttribute("value",d[j].replace(/[\'\"]/g,"")),h[j]&&(w_params=h[j].split("[where_order_by]"),F.setAttribute("where",w_params[0]),w_params=w_params[1].split("[db_info]"),F.setAttribute("order_by",w_params[0]),F.setAttribute("db_info",w_params[1])),F.setAttribute("onselect","set_select('"+i+"_option"+j+"')"),F.innerHTML=d[j].replace(/"/g,"'"),1==_[j]&&F.setAttribute("selected","selected"),P.appendChild(F)}var R=document.getElementById("show_table");T.appendChild(D),T.appendChild(O),M.appendChild(x),M.appendChild(E),M.appendChild(A),M.appendChild(k),M.appendChild(C),M.appendChild(P),B.appendChild(T),B.appendChild(M),I.appendChild(B),I.appendChild(L),R.appendChild(I),"top"==a&&label_top(i),change_class(m,i),refresh_attr(i,"type_text"),jQuery(function(){jQuery("#choices").sortable({items:".change_pos",handle:".el_choices_sortable",update:function(e,t){refresh_sel_options(i,"select")}})}),jQuery("#main_div").append(form_maker.type_select_description)}function create_relative_position(e,t,i){var n=jQuery('<label class="fm-field-label">Relative Position</label>'),a=jQuery('<input type="radio" id="edit_for_flow_vertical" name="edit_for_flow" value="ver" onchange="refresh_rowcol('+e+",'"+i+"')\""+("hor"==t?"":' checked="checked"')+" />"),r=jQuery('<label for="edit_for_flow_vertical">Vertical</label>'),l=jQuery('<input type="radio" id="edit_for_flow_horizontal" name="edit_for_flow" value="hor" onchange="refresh_rowcol('+e+",'"+i+"')\""+("hor"==t?' checked="checked"':"")+" />"),d=jQuery('<label for="edit_for_flow_horizontal">Horizontal</label>'),_=a;return create_option_container(n,_=(_=(_=_.add(r)).add(l)).add(d))}function refresh_limit_choice(e,t){document.getElementById("edit_for_limitchoice").value||(document.getElementById("edit_for_limitchoice").value=""),document.getElementById(e+"_limitchoice_numform_id_temp").value=document.getElementById("edit_for_limitchoice").value,refresh_attr(e,"type_"+t)}function refresh_limit_choice_alert(e,t){document.getElementById("edit_for_limitchoicealert").value||(document.getElementById("edit_for_limitchoicealert").value="You have exceeded the selection limit."),document.getElementById(e+"_limitchoicealert_numform_id_temp").value=document.getElementById("edit_for_limitchoicealert").value,refresh_attr(e,"type_"+t)}function refresh_characters_limit(e,t){document.getElementById("edit_for_charlimit").value||(document.getElementById("edit_for_charlimit").value=""),document.getElementById(e+"_charlimitform_id_temp").value=document.getElementById("edit_for_charlimit").value,refresh_attr(e,"type_"+t)}function refresh_rowcol(l,d){document.getElementById("edit_for_rowcol").value||(document.getElementById("edit_for_rowcol").value=1),document.getElementById(l+"_rowcol_numform_id_temp").value=document.getElementById("edit_for_rowcol").value;var _=document.getElementById(l+"_table_little");if(_.removeAttribute("for_hor"),_.innerHTML="",choeices=jQuery(".change_pos").length,1==document.getElementById("edit_for_flow_vertical").checked){var r=document.getElementById("edit_for_rowcol").value,o=parseInt((choeices+1)/r),s=0,m=1;tr_row=document.createElement("div"),tr_row.setAttribute("id",l+"_element_tr0"),tr_row.style.display="table-row",jQuery(".change_pos").each(function(){var e=jQuery(this)[0].id;r<=s&&(s=0,tr_row=document.createElement("div"),tr_row.setAttribute("id",l+"_element_tr"+m),tr_row.style.display="table-row",m++);var t=document.createElement("div");t.setAttribute("valign","top"),t.setAttribute("id",l+"_td_little"+e),t.setAttribute("idi",e),t.style.display="table-cell";var i=document.createElement("input");if(i.setAttribute("type",d),i.setAttribute("id",l+"_elementform_id_temp"+e),jQuery("#"+l+"_elementform_id_temp"+e).prop("checked")&&i.setAttribute("checked","checked"),"right"==document.getElementById(l+"_option_left_right").value&&(i.style.cssText="float: left !important"),"checkbox"==d)if(i.setAttribute("name",l+"_elementform_id_temp"+e),"yes"==document.getElementById(l+"_allow_otherform_id_temp").value&&"1"==jQuery(this).find("#el_choices"+e).attr("other"))i.setAttribute("value",""),i.setAttribute("other","1"),i.setAttribute("onclick","if(set_checked('"+l+"','"+e+"','form_id_temp')) show_other_input('"+l+"','form_id_temp');");else{if("no"==document.getElementById(l+"_value_disabledform_id_temp").value)n=(n=jQuery(this).find("#el_choices"+e).val()).replace(/[\"\']/g,""),i.setAttribute("value",n);else n=(n=jQuery(this).find("#el_option_value"+e).val()).replace(/[\"\']/g,""),i.setAttribute("value",n);i.setAttribute("onclick","set_checked('"+l+"','"+e+"','form_id_temp')")}if("radio"==d)if(i.setAttribute("name",l+"_elementform_id_temp"),"yes"==document.getElementById(l+"_allow_otherform_id_temp").value&&"1"==jQuery(this).find("#el_choices"+e).attr("other"))i.setAttribute("value",""),i.setAttribute("other","1"),i.setAttribute("onClick","set_default('"+l+"','"+e+"','form_id_temp'); show_other_input('"+l+"','form_id_temp');");else{var n;if("no"==document.getElementById(l+"_value_disabledform_id_temp").value)n=(n=jQuery(this).find("#el_choices"+e).val()).replace(/[\"\']/g,""),i.setAttribute("value",n);else n=(n=jQuery(this).find("#el_option_value"+e).val()).replace(/[\"\']/g,""),i.setAttribute("value",n);i.setAttribute("onClick","set_default('"+l+"','"+e+"','form_id_temp')")}var a=document.createElement("label");a.setAttribute("id",l+"_label_element"+e),a.setAttribute("class","ch-rad-label"),a.setAttribute("for",l+"_elementform_id_temp"+e),a.innerHTML=jQuery(this).find("#el_choices"+e).val().replaceAll('"',"'"),"right"==document.getElementById(l+"_option_left_right").value&&(a.style.cssText="float: none !important"),jQuery(this).find("#el_option_params"+e).val()&&(w_params=jQuery(this).find("#el_option_params"+e).val().split("[where_order_by]"),a.setAttribute("where",w_params[0]),w_params=w_params[1].split("[db_info]"),a.setAttribute("order_by",w_params[0]),a.setAttribute("db_info",w_params[1])),t.appendChild(a),t.appendChild(i),tr_row.appendChild(t),_.appendChild(tr_row),s++})}else{o=document.getElementById("edit_for_rowcol").value,r=parseInt((choeices+1)/o),s=0,m=0;jQuery(".change_pos").each(function(e){var t=jQuery(this)[0].id;s<o&&(tr_row=document.createElement("div"),tr_row.setAttribute("id",l+"_element_tr"+e),tr_row.style.display="table-row","radio"!=d&&"checkbox"!=d||(tr_row.style.display="inline-flex",tr_row.style.flexWrap="wrap"));var i=document.createElement("div");i.setAttribute("valign","top"),i.setAttribute("id",l+"_td_little"+t),i.setAttribute("idi",t),i.style.display="table-cell";var n=document.createElement("input");if(n.setAttribute("type",d),n.setAttribute("id",l+"_elementform_id_temp"+t),jQuery("#"+l+"_elementform_id_temp"+t).prop("checked")&&n.setAttribute("checked","checked"),"right"==document.getElementById(l+"_option_left_right").value&&(n.style.cssText="float: left !important"),"checkbox"==d&&(n.setAttribute("name",l+"_elementform_id_temp"+t),"yes"==document.getElementById(l+"_allow_otherform_id_temp").value&&"1"==jQuery(this).find("#el_choices"+t).attr("other")?(n.setAttribute("value",""),n.setAttribute("other","1"),n.setAttribute("onclick","if(set_checked('"+l+"','"+t+"','form_id_temp')) show_other_input('"+l+"','form_id_temp');")):("no"==document.getElementById(l+"_value_disabledform_id_temp").value?n.setAttribute("value",jQuery(this).find("#el_choices"+t).val()):n.setAttribute("value",jQuery(this).find("#el_option_value"+t).val()),n.setAttribute("onclick","set_checked('"+l+"','"+t+"','form_id_temp')"))),"radio"==d)if(n.setAttribute("name",l+"_elementform_id_temp"),"yes"==document.getElementById(l+"_allow_otherform_id_temp").value&&"1"==jQuery(this).find("#el_choices"+t).attr("other"))n.setAttribute("other","1"),n.setAttribute("onClick","set_default('"+l+"','"+t+"','form_id_temp'); show_other_input('"+l+"','form_id_temp')");else{var a;if("no"==document.getElementById(l+"_value_disabledform_id_temp").value)a=(a=jQuery(this).find("#el_choices"+t).val()).replaceAll("'",""),n.setAttribute("value",a);else a=(a=jQuery(this).find("#el_option_value"+t).val()).replaceAll("'",""),n.setAttribute("value",a);n.setAttribute("onClick","set_default('"+l+"','"+t+"','form_id_temp')")}var r=document.createElement("label");r.setAttribute("id",l+"_label_element"+t),r.setAttribute("class","ch-rad-label"),r.setAttribute("for",l+"_elementform_id_temp"+t),r.innerHTML=jQuery(this).find("#el_choices"+t).val().replaceAll('"',"'"),"right"==document.getElementById(l+"_option_left_right").value&&(r.style.cssText="float: none !important"),jQuery(this).find("#el_option_params"+t).val()&&(w_params=jQuery(this).find("#el_option_params"+t).val().split("[where_order_by]"),r.setAttribute("where",w_params[0]),w_params=w_params[1].split("[db_info]"),r.setAttribute("order_by",w_params[0]),r.setAttribute("db_info",w_params[1])),i.appendChild(r),i.appendChild(n),s<o?(tr_row.appendChild(i),_.appendChild(tr_row)):(m==o&&(m=0),tr_row=document.getElementById(l+"_table_little").childNodes[m],tr_row.appendChild(i),m++),s++}),_.setAttribute("for_hor",l+"_hor")}refresh_attr(l,"type_"+d)}function show_other_input(t){jQuery(".change_pos").each(function(){var e=jQuery(this)[0].id;if(document.getElementById(t+"_elementform_id_temp"+e)&&document.getElementById(t+"_elementform_id_temp"+e).getAttribute("other")&&1==document.getElementById(t+"_elementform_id_temp"+e).getAttribute("other"))return element_other=document.getElementById(t+"_elementform_id_temp"+e),!1});var e=element_other.parentNode,i=document.createElement("br");i.setAttribute("id",t+"_other_brform_id_temp");var n=document.createElement("input");n.setAttribute("id",t+"_other_inputform_id_temp"),n.setAttribute("name",t+"_other_inputform_id_temp"),n.setAttribute("type","text"),n.setAttribute("class","other_input"),e.appendChild(i),e.appendChild(n)}function create_option_label_position(e,t,i){var n=jQuery('<label class="fm-field-label">Option Label Position</label>'),a=jQuery('<input type="radio" id="edit_for_option_position_left" name="edit_for_option_position" onchange="option_left('+e+",'"+i+"')\""+("right"==t?"":' checked="checked"')+" />"),r=jQuery('<label for="edit_for_option_position_left">Left</label>'),l=jQuery('<input type="radio" id="edit_for_option_position_right" name="edit_for_option_position" onchange="option_right('+e+",'"+i+"')\""+("right"==t?' checked="checked"':"")+" />"),d=jQuery('<label for="edit_for_option_position_right">Right</label>'),_=a;return create_option_container(n,_=(_=(_=_.add(r)).add(l)).add(d))}function option_right(e,t){jQuery("#"+e+"_table_little").find(jQuery(".ch-rad-label")).css("cssText","float: none !important;"),jQuery("#"+e+"_table_little").find(jQuery('#main_div input[type="'+t+'"]')).css("cssText","float: left !important;"),jQuery("#"+e+"_option_left_right").val("right")}function option_left(e,t){jQuery("#"+e+"_table_little").find(jQuery(".ch-rad-label")).css("cssText","float: left !important;"),jQuery("#"+e+"_table_little").find(jQuery('#main_div input[type="'+t+'"]')).css("cssText","float: right !important;"),jQuery("#"+e+"_option_left_right").val("left")}function create_rowcol(e,t,i){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_rowcol">Rows/Columns</label>'),jQuery('<input type="number" class="fm-width-100" min="1" id="edit_for_rowcol" oninput="validity.valid||(value=\'\')"; onChange="refresh_rowcol('+e+",'"+i+'\')" value="'+t+'" />'))}function create_limit_choice(e,t,i){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_limitchoice">Limit of Selected Choices</label>'),jQuery('<input type="number" class="fm-width-100" id="edit_for_limitchoice" min="0" oninput="validity.valid||(value=\'\')"; onChange="refresh_limit_choice('+e+",'"+i+'\')" value="'+t+'" />'))}function create_limit_choice_alert(e,t,i){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_limitchoicealert">Alert for Selected Choice Limit</label>'),jQuery('<input type="text" class="fm-width-100" id="edit_for_limitchoicealert" onChange="refresh_limit_choice_alert('+e+",'"+i+'\')" value="'+t.replace(/"/g,"&quot;")+'" />'))}function create_characters_limit(e,t,i){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_charlimit">Limit of characters</label>'),jQuery('<input type="number" class="fm-width-100" id="edit_for_charlimit" min="0" oninput="validity.valid||(value=\'\');" onChange="refresh_characters_limit('+e+",'"+i+'\')" value="'+t+'" />'))}function create_randomize(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_randomize">Randomize in frontend</label>'),jQuery('<input type="checkbox" id="el_randomize" onclick="set_randomize(\''+e+"_randomizeform_id_temp')\""+("yes"==t?' checked="checked"':"")+" />"))}function set_randomize(e){"yes"==document.getElementById(e).value?document.getElementById(e).setAttribute("value","no"):document.getElementById(e).setAttribute("value","yes")}function create_allow_other(e,t,i){return create_option_container(jQuery('<label class="fm-field-label" for="el_allow_other">Allow other</label>'),jQuery('<input type="checkbox" id="el_allow_other" onclick="set_allow_other('+e+",'"+i+"')\""+("yes"==t?' checked="checked"':"")+" />"))}function set_allow_other(t,i){if("yes"==document.getElementById(t+"_allow_otherform_id_temp").value)document.getElementById(t+"_allow_otherform_id_temp").setAttribute("value","no"),jQuery(".change_pos").each(function(){var e=jQuery(this)[0].id;if(document.getElementById("el_choices"+e)&&document.getElementById("el_choices"+e).getAttribute("other")&&1==document.getElementById("el_choices"+e).getAttribute("other"))return remove_choise(e,t,i),!1});else{document.getElementById(t+"_allow_otherform_id_temp").setAttribute("value","yes");var n=0;jQuery(".change_pos").each(function(){var e=parseInt(jQuery(this)[0].id);n=n<e?e:n}),n+=1;var e=jQuery("#choices"),a=jQuery('<div id="'+n+'" class="change_pos fm-width-100"><div class="fm-table-col fm-width-40"><input type="text" class="fm-field-choice" id="el_choices'+n+'" value="other" other="1" onKeyUp="change_label(\''+t+"_label_element"+n+"', this.value); change_in_value('"+t+"_elementform_id_temp"+n+'\', this.value)" /></div><div class="fm-table-col fm-width-40"><input type="text" class="fm-field-choice" id="el_option_value'+n+'" value="" disabled="disabled" /></div><div class="fm-table-col fm-width-10"></div><div class="fm-table-col fm-width-10"><span class="fm-move-attribute fm-ico-draggable el_choices_sortable"></span></div></div>');e.append(a),refresh_rowcol(t,i)}}function create_radio_options(e,t,i,a,r,l,d,_,o){var s=jQuery('<label class="fm-field-label">Options</label>'),m=jQuery('<button id="el_choices_add" class="fm-add-option button-secondary" onClick="add_choise(\''+o+"', "+e+'); return false;" title="Add option"><span class="field-type-button fm-add-attribute dashicons dashicons-plus-alt"></span>Option</button>');if(form_maker.is_demo)var u=jQuery('<button class="fm-add-option button-secondary" onClick="alert(\'This feature is disabled in demo.\')" title="Add options from database"><span class="field-type-button fm-add-attribute dashicons dashicons-plus-alt"></span>From Database</button>');else u=jQuery("<button class=\"fm-add-option button-secondary\" onClick=\"tb_show('', 'admin-ajax.php?action=select_data_from_db&field_id="+e+"&nonce="+fm_ajax.ajaxnonce+"&field_type=radio&value_disabled="+t+'&width=530&height=370&TB_iframe=1\'); return false;" title="Add options from database"><span class="field-type-button fm-add-attribute dashicons dashicons-plus-alt"></span>From Database</button>');var c=jQuery('<div id="choices" class="fm-width-100 ui-sortable"></div>'),p=jQuery('<div class="fm-width-100"><div class="fm-header-label fm-width-40">Name</div><div class="fm-header-label fm-width-40">Value</div><div class="fm-header-label fm-width-10">Delete</div><div class="fm-header-label fm-width-10">Move</div></div>');for(c.append(p),aaa=!1,n=i.length,j=0;j<n;j++){var f=jQuery('<div id="'+j+'" class="change_pos fm-width-100"><div class="fm-table-col fm-width-40"><input type="text" class="fm-field-choice" id="el_choices'+j+'"'+("yes"==l&&j==d?' other="1"':"")+' value="'+i[j].replace(/"/g,"&quot;")+'" onKeyUp="change_label(\''+e+"_label_element"+j+'\', this.value)" onpaste="elem=this; change_label_name_on_paste('+j+", '"+e+"_label_element"+j+"', '"+o+"'); change_label_value_on_paste('"+e+"_elementform_id_temp"+j+"', this)\""+(a[j]?' disabled="disabled"':"")+' /></div><div class="fm-table-col fm-width-40"><input type="text" class="fm-field-choice'+(a[j]||"yes"==l&&j==d?"":" el_option_value")+'" id="el_option_value'+j+'" value="'+r[j].replace(/[\"\']/g,"")+'" onKeyUp="change_label_value(\''+e+"_elementform_id_temp"+j+"', this.value)\" onpaste=\"change_label_value_on_paste('"+e+"_elementform_id_temp"+j+"', this)\""+("no"==t||a[j]||"yes"==l&&j==d?' disabled="disabled"':"")+' /><input type="hidden" id="el_option_params'+j+'" class="el_option_params" value="'+a[j]+'" /></div><div class="fm-table-col fm-width-10">'+("yes"==l&&j==d?"":'<span class="fm-remove-attribute dashicons dashicons-dismiss" id="el_choices'+j+'_remove" onClick="remove_choise('+j+","+e+",'"+o+"')\"></span>")+'</div><div class="fm-table-col fm-width-10"><span class="fm-move-attribute fm-ico-draggable el_choices_sortable"></span></div></div>');c.append(f),1==_[j]&&"yes"==l&&j==d&&(aaa=!0)}var h=s;return create_option_container(null,h=(h=(h=h.add(m)).add(u)).add(c))}function remove_choise(e,t,i){var n=document.getElementById("choices"),a=document.getElementById(e);n.removeChild(a),refresh_rowcol(t,i)}function type_radio(i,e,t,n,a,r,l,d,_,o,s,m,u,c,p,f,h,y,b,v,g){jQuery("#element_type").val("type_radio"),delete_last_child();var w=jQuery("#edit_table"),E=jQuery('<div id="edit_div"></div>');w.append(E);var A=jQuery('<div id="edit_main_table"></div>');E.append(A),A.append(create_field_type("type_radio")),A.append(create_label(i,e)),A.append(create_label_position(i,n)),A.append(create_hide_label(i,r)),A.append(create_required(i,s)),A.append(create_relative_position(i,l,"radio")),A.append(create_option_label_position(i,a,"radio")),A.append(create_radio_options(i,y,d,v,b,u,c,_,"radio"));var x=jQuery('<div class="inside"></div>');A.append(create_advanced_options_container(x)),x.append(create_field_label_size(i,t)),x.append(create_class(i,p)),x.append(create_rowcol(i,o,"radio")),x.append(create_randomize(i,m)),x.append(create_enable_options_value(i,y,g,"radio")),x.append(create_allow_other(i,u,"radio")),x.append(create_additional_attributes(i,f,"type_radio")),element="input",type="radio";var k=document.createElement("input");k.setAttribute("type","hidden"),k.setAttribute("value","type_radio"),k.setAttribute("name",i+"_typeform_id_temp"),k.setAttribute("id",i+"_typeform_id_temp");var j=document.createElement("input");j.setAttribute("type","hidden"),j.setAttribute("value",s),j.setAttribute("name",i+"_requiredform_id_temp"),j.setAttribute("id",i+"_requiredform_id_temp");var C=document.createElement("input");C.setAttribute("type","hidden"),C.setAttribute("value",r),C.setAttribute("name",i+"_hide_labelform_id_temp"),C.setAttribute("id",i+"_hide_labelform_id_temp");var I=document.createElement("input");I.setAttribute("type","hidden"),I.setAttribute("value",m),I.setAttribute("name",i+"_randomizeform_id_temp"),I.setAttribute("id",i+"_randomizeform_id_temp");var B=document.createElement("input");B.setAttribute("type","hidden"),B.setAttribute("value",u),B.setAttribute("name",i+"_allow_otherform_id_temp"),B.setAttribute("id",i+"_allow_otherform_id_temp");var Q=document.createElement("input");Q.setAttribute("type","hidden"),Q.setAttribute("value",o),Q.setAttribute("name",i+"_rowcol_numform_id_temp"),Q.setAttribute("id",i+"_rowcol_numform_id_temp");var T=document.createElement("input");T.setAttribute("type","hidden"),T.setAttribute("value",a),T.setAttribute("id",i+"_option_left_right");var M=document.createElement("input");M.setAttribute("type","hidden"),M.setAttribute("value",y),M.setAttribute("name",i+"_value_disabledform_id_temp"),M.setAttribute("id",i+"_value_disabledform_id_temp");var L=document.createElement("input");L.setAttribute("type","hidden"),L.setAttribute("value",g),L.setAttribute("name",i+"_use_for_submissionform_id_temp"),L.setAttribute("id",i+"_use_for_submissionform_id_temp");var z=document.createElement("div");z.setAttribute("id","main_div");var q=document.createElement("div");q.setAttribute("id",i+"_elemet_tableform_id_temp");var S="yes"==r?"none":"table-cell",N=document.createElement("div");N.setAttribute("align","left"),N.style.display=S,N.style.width=t+"px",N.setAttribute("id",i+"_label_sectionform_id_temp");var H=document.createElement("div");H.setAttribute("align","left"),H.style.display="table-cell",H.setAttribute("id",i+"_element_sectionform_id_temp");document.createElement("br"),document.createElement("br");var D=document.createElement("br"),O=(document.createElement("br"),document.createElement("div"));O.style.display="table";var P=document.createElement("div");P.setAttribute("id",i+"_table_little"),P.style.display="table-row-group",O.appendChild(P);var F=document.createElement("div");F.setAttribute("id",i+"_element_tr1"),F.style.display="table-row";var R=document.createElement("div");R.setAttribute("id",i+"_element_tr2"),R.style.display="table-row";var W=document.createElement("div");W.setAttribute("valign","top"),W.setAttribute("id",i+"_td_little1"),W.style.display="table-cell";var K=document.createElement("div");K.setAttribute("valign","top"),K.setAttribute("id",i+"_td_little2"),K.style.display="table-cell";var U=document.createElement("span");U.setAttribute("id",i+"_element_labelform_id_temp"),U.innerHTML=e,U.setAttribute("class","label"),U.style.verticalAlign="top";var V=document.createElement("span");V.setAttribute("id",i+"_required_elementform_id_temp"),V.innerHTML="",V.setAttribute("class","required"),V.style.verticalAlign="top","yes"==s&&(V.innerHTML=" *");var $=document.getElementById("show_table");N.appendChild(U),N.appendChild(V),H.appendChild(k),H.appendChild(j),H.appendChild(C),H.appendChild(I),H.appendChild(B),H.appendChild(Q),H.appendChild(T),H.appendChild(M),H.appendChild(L),H.appendChild(O),q.appendChild(N),q.appendChild(H),z.appendChild(q),z.appendChild(D),$.appendChild(z),jQuery("#main_div").append(form_maker.type_radio_description),"top"==n&&label_top(i),change_class(p,i),refresh_rowcol(i,"radio"),aaa&&show_other_input(i),jQuery(function(){jQuery("#choices").sortable({items:".change_pos",handle:".el_choices_sortable",update:function(e,t){refresh_rowcol(i,"radio")}})})}function type_checkbox(i,e,t,n,a,r,l,d,_,o,s,m,u,c,p,f,h,y,b,v,g,w,E){jQuery("#element_type").val("type_checkbox"),delete_last_child();var A=jQuery("#edit_table"),x=jQuery('<div id="edit_div"></div>');A.append(x);var k=jQuery('<div id="edit_main_table"></div>');x.append(k),k.append(create_field_type("type_checkbox")),k.append(create_label(i,e)),k.append(create_label_position(i,n)),k.append(create_hide_label(i,r)),k.append(create_required(i,u)),k.append(create_relative_position(i,l,"checkbox")),k.append(create_option_label_position(i,a,"checkbox")),k.append(create_radio_options(i,v,d,w,g,p,f,_,"checkbox"));var j=jQuery('<div class="inside"></div>');k.append(create_advanced_options_container(j)),j.append(create_field_label_size(i,t)),j.append(create_class(i,h)),j.append(create_rowcol(i,o,"checkbox")),j.append(create_limit_choice(i,s,"checkbox")),j.append(create_limit_choice_alert(i,m,"checkbox")),j.append(create_randomize(i,c)),j.append(create_enable_options_value(i,v,E,"checkbox")),j.append(create_allow_other(i,p,"checkbox")),j.append(create_additional_attributes(i,y,"type_checkbox")),element="input",type="checkbox";var C=document.createElement("input");C.setAttribute("type","hidden"),C.setAttribute("value","type_checkbox"),C.setAttribute("name",i+"_typeform_id_temp"),C.setAttribute("id",i+"_typeform_id_temp");var I=document.createElement("input");I.setAttribute("type","hidden"),I.setAttribute("value",u),I.setAttribute("name",i+"_requiredform_id_temp"),I.setAttribute("id",i+"_requiredform_id_temp");var B=document.createElement("input");B.setAttribute("type","hidden"),B.setAttribute("value",r),B.setAttribute("name",i+"_hide_labelform_id_temp"),B.setAttribute("id",i+"_hide_labelform_id_temp");var Q=document.createElement("input");Q.setAttribute("type","hidden"),Q.setAttribute("value",c),Q.setAttribute("name",i+"_randomizeform_id_temp"),Q.setAttribute("id",i+"_randomizeform_id_temp");var T=document.createElement("input");T.setAttribute("type","hidden"),T.setAttribute("value",p),T.setAttribute("name",i+"_allow_otherform_id_temp"),T.setAttribute("id",i+"_allow_otherform_id_temp");var M=document.createElement("input");M.setAttribute("type","hidden"),M.setAttribute("value",f),M.setAttribute("name",i+"_allow_other_numform_id_temp"),M.setAttribute("id",i+"_allow_other_numform_id_temp");var L=document.createElement("input");L.setAttribute("type","hidden"),L.setAttribute("value",s),L.setAttribute("name",i+"_limitchoice_numform_id_temp"),L.setAttribute("id",i+"_limitchoice_numform_id_temp");var z=document.createElement("input");z.setAttribute("type","hidden"),z.setAttribute("value",m.replace(/"/g,"&quot;")),z.setAttribute("name",i+"_limitchoicealert_numform_id_temp"),z.setAttribute("id",i+"_limitchoicealert_numform_id_temp");var q=document.createElement("input");q.setAttribute("type","hidden"),q.setAttribute("value",o),q.setAttribute("name",i+"_rowcol_numform_id_temp"),q.setAttribute("id",i+"_rowcol_numform_id_temp");var S=document.createElement("input");S.setAttribute("type","hidden"),S.setAttribute("value",a),S.setAttribute("id",i+"_option_left_right");var N=document.createElement("input");N.setAttribute("type","hidden"),N.setAttribute("value",v),N.setAttribute("name",i+"_value_disabledform_id_temp"),N.setAttribute("id",i+"_value_disabledform_id_temp");var H=document.createElement("input");H.setAttribute("type","hidden"),H.setAttribute("value",E),H.setAttribute("name",i+"_use_for_submissionform_id_temp"),H.setAttribute("id",i+"_use_for_submissionform_id_temp");var D=document.createElement("div");D.setAttribute("id","main_div");var O=document.createElement("div");O.setAttribute("id",i+"_elemet_tableform_id_temp");var P="yes"==r?"none":"table-cell",F=document.createElement("div");F.setAttribute("align","left"),F.style.display=P,F.style.width=t+"px",F.setAttribute("id",i+"_label_sectionform_id_temp");var R=document.createElement("div");R.setAttribute("align","left"),R.style.display="table-cell",R.setAttribute("id",i+"_element_sectionform_id_temp");document.createElement("br"),document.createElement("br");var W=document.createElement("br"),K=(document.createElement("br"),document.createElement("div"));K.style.display="table";var U=document.createElement("div");U.setAttribute("id",i+"_table_little"),U.style.display="table-row-group",K.appendChild(U);var V=document.createElement("span");V.setAttribute("id",i+"_element_labelform_id_temp"),V.innerHTML=e,V.setAttribute("class","label"),V.style.verticalAlign="top";var $=document.createElement("span");$.setAttribute("id",i+"_required_elementform_id_temp"),$.innerHTML="",$.setAttribute("class","required"),$.style.verticalAlign="top","yes"==u&&($.innerHTML=" *");var G=document.getElementById("show_table");F.appendChild(V),F.appendChild($),R.appendChild(C),R.appendChild(I),R.appendChild(B),R.appendChild(Q),R.appendChild(T),R.appendChild(M),R.appendChild(q),R.appendChild(L),R.appendChild(z),R.appendChild(S),R.appendChild(N),R.appendChild(H),R.appendChild(K),O.appendChild(F),O.appendChild(R),D.appendChild(O),D.appendChild(W),G.appendChild(D),jQuery("#main_div").append(form_maker.type_checkbox_description),"top"==n&&label_top(i),change_class(h,i),refresh_rowcol(i,"checkbox"),aaa&&show_other_input(i),jQuery(function(){jQuery("#choices").sortable({items:".change_pos",handle:".el_choices_sortable",update:function(e,t){refresh_rowcol(i,"checkbox")}})})}function create_keys(e,t){jQuery('<label class="fm-field-label">Keys</label>');return create_option_container(null,jQuery('<a href="'+admin_url+'?page=options_fm" target="_blank" class="fm-field-recaptcha-label">'+t+"</a>"))}function create_recaptcha_invisible(e,t){var i=jQuery('<label class="fm-field-label">Type</label>'),n=jQuery('<input type="radio" id="edit_for_recaptcha_type_v2" name="edit_for_recaptcha_type" value="v2" onchange="fm_recaptcha_type('+e+', this.value)"'+("v2"==t?' checked="checked"':"")+" />"),a=jQuery('<label for="edit_for_recaptcha_type_v2">reCAPTCHA v2 (checkbox)</label>'),r=jQuery('<input type="radio" id="edit_for_recaptcha_type_invisible" name="edit_for_recaptcha_type" value="invisible" onchange="fm_recaptcha_type('+e+', this.value)"'+("invisible"==t?' checked="checked"':"")+" />"),l=jQuery('<label for="edit_for_recaptcha_type_invisible">reCAPTCHA v2 (invisible)</label>'),d=jQuery('<input type="radio" id="edit_for_recaptcha_type_v3" name="edit_for_recaptcha_type" value="v3" onchange="fm_recaptcha_type('+e+', this.value)"'+("v3"==t?' checked="checked"':"")+" />"),_=jQuery('<label for="edit_for_recaptcha_type_v3">reCAPTCHA v3</label>'),o=n;return create_option_container(i,o=(o=(o=(o=(o=(o=(o=(o=(o=(o=(o=(o=(o=o.add(a)).add(jQuery("<br />"))).add(jQuery('<span class="fm-description">Validate users with the "I\'m not a robot" checkbox.</span>'))).add(jQuery("<br />"))).add(r)).add(l)).add(jQuery("<br />"))).add(jQuery('<span class="fm-description">Validate users in the background.</span>'))).add(jQuery("<br />"))).add(d)).add(_)).add(jQuery("<br />"))).add(jQuery('<span class="fm-description">Verify requests with a score.</span>')))}function fm_recaptcha_type(e,t){jQuery("#wd_recaptchaform_id_temp").attr("w_type",t),"invisible"==t?(jQuery("#recaptcha_position").show(),jQuery("#recaptcha_keys_message").show(),jQuery("#recaptcha_advanced").hide(),jQuery("#recaptcha_score").hide(),jQuery("#"+e+"_hide_labelform_id_temp").val("no"),jQuery("#el_hide_label").prop("checked",!0),hide_label(e)):"v3"==t?(jQuery("#recaptcha_score").show(),jQuery("#recaptcha_keys_message").show(),jQuery("#recaptcha_advanced").hide(),jQuery("#recaptcha_position").hide(),jQuery("#"+e+"_hide_labelform_id_temp").val("no"),jQuery("#el_hide_label").prop("checked",!0),hide_label(e)):(jQuery("#recaptcha_position").hide(),jQuery("#recaptcha_score").hide(),jQuery("#recaptcha_keys_message").hide(),jQuery("#recaptcha_advanced").show())}function create_recaptcha_score(e,t,i){return create_option_container(jQuery('<label class="fm-field-label">Score</label>'),'ReCaptcha v3 returns a score based on the user interactions with your forms. Scores range from 0.0 to 1.0, with 0.0 indicating abusive traffic and 1.0 indicating good traffic. <a href="'+admin_url+'?page=options_fm" target="_blank" class="fm-field-recaptcha-label">To change recaptcha score click here</a>',"recaptcha_score","v3"==i)}function create_recaptcha_position(e,t,i){var n=jQuery('<label class="fm-field-label">Display</label>'),a=jQuery('<input type="radio" id="edit_for_recaptcha_position_hidden" name="edit_for_recaptcha_position" value="hidden" onchange="fm_recaptcha_position('+e+', this.value)"'+("hidden"==t?' checked="checked"':"")+" />"),r=jQuery('<label for="edit_for_recaptcha_position_hidden">Hidden</label>'),l=jQuery('<input type="radio" id="edit_for_recaptcha_position_inline" name="edit_for_recaptcha_position" value="inline" onchange="fm_recaptcha_position('+e+', this.value)"'+("inline"==t?' checked="checked"':"")+" />"),d=jQuery('<label for="edit_for_recaptcha_position_inline">Inline</label>'),_=jQuery('<input type="radio" id="edit_for_recaptcha_position_bottomright" name="edit_for_recaptcha_position" value="bottomright" onchange="fm_recaptcha_position('+e+', this.value)"'+("bottomright"==t?' checked="checked"':"")+" />"),o=jQuery('<label for="edit_for_recaptcha_position_bottomright">Bottom-Right</label>'),s=jQuery('<input type="radio" id="edit_for_recaptcha_position_bottomleft" name="edit_for_recaptcha_position" value="bottomleft" onchange="fm_recaptcha_position('+e+', this.value)"'+("bottomleft"==t?' checked="checked"':"")+" />"),m=jQuery('<label for="edit_for_recaptcha_position_bottomleft">Bottom-Left</label>'),u=a;return create_option_container(n,u=(u=(u=(u=(u=(u=(u=(u=(u=(u=u.add(r)).add(jQuery("<br />"))).add(l)).add(d)).add(jQuery("<br />"))).add(_)).add(o)).add(jQuery("<br />"))).add(s)).add(m),"recaptcha_position","invisible"==i)}function fm_recaptcha_position(e,t){jQuery("#wd_recaptchaform_id_temp").attr("position",t)}function go_to_type_recaptcha(e){type_recaptcha(e,"reCAPTCHA","","top","yes","invisible","bottomright",.5)}function type_recaptcha(e,t,i,n,a,r,l,d){jQuery("#element_type").val("type_recaptcha"),delete_last_child();var _=jQuery("#edit_table"),o=jQuery('<div id="edit_div"></div>');_.append(o);var s=jQuery('<div id="edit_main_table"></div>');o.append(s),s.append(create_field_type("type_recaptcha")),s.append(create_recaptcha_invisible(e,r)),s.append(create_recaptcha_position(e,l,r)),s.append(create_recaptcha_score(e,d,r)),s.append(create_keys(e,"To set up recaptcha keys click here"));var m=jQuery('<div class="inside"></div>'),u=!1;"invisible"!=r&&"v3"!=r&&(u=!0),s.append(create_advanced_options_container(m,"recaptcha_advanced",u)),m.append(create_label(e,t)),m.append(create_label_position(e,n)),m.append(create_hide_label(e,a)),m.append(create_field_label_size(e,i)),element="img",type="captcha";var c=document.createElement("input");c.setAttribute("type","hidden"),c.setAttribute("value","type_recaptcha"),c.setAttribute("name",e+"_typeform_id_temp"),c.setAttribute("id",e+"_typeform_id_temp");var p=document.createElement("input");p.setAttribute("type","hidden"),p.setAttribute("value",a),p.setAttribute("name",e+"_hide_labelform_id_temp"),p.setAttribute("id",e+"_hide_labelform_id_temp");var f=document.createElement("div");f.setAttribute("id","recaptcha_keys_message"),f.setAttribute("class","error"),f.innerHTML=form_maker.invisible_recaptcha_error;var h=document.createElement("div");h.setAttribute("id","wd_recaptchaform_id_temp"),h.setAttribute("w_type",r),h.setAttribute("position",l);var y=document.createElement("span");y.style.color="red",y.style.fontStyle="italic",y.innerHTML=form_maker.no_preview,h.appendChild(y);var b=document.createElement("div");b.setAttribute("id","main_div");var v=document.createElement("div");v.setAttribute("id",e+"_elemet_tableform_id_temp");var g="yes"==a?"none":"table-cell",w=document.createElement("div");w.setAttribute("align","left"),w.style.display=g,w.style.width=i+"px",w.setAttribute("id",e+"_label_sectionform_id_temp");var E=document.createElement("div");E.setAttribute("align","left"),E.style.display="table-cell",E.setAttribute("id",e+"_element_sectionform_id_temp");document.createElement("br"),document.createElement("br");var A=document.createElement("br"),x=(document.createElement("br"),document.createElement("span"));x.setAttribute("id",e+"_element_labelform_id_temp"),x.innerHTML=t,x.setAttribute("class","label"),x.style.verticalAlign="top";var k=document.getElementById("show_table");w.appendChild(x),E.appendChild(c),E.appendChild(p),E.appendChild(h),v.appendChild(f),v.appendChild(w),v.appendChild(E),b.appendChild(v),b.appendChild(A),k.appendChild(b),jQuery("#main_div").append(form_maker.type_recaptcha_description),"top"==n&&label_top(e),"v2"==jQuery("input[name='edit_for_recaptcha_type']:checked").val()&&jQuery("#recaptcha_keys_message").hide()}function create_submit_label(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_title">Submit label</label>'),jQuery('<input type="text" class="fm-width-100" id="edit_for_title" onKeyUp="change_label(\''+e+'_element_submitform_id_temp\', this.value)" value="'+t+'" />'))}function create_display_reset(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_reset_active">Display Reset</label>'),jQuery('<input type="checkbox" id="el_reset_active" onclick="active_reset(this.checked, '+e+')"'+(t?' checked="checked"':"")+" />"))}function active_reset(e,t){document.getElementById(t+"_element_resetform_id_temp").style.display=e?"inline":"none"}function create_reset_label(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_title_textarea">Reset label</label>'),jQuery('<input type="text" class="fm-width-100" id="edit_for_title_textarea" onKeyUp="change_label(\''+e+'_element_resetform_id_temp\', this.value)" value="'+t+'" />'))}function go_to_type_submit_reset(e){w_attr_name=[],w_attr_value=[],type_submit_reset(e,"Submit","Reset","",!0,w_attr_name,w_attr_value)}function type_submit_reset(e,t,i,n,a,r,l){jQuery("#element_type").val("type_submit_reset"),delete_last_child();var d=jQuery("#edit_table"),_=jQuery('<div id="edit_div"></div>');d.append(_);var o=jQuery('<div id="edit_main_table"></div>');_.append(o),o.append(create_field_type("type_submit_reset")),o.append(create_submit_label(e,t)),o.append(create_display_reset(e,a)),o.append(create_reset_label(e,i));var s=jQuery('<div class="inside"></div>');o.append(create_advanced_options_container(s)),s.append(create_class(e,n)),s.append(create_additional_attributes(e,r,"type_submit_reset"));var m=document.createElement("br"),u=document.createElement("input");u.setAttribute("type","hidden"),u.setAttribute("value","type_submit_reset"),u.setAttribute("name",e+"_typeform_id_temp"),u.setAttribute("id",e+"_typeform_id_temp");var c=document.createElement("button");c.setAttribute("type","button"),c.setAttribute("class","button button-secondary button-hero button-submit"),c.setAttribute("id",e+"_element_submitform_id_temp"),c.setAttribute("value",t),c.innerHTML=t,c.setAttribute("disabled","disabled");var p=document.createElement("button");p.setAttribute("type","button"),p.setAttribute("class","button button-secondary button-hero button-reset"),a||(p.style.display="none"),p.setAttribute("id",e+"_element_resetform_id_temp"),p.setAttribute("value",i),p.setAttribute("disabled","disabled"),p.innerHTML=i;var f=document.createElement("div");f.setAttribute("id","main_div");var h=document.createElement("div");h.setAttribute("id",e+"_elemet_tableform_id_temp");var y=document.createElement("div");y.setAttribute("align","left"),y.style.display="table-cell",y.setAttribute("id",e+"_label_sectionform_id_temp");var b=document.createElement("div");b.setAttribute("align","left"),b.style.display="table-cell",b.setAttribute("id",e+"_element_sectionform_id_temp");var v=document.createElement("span");v.setAttribute("id",e+"_element_labelform_id_temp"),v.style.cssText="display:none",v.innerHTML="type_submit_reset_"+e;var g=document.getElementById("show_table");y.appendChild(v),b.appendChild(u),b.appendChild(c),b.appendChild(p),h.appendChild(y),h.appendChild(b),f.appendChild(h),f.appendChild(m),g.appendChild(f),jQuery("#main_div").append(form_maker.type_submit_description),change_class(n,e),refresh_attr(e,"type_submit_reset")}function create_canvas_width_height(e,t,i){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_input_size">Canvas Width / Height (px)</label>'),jQuery('<input type="text" class="fm-width-40" id="edit_for_input_size" onKeyPress="return check_isnum(event)" onKeyUp="change_w_style(\''+e+'_canvasform_id_temp\', this.value)" value="'+t+'" /> x <input type="text" class="fm-width-40" id="edit_for_input_size" onKeyPress="return check_isnum(event)" onKeyUp="change_h_style(\''+e+'_canvasform_id_temp\', this.value)" value="'+i+'" /><p class="description">'+form_maker.leave_empty+"</p>"))}function type_signature(e,t){jQuery("#element_type").val(t.field_type),delete_last_child();var i=jQuery("#edit_table"),n=jQuery('<div id="edit_div"></div>');i.append(n);var a=jQuery('<div id="edit_main_table"></div>');n.append(a),a.append(create_field_type(t.field_type)),a.append(create_label(e,t.field_label)),a.append(create_label_position(e,t.field_label_pos)),a.append(create_hide_label(e,t.field_label_hide)),a.append(create_required(e,t.required));var r=jQuery('<div class="inside"></div>');a.append(create_advanced_options_container(r)),r.append(create_field_label_size(e,t.field_label_size)),r.append(create_canvas_width_height(e,t.canvas.width,t.canvas.height)),r.append(create_class(e,t.class)),r.append(create_upload_destination(e,t.destination)),element="signature";var l=document.createElement("br"),d=document.createElement("span");d.setAttribute("id",e+"_element_labelform_id_temp"),d.innerHTML=t.field_label,d.setAttribute("class","label"),d.style.verticalAlign="top";var _=document.createElement("span");_.setAttribute("id",e+"_required_elementform_id_temp"),_.innerHTML="",_.setAttribute("class","required"),_.style.verticalAlign="top","yes"==t.required&&(_.innerHTML=" *");var o=document.createElement("div");o.setAttribute("id",e+"_label_sectionform_id_temp"),o.setAttribute("align","left"),o.style.display="yes"==t.field_label_hide?"none":"table-cell",o.style.width=t.field_label_size+"px",o.style.verticalAlign="top",o.appendChild(d),o.appendChild(_);var s=document.createElement("canvas");s.setAttribute("id",e+"_canvasform_id_temp"),s.setAttribute("class","fm-signature"),s.style.width=t.canvas.width+"px",s.style.height=t.canvas.height+"px",s.style.border="1px solid";var m=document.createElement("input");m.setAttribute("type","hidden"),m.setAttribute("value",t.field_type),m.setAttribute("name",e+"_typeform_id_temp"),m.setAttribute("id",e+"_typeform_id_temp");var u=document.createElement("input");u.setAttribute("type","hidden"),u.setAttribute("value",t.field_label_pos),u.setAttribute("name",e+"_option_left_right"),u.setAttribute("id",e+"_option_left_right");var c=document.createElement("input");c.setAttribute("type","hidden"),c.setAttribute("value",t.field_label_hide),c.setAttribute("name",e+"_hide_labelform_id_temp"),c.setAttribute("id",e+"_hide_labelform_id_temp");var p=document.createElement("input");p.setAttribute("type","hidden"),p.setAttribute("value",t.required),p.setAttribute("name",e+"_requiredform_id_temp"),p.setAttribute("id",e+"_requiredform_id_temp");var f=document.createElement("input");f.setAttribute("type","hidden"),f.setAttribute("value",t.canvas.width),f.setAttribute("name",e+"_canvas_widthform_id_temp"),f.setAttribute("id",e+"_canvas_widthform_id_temp");var h=document.createElement("input");h.setAttribute("type","hidden"),h.setAttribute("value",t.canvas.height),h.setAttribute("name",e+"_canvas_heightform_id_temp"),h.setAttribute("id",e+"_canvas_heightform_id_temp");var y=document.createElement("input");y.setAttribute("type","hidden"),y.setAttribute("value",t.destination),y.setAttribute("name",e+"_destination"),y.setAttribute("id",e+"_destination");var b=document.createElement("div");b.setAttribute("align","left"),b.style.display="table-cell",b.setAttribute("id",e+"_element_sectionform_id_temp"),b.appendChild(s),b.appendChild(m),b.appendChild(u),b.appendChild(c),b.appendChild(p),b.appendChild(f),b.appendChild(h),b.appendChild(y);var v=document.createElement("div");v.setAttribute("id",e+"_elemet_tableform_id_temp"),v.appendChild(o),v.appendChild(b);var g,w,E,A=document.createElement("div");A.setAttribute("id","main_div"),A.appendChild(v),A.appendChild(l),document.getElementById("show_table").appendChild(A),"top"==t.field_label_pos&&label_top(e),change_class(t.class,e),g=this,E=function(e){w.attr({width:e.width,height:e.height})},jQuery(document).ready(function(){w=jQuery("#"+e+"_canvasform_id_temp"),g.addEventListener("orientationchange",E,!1),g.addEventListener("resize",E,!1),E(t.canvas),jQuery("#"+e+"_element_sectionform_id_temp").signaturePad({drawOnly:!0,defaultAction:"drawIt",validateFields:!1,lineWidth:0,output:null,sigNav:null,name:null,typed:null,typeIt:null,drawIt:null,typeItDesc:null,drawItDesc:null})})}function type_editor(e,t){jQuery("#element_type").val("type_editor"),delete_last_child();var i=jQuery("#edit_table"),n=jQuery('<div id="edit_div"></div>');i.append(n);var a,r=jQuery('<div id="edit_main_table"></div>');n.append(r),r.append(create_field_type("type_editor")),iReturnLeft=jQuery("#edit_table").offset().left,document.getElementById("main_editor").style.display="block",document.getElementById("main_editor").style.left=iReturnLeft+15+"px",document.getElementById("main_editor").style.top="120px",document.getElementById("main_editor").style.width=jQuery("#edit_table").width()-30+"px",document.getElementById("form_maker_editor_ifr")&&"none"==document.getElementById("form_maker_editor").style.display?(ifr_id="form_maker_editor_ifr",ifr=getIFrameDocument(ifr_id),ifr.body.innerHTML=t):document.getElementById("form_maker_editor").value=t,(a=document.createElement("div")).setAttribute("id","main_div"),document.getElementById("show_table").appendChild(a),(a=document.createElement("div")).style.width="500px",document.getElementById("edit_table").appendChild(a)}function type_section_break(e,t){jQuery("#element_type").val("type_section_break"),delete_last_child();var i=jQuery("#edit_table"),n=jQuery('<div id="edit_div"></div>');i.append(n);var a,r=jQuery('<div id="edit_main_table"></div>');n.append(r),r.append(create_field_type("type_section_break")),iReturnLeft=jQuery("#edit_table").offset().left,document.getElementById("main_editor").style.display="block",document.getElementById("main_editor").style.left=iReturnLeft+15+"px",document.getElementById("main_editor").style.top="120px",document.getElementById("main_editor").style.width=jQuery("#edit_table").width()-30+"px",document.getElementById("form_maker_editor_ifr")&&"none"==document.getElementById("form_maker_editor").style.display?(ifr_id="form_maker_editor_ifr",ifr=getIFrameDocument(ifr_id),ifr.body.innerHTML=t):document.getElementById("form_maker_editor").value=t,element="div",(a=document.createElement("div")).setAttribute("id","main_div"),document.getElementById("show_table").appendChild(a),(a=document.createElement("div")).style.width="500px",document.getElementById("edit_table").appendChild(a)}function create_page_title(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_page_title_input">Page Title</label>'),jQuery('<input type="text" class="fm-width-100" id="el_page_title_input" name="el_page_title_input" onKeyup="pagebreak_title_change(this.value,'+e+')" value="'+t+'" />'))}function pagebreak_title_change(e){e=e.replace(/(<([^>]+)>)/gi,""),document.getElementById("_div_between").setAttribute("page_title",e),document.getElementById("div_page_title").innerHTML=e+"<br/><br/>"}function create_next_type(e,t){var i=jQuery('<label class="fm-field-label">Next Type</label>'),n=jQuery('<input type="radio" id="el_type_next_text" name="el_type_next" value="text" onclick="pagebreak_type_change(\'next\',\'text\')"'+("text"==t[0]?' checked="checked"':"")+" />"),a=jQuery('<label for="el_type_next_text">Text</label>'),r=jQuery('<input type="radio" id="el_type_next_img" name="el_type_next" value="img" onclick="pagebreak_type_change(\'next\',\'img\')"'+("text"==t[0]?"":' checked="checked"')+" />"),l=jQuery('<label for="el_type_next_img">Image</label>'),d=n;return create_option_container(i,d=(d=(d=d.add(a)).add(r)).add(l))}function pagebreak_type_change(e,t){switch(document.getElementById("_div_between").setAttribute(e+"_type",t),t){case"button":document.getElementById("_div_between").setAttribute(e+"_title",e),(i=document.createElement("label")).setAttribute("class","fm-field-label"),i.setAttribute("for","el_title_"+e),i.setAttribute("id",e+"_label"),i.setAttribute("type","button"),i.innerHTML=e[0].toUpperCase()+e.slice(1)+" "+t+" name",document.getElementById(e+"_label").parentNode.replaceChild(i,document.getElementById(e+"_label")),document.getElementById("el_title_"+e).value=e,(n=document.createElement("button")).setAttribute("id","page_"+e+"_0"),n.setAttribute("class",document.getElementById("_div_between").getAttribute(e+"_class")),n.style.cursor="pointer",n.innerHTML=e,document.getElementById("_element_section_"+e).replaceChild(n,document.getElementById("page_"+e+"_0"));break;case"text":document.getElementById("_div_between").setAttribute(e+"_title",e),(i=document.createElement("label")).setAttribute("class","fm-field-label"),i.setAttribute("for","el_title_"+e),i.setAttribute("id",e+"_label"),i.innerHTML=e[0].toUpperCase()+e.slice(1)+" "+t+" name",document.getElementById(e+"_label").parentNode.replaceChild(i,document.getElementById(e+"_label")),document.getElementById("el_title_"+e).value=e[0].toUpperCase()+e.slice(1),(n=document.createElement("span")).setAttribute("id","page_"+e+"_0"),n.setAttribute("class",document.getElementById("_div_between").getAttribute(e+"_class")),n.style.cursor="pointer",n.innerHTML=e[0].toUpperCase()+e.slice(1),document.getElementById("_element_section_"+e).replaceChild(n,document.getElementById("page_"+e+"_0"));break;case"img":var i,n;document.getElementById("_div_between").setAttribute(e+"_title",plugin_url+"/images/"+e+".png"),(i=document.createElement("label")).setAttribute("class","fm-field-label"),i.setAttribute("for","el_title_"+e),i.setAttribute("id",e+"_label"),i.innerHTML=e[0].toUpperCase()+e.slice(1)+" "+t+" src",document.getElementById(e+"_label").parentNode.replaceChild(i,document.getElementById(e+"_label")),document.getElementById("el_title_"+e).value=plugin_url+"/images/"+e+".png",(n=document.createElement("img")).setAttribute("id","page_"+e+"_0"),n.setAttribute("class",document.getElementById("_div_between").getAttribute(e+"_class")),n.style.cursor="pointer",n.src=plugin_url+"/images/"+e+".png",document.getElementById("_element_section_"+e).replaceChild(n,document.getElementById("page_"+e+"_0"))}}function create_next_text_name(e,t){return create_option_container(jQuery('<label id="next_label" class="fm-field-label" for="el_title_next">Next text name</label>'),jQuery('<input type="text" class="fm-width-100" id="el_title_next" onKeyup="change_pagebreak_label( this.value, \'next\')" onChange="change_pagebreak_label( this.value, \'next\')" value="'+t[0]+'" />'))}function change_pagebreak_label(e,t){button_type=document.getElementById("_div_between").getAttribute(t+"_type"),"img"!=button_type?(document.getElementById("page_"+t+"_0").value=e,document.getElementById("page_"+t+"_0").innerHTML=e):document.getElementById("page_"+t+"_0").src=e,document.getElementById("_div_between").setAttribute(t+"_title",e)}function create_check_required_next(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_check_next_input">Check the required fields</label>'),jQuery('<input type="checkbox" id="el_check_next_input" onclick="set_checkable(\'next\')"'+("true"==t[0]?' checked="checked"':"")+" />"))}function set_checkable(e){document.getElementById("_div_between").setAttribute(e+"_checkable",document.getElementById("el_check_"+e+"_input").checked)}function create_previous_type(e,t){var i=jQuery('<label class="fm-field-label">Previous Type</label>'),n=jQuery('<input type="radio" id="el_type_previous_text" name="el_type_previous" value="text" onclick="pagebreak_type_change(\'previous\',\'text\')"'+("text"==t[1]?' checked="checked"':"")+" />"),a=jQuery('<label for="el_type_previous_text">Text</label>'),r=jQuery('<input type="radio" id="el_type_previous_img" name="el_type_previous" value="img" onclick="pagebreak_type_change(\'previous\',\'img\')"'+("text"==t[1]?"":' checked="checked"')+" />"),l=jQuery('<label for="el_type_previous_img">Image</label>'),d=n;return create_option_container(i,d=(d=(d=d.add(a)).add(r)).add(l))}function create_previous_text_name(e,t){return create_option_container(jQuery('<label id="previous_label" class="fm-field-label" for="el_title_previous">Previous text name</label>'),jQuery('<input type="text" class="fm-width-100" id="el_title_previous" onKeyup="change_pagebreak_label( this.value, \'previous\')" onChange="change_pagebreak_label( this.value, \'previous\')" value="'+t[1]+'" />'))}function create_check_required_previous(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_check_previous_input">Check the required fields</label>'),jQuery('<input type="checkbox" id="el_check_previous_input" onclick="set_checkable(\'previous\')"'+("true"==t[1]?' checked="checked"':"")+" />"))}function create_next_class(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="next_element_style">Next class</label>'),jQuery('<input type="text" class="fm-width-100" id="next_element_style" onChange="change_pagebreak_class(this.value, \'next\')" value="'+t[0]+'" />'))}function create_previous_class(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="previous_element_style">Previous class</label>'),jQuery('<input type="text" class="fm-width-100" id="previous_element_style" onChange="change_pagebreak_class(this.value, \'previous\')" value="'+t[1]+'" />'))}function change_pagebreak_class(e,t){document.getElementById("page_"+t+"_0").setAttribute("class",e),document.getElementById("_div_between").setAttribute(t+"_class",e)}function type_page_break(e,t,i,n,a,r,l,d){jQuery("#element_type").val("type_page_break"),delete_last_child();var _=jQuery("#edit_table"),o=jQuery('<div id="edit_div"></div>');_.append(o);var s=jQuery('<div id="edit_main_table"></div>');o.append(s),s.append(create_field_type("type_page_break")),s.append(create_page_title(e,t)),s.append(create_next_type(e,n)),s.append(create_next_text_name(e,i)),s.append(create_check_required_next(e,r)),s.append(create_previous_type(e,n)),s.append(create_previous_text_name(e,i)),s.append(create_check_required_previous(e,r));var m=jQuery('<div class="inside"></div>');s.append(create_advanced_options_container(m)),m.append(create_next_class(e,a)),m.append(create_previous_class(e,a)),m.append(create_additional_attributes(e,l,"type_page_break"));var u=document.createElement("br"),c=document.createElement("div");c.setAttribute("id","main_div");var p=document.createElement("div");p.setAttribute("id",e+"_elemet_tableform_id_temp");var f=document.createElement("div");f.setAttribute("align","left"),f.style.display="table-cell",f.setAttribute("id",e+"_label_sectionform_id_temp");var h=document.createElement("div");h.setAttribute("align","left"),h.style.display="table-cell",h.setAttribute("id",e+"_element_sectionform_id_temp");var y=document.createElement("div");y.setAttribute("align","right"),y.setAttribute("id","_element_section_next");var b=make_pagebreak_button("next",i[0],n[0],a[0],0);y.appendChild(b);var v=document.createElement("div");v.setAttribute("align","left"),v.setAttribute("id","_element_section_previous");var g=make_pagebreak_button("previous",i[1],n[1],a[1],0);v.appendChild(g);var w=document.createElement("div");w.setAttribute("align","center"),w.setAttribute("style","border:2px solid blue;padding:20px; margin:20px"),w.innerHTM="FIELDS";var E=document.createElement("div");E.innerHTML=t+"<br/><br/>",E.setAttribute("id","div_page_title"),E.setAttribute("align","center");var A=document.createElement("div");A.setAttribute("page_title",t),A.setAttribute("next_type",n[0]),A.setAttribute("next_title",i[0]),A.setAttribute("next_class",a[0]),A.setAttribute("next_checkable",r[0]),A.setAttribute("previous_type",n[1]),A.setAttribute("previous_title",i[1]),A.setAttribute("previous_class",a[1]),A.setAttribute("previous_checkable",r[1]),A.setAttribute("align","center"),A.setAttribute("id","_div_between"),A.innerHTML="--------------------------------------<br />P A G E B R E A K<br />--------------------------------------",h.appendChild(E),h.appendChild(w),h.appendChild(y),h.appendChild(A),h.appendChild(v);var x=document.getElementById("show_table");p.appendChild(h),c.appendChild(p),c.appendChild(u),x.appendChild(c),refresh_attr(e,"type_page_break")}function make_pagebreak_button(e,t,i,n,a){switch(i){case"button":return(r=document.createElement("button")).setAttribute("id","page_"+e+"_"+a),r.setAttribute("type","button"),r.setAttribute("class",n),r.style.cursor="pointer",r.innerHTML=t,r;case"text":return(r=document.createElement("span")).setAttribute("id","page_"+e+"_"+a),r.setAttribute("class",n),r.style.cursor="pointer",r.innerHTML=t,r;case"img":var r;return(r=document.createElement("img")).setAttribute("id","page_"+e+"_"+a),r.setAttribute("class",n),r.style.cursor="pointer",r.src=t,r}}function create_placeholder_name(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_first_value_input">Placeholder</label>'),jQuery('<input type="text" class="fm-width-40" id="el_first_value_first" onKeyUp="change_input_value(this.value,\''+e+'_element_firstform_id_temp\')" value="'+t[0].replace(/"/g,"&quot;")+'" />-<input type="text" class="fm-width-40" id="el_first_value_last" onKeyUp="change_input_value(this.value,\''+e+'_element_lastform_id_temp\')" value="'+t[1].replace(/"/g,"&quot;")+'" />'))}function create_field_size_name(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_input_size">Width(px)</label>'),jQuery('<input class="fm-width-100" type="text" id="edit_for_input_size" onKeyPress="return check_isnum(event)" onKeyUp="change_w_style(\''+e+"_element_firstform_id_temp', this.value); change_w_style('"+e+"_element_middleform_id_temp', this.value); change_w_style('"+e+'_element_lastform_id_temp\', this.value)" value="'+t+'" /><p class="description">'+form_maker.leave_empty+"</p>"))}function create_enable_name_fields(e,t,i){var n=jQuery('<label class="fm-field-label">Enable Field(s)</label>'),a=jQuery('<input type="checkbox" id="el_title" value="no" onclick="enable_name_fields('+e+",'title')\""+("yes"==t[0]?' checked="checked"':"")+" />"),r=jQuery('<label for="el_title" id="el_title_label">'+i[0]+"</label>"),l=jQuery('<input type="checkbox" id="el_middle" value="no" onclick="enable_name_fields('+e+",'middle')\""+("yes"==t[1]?' checked="checked"':"")+" />"),d=jQuery('<label for="el_middle" id="el_middle_label">'+i[3]+"</label>"),_=jQuery('<label id="el_first_label" class="fm-hide">'+i[1]+'</label><label id="el_last_label" class="fm-hide">'+i[2]+"</label>"),o=a;return create_option_container(n,o=(o=(o=(o=o.add(r)).add(l)).add(d)).add(_))}function enable_name_fields(t,e){var i="title"==e?2:3;tr_name1=document.getElementById(t+"_tr_name1"),tr_name2=document.getElementById(t+"_tr_name2"),first_input=document.getElementById(t+"_td_name_input_first"),first_label=document.getElementById(t+"_td_name_label_first");var n="title"==e?"40":document.getElementById("edit_for_input_size").value;if(1==document.getElementById("el_"+e).checked?document.getElementById(t+"_enable_fieldsform_id_temp").setAttribute(e,"yes"):document.getElementById(t+"_enable_fieldsform_id_temp").setAttribute(e,"no"),"yes"==document.getElementById(t+"_enable_fieldsform_id_temp").getAttribute(e)){var a=document.createElement("div");a.setAttribute("id",t+"_td_name_input_"+e),a.style.cssText="display:table-cell";var r=document.createElement("input");r.setAttribute("type","text"),w_title[i]==w_first_val[i]?(r.setAttribute("value",w_first_val[i]),r.setAttribute("placeholder",w_title[i])):r.setAttribute("value",w_first_val[i]),r.setAttribute("id",t+"_element_"+e+"form_id_temp"),r.setAttribute("name",t+"_element_"+e+"form_id_temp"),r.setAttribute("value",w_first_val[i]),r.setAttribute("title",w_title[i]),r.setAttribute("placeholder",w_title[i]),r.style.cssText="margin-right: 10px; width: "+n+"px";var l=document.createElement("div");l.setAttribute("id",t+"_td_name_label_"+e),l.style.cssText="display:table-cell";var d=document.createElement("label");d.setAttribute("class","mini_label"),d.setAttribute("id",t+"_mini_label_"+e),d.innerHTML=document.getElementById("el_"+e+"_label").innerHTML,a.appendChild(r),l.appendChild(d),"title"==e?(tr_name1.insertBefore(a,first_input),tr_name2.insertBefore(l,first_label)):(tr_name1.appendChild(a),tr_name2.appendChild(l))}else document.getElementById(t+"_td_name_input_"+e)&&(tr_name1.removeChild(document.getElementById(t+"_td_name_input_"+e)),tr_name2.removeChild(document.getElementById(t+"_td_name_label_"+e)));var _=document.createTextNode("-"),o=document.createTextNode("-");value_if_empty_width="title"==e?"60":"95";var s=document.createElement("input");s.setAttribute("id","el_first_value_"+e),s.setAttribute("type","text"),s.setAttribute("value",w_title[i]),s.style.cssText="width:"+value_if_empty_width+"px;",s.setAttribute("onKeyUp","change_input_value(this.value,'"+t+"_element_"+e+"form_id_temp')"),el_first_value_first=document.getElementById("el_first_value_first"),parent=el_first_value_first.parentNode,"yes"==document.getElementById(t+"_enable_fieldsform_id_temp").getAttribute(e)?"title"==e?(parent.insertBefore(_,el_first_value_first),parent.insertBefore(s,_)):(parent.appendChild(o),parent.appendChild(s)):document.getElementById("el_first_value_"+e)&&("title"==e?parent.removeChild(document.getElementById("el_first_value_title").nextSibling):parent.removeChild(document.getElementById("el_first_value_middle").previousSibling),parent.removeChild(document.getElementById("el_first_value_"+e))),refresh_attr(t,"type_name"),jQuery(function(){jQuery("label#"+t+"_mini_label_title").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' class='title' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.title").focus(),jQuery("input.title").blur(function(){var e=jQuery(this).val();jQuery("#"+t+"_mini_label_title").text(e),document.getElementById("el_title_label").innerHTML=e})}}),jQuery("label#"+t+"_mini_label_middle").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' class='middle' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.middle").focus(),jQuery("input.middle").blur(function(){var e=jQuery(this).val();jQuery("#"+t+"_mini_label_middle").text(e),document.getElementById("el_middle_label").innerHTML=e})}})})}function create_autofill_user_name(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_autofill">Autofill with user name</label>'),jQuery('<input type="checkbox" id="el_autofill" onclick="set_autofill(\''+e+"_autofillform_id_temp')\""+("yes"==t?' checked="checked"':"")+" />"))}function set_autofill(e){"yes"==document.getElementById(e).value?document.getElementById(e).value="no":document.getElementById(e).value="yes"}function go_to_type_name(e){w_attr_name=[],w_attr_value=[],w_first_val=["","","",""],w_title=["","","",""],w_mini_labels=["Title","First","Last","Middle"],w_name_fields=["no","no"],type_name(e,"Name","","top","no",w_first_val,w_title,w_mini_labels,"","normal","no","no","",w_attr_name,w_attr_value,w_name_fields,"no")}function type_name(t,e,i,n,a,r,l,d,_,o,s,m,u,c,p,f,h){jQuery("#element_type").val("type_name"),delete_last_child();var y=jQuery("#edit_table"),b=jQuery('<div id="edit_div"></div>');y.append(b);var v=jQuery('<div id="edit_main_table"></div>');b.append(v),v.append(create_field_type("type_name")),v.append(create_label(t,e)),v.append(create_label_position(t,n)),v.append(create_hide_label(t,a)),v.append(create_required(t,s)),v.append(create_placeholder_name(t,l)),v.append(create_field_size_name(t,_));var g=jQuery('<div class="inside"></div>');v.append(create_advanced_options_container(g)),g.append(create_enable_name_fields(t,f,d)),g.append(create_autofill_user_name(t,h)),g.append(create_unique_values(t,m)),g.append(create_field_label_size(t,i)),g.append(create_class(t,u)),g.append(create_additional_attributes(t,c,"type_name"));var w=document.createElement("br"),E=document.createElement("input");E.setAttribute("type","hidden"),E.setAttribute("value","type_name"),E.setAttribute("name",t+"_typeform_id_temp"),E.setAttribute("id",t+"_typeform_id_temp");var A=document.createElement("input");A.setAttribute("type","hidden"),A.setAttribute("value",h),A.setAttribute("name",t+"_autofillform_id_temp"),A.setAttribute("id",t+"_autofillform_id_temp");var x=document.createElement("input");x.setAttribute("type","hidden"),x.setAttribute("value",s),x.setAttribute("name",t+"_requiredform_id_temp"),x.setAttribute("id",t+"_requiredform_id_temp");var k=document.createElement("input");k.setAttribute("type","hidden"),k.setAttribute("value",a),k.setAttribute("name",t+"_hide_labelform_id_temp"),k.setAttribute("id",t+"_hide_labelform_id_temp");var j=document.createElement("input");j.setAttribute("type","hidden"),j.setAttribute("name",t+"_enable_fieldsform_id_temp"),j.setAttribute("id",t+"_enable_fieldsform_id_temp"),j.setAttribute("title",f[0]),j.setAttribute("first","yes"),j.setAttribute("last","yes"),j.setAttribute("middle",f[1]);var C=document.createElement("input");C.setAttribute("type","hidden"),C.setAttribute("value",m),C.setAttribute("name",t+"_uniqueform_id_temp"),C.setAttribute("id",t+"_uniqueform_id_temp"),edit_labels=document.createTextNode("The labels of the fields are editable. Please, click on the label to edit.");var I=document.createElement("div");I.setAttribute("id","main_div");var B=document.createElement("div");B.setAttribute("class","fm-editable-label"),B.appendChild(edit_labels);var Q=document.createElement("div");Q.setAttribute("id",t+"_elemet_tableform_id_temp");var T="yes"==a?"none":"table-cell",M=document.createElement("div");M.setAttribute("align","left"),M.style.display=T,M.style.width=i+"px",M.setAttribute("id",t+"_label_sectionform_id_temp");var L=document.createElement("div");L.setAttribute("align","left"),L.style.display="table-cell",L.setAttribute("id",t+"_element_sectionform_id_temp");var z=document.createElement("div");z.style.display="table",z.setAttribute("id",t+"_table_name"),z.setAttribute("cellpadding","0"),z.setAttribute("cellspacing","0");var q=document.createElement("div");q.style.display="table-row",q.setAttribute("id",t+"_tr_name1");var S=document.createElement("div");S.style.display="table-row",S.setAttribute("id",t+"_tr_name2");var N=document.createElement("div");N.style.display="table-cell",N.setAttribute("id",t+"_td_name_input_first");var H=document.createElement("div");H.style.display="table-cell",H.setAttribute("id",t+"_td_name_input_last");var D=document.createElement("div");D.style.display="table-cell",D.setAttribute("id",t+"_td_name_label_first"),D.setAttribute("align","left");var O=document.createElement("div");O.style.display="table-cell",O.setAttribute("id",t+"_td_name_label_last"),O.setAttribute("align","left");var P=document.createElement("span");P.setAttribute("id",t+"_element_labelform_id_temp"),P.innerHTML=e,P.setAttribute("class","label"),P.style.verticalAlign="top";var F=document.createElement("span");F.setAttribute("id",t+"_required_elementform_id_temp"),F.innerHTML="",F.setAttribute("class","required"),F.style.verticalAlign="top","yes"==s&&(F.innerHTML=" *");var R=document.createElement("input");R.setAttribute("type","text"),R.style.cssText="margin-right: 10px; width:"+_+"px",R.setAttribute("id",t+"_element_firstform_id_temp"),R.setAttribute("name",t+"_element_firstform_id_temp"),R.setAttribute("value",r[0]),R.setAttribute("title",l[0]),R.setAttribute("placeholder",l[0]);var W=document.createElement("label");W.setAttribute("class","mini_label"),W.setAttribute("id",t+"_mini_label_first"),W.innerHTML=d[1];var K=document.createElement("input");K.setAttribute("type","text"),K.style.cssText="margin-right: 10px; width:"+_+"px",K.setAttribute("id",t+"_element_lastform_id_temp"),K.setAttribute("name",t+"_element_lastform_id_temp"),K.setAttribute("value",r[1]),K.setAttribute("title",l[1]),K.setAttribute("placeholder",l[1]);var U=document.createElement("label");U.setAttribute("class","mini_label"),U.setAttribute("id",t+"_mini_label_last"),U.innerHTML=d[2];var V=document.getElementById("show_table");M.appendChild(P),M.appendChild(F),N.appendChild(R),H.appendChild(K),q.appendChild(N),q.appendChild(H),D.appendChild(W),O.appendChild(U),S.appendChild(D),S.appendChild(O),z.appendChild(q),z.appendChild(S),L.appendChild(E),L.appendChild(x),L.appendChild(k),L.appendChild(C),L.appendChild(A),L.appendChild(j),L.appendChild(z),Q.appendChild(M),Q.appendChild(L),I.appendChild(Q),I.appendChild(w),I.appendChild(B),V.appendChild(I),jQuery("#main_div").append("<br>"+form_maker.type_name_description),"top"==n&&label_top(t),change_class(u,t),"yes"==f[0]&&enable_name_fields(t,"title"),"yes"==f[1]&&enable_name_fields(t,"middle"),jQuery(function(){jQuery("label#"+t+"_mini_label_first").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' class='first' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.first").focus(),jQuery("input.first").blur(function(){var e=jQuery(this).val();jQuery("#"+t+"_mini_label_first").text(e),document.getElementById("el_first_label").innerHTML=e})}}),jQuery("label#"+t+"_mini_label_last").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' class='last' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.last").focus(),jQuery("input.last").blur(function(){var e=jQuery(this).val();jQuery("#"+t+"_mini_label_last").text(e),document.getElementById("el_last_label").innerHTML=e})}})}),refresh_attr(t,"type_name")}function create_autofill_user_email(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_autofill">Autofill with user email</label>'),jQuery('<input type="checkbox" id="el_autofill" onclick="set_autofill(\''+e+"_autofillform_id_temp')\""+("yes"==t?' checked="checked"':"")+" />"))}function create_confirmation_email(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_verification_mail">Confirmation Email</label>'),jQuery('<input type="checkbox" id="el_verification_mail" onclick="verification_mail('+e+')"'+("yes"==t?' checked="checked"':"")+" />"))}function verification_mail(e){document.getElementById("el_verification_mail").checked?(document.getElementById("confirm_validation_label").style.display="block",document.getElementById("confirm_validation_empty").style.display="block",document.getElementById(e+"_verification_id_temp").value="yes",document.getElementById(e+"_1_label_sectionform_id_temp").style.display=document.getElementById(e+"_label_sectionform_id_temp").style.display,document.getElementById(e+"_1_element_sectionform_id_temp").style.display=document.getElementById(e+"_element_sectionform_id_temp").style.display):(document.getElementById("confirm_validation_label").style.display="none",document.getElementById("confirm_validation_empty").style.display="none",document.getElementById(e+"_verification_id_temp").value="no",document.getElementById(e+"_1_label_sectionform_id_temp").style.display="none",document.getElementById(e+"_1_element_sectionform_id_temp").style.display="none")}function create_confirmation_email_label(e,t,i){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_label">Confirmation label</label>'),jQuery('<textarea id="edit_for_label" class="fm-width-100" onKeyUp="change_label(\''+e+"_element_labelform_id_temp', this.value, '"+e+'_1_element_labelform_id_temp\')" rows="4">'+i+"</textarea>"),"confirm_validation_label","yes"==t)}function create_confirmation_email_placeholder(e,t,i){return create_option_container(jQuery('<label class="fm-field-label" for="el_first_value_verification_input">Confirmation placeholder</label>'),jQuery('<input type="text" class="fm-width-100" id="el_first_value_verification_input" onKeyUp="change_input_value(this.value,\''+e+'_1_elementform_id_temp\')" value="'+i.replace(/"/g,"&quot;")+'" />'),"confirm_validation_empty","yes"==t)}function go_to_type_submitter_mail(e){w_attr_name=[],w_attr_value=[],type_submitter_mail(e,"Email","","top","no","","","","no","no","","no","Email confirmation","",w_attr_name,w_attr_value,"no")}function type_submitter_mail(e,t,i,n,a,r,l,d,_,o,s,m,u,c,p,f,h){jQuery("#element_type").val("type_submitter_mail"),delete_last_child();var y=jQuery("#edit_table"),b=jQuery('<div id="edit_div"></div>');y.append(b);var v=jQuery('<div id="edit_main_table"></div>');b.append(v),v.append(create_field_type("type_submitter_mail")),v.append(create_label(e,t)),v.append(create_label_position(e,n)),v.append(create_hide_label(e,a)),v.append(create_required(e,_)),v.append(create_placeholder(e,d)),v.append(create_field_size(e,r,"'"+e+"_elementform_id_temp'","'"+e+"_1_elementform_id_temp'"));var g=jQuery('<div class="inside"></div>');v.append(create_advanced_options_container(g)),g.append(create_confirmation_email(e,m)),g.append(create_confirmation_email_label(e,m,u)),g.append(create_confirmation_email_placeholder(e,m,c)),g.append(create_autofill_user_email(e,h)),g.append(create_unique_values(e,o)),g.append(create_field_label_size(e,i,"'"+e+"_label_sectionform_id_temp'","'"+e+"_1_label_sectionform_id_temp'")),g.append(create_class(e,s)),g.append(create_additional_attributes(e,p,"type_submitter_mail")),element="input",type="text";var w=document.createElement("input");w.setAttribute("type","hidden"),w.setAttribute("value","type_submitter_mail"),w.setAttribute("name",e+"_typeform_id_temp"),w.setAttribute("id",e+"_typeform_id_temp");var E=document.createElement("input");E.setAttribute("type","hidden"),E.setAttribute("value",h),E.setAttribute("name",e+"_autofillform_id_temp"),E.setAttribute("id",e+"_autofillform_id_temp");var A=document.createElement("input");A.setAttribute("type","hidden"),A.setAttribute("value",_),A.setAttribute("name",e+"_requiredform_id_temp"),A.setAttribute("id",e+"_requiredform_id_temp");var x=document.createElement("input");x.setAttribute("type","hidden"),x.setAttribute("value",a),x.setAttribute("name",e+"_hide_labelform_id_temp"),x.setAttribute("id",e+"_hide_labelform_id_temp");var k=document.createElement("input");k.setAttribute("type","hidden"),k.setAttribute("value",o),k.setAttribute("name",e+"_uniqueform_id_temp"),k.setAttribute("id",e+"_uniqueform_id_temp");var j=document.createElement("input");j.setAttribute("type","hidden"),j.setAttribute("value",m),j.setAttribute("name",e+"_verification_id_temp"),j.setAttribute("id",e+"_verification_id_temp");var C=document.createElement(element);C.setAttribute("type",type),C.style.cssText="width:"+r+"px;",C.setAttribute("id",e+"_elementform_id_temp"),C.setAttribute("name",e+"_elementform_id_temp"),C.setAttribute("value",l),C.setAttribute("title",d),C.setAttribute("placeholder",d);var I=document.createElement(element);I.setAttribute("type",type),I.style.cssText="width:"+r+"px;",I.setAttribute("id",e+"_1_elementform_id_temp"),I.setAttribute("name",e+"_1_elementform_id_temp"),I.setAttribute("placeholder",c),I.setAttribute("title",c);var B=document.createElement("div");B.setAttribute("id","main_div");var Q=document.createElement("div");Q.setAttribute("id",e+"_elemet_tableform_id_temp");var T="yes"==a?"none":"table-cell",M=document.createElement("div");M.setAttribute("align","left"),M.style.display=T,M.style.width=i+"px",M.setAttribute("id",e+"_label_sectionform_id_temp");var L="yes"==a||"no"==m?"none":"table-cell",z=document.createElement("div");z.setAttribute("align","left"),z.style.display=L,z.style.width=i+"px",z.setAttribute("id",e+"_1_label_sectionform_id_temp");var q=document.createElement("div");q.setAttribute("align","left"),q.style.display="table-cell",q.setAttribute("id",e+"_element_sectionform_id_temp");var S="no"==m?"none":"table-cell",N=document.createElement("div");N.setAttribute("align","left"),N.style.display=S,N.setAttribute("id",e+"_1_element_sectionform_id_temp");document.createElement("br"),document.createElement("br");var H=document.createElement("br"),D=(document.createElement("br"),document.createElement("br")),O=document.createElement("span");O.setAttribute("id",e+"_element_labelform_id_temp"),O.innerHTML=t,O.setAttribute("class","label"),O.style.verticalAlign="top";var P=document.createElement("span");P.setAttribute("id",e+"_1_element_labelform_id_temp"),P.innerHTML=u,P.setAttribute("class","label"),P.style.verticalAlign="top";var F=document.createElement("span");F.setAttribute("id",e+"_required_elementform_id_temp"),F.innerHTML="",F.setAttribute("class","required"),F.style.verticalAlign="top","yes"==_&&(F.innerHTML=" *");var R=document.createElement("span");R.setAttribute("id",e+"_1_required_elementform_id_temp"),R.innerHTML="",R.setAttribute("class","required"),R.style.verticalAlign="top","yes"==_&&(R.innerHTML=" *");var W=document.getElementById("show_table");M.appendChild(O),M.appendChild(F),z.appendChild(P),z.appendChild(R),q.appendChild(w),q.appendChild(A),q.appendChild(x),q.appendChild(k),q.appendChild(j),q.appendChild(E),q.appendChild(C),N.appendChild(I),Q.appendChild(M),Q.appendChild(q),Q.appendChild(D),Q.appendChild(z),Q.appendChild(N),B.appendChild(Q),B.appendChild(H),W.appendChild(B),jQuery("#main_div").append(form_maker.type_email_description),"top"==n&&label_top(e),change_class(s,e),refresh_attr(e,"type_text")}function go_to_type_phone_new(e){w_attr_name=[],w_attr_value=[],type_phone_new(e,"Phone","","top","no","","","us","no","no","",w_attr_name,w_attr_value)}function type_phone_new(e,t,i,n,a,r,l,d,_,o,s,m,u){jQuery("#element_type").val("type_phone_new"),delete_last_child();var c=jQuery("#edit_table"),p=jQuery('<div id="edit_div"></div>');c.append(p);var f=jQuery('<div id="edit_main_table"></div>');p.append(f),f.append(create_field_type("type_phone_new")),f.append(create_label(e,t)),f.append(create_label_position(e,n)),f.append(create_hide_label(e,a)),f.append(create_required(e,_)),f.append(create_field_size(e,r));var h=jQuery('<div class="inside"></div>');f.append(create_advanced_options_container(h)),h.append(create_unique_values(e,o)),h.append(create_field_label_size(e,i)),h.append(create_class(e,s)),h.append(create_additional_attributes(e,m,"type_phone_new"));var y=document.createElement("br"),b=document.createElement("input");b.setAttribute("type","hidden"),b.setAttribute("value","type_phone_new"),b.setAttribute("name",e+"_typeform_id_temp"),b.setAttribute("id",e+"_typeform_id_temp");var v=document.createElement("input");v.setAttribute("type","hidden"),v.setAttribute("value",_),v.setAttribute("name",e+"_requiredform_id_temp"),v.setAttribute("id",e+"_requiredform_id_temp");var g=document.createElement("input");g.setAttribute("type","hidden"),g.setAttribute("value",a),g.setAttribute("name",e+"_hide_labelform_id_temp"),g.setAttribute("id",e+"_hide_labelform_id_temp");var w=document.createElement("input");w.setAttribute("type","hidden"),w.setAttribute("value",o),w.setAttribute("name",e+"_uniqueform_id_temp"),w.setAttribute("id",e+"_uniqueform_id_temp");var E=document.createElement("div");E.setAttribute("id","main_div");var A=document.createElement("div");A.setAttribute("id",e+"_elemet_tableform_id_temp");var x="yes"==a?"none":"table-cell",k=document.createElement("div");k.setAttribute("align","left"),k.style.display=x,k.style.width=i+"px",k.setAttribute("id",e+"_label_sectionform_id_temp");var j=document.createElement("div");j.setAttribute("align","left"),j.style.display="table-cell",j.setAttribute("id",e+"_element_sectionform_id_temp");var C=document.createElement("div");C.style.display="table",C.setAttribute("id",e+"_table_name");var I=document.createElement("div");I.style.display="table-row",I.setAttribute("id",e+"_tr_name1");var B=document.createElement("div");B.style.display="table-cell",B.setAttribute("id",e+"_td_name_input_first");var Q=document.createElement("span");Q.setAttribute("id",e+"_element_labelform_id_temp"),Q.innerHTML=t,Q.setAttribute("class","label"),Q.style.verticalAlign="top";var T=document.createElement("span");T.setAttribute("id",e+"_required_elementform_id_temp"),T.innerHTML="",T.setAttribute("class","required"),"yes"==_&&(T.innerHTML=" *");var M=document.createElement("input");M.setAttribute("type","text"),M.style.cssText="width:"+r+"px",M.setAttribute("id",e+"_elementform_id_temp"),M.setAttribute("name",e+"_elementform_id_temp"),M.setAttribute("value",l),M.setAttribute("top-country",d);var L=document.getElementById("show_table");k.appendChild(Q),k.appendChild(T),B.appendChild(M),I.appendChild(B),C.appendChild(I),j.appendChild(b),j.appendChild(v),j.appendChild(g),j.appendChild(w),j.appendChild(C),A.appendChild(k),A.appendChild(j),E.appendChild(A),E.appendChild(y),L.appendChild(E),jQuery("#main_div").append(form_maker.type_phone_description),"top"==n&&label_top(e),change_class(s,e),refresh_attr(e,"type_text");var z=jQuery("#"+e+"_elementform_id_temp"),q=window.intlTelInput(z[0],{nationalMode:!1,formatOnDisplay:!0,initialCountry:d,utilsScript:form_maker.plugin_url+"/js/intlTelInput-utils.js"});z[0].addEventListener("close:countrydropdown",function(){var e=q.getSelectedCountryData().iso2;q.setCountry(e),z.attr("top-country",e)})}function create_address_size(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_input_size">Overall width(px)</label>'),jQuery('<input class="fm-width-100" type="text" id="edit_for_input_size" onKeyPress="return check_isnum(event)" onKeyUp="change_w_style(\''+e+'_div_address\', this.value)" value="'+t+'" /><p class="description">'+form_maker.leave_empty+"</p>"))}function create_use_us_states_list(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_us_states">Use list for US states and Canada provinces</label>'),jQuery('<input type="checkbox" id="el_us_states" onclick="disable_fields('+e+",'us_states');\""+("yes"==t[6]?' checked="checked"':"")+" />"))}function disable_fields(i,n){var e=document.getElementById(i+"_div_address");if(n&&(1==document.getElementById("el_"+n).checked?document.getElementById(i+"_disable_fieldsform_id_temp").setAttribute(n,"yes"):document.getElementById(i+"_disable_fieldsform_id_temp").setAttribute(n,"no")),"yes"==document.getElementById(i+"_disable_fieldsform_id_temp").getAttribute("state"))document.getElementById("el_us_states").disabled=!0;else if(document.getElementById("el_us_states").disabled=!1,"us_states"==n)return void change_state_input(i,"form_id_temp");e.innerHTML="";var t=new Array,a=["street1","street2","city","state","postal","country"],r=0;for(l=0;l<6;l++){if("no"==document.getElementById(i+"_disable_fieldsform_id_temp").getAttribute(a[l]))if("street1"==a[l]||"street2"==a[l]){var d=document.createElement("input");d.setAttribute("type","text"),d.style.cssText="width:100%",d.setAttribute("id",i+"_"+a[l]+"form_id_temp"),d.setAttribute("name",parseInt(i)+l+"_"+a[l]+"form_id_temp");var _=document.createElement("label");_.setAttribute("class","mini_label"),_.setAttribute("id",i+"_mini_label_"+a[l]),_.style.cssText="display:block;",_.innerHTML=document.getElementById("el_"+a[l]+"_label").innerHTML,w_mini_labels[l]=document.getElementById("el_"+a[l]+"_label").innerHTML,(s=document.createElement("span")).style.cssText="float:left; width:100%; padding-bottom: 8px; display:block",s.appendChild(d),s.appendChild(_),e.appendChild(s)}else{var o,s;if(r++,"country"!=a[l])(n=document.createElement("input")).setAttribute("type","text"),n.style.cssText="width:100%",n.setAttribute("id",i+"_"+a[l]+"form_id_temp"),n.setAttribute("name",parseInt(i)+l+"_"+a[l]+"form_id_temp"),(o=document.createElement("label")).setAttribute("class","mini_label"),o.setAttribute("id",i+"_mini_label_"+a[l]),o.style.cssText="display:block;",o.innerHTML=document.getElementById("el_"+a[l]+"_label").innerHTML,w_mini_labels[l]=document.getElementById("el_"+a[l]+"_label").innerHTML;else(n=document.createElement("select")).setAttribute("type","text"),n.style.cssText="width:100%",n.setAttribute("id",i+"_countryform_id_temp"),n.setAttribute("name",parseInt(i)+l+"_countryform_id_temp"),n.setAttribute("onChange","change_state_input('"+i+"', 'form_id_temp')"),(o=document.createElement("label")).setAttribute("class","mini_label"),o.setAttribute("id",i+"_mini_label_country"),o.style.cssText="display:block;",o.innerHTML=document.getElementById("el_"+a[l]+"_label").innerHTML,w_mini_labels[l]=document.getElementById("el_"+a[l]+"_label").innerHTML,countries=form_maker.countries,jQuery.each(countries,function(e,t){var i=document.createElement("option");i.setAttribute("value",t),i.innerHTML=t,n.appendChild(i)});if(r%2!=0)(s=document.createElement("span")).style.cssText="float:left; width:48%; padding-bottom: 8px;";else(s=document.createElement("span")).style.cssText="float:right; width:48%; padding-bottom: 8px;";s.appendChild(n),s.appendChild(o),e.appendChild(s)}else{var m=document.createElement("input");m.setAttribute("type","hidden"),m.setAttribute("id",i+"_"+a[l]+"form_id_temp"),m.setAttribute("value",document.getElementById("el_"+a[l]+"_label").innerHTML),m.setAttribute("id_for_label",parseInt(i)+l),t.push(m)}for(k=0;k<t.length;k++)e.appendChild(t[k])}"no"==document.getElementById(i+"_disable_fieldsform_id_temp").getAttribute("state")&&"yes"==document.getElementById(i+"_disable_fieldsform_id_temp").getAttribute("country")&&change_state_input(i,"form_id_temp"),jQuery(function(t){t("label#"+i+"_mini_label_street1").click(function(){if(0==t(this).children("input").length){var e="<input type='text' class='street1' style='outline:none; border:none; background:none;' value=\""+t(this).text()+'">';t(this).html(e),t("input.street1").focus(),t("input.street1").blur(function(){var e=t(this).val();t("#"+i+"_mini_label_street1").text(e),document.getElementById("el_street1_label").innerHTML=e})}}),t("label#"+i+"_mini_label_street2").click(function(){if(0==t(this).children("input").length){var e="<input type='text' class='street2' style='outline:none; border:none; background:none;' value=\""+t(this).text()+'">';t(this).html(e),t("input.street2").focus(),t("input.street2").blur(function(){var e=t(this).val();t("#"+i+"_mini_label_street2").text(e),document.getElementById("el_street2_label").innerHTML=e})}}),t("label#"+i+"_mini_label_city").click(function(){if(0==t(this).children("input").length){var e="<input type='text' class='city' style='outline:none; border:none; background:none;' value=\""+t(this).text()+'">';t(this).html(e),t("input.city").focus(),t("input.city").blur(function(){var e=t(this).val();t("#"+i+"_mini_label_city").text(e),document.getElementById("el_city_label").innerHTML=e})}}),t("label#"+i+"_mini_label_state").click(function(){if(0==t(this).children("input").length){var e="<input type='text' class='state' style='outline:none; border:none; background:none;' value=\""+t(this).text()+'">';t(this).html(e),t("input.state").focus(),t("input.state").blur(function(){var e=t(this).val();t("#"+i+"_mini_label_state").text(e),document.getElementById("el_state_label").innerHTML=e})}}),t("label#"+i+"_mini_label_postal").click(function(){if(0==t(this).children("input").length){var e="<input type='text' class='postal' style='outline:none; border:none; background:none;' value=\""+t(this).text()+'">';t(this).html(e),t("input.postal").focus(),t("input.postal").blur(function(){var e=t(this).val();t("#"+i+"_mini_label_postal").text(e),document.getElementById("el_postal_label").innerHTML=e})}}),t("label#"+i+"_mini_label_country").click(function(){if(0==t(this).children("input").length){var e="<input type='text' class='country' style='outline:none; border:none; background:none;' value=\""+t(this).text()+'">';t(this).html(e),t("input.country").focus(),t("input.country").blur(function(){var e=t(this).val();t("#"+i+"_mini_label_country").text(e),document.getElementById("el_country_label").innerHTML=e})}})}),refresh_attr(i,"type_address")}function change_state_input(e,t){if(document.getElementById(e+"_country"+t)&&document.getElementById(e+"_state"+t)&&!document.getElementById("el_state").checked&&!document.getElementById("el_us_states").disabled){var i=!1,n=document.getElementById(e+"_state"+t);if("United States"==document.getElementById(e+"_country"+t).value&&document.getElementById("el_us_states").checked){var a=document.createElement("select"),r=form_maker.states;for(var l in r){(d=document.createElement("option")).setAttribute("value",l),d.innerHTML=r[l],a.appendChild(d)}i=!0}else if("Canada"==document.getElementById(e+"_country"+t).value&&document.getElementById("el_us_states").checked){a=document.createElement("select"),r=form_maker.provinces;for(var l in r){var d;(d=document.createElement("option")).setAttribute("value",l),d.innerHTML=r[l],a.appendChild(d)}i=!0}else if("SELECT"==document.getElementById(e+"_state"+t).tagName){a=document.createElement("input");i=!0}if(i){a.setAttribute("type","text"),a.style.cssText="width: 100%",a.setAttribute("id",e+"_state"+t),a.setAttribute("name",parseInt(e)+3+"_state"+t);var _=n.parentNode;_.removeChild(n),_.insertBefore(a,_.firstChild)}}}function create_disable_address_fields(e,t,i){var n=jQuery('<label class="fm-field-label">Disable Field(s)</label>'),a=jQuery('<input type="checkbox" id="el_street1" value="no" onclick="disable_fields('+e+",'street1')\""+("yes"==t[0]?' checked="checked"':"")+" />"),r=jQuery('<label for="el_street1" id="el_street1_label">'+i[0]+"</label>"),l=jQuery('<input type="checkbox" id="el_street2" value="no" onclick="disable_fields('+e+",'street2')\""+("yes"==t[1]?' checked="checked"':"")+" />"),d=jQuery('<label for="el_street2" id="el_street2_label">'+i[1]+"</label>"),_=jQuery('<input type="checkbox" id="el_city" value="no" onclick="disable_fields('+e+",'city')\""+("yes"==t[2]?' checked="checked"':"")+" />"),o=jQuery('<label for="el_city" id="el_city_label">'+i[2]+"</label>"),s=jQuery('<input type="checkbox" id="el_state" value="no" onclick="disable_fields('+e+",'state')\""+("yes"==t[3]?' checked="checked"':"")+" />"),m=jQuery('<label for="el_state" id="el_state_label">'+i[3]+"</label>"),u=jQuery('<input type="checkbox" id="el_postal" value="no" onclick="disable_fields('+e+",'postal')\""+("yes"==t[4]?' checked="checked"':"")+" />"),c=jQuery('<label for="el_postal" id="el_postal_label">'+i[4]+"</label>"),p=jQuery('<input type="checkbox" id="el_country" value="no" onclick="disable_fields('+e+",'country')\""+("yes"==t[5]?' checked="checked"':"")+" />"),f=jQuery('<label for="el_country" id="el_country_label">'+i[5]+"</label>"),h=a;return create_option_container(n,h=(h=(h=(h=(h=(h=(h=(h=(h=(h=(h=(h=(h=(h=(h=(h=h.add(r)).add(jQuery("<br />"))).add(l)).add(d)).add(jQuery("<br />"))).add(_)).add(o)).add(jQuery("<br />"))).add(s)).add(m)).add(jQuery("<br />"))).add(u)).add(c)).add(jQuery("<br />"))).add(p)).add(f))}function go_to_type_address(e){w_attr_name=[],w_attr_value=[],w_mini_labels=["Street Address","Street Address Line 2","City","State / Province / Region","Postal / Zip Code","Country"],w_disabled_fields=["no","no","no","no","no","no","yes"],type_address(e,"Address","","top","no","",w_mini_labels,w_disabled_fields,"no","wdform_address",w_attr_name,w_attr_value)}function type_address(i,e,t,n,a,r,l,d,_,o,s,m){jQuery("#element_type").val("type_address"),delete_last_child();var u=jQuery("#edit_table"),c=jQuery('<div id="edit_div"></div>');u.append(c);var p=jQuery('<div id="edit_main_table"></div>');c.append(p),p.append(create_field_type("type_address")),p.append(create_label(i,e)),p.append(create_label_position(i,n)),p.append(create_hide_label(i,a)),p.append(create_required(i,_)),p.append(create_address_size(i,r)),p.append(create_use_us_states_list(i,d));var f=jQuery('<div class="inside"></div>');p.append(create_advanced_options_container(f)),f.append(create_disable_address_fields(i,d,l)),f.append(create_field_label_size(i,t)),f.append(create_class(i,o)),f.append(create_additional_attributes(i,s,"type_address"));var h=document.createElement("input");h.setAttribute("type","hidden"),h.setAttribute("value","type_address"),h.setAttribute("name",i+"_typeform_id_temp"),h.setAttribute("id",i+"_typeform_id_temp");var y=document.createElement("input");y.setAttribute("type","hidden"),y.setAttribute("name",i+"_disable_fieldsform_id_temp"),y.setAttribute("id",i+"_disable_fieldsform_id_temp"),y.setAttribute("street1",d[0]),y.setAttribute("street2",d[1]),y.setAttribute("city",d[2]),y.setAttribute("state",d[3]),y.setAttribute("us_states",d[6]),y.setAttribute("postal",d[4]),y.setAttribute("country",d[5]);var b=document.createElement("input");b.setAttribute("type","hidden"),b.setAttribute("value",_),b.setAttribute("name",i+"_requiredform_id_temp"),b.setAttribute("id",i+"_requiredform_id_temp");var v=document.createElement("input");v.setAttribute("type","hidden"),v.setAttribute("value",a),v.setAttribute("name",i+"_hide_labelform_id_temp"),v.setAttribute("id",i+"_hide_labelform_id_temp");var g=document.createElement("div");g.setAttribute("id","main_div");var w=document.createTextNode("The labels of the fields are editable. Please, click on the label to edit."),E=document.createElement("div");E.setAttribute("style","margin-left:4px; color:red; display:inline-block;"),E.appendChild(w);var A=document.createElement("div");A.setAttribute("id",i+"_elemet_tableform_id_temp");var x="yes"==a?"none":"table-cell",k=document.createElement("div");k.setAttribute("align","left"),k.style.display=x,k.style.width=t+"px",k.style.verticalAlign="top",k.setAttribute("id",i+"_label_sectionform_id_temp");var j=document.createElement("div");j.setAttribute("align","left"),j.style.display="table-cell",j.setAttribute("id",i+"_element_sectionform_id_temp");var C=document.createElement("div");C.setAttribute("id",i+"_div_address"),C.style.cssText="width:"+r+"px";var I=document.createElement("span");I.style.cssText="float:left; width:100%; padding-bottom: 8px; display:block";var B=document.createElement("span");B.style.cssText="float:left; width:100%; padding-bottom: 8px; display:block";var Q=document.createElement("span");Q.style.cssText="float:left; width:48%; padding-bottom: 8px;";var T=document.createElement("span");T.style.cssText="float:right; width:48%; padding-bottom: 8px;";var M=document.createElement("span");M.style.cssText="float:left; width:48%; padding-bottom: 8px;";var L=document.createElement("span");L.style.cssText="float:right; width:48%; padding-bottom: 8px;";var z=document.createElement("br"),q=document.createElement("span");q.setAttribute("id",i+"_element_labelform_id_temp"),q.innerHTML=e,q.setAttribute("class","wd_form_label"),q.style.verticalAlign="top";var S=document.createElement("span");S.setAttribute("id",i+"_required_elementform_id_temp"),S.innerHTML="",S.setAttribute("class","required"),S.style.verticalAlign="top","yes"==_&&(S.innerHTML=" *");var N=document.createElement("input");N.setAttribute("type","text"),N.style.cssText="width:100%",N.setAttribute("id",i+"_street1form_id_temp"),N.setAttribute("name",i+"_street1form_id_temp");var H=document.createElement("label");H.setAttribute("class","mini_label"),H.setAttribute("id",i+"_mini_label_street1"),H.style.cssText="display:block;",H.innerHTML=l[0];var D=document.createElement("input");D.setAttribute("type","text"),D.style.cssText="width:100%",D.setAttribute("id",i+"_street2form_id_temp"),D.setAttribute("name",parseInt(i)+1+"_street2form_id_temp");var O=document.createElement("label");O.setAttribute("class","mini_label"),O.setAttribute("id",i+"_mini_label_street2"),O.style.cssText="display:block;",O.innerHTML=l[1];var P=document.createElement("input");P.setAttribute("type","text"),P.style.cssText="width:100%",P.setAttribute("id",i+"_cityform_id_temp"),P.setAttribute("name",parseInt(i)+2+"_cityform_id_temp");var F=document.createElement("label");F.setAttribute("class","mini_label"),F.setAttribute("id",i+"_mini_label_city"),F.style.cssText="display:block;",F.innerHTML=l[2];var R=document.createElement("input");R.setAttribute("type","text"),R.style.cssText="width:100%",R.setAttribute("id",i+"_stateform_id_temp"),R.setAttribute("name",parseInt(i)+3+"_stateform_id_temp");var W=document.createElement("label");W.setAttribute("class","mini_label"),W.setAttribute("id",i+"_mini_label_state"),W.style.cssText="display:block;",W.innerHTML=l[3];var K=document.createElement("input");K.setAttribute("type","text"),K.style.cssText="width:100%",K.setAttribute("id",i+"_postalform_id_temp"),K.setAttribute("name",parseInt(i)+4+"_postalform_id_temp");var U=document.createElement("label");U.setAttribute("class","mini_label"),U.setAttribute("id",i+"_mini_label_postal"),U.style.cssText="display:block;",U.innerHTML=l[4];var V=document.createElement("select");V.setAttribute("type","text"),V.style.cssText="width:100%",V.setAttribute("id",i+"_countryform_id_temp"),V.setAttribute("name",parseInt(i)+5+"_countryform_id_temp"),V.setAttribute("onChange","change_state_input('"+i+"','form_id_temp')");var $=document.createElement("label");$.setAttribute("class","mini_label"),$.setAttribute("id",i+"_mini_label_country"),$.style.cssText="display:block;",$.innerHTML=l[5],countries=form_maker.countries,jQuery.each(countries,function(e,t){var i=document.createElement("option");i.setAttribute("value",t),i.innerHTML=t,V.appendChild(i)});var G=document.getElementById("show_table");k.appendChild(q),k.appendChild(S),I.appendChild(N),I.appendChild(H),B.appendChild(D),B.appendChild(O),Q.appendChild(P),Q.appendChild(F),T.appendChild(R),T.appendChild(W),M.appendChild(K),M.appendChild(U),L.appendChild(V),L.appendChild($),C.appendChild(I),C.appendChild(B),C.appendChild(Q),C.appendChild(T),C.appendChild(M),C.appendChild(L),j.appendChild(h),j.appendChild(b),j.appendChild(v),j.appendChild(y),j.appendChild(C),A.appendChild(k),A.appendChild(j),g.appendChild(A),g.appendChild(z),g.appendChild(E),G.appendChild(g),jQuery("#main_div").append("<br><br>"+form_maker.type_address_description),"top"==n&&label_top(i),change_class(o,i),refresh_attr(i,"type_address"),"yes"==d[0]&&disable_fields(i,"street1"),"yes"==d[1]&&disable_fields(i,"street2"),"yes"==d[2]&&disable_fields(i,"city"),"yes"==d[3]&&disable_fields(i,"state"),"yes"==d[4]&&disable_fields(i,"postal"),"yes"==d[5]&&disable_fields(i,"country"),"yes"==d[6]&&disable_fields(i,"us_states"),jQuery(function(t){t("label#"+i+"_mini_label_street1").click(function(){if(0==t(this).children("input").length){var e="<input type='text' class='street1' style='outline:none; border:none; background:none; width:130px;' value=\""+t(this).text()+'">';t(this).html(e),t("input.street1").focus(),t("input.street1").blur(function(){var e=t(this).val();e=e.replaceAll('"',"'"),t("#"+i+"_mini_label_street1").text(e),document.getElementById("el_street1_label").innerHTML=e})}}),t("label#"+i+"_mini_label_street2").click(function(){if(0==t(this).children("input").length){var e="<input type='text' class='street2' style='outline:none; border:none; background:none; width:130px;' value=\""+t(this).text()+'">';t(this).html(e),t("input.street2").focus(),t("input.street2").blur(function(){var e=t(this).val();e=e.replaceAll('"',"'"),t("#"+i+"_mini_label_street2").text(e),document.getElementById("el_street2_label").innerHTML=e})}}),t("label#"+i+"_mini_label_city").click(function(){if(0==t(this).children("input").length){var e="<input type='text' class='city' style='outline:none; border:none; background:none; width:130px;' value=\""+t(this).text()+'">';t(this).html(e),t("input.city").focus(),t("input.city").blur(function(){var e=t(this).val();e=e.replaceAll('"',"'"),t("#"+i+"_mini_label_city").text(e),document.getElementById("el_city_label").innerHTML=e})}}),t("label#"+i+"_mini_label_state").click(function(){if(0==t(this).children("input").length){var e="<input type='text' class='state' style='outline:none; border:none; background:none; width:130px;' value=\""+t(this).text()+'">';t(this).html(e),t("input.state").focus(),t("input.state").blur(function(){var e=t(this).val();e=e.replaceAll('"',"'"),t("#"+i+"_mini_label_state").text(e),document.getElementById("el_state_label").innerHTML=e})}}),t("label#"+i+"_mini_label_postal").click(function(){if(0==t(this).children("input").length){var e="<input type='text' class='postal' style='outline:none; border:none; background:none; width:130px;' value=\""+t(this).text()+'">';t(this).html(e),t("input.postal").focus(),t("input.postal").blur(function(){var e=t(this).val();e=e.replaceAll('"',"'"),t("#"+i+"_mini_label_postal").text(e),document.getElementById("el_postal_label").innerHTML=e})}}),t("label#"+i+"_mini_label_country").click(function(){if(0==t(this).children("input").length){var e="<input type='text' class='country' style='outline:none; border:none; background:none; width:130px;' value=\""+t(this).text()+'">';t(this).html(e),t("input.country").focus(),t("input.country").blur(function(){var e=t(this).val();e=e.replaceAll('"',"'"),t("#"+i+"_mini_label_country").text(e),document.getElementById("el_country_label").innerHTML=e})}})})}function create_markmap_address(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="addrval'+t+'">Address</label>'),jQuery('<input type="text" class="fm-width-100" id="addrval'+t+'" onChange="changeAddress('+e+", "+t+')" value="" />'))}function create_markmap_longitude(e,t,i){return create_option_container(jQuery('<label class="fm-field-label" for="longval'+i+'">Longitude</label>'),jQuery('<input type="text" class="fm-width-100" id="longval'+i+'" onkeyup="update_position('+e+", "+i+')" value="'+t+'" />'))}function create_markmap_latitude(e,t,i){return create_option_container(jQuery('<label class="fm-field-label" for="latval'+i+'">Latitude</label>'),jQuery('<input type="text" class="fm-width-100" id="latval'+i+'" onkeyup="update_position('+e+", "+i+')" value="'+t+'" />'))}function create_markmap_size(e,t,i){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_input_size">Size(px)</label>'),jQuery('<input type="text" class="fm-width-40" id="edit_for_input_size" onKeyPress="return check_isnum(event)" onKeyUp="change_w_style(\''+e+'_elementform_id_temp\', this.value)" value="'+t+'" />x<input type="text" class="fm-width-40" id="edit_for_input_size" onKeyPress="return check_isnum(event)" onKeyUp="change_h_style(\''+e+'_elementform_id_temp\', this.value)" value="'+i+'" /><p class="description">'+form_maker.leave_empty+"</p>"))}function create_markmap_info(e,t,i){return create_option_container(jQuery('<label class="fm-field-label" for="info'+i+'">Marker Info</label>'),jQuery('<textarea class="fm-width-100" id="info'+i+'" rows="3" onKeyUp="change_info(this.value,'+e+", "+i+')">'+t+"</textarea>"))}function go_to_type_mark_map(e){w_attr_name=[],w_attr_value=[],type_mark_map(e,"Mark your place on map","","top","no","2.294254","48.858334","2.294254","48.858334","13","370","300","wdform_map","",w_attr_name,w_attr_value)}function type_mark_map(e,t,i,n,a,r,l,d,_,o,s,m,u,c,p,f){jQuery("#element_type").val("type_mark_map"),delete_last_child();var h=jQuery("#edit_table"),y=jQuery('<div id="edit_div"></div>');h.append(y);var b=jQuery('<div id="edit_main_table"></div>');y.append(b),b.append(create_field_type("type_mark_map")),b.append(create_label(e,t)),b.append(create_label_position(e,n)),b.append(create_hide_label(e,a)),b.append(jQuery('<div class="notice notice-info"><p>Drag the marker to change default marker position.</p></div>')),b.append(create_markmap_address(e,0)),b.append(create_markmap_longitude(e,d,0)),b.append(create_markmap_latitude(e,_,0)),b.append(create_markmap_info(e,c,0)),b.append(create_markmap_size(e,s,m)),b.append(create_keys(e,"To set up map key click here"));var v=jQuery('<div class="inside"></div>');b.append(create_advanced_options_container(v)),v.append(create_field_label_size(e,i)),v.append(create_class(e,u)),v.append(create_additional_attributes(e,p,"type_mark_map")),element="div";var g=document.createElement("br"),w=document.createElement("input");w.setAttribute("type","hidden"),w.setAttribute("value","type_mark_map"),w.setAttribute("name",e+"_typeform_id_temp"),w.setAttribute("id",e+"_typeform_id_temp");var E=document.createElement("div");E.setAttribute("id",e+"_elementform_id_temp"),E.setAttribute("long0",d),E.setAttribute("lat0",_),E.setAttribute("zoom",o),E.style.cssText="width:"+s+"px; height: "+m+"px",E.setAttribute("info0",c),E.setAttribute("center_x",r),E.setAttribute("center_y",l);var A=document.createElement("input");A.setAttribute("type","hidden"),A.setAttribute("value",a),A.setAttribute("name",e+"_hide_labelform_id_temp"),A.setAttribute("id",e+"_hide_labelform_id_temp");var x=document.createElement("span");x.setAttribute("id",e+"_element_labelform_id_temp"),x.innerHTML=t,x.setAttribute("class","wd_form_label"),x.style.verticalAlign="top";var k=document.createElement("div");k.setAttribute("id","main_div");var j=document.createElement("div");j.setAttribute("id",e+"_elemet_tableform_id_temp");var C="yes"==a?"none":"table-cell",I=document.createElement("div");I.setAttribute("align","left"),I.style.display=C,I.style.width=i+"px",I.style.verticalAlign="top",I.setAttribute("id",e+"_label_sectionform_id_temp");var B=document.createElement("div");B.setAttribute("align","left"),B.style.display="table-cell",B.setAttribute("id",e+"_element_sectionform_id_temp");var Q=document.getElementById("show_table");I.appendChild(x),B.appendChild(w),B.appendChild(E),B.appendChild(A),j.appendChild(I),j.appendChild(B),k.appendChild(j),k.appendChild(g),Q.appendChild(k),jQuery("#main_div").append(form_maker.type_mark_on_map_description),"top"==n&&label_top(e),change_class(u,e),refresh_attr(e,"type_text"),if_gmap_init(e),add_marker_on_map(e,0,d,_,c,!0)}function create_edit_country_list(e){jQuery('<label class="fm-field-label">Edit country list</label>');return create_option_container(null,jQuery("<a href=\"\" onclick=\"tb_show('', 'admin-ajax.php?action=FormMakerEditCountryinPopup&nonce="+fm_ajax.ajaxnonce+"&field_id="+e+'&width=530&height=370&TB_iframe=1\'); return false;" class="thickbox-preview fm-field-recaptcha-label">Edit country list</a>'))}function go_to_type_country(e){w_countries=form_maker.countries,w_attr_name=[],w_attr_value=[],type_country(e,"Country","","no",w_countries,"top","","no","wdform_select",w_attr_name,w_attr_value)}function type_country(e,t,i,n,a,r,l,d,_,o,s){jQuery("#element_type").val("type_country"),delete_last_child();var m=jQuery("#edit_table"),u=jQuery('<div id="edit_div"></div>');m.append(u);var c=jQuery('<div id="edit_main_table"></div>');u.append(c),c.append(create_field_type("type_country")),c.append(create_label(e,t)),c.append(create_label_position(e,r)),c.append(create_hide_label(e,n)),c.append(create_required(e,d)),c.append(create_field_size(e,l));var p=jQuery('<div class="inside"></div>');c.append(create_advanced_options_container(p)),p.append(create_edit_country_list(e)),p.append(create_field_label_size(e,i)),p.append(create_class(e,_)),p.append(create_additional_attributes(e,o,"type_country"));document.createElement("br");var f=document.createElement("input");f.setAttribute("type","hidden"),f.setAttribute("value","type_country"),f.setAttribute("name",e+"_typeform_id_temp"),f.setAttribute("id",e+"_typeform_id_temp");var h=document.createElement("input");h.setAttribute("type","hidden"),h.setAttribute("value",d),h.setAttribute("name",e+"_requiredform_id_temp"),h.setAttribute("id",e+"_requiredform_id_temp");var y=document.createElement("input");y.setAttribute("type","hidden"),y.setAttribute("value",n),y.setAttribute("name",e+"_hide_labelform_id_temp"),y.setAttribute("id",e+"_hide_labelform_id_temp");var b=document.createElement("div");b.setAttribute("id","main_div");var v=document.createElement("div");v.setAttribute("id",e+"_elemet_tableform_id_temp");var g="yes"==n?"none":"table-cell",w=document.createElement("div");w.setAttribute("align","left"),w.style.display=g,w.style.width=i+"px",w.setAttribute("id",e+"_label_sectionform_id_temp");var E=document.createElement("div");E.setAttribute("align","left"),E.style.display="table-cell",E.style.width=i+"px",E.setAttribute("id",e+"_element_sectionform_id_temp");document.createElement("br"),document.createElement("br");var A=document.createElement("br"),x=(document.createElement("br"),document.createElement("div"));x.setAttribute("id",e+"_table_little"),x.style.display="table";var k=document.createElement("div");k.setAttribute("id",e+"_element_tr1"),k.style.display="table-row";var j=document.createElement("div");j.setAttribute("id",e+"_element_tr2"),j.style.display="table-row";var C=document.createElement("div");C.setAttribute("valign","top"),C.setAttribute("id",e+"_td_little1"),C.style.display="table-cell";var I=document.createElement("div");I.setAttribute("valign","top"),I.setAttribute("id",e+"_td_little2"),I.style.display="table-cell";var B=document.createElement("span");B.setAttribute("id",e+"_element_labelform_id_temp"),B.innerHTML=t,B.setAttribute("class","label"),B.style.verticalAlign="top";var Q=document.createElement("span");Q.setAttribute("id",e+"_required_elementform_id_temp"),Q.innerHTML="",Q.setAttribute("class","required"),Q.style.verticalAlign="top","yes"==d&&(Q.innerHTML=" *");var T=document.createElement("select");T.setAttribute("id",e+"_elementform_id_temp"),T.setAttribute("name",e+"_elementform_id_temp"),T.style.cssText="width:"+l+"px",jQuery.each(a,function(e,t){var i=document.createElement("option");i.setAttribute("value",t),i.innerHTML=t,T.appendChild(i)});var M=document.getElementById("show_table");w.appendChild(B),w.appendChild(Q),E.appendChild(y),E.appendChild(f),E.appendChild(h),E.appendChild(T),v.appendChild(w),v.appendChild(E),b.appendChild(v),b.appendChild(A),M.appendChild(b),jQuery("#main_div").append(form_maker.type_country_list_description),"top"==r&&label_top(e),change_class(_,e),refresh_attr(e,"type_text")}function create_datefields_separator(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_fields_divider">Fields separator</label>'),jQuery('<input type="text" class="fm-width-100" id="edit_for_fields_divider" onKeyUp="set_divider('+e+', this.value)" value="'+t+'" />'))}function create_datefield_day_type(e,t){var i=jQuery('<label class="fm-field-label">Day field type</label>'),n=jQuery('<input type="radio" id="el_day_field_type_text" name="edit_for_day_field_type" onchange="field_to_text('+e+", 'day')\""+("SELECT"==t?"":' checked="checked"')+" />"),a=jQuery('<label for="el_day_field_type_text">Input</label>'),r=jQuery('<input type="radio" id="el_day_field_type_select" name="edit_for_day_field_type" onchange="field_to_select('+e+", 'day')\""+("SELECT"==t?' checked="checked"':"")+" />"),l=jQuery('<label for="el_day_field_type_select">Select</label>'),d=n;return create_option_container(i,d=(d=(d=d.add(a)).add(r)).add(l))}function create_datefields_day_size(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_day_size">Day field width(px)</label>'),jQuery('<input type="text" class="fm-width-100" id="edit_for_day_size" onKeyPress="return check_isnum(event)" onKeyUp="change_w_style(\''+e+'_dayform_id_temp\', this.value)" value="'+t+'" />'))}function create_datefield_month_type(e,t){var i=jQuery('<label class="fm-field-label">Month field type</label>'),n=jQuery('<input type="radio" id="el_month_field_type_text" name="edit_for_month_field_type" onchange="field_to_text('+e+", 'month')\""+("SELECT"==t?"":' checked="checked"')+" />"),a=jQuery('<label for="el_month_field_type_text">Input</label>'),r=jQuery('<input type="radio" id="el_month_field_type_select" name="edit_for_month_field_type" onchange="field_to_select('+e+", 'month')\""+("SELECT"==t?' checked="checked"':"")+" />"),l=jQuery('<label for="el_month_field_type_select">Select</label>'),d=n;return create_option_container(i,d=(d=(d=d.add(a)).add(r)).add(l))}function create_datefields_month_size(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_month_size">Month field width(px)</label>'),jQuery('<input type="text" class="fm-width-100" id="edit_for_month_size" onKeyPress="return check_isnum(event)" onKeyUp="change_w_style(\''+e+'_monthform_id_temp\', this.value)" value="'+t+'" />'))}function create_datefield_year_type(e,t){var i=jQuery('<label class="fm-field-label">Year field type</label>'),n=jQuery('<input type="radio" id="el_year_field_type_text" name="edit_for_year_field_type" onchange="field_to_text('+e+", 'year')\""+("SELECT"==t?"":' checked="checked"')+" />"),a=jQuery('<label for="el_year_field_type_text">Input</label>'),r=jQuery('<input type="radio" id="el_year_field_type_select" name="edit_for_year_field_type" onchange="field_to_select('+e+", 'year')\""+("SELECT"==t?' checked="checked"':"")+" />"),l=jQuery('<label for="el_year_field_type_select">Select</label>'),d=n;return create_option_container(i,d=(d=(d=d.add(a)).add(r)).add(l))}function create_datefields_year_size(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_year_size">Year field width(px)</label>'),jQuery('<input type="text" class="fm-width-100" id="edit_for_year_size" onKeyPress="return check_isnum(event)" onKeyUp="change_w_style(\''+e+'_yearform_id_temp\', this.value)" value="'+t+'" />'))}function create_datefields_year_interval(e,t,i){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_year_interval_from">Year interval</label>'),jQuery('<input type="text" class="fm-width-40" id="edit_for_year_interval_from" onKeyPress="return check_isnum(event)" onFocusOut="year_interval('+e+')" value="'+t+'" />-<input type="text" class="fm-width-40" id="edit_for_year_interval_to" onKeyPress="return check_isnum(event)" onFocusOut="year_interval('+e+')" value="'+i+'" />'))}function create_datefields_min_birthdate(e,t,i,n){new Date;return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_min_day">Min value of date</label>'),jQuery('<input type="number" class="fm-width-30 hide_number_arrow" id="edit_for_min_day" placeholder="Day" min="0" max="31" oninput="validity.valid||(value=\'\')"; onKeyPress="return check_isnum(event)" onKeyUp="min_date_field_birthdate('+e+')" value="'+t+'" /> - <input type="number" class="fm-width-30 hide_number_arrow" id="edit_for_min_month" placeholder="Month" min="0" max="12" oninput="validity.valid||(value=\'\')"; onKeyPress="return check_isnum(event)" onKeyUp="min_date_field_birthdate('+e+')" value="'+i+'" /> - <input type="number" class="fm-width-20 hide_number_arrow" id="edit_for_min_year" placeholder="Year" min="1" oninput="validity.valid||(value=\'\')"; onKeyPress="return check_isnum(event)" onKeyUp="min_date_field_birthdate('+e+')" value="'+n+'" />'))}function create_datefields_min_alert(e,t,i){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_min_dob_alert">Alert for Min value of date</label>'),jQuery('<input type="text" class="fm-width-100" id="edit_for_min_dob_alert" onChange="refresh_datefields_min_alert('+e+",'"+i+'\')" value="'+t.replace(/"/g,"&quot;")+'" />'))}function field_to_select(e,t){switch(t){case"day":w_width=""!=document.getElementById("edit_for_day_size").value?document.getElementById("edit_for_day_size").value:30,w_day=document.getElementById(e+"_dayform_id_temp").value,document.getElementById(e+"_td_date_input1").innerHTML="";var i=document.createElement("select");for(i.setAttribute("id",e+"_dayform_id_temp"),i.setAttribute("name",e+"_dayform_id_temp"),i.setAttribute("onChange","set_select(this)"),i.style.width=w_width+"px",(d=document.createElement("option")).setAttribute("value",""),d.innerHTML="",i.appendChild(d),k=1;k<=31;k++){k<10&&(k="0"+k),(d=document.createElement("option")).setAttribute("value",k),d.innerHTML=k,k==w_day&&d.setAttribute("selected","selected"),i.appendChild(d)}document.getElementById(e+"_td_date_input1").appendChild(i);break;case"month":w_width=""!=document.getElementById("edit_for_month_size").value?document.getElementById("edit_for_month_size").value:60,w_month=document.getElementById(e+"_monthform_id_temp").value,document.getElementById(e+"_td_date_input2").innerHTML="";var n=document.createElement("select");n.setAttribute("id",e+"_monthform_id_temp"),n.setAttribute("name",e+"_monthform_id_temp"),n.setAttribute("onChange","set_select(this)"),n.style.width=w_width+"px",(d=document.createElement("option")).setAttribute("value",""),d.innerHTML="",n.appendChild(d);var a=new Array("\x3c!--repstart--\x3eJanuary\x3c!--repend--\x3e","\x3c!--repstart--\x3eFebruary\x3c!--repend--\x3e","\x3c!--repstart--\x3eMarch\x3c!--repend--\x3e","\x3c!--repstart--\x3eApril\x3c!--repend--\x3e","\x3c!--repstart--\x3eMay\x3c!--repend--\x3e","\x3c!--repstart--\x3eJune\x3c!--repend--\x3e","\x3c!--repstart--\x3eJuly\x3c!--repend--\x3e","\x3c!--repstart--\x3eAugust\x3c!--repend--\x3e","\x3c!--repstart--\x3eSeptember\x3c!--repend--\x3e","\x3c!--repstart--\x3eOctober\x3c!--repend--\x3e","\x3c!--repstart--\x3eNovember\x3c!--repend--\x3e","\x3c!--repstart--\x3eDecember\x3c!--repend--\x3e");for(k=1;k<=12;k++){k<10&&(k="0"+k),(d=document.createElement("option")).setAttribute("value",k),d.innerHTML=a[k-1],k==w_month&&d.setAttribute("selected","selected"),n.appendChild(d)}document.getElementById(e+"_td_date_input2").appendChild(n);break;case"year":w_width=""!=document.getElementById("edit_for_year_size").value?document.getElementById("edit_for_year_size").value:60,w_year=document.getElementById(e+"_yearform_id_temp").value,document.getElementById(e+"_td_date_input3").innerHTML="";var r=document.createElement("select");r.setAttribute("id",e+"_yearform_id_temp"),r.setAttribute("name",e+"_yearform_id_temp"),r.setAttribute("onChange","set_select(this)"),r.style.width=w_width+"px",(d=document.createElement("option")).setAttribute("value",""),d.innerHTML="",r.appendChild(d);var l=new Date;for(from=parseInt(document.getElementById("edit_for_year_interval_from").value),to=""!=document.getElementById("edit_for_year_interval_to").value?parseInt(document.getElementById("edit_for_year_interval_to").value):l.getFullYear(),k=to;k>=from;k--){var d;(d=document.createElement("option")).setAttribute("value",k),d.innerHTML=k,k==w_year&&d.setAttribute("selected","selected"),r.appendChild(d)}r.value=w_year,r.setAttribute("from",from),r.setAttribute("to",to),document.getElementById(e+"_td_date_input3").appendChild(r)}refresh_attr(e,"type_date_fields")}function field_to_text(e,t){switch(t){case"day":w_width=""!=document.getElementById("edit_for_day_size").value?document.getElementById("edit_for_day_size").value:30,w_day=document.getElementById(e+"_dayform_id_temp").value,document.getElementById(e+"_td_date_input1").innerHTML="";var i=document.createElement("input");i.setAttribute("type","text"),i.setAttribute("value",w_day),i.setAttribute("id",e+"_dayform_id_temp"),i.setAttribute("name",e+"_dayform_id_temp"),i.setAttribute("onBlur","if (this.value=='0') this.value=''; else add_0('"+e+"_dayform_id_temp')"),i.style.width=w_width+"px",document.getElementById(e+"_td_date_input1").appendChild(i);break;case"month":w_width=""!=document.getElementById("edit_for_month_size").value?document.getElementById("edit_for_month_size").value:60,w_month=document.getElementById(e+"_monthform_id_temp").value,document.getElementById(e+"_td_date_input2").innerHTML="";var n=document.createElement("input");n.setAttribute("type","text"),n.setAttribute("value",w_month),n.setAttribute("id",e+"_monthform_id_temp"),n.setAttribute("name",e+"_monthform_id_temp"),n.style.width=w_width+"px",n.setAttribute("onBlur","if (this.value=='0') this.value=''; else add_0('"+e+"_monthform_id_temp')"),document.getElementById(e+"_td_date_input2").appendChild(n);break;case"year":w_width=""!=document.getElementById("edit_for_year_size").value?document.getElementById("edit_for_year_size").value:60,w_year=document.getElementById(e+"_yearform_id_temp").value,document.getElementById(e+"_td_date_input3").innerHTML="";var a=new Date;from=parseInt(document.getElementById("edit_for_year_interval_from").value),to=""!=document.getElementById("edit_for_year_interval_to").value?parseInt(document.getElementById("edit_for_year_interval_to").value):a.getFullYear(),(parseInt(w_year)<from||parseInt(w_year)>to)&&(w_year="");var r=document.createElement("input");r.setAttribute("type","text"),r.setAttribute("value",w_year),r.setAttribute("id",e+"_yearform_id_temp"),r.setAttribute("name",e+"_yearform_id_temp"),r.style.width=w_width+"px",r.setAttribute("from",from),r.setAttribute("to",to),document.getElementById(e+"_td_date_input3").appendChild(r)}refresh_attr(e,"type_date_fields")}function set_divider(e,t){document.getElementById(e+"_separator1").innerHTML=t,document.getElementById(e+"_separator2").innerHTML=t}function year_interval(e){var t=new Date;from=parseInt(document.getElementById("edit_for_year_interval_from").value),to=""!=document.getElementById("edit_for_year_interval_to").value?parseInt(document.getElementById("edit_for_year_interval_to").value):t.getFullYear(),to-from<0?(alert("Invalid interval of years."),document.getElementById("edit_for_year_interval_from").value=to):"SELECT"==document.getElementById(e+"_yearform_id_temp").tagName?field_to_select(e,"year"):field_to_text(e,"year")}function min_date_field_birthdate(e){document.getElementById("edit_for_min_day").value||(document.getElementById("edit_for_min_day").value=""),document.getElementById("edit_for_min_month").value||(document.getElementById("edit_for_min_month").value=""),document.getElementById("edit_for_min_year").value||(document.getElementById("edit_for_min_year").value=""),document.getElementById(e+"_min_day_id_temp").value=document.getElementById("edit_for_min_day").value,document.getElementById(e+"_min_month_id_temp").value=document.getElementById("edit_for_min_month").value,document.getElementById(e+"_min_year_id_temp").value=document.getElementById("edit_for_min_year").value,refresh_attr(e,"type_date_fields")}function refresh_datefields_min_alert(e,t){document.getElementById("edit_for_min_dob_alert").value||(document.getElementById("edit_for_min_dob_alert").value="Date of birth does not meet specified requirements."),document.getElementById(e+"_min_dob_alert_id_temp").value=document.getElementById("edit_for_min_dob_alert").value,refresh_attr(e,"type_"+t)}function go_to_type_date_fields(e){w_attr_name=[],w_attr_value=[];var t=new Date;w_to=t.getFullYear(),type_date_fields(e,"Date of Birth","","top","no","","","","SELECT","SELECT","SELECT","day","month","year","60","100","80","no","wdform_date_fields","1901",w_to,"","","","Date of birth does not meet specified requirements.","&nbsp;/&nbsp;",w_attr_name,w_attr_value)}function type_date_fields(i,e,t,n,a,r,l,d,_,o,s,m,u,c,p,f,h,y,b,v,g,w,E,A,x,k,j,C){current_date=new Date,jQuery("#element_type").val("type_date_fields"),delete_last_child();var I=jQuery("#edit_table"),B=jQuery('<div id="edit_div"></div>');I.append(B);var Q=jQuery('<div id="edit_main_table"></div>');B.append(Q),Q.append(create_field_type("type_date_fields")),Q.append(create_label(i,e)),Q.append(create_label_position(i,n)),Q.append(create_hide_label(i,a)),Q.append(create_required(i,y));var T=jQuery('<div class="inside"></div>');Q.append(create_advanced_options_container(T)),T.append(create_datefields_separator(i,k)),T.append(create_datefield_day_type(i,_)),T.append(create_datefields_day_size(i,p)),T.append(create_datefield_month_type(i,o)),T.append(create_datefields_month_size(i,f)),T.append(create_datefield_year_type(i,s)),T.append(create_datefields_year_size(i,h)),T.append(create_datefields_year_interval(i,v,g)),T.append(create_datefields_min_birthdate(i,w,E,A)),T.append(create_datefields_min_alert(i,x,"type_date_fields")),T.append(jQuery('<div class="notice notice-info"><p>Leave the second field empty and the current year will be used automatically. For a specific year (other than current) fill out both the start and finish points of the range.</p></div>')),T.append(create_field_label_size(i,t)),T.append(create_class(i,b)),T.append(create_additional_attributes(i,j,"type_date_fields"));var M=document.createElement("br"),L=document.createElement("input");L.setAttribute("type","hidden"),L.setAttribute("value","type_date_fields"),L.setAttribute("name",i+"_typeform_id_temp"),L.setAttribute("id",i+"_typeform_id_temp");var z=document.createElement("input");z.setAttribute("type","hidden"),z.setAttribute("value",y),z.setAttribute("name",i+"_requiredform_id_temp"),z.setAttribute("id",i+"_requiredform_id_temp");var q=document.createElement("input");q.setAttribute("type","hidden"),q.setAttribute("value",a),q.setAttribute("name",i+"_hide_labelform_id_temp"),q.setAttribute("id",i+"_hide_labelform_id_temp");var S=document.createTextNode("The labels of the fields are editable. Please, click on the label to edit."),N=document.createElement("div");N.setAttribute("id","main_div");var H=document.createElement("div");H.setAttribute("style","margin-left:4px; color:red;"),H.appendChild(S);var D=document.createElement("div");D.setAttribute("id",i+"_elemet_tableform_id_temp");var O="yes"==a?"none":"table-cell",P=document.createElement("div");P.setAttribute("align","left"),P.style.cssText="display:"+O+"; vertical-align:top; width:"+t+"px",P.setAttribute("id",i+"_label_sectionform_id_temp");var F=document.createElement("div");F.setAttribute("align","left"),F.style.display="table-cell",F.setAttribute("id",i+"_element_sectionform_id_temp");var R=document.createElement("div");R.setAttribute("id",i+"_table_date"),R.style.display="table";var W=document.createElement("div");W.setAttribute("id",i+"_tr_date1"),W.style.display="table-row";var K=document.createElement("div");K.setAttribute("id",i+"_tr_date2"),K.style.display="table-row";var U=document.createElement("div");U.setAttribute("id",i+"_td_date_input1"),U.style.display="table-cell";var V=document.createElement("div");V.setAttribute("id",i+"_td_date_separator1"),V.style.display="table-cell";var $=document.createElement("div");$.setAttribute("id",i+"_td_date_input2"),$.style.display="table-cell";var G=document.createElement("div");G.setAttribute("id",i+"_td_date_separator2"),G.style.display="table-cell";var Y=document.createElement("div");Y.setAttribute("id",i+"_td_date_input3"),Y.style.display="table-cell";var X=document.createElement("div");X.setAttribute("id",i+"_td_date_label1"),X.style.display="table-cell";var Z=document.createElement("div");Z.style.display="table-cell";var J=document.createElement("div");J.setAttribute("id",i+"_td_date_label2"),J.style.display="table-cell";var ee=document.createElement("div");ee.style.display="table-cell";var te=document.createElement("div");te.setAttribute("id",i+"_td_date_label3"),te.style.display="table-cell";var ie=document.createElement("span");ie.setAttribute("id",i+"_element_labelform_id_temp"),ie.innerHTML=e,ie.setAttribute("class","wd_form_label"),ie.style.verticalAlign="top";var ne=document.createElement("span");ne.setAttribute("id",i+"_required_elementform_id_temp"),ne.innerHTML="",ne.setAttribute("class","required"),ne.style.verticalAlign="top","yes"==y&&(ne.innerHTML=" *");var ae=document.createElement("input");ae.setAttribute("type","text"),ae.setAttribute("value",r),ae.setAttribute("id",i+"_dayform_id_temp"),ae.setAttribute("name",i+"_dayform_id_temp"),ae.setAttribute("onBlur","if (this.value=='0') this.value=''; else add_0('"+i+"_dayform_id_temp')"),ae.style.width=p+"px";var re=document.createElement("label");re.setAttribute("class","mini_label"),re.setAttribute("id",i+"_day_label"),re.innerHTML=m;var le=document.createElement("span");le.setAttribute("id",i+"_separator1"),le.setAttribute("class","wdform_separator"),le.innerHTML=k;var de=document.createElement("input");de.setAttribute("type","text"),de.setAttribute("value",l),de.setAttribute("id",i+"_monthform_id_temp"),de.setAttribute("name",i+"_monthform_id_temp"),de.style.width=f+"px",de.setAttribute("onBlur","if (this.value=='0') this.value=''; else add_0('"+i+"_monthform_id_temp')");var _e=document.createElement("label");_e.setAttribute("class","mini_label"),_e.setAttribute("class","mini_label"),_e.setAttribute("id",i+"_month_label"),_e.innerHTML=u;var oe=document.createElement("span");oe.setAttribute("id",i+"_separator2"),oe.setAttribute("class","wdform_separator"),oe.innerHTML=k,""==g&&(g=current_date.getFullYear());var se=document.createElement("input");se.setAttribute("type","text"),se.setAttribute("from",v),se.setAttribute("to",g),se.setAttribute("value",d),se.setAttribute("id",i+"_yearform_id_temp"),se.setAttribute("name",i+"_yearform_id_temp"),se.style.width=h+"px";var me=document.createElement("label");me.setAttribute("class","mini_label"),me.setAttribute("id",i+"_year_label"),me.innerHTML=c;var ue=document.createElement("input");ue.setAttribute("type","hidden"),ue.setAttribute("value",w),ue.setAttribute("name",i+"_min_day_id_temp"),ue.setAttribute("id",i+"_min_day_id_temp");var ce=document.createElement("input");ce.setAttribute("type","hidden"),ce.setAttribute("value",E),ce.setAttribute("name",i+"_min_month_id_temp"),ce.setAttribute("id",i+"_min_month_id_temp");var pe=document.createElement("input");pe.setAttribute("type","hidden"),pe.setAttribute("value",A),pe.setAttribute("name",i+"_min_year_id_temp"),pe.setAttribute("id",i+"_min_year_id_temp");var fe=document.createElement("input");fe.setAttribute("type","hidden"),fe.setAttribute("value",x.replace(/"/g,"&quot;")),fe.setAttribute("name",i+"_min_dob_alert_id_temp"),fe.setAttribute("id",i+"_min_dob_alert_id_temp");var he=document.getElementById("show_table");P.appendChild(ie),P.appendChild(ne),F.appendChild(q),U.appendChild(ae),V.appendChild(le),$.appendChild(de),G.appendChild(oe),Y.appendChild(se),W.appendChild(U),W.appendChild(V),W.appendChild($),W.appendChild(G),W.appendChild(Y),X.appendChild(re),J.appendChild(_e),te.appendChild(me),K.appendChild(X),K.appendChild(Z),K.appendChild(J),K.appendChild(ee),K.appendChild(te),R.appendChild(W),R.appendChild(K),F.appendChild(L),F.appendChild(z),F.appendChild(R),F.appendChild(ue),F.appendChild(ce),F.appendChild(pe),F.appendChild(fe),D.appendChild(P),D.appendChild(F),N.appendChild(D),N.appendChild(M),N.appendChild(H),he.appendChild(N),jQuery("#main_div").append("<br>"+form_maker.type_date_of_birth_description),"top"==n&&label_top(i),"SELECT"==_&&field_to_select(i,"day"),"SELECT"==o&&field_to_select(i,"month"),"SELECT"==s&&field_to_select(i,"year"),change_class(b,i),refresh_attr(i,"type_date_fields"),jQuery(function(t){t("label#"+i+"_day_label").click(function(){if(0==t(this).children("input").length){var e="<input type='text' class='day' style='outline:none; border:none; background:none; width:100px;' value=\""+t(this).text()+'">';t(this).html(e),t("input.day").focus(),t("input.day").blur(function(){var e=t(this).val();t("#"+i+"_day_label").text(e)})}}),t("label#"+i+"_month_label").click(function(){if(0==t(this).children("input").length){var e="<input type='text' class='month' style='outline:none; border:none; background:none; width:100px;' value=\""+t(this).text()+'">';t(this).html(e),t("input.month").focus(),t("input.month").blur(function(){var e=t(this).val();t("#"+i+"_month_label").text(e)})}}),t("label#"+i+"_year_label").click(function(){if(0==t(this).children("input").length){var e="<input type='text' class='year' size='8' style='outline:none; border:none; background:none; width:100px;' value=\""+t(this).text()+'">';t(this).html(e),t("input.year").focus(),t("input.year").blur(function(){var e=t(this).val();t("#"+i+"_year_label").text(e)})}})})}function create_payment_amount_range(e,t,i){return create_option_container(jQuery('<label class="fm-field-label">Range</label>'),jQuery('<input type="text" class="fm-width-40" id="el_range_min1" onKeyPress="return check_isnum(event)" onChange="change_input_range_new(\'min\', '+e+')" value="'+t+'" placeholder="Min" />-<input type="text" class="fm-width-40" id="el_range_max1" onKeyPress="return check_isnum(event)" onChange="change_input_range_new(\'max\', '+e+')" value="'+i+'" placeholder="Max" />'))}function create_hide_payment_currency(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_currency">Hide payment currency</label>'),jQuery('<input type="checkbox" id="el_currency" onchange="hide_currency(this.checked, '+e+')"'+("yes"==t?' checked="checked"':"")+" />"))}function create_hide_total_currency(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_hide_total_currency">Hide currency</label>'),jQuery('<input type="checkbox" id="el_hide_total_currency" onchange="hide_total_currency('+e+')"'+("yes"==t?' checked="checked"':"")+" />"))}function hide_total_currency(e){"no"==jQuery("#"+e+"_hide_totalcurrency_id_temp").val()?(jQuery("#"+e+"_hide_totalcurrency_id_temp").val("yes"),jQuery("#"+e+"toggle_currency").removeClass("wd-inline-block").addClass("wd-hidden")):(jQuery("#"+e+"_hide_totalcurrency_id_temp").val("no"),jQuery("#"+e+"toggle_currency").removeClass("wd-hidden").addClass("wd-inline-block"))}function change_input_range_new(e,t){var i="";""!=document.getElementById("el_range_"+e+"1").value&&(i=document.getElementById("el_range_"+e+"1").value),document.getElementById(t+"_range_"+e+"form_id_temp").value=i}function hide_currency(e,t){document.getElementById(t+"_td_name_currency").style.display=e?"none":"table-cell"}function go_to_type_paypal_price_new(e){w_attr_name=[],w_attr_value=[],type_paypal_price_new(e,"Amount","","top","no","","","","no","",w_attr_name,w_attr_value,"","","no","no")}function type_paypal_price_new(e,t,i,n,a,r,l,d,_,o,s,m,u,c,p,f){jQuery("#element_type").val("type_paypal_price_new"),delete_last_child();var h=jQuery("#edit_table"),y=jQuery('<div id="edit_div"></div>');h.append(y);var b=jQuery('<div id="edit_main_table"></div>');y.append(b),b.append(create_field_type("type_paypal_price_new")),b.append(create_label(e,t)),b.append(create_label_position(e,n)),b.append(create_hide_label(e,a)),b.append(create_required(e,_)),b.append(create_readonly(e,p)),b.append(create_field_size(e,d));var v=jQuery('<div class="inside"></div>');b.append(create_advanced_options_container(v)),v.append(create_payment_amount_range(e,u,c)),v.append(create_hide_payment_currency(e,f)),v.append(create_field_label_size(e,i)),v.append(create_class(e,o)),v.append(create_additional_attributes(e,s,"type_paypal_price_new"));var g=document.createElement("input");g.setAttribute("type","hidden"),g.setAttribute("value","type_paypal_price_new"),g.setAttribute("name",e+"_typeform_id_temp"),g.setAttribute("id",e+"_typeform_id_temp");var w=document.createElement("input");w.setAttribute("type","hidden"),w.setAttribute("value",_),w.setAttribute("name",e+"_requiredform_id_temp"),w.setAttribute("id",e+"_requiredform_id_temp");var E=document.createElement("input");E.setAttribute("type","hidden"),E.setAttribute("value",a),E.setAttribute("name",e+"_hide_labelform_id_temp"),E.setAttribute("id",e+"_hide_labelform_id_temp");var A=document.createElement("input");A.setAttribute("type","hidden"),A.setAttribute("value",p),A.setAttribute("name",e+"_readonlyform_id_temp"),A.setAttribute("id",e+"_readonlyform_id_temp");var x=document.createElement("input");x.setAttribute("type","hidden"),x.setAttribute("value",u),x.setAttribute("name",e+"_range_minform_id_temp"),x.setAttribute("id",e+"_range_minform_id_temp");var k=document.createElement("input");k.setAttribute("type","hidden"),k.setAttribute("value",c),k.setAttribute("name",e+"_range_maxform_id_temp"),k.setAttribute("id",e+"_range_maxform_id_temp");var j=document.createElement("div");j.setAttribute("id","main_div");var C=document.createElement("div");C.setAttribute("id",e+"_elemet_tableform_id_temp");var I="yes"==a?"none":"table-cell",B=document.createElement("div");B.setAttribute("align","left"),B.style.display=I,B.style.width=i+"px",B.setAttribute("id",e+"_label_sectionform_id_temp");var Q=document.createElement("div");Q.setAttribute("align","left"),Q.style.display="table-cell",Q.setAttribute("id",e+"_element_sectionform_id_temp");var T=document.createElement("div");T.setAttribute("id",e+"_table_price"),T.style.display="table";var M=document.createElement("div");M.setAttribute("id",e+"_tr_price1"),M.style.display="table-row";var L=document.createElement("div");L.setAttribute("id",e+"_td_name_currency"),L.style.display="no"==f?"table-cell":"none";var z=document.createElement("div");z.setAttribute("id",e+"_td_name_dollars"),z.style.display="table-cell";var q=document.createElement("div");q.style.display="table-cell";var S=document.createElement("div");S.setAttribute("align","left"),S.style.display="table-cell";var N=document.createElement("div");N.setAttribute("id",e+"_td_name_label_divider"),N.style.display="table-cell";var H=document.createElement("div");H.setAttribute("align","left"),H.setAttribute("id",e+"_td_name_label_cents"),H.style.display="table-cell";var D=document.createElement("span");D.setAttribute("id",e+"_element_labelform_id_temp"),D.innerHTML=t,D.setAttribute("class","label"),D.style.verticalAlign="top";var O=document.createElement("span");O.setAttribute("id",e+"_required_elementform_id_temp"),O.innerHTML="",O.setAttribute("class","required"),O.style.verticalAlign="top","yes"==_&&(O.innerHTML=" *");var P=document.createElement("span");P.setAttribute("class","wdform_colon"),P.style.cssText="font-style:bold; vertical-align:middle",P.innerHTML="\x3c!--repstart--\x3e&nbsp;$&nbsp;\x3c!--repend--\x3e";var F=document.createElement("label");F.setAttribute("class","mini_label");var R=document.createElement("input");R.setAttribute("type","text"),R.style.cssText="width:"+d+"px",R.setAttribute("id",e+"_elementform_id_temp"),R.setAttribute("name",e+"_elementform_id_temp"),R.setAttribute("value",r),R.setAttribute("title",l),R.setAttribute("placeholder",l),"yes"==p&&R.setAttribute("readonly","readonly"),R.setAttribute("onKeyPress","return check_isnum(event)");var W=document.createElement("label");W.setAttribute("class","mini_label"),W.setAttribute("id",e+"_mini_label_dollars");var K=document.getElementById("show_table");B.appendChild(D),B.appendChild(O),Q.appendChild(E),L.appendChild(P),z.appendChild(R),M.appendChild(L),M.appendChild(z),q.appendChild(F),S.appendChild(W),T.appendChild(M),Q.appendChild(g),Q.appendChild(w),Q.appendChild(A),Q.appendChild(x),Q.appendChild(k),Q.appendChild(T),C.appendChild(B),C.appendChild(Q),j.appendChild(C),K.appendChild(j),jQuery("#main_div").append("<br>"+form_maker.type_price_description),"top"==n&&label_top(e),change_class(o,e),refresh_attr(e,"type_text")}function create_paypal_select_options(e,t,i,a,r){var l=jQuery('<label class="fm-field-label">Options</label>'),d=jQuery('<button id="el_choices_add" class="fm-add-option button-secondary" onClick="add_choise_price(\'select\', '+e+'); return false;" title="Add option"><span class="field-type-button fm-add-attribute dashicons dashicons-plus-alt"></span>Option</button>');if(form_maker.is_demo)var _=jQuery('<button class="fm-add-option button-secondary" onClick="alert(\'This feature is disabled in demo.\')" title="Add options from database"><span class="field-type-button fm-add-attribute dashicons dashicons-plus-alt"></span>From Database</button>');else _=jQuery("<button class=\"fm-add-option button-secondary\" onClick=\"tb_show('', 'admin-ajax.php?action=select_data_from_db&nonce="+fm_ajax.ajaxnonce+"&field_id="+e+'&field_type=paypal_select&width=530&height=370&TB_iframe=1\'); return false;" title="Add options from database"><span class="field-type-button fm-add-attribute dashicons dashicons-plus-alt"></span>From Database</button>');var o=jQuery('<div class="fm-width-100 error">IMPORTANT! Check the "Empty value" checkbox only if you want the option to be considered as empty.</div>'),s=jQuery('<div id="choices" class="fm-width-100 ui-sortable"></div>'),m=jQuery('<div class="fm-width-100"><div class="fm-header-label fm-width-40">Product name</div><div class="fm-header-label fm-width-20">Price</div><div class="fm-header-label fm-width-20">Empty value</div><div class="fm-header-label fm-width-10">Delete</div><div class="fm-header-label fm-width-10">Move</div></div>');for(s.append(m),n=t.length,j=0;j<n;j++){var u=jQuery('<div id="'+j+'" class="change_pos fm-width-100"><div class="fm-table-col fm-width-40"><input type="text" class="fm-field-choice" id="el_option'+j+'" value="'+t[j].replace(/"/g,"&quot;")+'" onKeyUp="change_label_price(\''+e+"_option"+j+"', this.value)\""+(i[j]?' disabled="disabled"':"")+' /></div><div class="fm-table-col fm-width-20"><input type="text" class="fm-field-choice" id="el_option_price'+j+'" value="'+a[j]+'" onKeyPress="return check_isnum_point(event)" onKeyUp="change_value_price(\''+e+"_option"+j+"', this.value)\""+(i[j]?' disabled="disabled"':"")+' /></div><div class="fm-table-col fm-width-20"><input type="hidden" id="el_option_params'+j+'" value="'+i[j]+'" /><input type="checkbox" title="Empty value" class="el_option_dis" id="el_option'+j+'_dis" onClick="dis_option_price('+e+","+j+', this.checked)"'+(r[j]?' checked="checked"':"")+' /></div><div class="fm-table-col fm-width-10"><span class="fm-remove-attribute dashicons dashicons-dismiss" id="el_option'+j+'_remove" onClick="remove_option_price('+j+","+e+')"></span></div><div class="fm-table-col fm-width-10"><span class="fm-move-attribute fm-ico-draggable el_choices_sortable"></span></div></div>');s.append(u)}var c=l;return create_option_container(null,c=(c=(c=(c=c.add(d)).add(_)).add(s)).add(o))}function create_payment_quantity(e,t,i){return create_option_container(jQuery('<label class="fm-field-label" for="el_quantity">Quantity property</label>'),jQuery('<input type="checkbox" id="el_quantity" value="yes" onchange="add_quantity('+e+","+t+')"'+("yes"==i?' checked="checked"':"")+" />"))}function add_quantity(e,t){if(div_=document.getElementById(e+"_divform_id_temp"),""==form_maker_getElementsByAttribute(div_,"*","id",e+"_element_quantityform_id_temp")){select_=document.createElement("input"),select_.setAttribute("type","number"),select_.setAttribute("min","1"),select_.setAttribute("required","1"),select_.setAttribute("value",t),select_.setAttribute("id",e+"_element_quantityform_id_temp"),select_.setAttribute("name",e+"_element_quantityform_id_temp"),select_.setAttribute("onKeyPress","return check_isnum(event)"),select_.setAttribute("onfocusout","validity.valid||(value='1')"),select_.style.cssText="width:50px; margin:2px 0px";var i=document.createElement("label");i.innerHTML="\x3c!--repstart--\x3eQuantity\x3c!--repend--\x3e",i.style.cssText="margin-right:5px",i.setAttribute("class","mini_label"),i.setAttribute("id",e+"_element_quantity_label_form_id_temp");var n=document.createElement("span");n.style.cssText="margin-right:15px",n.setAttribute("id",e+"_element_quantity_spanform_id_temp"),n.appendChild(i),n.appendChild(select_),div_.firstChild?div_.insertBefore(n,div_.firstChild):div_.appendChild(n)}else div_.removeChild(document.getElementById(e+"_element_quantity_spanform_id_temp"))}function create_payment_property(e){var t=jQuery('<label class="fm-field-label">Product properties</label>'),i=jQuery("<a class=\"thickbox-preview\" onClick=\"tb_show('', 'admin-ajax.php?action=product_option&nonce="+fm_ajax.ajaxnonce+"&field_id="+e+'&width=530&height=370&TB_iframe=1\')"><span class="fm-add-attribute dashicons dashicons-plus-alt" title="Add"></span></a>'),n=jQuery('<ul id="option_ul" class="fm-width-100"></ul>'),a=t;return create_option_container(null,a=(a=a.add(i)).add(n))}function add_choise_price(e,t){var i=0;document.getElementById(t+"_hor")&&(i=1,flow_ver(t));var n=0;if(jQuery(".change_pos").each(function(){var e=parseInt(jQuery(this)[0].id);n=n<e?e:n}),n+=1,"radio"==e||"checkbox"==e){element="input";var a=document.getElementById(t+"_table_little"),r=document.createElement("div");r.setAttribute("id",t+"_element_tr"+n),r.style.display="table-row";var l=document.createElement("div");l.setAttribute("valign","top"),l.setAttribute("id",t+"_td_little"+n),l.setAttribute("idi",n),l.style.display="table-cell";var d=document.createElement(element);d.setAttribute("type",e),d.setAttribute("value",""),d.setAttribute("id",t+"_elementform_id_temp"+n),"right"==document.getElementById(t+"_option_left_right").value&&(d.style.cssText="float: left !important"),"checkbox"==e&&(d.setAttribute("onClick","set_checked('"+t+"','"+n+"','form_id_temp')"),d.setAttribute("name",t+"_elementform_id_temp"+n)),"radio"==e&&(d.setAttribute("onClick","set_default('"+t+"','"+n+"','form_id_temp')"),d.setAttribute("name",t+"_elementform_id_temp"));var _=document.createElement("label");_.setAttribute("id",t+"_label_element"+n),_.setAttribute("class","ch-rad-label"),_.setAttribute("for",t+"_elementform_id_temp"+n),"right"==document.getElementById(t+"_option_left_right").value&&(_.style.cssText="float: none !important");var o=document.createElement("input");o.setAttribute("type","hidden"),o.setAttribute("id",t+"_elementlabel_form_id_temp"+n),o.setAttribute("name",t+"_elementform_id_temp"+n+"_label"),o.setAttribute("value",""),l.appendChild(d),l.appendChild(_),l.appendChild(o),r.appendChild(l),a.appendChild(r);var s=jQuery("#choices"),m=jQuery('<div id="'+n+'" class="change_pos fm-width-100"><div class="fm-table-col fm-width-60"><input type="text" class="fm-field-choice" id="el_choices'+n+'" value="" onKeyUp="change_label(\''+t+"_label_element"+n+"', this.value); change_label_1('"+t+"_elementlabel_form_id_temp"+n+'\', this.value);" /></div><div class="fm-table-col fm-width-20"><input type="text" class="fm-field-choice" id="el_option_price'+n+'" value="" onKeyPress="return check_isnum_point(event)" onKeyUp="change_value_price(\''+t+"_elementform_id_temp"+n+'\', this.value)" /></div><input type="hidden" id="el_option_params'+n+'" value="" /><div class="fm-table-col fm-width-10"><span class="fm-remove-attribute dashicons dashicons-dismiss" id="el_option'+n+'_remove" onClick="remove_choise_price('+n+","+t+')"></span></div><div class="fm-table-col fm-width-10"><span class="fm-move-attribute fm-ico-draggable el_choices_sortable"></span></div></div>');s.append(m),refresh_attr(t,"type_checkbox")}if("select"==e){var u=document.getElementById(t+"_elementform_id_temp"),c=document.createElement("option");c.setAttribute("id",t+"_option"+n),u.appendChild(c);s=jQuery("#choices"),m=jQuery('<div id="'+n+'" class="change_pos fm-width-100"><div class="fm-table-col fm-width-40"><input type="text" class="fm-field-choice" id="el_option'+n+'" value="" onKeyUp="change_label_price(\''+t+"_option"+n+'\', this.value)" /></div><div class="fm-table-col fm-width-20"><input type="text" class="fm-field-choice" id="el_option_price'+n+'" value="" onKeyPress="return check_isnum_point(event)" onKeyUp="change_value_price(\''+t+"_option"+n+'\', this.value)" /></div><div class="fm-table-col fm-width-20"><input type="hidden" id="el_option_params'+n+'" value="" /><input type="checkbox" title="Empty value" class="el_option_dis" id="el_option'+n+'_dis" onClick="dis_option_price('+t+","+n+', this.checked)" /></div><div class="fm-table-col fm-width-10"><span class="fm-remove-attribute dashicons dashicons-dismiss" id="el_option'+n+'_remove" onClick="remove_option_price('+n+","+t+')"></span></div><div class="fm-table-col fm-width-10"><span class="fm-move-attribute fm-ico-draggable el_choices_sortable"></span></div></div>');s.append(m)}1==i&&flow_hor(t)}function flow_hor(e){for(tbody=document.getElementById(e+"_table_little"),td_array=new Array,n=tbody.childNodes.length,k=0;k<n;k++)td_array[k]=tbody.childNodes[k].childNodes[0];for(k=0;k<n;k++)tbody.removeChild(tbody.childNodes[0]);var t=document.createElement("div");for(t.style.display="table-row",t.setAttribute("id",e+"_hor"),tbody.appendChild(t),k=0;k<n;k++)t.appendChild(td_array[k])}function flow_ver(e){for(tbody=document.getElementById(e+"_table_little"),tr=document.getElementById(e+"_hor"),td_array=new Array,n=tr.childNodes.length,k=0;k<n;k++)td_array[k]=tr.childNodes[k];for(tbody.removeChild(tr),k=0;k<n;k++){var t=document.createElement("div");t.setAttribute("id",e+"_element_tr"+td_array[k].getAttribute("idi")),t.style.display="table-row",t.appendChild(td_array[k]),tbody.appendChild(t)}}function change_label_price(e,t){document.getElementById(e).innerHTML=t}function change_value_price(e,t){document.getElementById(e).value=t}function dis_option_price(e,t,i){document.getElementById(e+"_option"+t).value=i?"":document.getElementById("el_option_price"+t).value}function remove_option_price(e,t){var i=document.getElementById(t+"_elementform_id_temp"),n=document.getElementById(t+"_option"+e);i.removeChild(n);var a=document.getElementById("choices"),r=document.getElementById(e);a.removeChild(r)}function add_properties(e,t,a){for(n=t.length,i=0;i<n;i++){for(select_=document.createElement("select"),select_.setAttribute("id",e+"_propertyform_id_temp"+i),select_.setAttribute("name",e+"_propertyform_id_temp"+i),select_.style.cssText="width:auto; margin:2px 0px",k=0;k<a[i].length;k++){var r=document.createElement("option");r.setAttribute("id",e+"_"+i+"_option"+k),r.setAttribute("value",a[i][k]),r.innerHTML=a[i][k],select_.appendChild(r)}var l=document.createElement("label");l.innerHTML=t[i],l.style.cssText="margin-right:5px",l.setAttribute("class","mini_label"),l.setAttribute("id",e+"_property_label_form_id_temp"+i);var d=document.createElement("span");d.style.cssText="margin-right:15px",d.setAttribute("id",e+"_property_"+i),div_=document.getElementById(e+"_divform_id_temp"),d.appendChild(l),d.appendChild(select_),div_.appendChild(d);var _=document.createElement("li");_.setAttribute("id","property_li_"+i);var o=document.createElement("label");o.innerHTML=t[i],o.setAttribute("id","label_property_"+i),o.style.cssText="font-weight:bold; font-size: 13px";var s=document.createElement("a");s.setAttribute("onclick","tb_show('', 'admin-ajax.php?action=product_option&nonce="+fm_ajax.ajaxnonce+"&field_id="+e+"&property_id="+i+"&width=530&height=370&TB_iframe=1')"),s.setAttribute("class","thickbox-preview");var m=document.createElement("span");m.setAttribute("class","fm-edit-attribute fm-ico-edit"),s.appendChild(m);var u=document.createElement("span");u.setAttribute("class","fm-remove-attribute dashicons dashicons-dismiss"),u.setAttribute("onClick","remove_property("+e+","+i+")"),ul_=document.getElementById("option_ul"),_.appendChild(o),_.appendChild(s),_.appendChild(u),ul_.appendChild(_)}}function remove_property(e,t){property_=document.getElementById(e+"_property_"+t),property_.parentNode.removeChild(property_),property_li_=document.getElementById("property_li_"+t),property_li_.parentNode.removeChild(property_li_)}function go_to_type_paypal_select(e){w_choices=["Select product","product 1","product 2"],w_choices_price=["","100","200"],w_choices_checked=["1","0","0"],w_choices_params=["","",""],w_choices_disabled=[!0,!1,!1],w_attr_name=[],w_attr_value=[],w_property=[],w_property_values=[],type_paypal_select(e,"Select Product","","top","no","",w_choices,w_choices_price,w_choices_checked,"no","no","1","wdform_select",w_attr_name,w_attr_value,w_choices_disabled,w_property,w_property_values,w_choices_params)}function type_paypal_select(i,e,t,a,r,l,d,_,o,s,m,u,c,p,f,h,y,b,v){jQuery("#element_type").val("type_paypal_select"),delete_last_child();var g=jQuery("#edit_table"),w=jQuery('<div id="edit_div"></div>');g.append(w);var E=jQuery('<div id="edit_main_table"></div>');w.append(E),E.append(create_field_type("type_paypal_select")),E.append(create_label(i,e)),E.append(create_label_position(i,a)),E.append(create_hide_label(i,r)),E.append(create_required(i,s)),E.append(create_field_size(i,l)),E.append(create_paypal_select_options(i,d,v,_,h));var A=jQuery('<div class="inside"></div>');E.append(create_advanced_options_container(A)),A.append(create_payment_quantity(i,u,m)),A.append(create_payment_property(i)),A.append(create_field_label_size(i,t)),A.append(create_class(i,c)),A.append(create_additional_attributes(i,p,"type_paypal_select"));var x=document.createElement("input");x.setAttribute("type","hidden"),x.setAttribute("value","type_paypal_select"),x.setAttribute("name",i+"_typeform_id_temp"),x.setAttribute("id",i+"_typeform_id_temp");var k=document.createElement("input");k.setAttribute("type","hidden"),k.setAttribute("value",s),k.setAttribute("name",i+"_requiredform_id_temp"),k.setAttribute("id",i+"_requiredform_id_temp");var C=document.createElement("input");C.setAttribute("type","hidden"),C.setAttribute("value",r),C.setAttribute("name",i+"_hide_labelform_id_temp"),C.setAttribute("id",i+"_hide_labelform_id_temp");var I=document.createElement("div");I.setAttribute("id","main_div");var B=document.createElement("div");B.setAttribute("id",i+"_elemet_tableform_id_temp");var Q="yes"==r?"none":"table-cell",T=document.createElement("div");T.setAttribute("align","left"),T.style.display=Q,T.style.width=t+"px",T.setAttribute("id",i+"_label_sectionform_id_temp");var M=document.createElement("div");M.setAttribute("align","left"),M.style.display="table-cell",M.setAttribute("id",i+"_element_sectionform_id_temp");document.createElement("br"),document.createElement("br");var L=document.createElement("br"),z=(document.createElement("br"),document.createElement("div"));z.setAttribute("id",i+"_table_little"),z.style.display="table";var q=document.createElement("div");q.setAttribute("id",i+"_element_tr1"),q.style.display="table-row";var S=document.createElement("div");S.setAttribute("id",i+"_element_tr2"),S.style.display="table-row";var N=document.createElement("div");N.setAttribute("valign","top"),N.setAttribute("id",i+"_td_little1"),N.style.display="table-cell";var H=document.createElement("div");H.setAttribute("valign","top"),H.setAttribute("id",i+"_td_little2"),H.style.display="table-cell";var D=document.createElement("span");D.setAttribute("id",i+"_element_labelform_id_temp"),D.innerHTML=e,D.setAttribute("class","label"),D.style.verticalAlign="top";var O=document.createElement("span");O.setAttribute("id",i+"_required_elementform_id_temp"),O.innerHTML="",O.setAttribute("class","required"),O.style.verticalAlign="top","yes"==s&&(O.innerHTML=" *");var P=document.createElement("select");for(P.setAttribute("id",i+"_elementform_id_temp"),P.setAttribute("name",i+"_elementform_id_temp"),P.style.cssText="width:"+l+"px",P.setAttribute("onchange","set_select(this)"),n=d.length,j=0;j<n;j++){var F=document.createElement("option");F.setAttribute("id",i+"_option"+j),h[j]?F.value="":F.setAttribute("value",_[j]),v[j]&&(w_params=v[j].split("[where_order_by]"),F.setAttribute("where",w_params[0]),w_params=w_params[1].split("[db_info]"),F.setAttribute("order_by",w_params[0]),F.setAttribute("db_info",w_params[1])),F.setAttribute("onselect","set_select('"+i+"_option"+j+"')"),F.innerHTML=d[j].replace(/"/g,"&quot;"),1==o[j]&&F.setAttribute("selected","selected"),P.appendChild(F)}var R=document.createElement("div");R.setAttribute("id",i+"_divform_id_temp");var W=document.getElementById("show_table");T.appendChild(D),T.appendChild(O),M.appendChild(x),M.appendChild(k),M.appendChild(C),M.appendChild(P),M.appendChild(R),B.appendChild(T),B.appendChild(M),I.appendChild(B),I.appendChild(L),W.appendChild(I),jQuery("#main_div").append(form_maker.type_payment_select_description),"top"==a&&label_top(i),"yes"==m&&add_quantity(i,u),change_class(c,i),refresh_attr(i,"type_text"),add_properties(i,y,b),jQuery(function(){jQuery("#choices").sortable({items:".change_pos",handle:".el_choices_sortable",update:function(e,t){refresh_paypal_fields(i,"select")}})})}function refresh_paypal_fields(l,d){if("radio"==d||"checkbox"==d){var _=document.getElementById(l+"_table_little");_.innerHTML="",jQuery(".change_pos").each(function(){var e=jQuery(this)[0].id,t=document.createElement("div");t.setAttribute("id",l+"_element_tr"+e),t.style.display="table-row";var i=document.createElement("div");i.setAttribute("valign","top"),i.setAttribute("id",l+"_td_little"+e),i.setAttribute("idi",e),i.style.display="table-cell";var n=document.createElement("input");n.setAttribute("type",d),n.setAttribute("id",l+"_elementform_id_temp"+e),n.setAttribute("value",jQuery(this).find(jQuery("#el_option_price"+e))[0].value),"checkbox"==d&&(n.setAttribute("onClick","set_checked('"+l+"','"+e+"','form_id_temp')"),n.setAttribute("name",l+"_elementform_id_temp"+e)),"radio"==d&&(n.setAttribute("onClick","set_default('"+l+"','"+e+"','form_id_temp')"),n.setAttribute("name",l+"_elementform_id_temp"));var a=document.createElement("label");a.setAttribute("id",l+"_label_element"+e),a.setAttribute("class","ch-rad-label"),a.setAttribute("for",l+"_elementform_id_temp"+e),a.innerHTML=jQuery(this).find(jQuery("#el_choices"+e))[0].value,jQuery(this).find(jQuery(".el_option_params")).val()&&(w_params=jQuery(this).find(jQuery(".el_option_params")).val().split("[where_order_by]"),a.setAttribute("where",w_params[0]),w_params=w_params[1].split("[db_info]"),a.setAttribute("order_by",w_params[0]),a.setAttribute("db_info",w_params[1]));var r=document.createElement("input");r.setAttribute("type","hidden"),r.setAttribute("id",l+"_elementlabel_form_id_temp"+e),r.setAttribute("name",l+"_elementform_id_temp"+e+"_label"),r.setAttribute("value",jQuery(this).find(jQuery("#el_choices"+e))[0].value),i.appendChild(n),i.appendChild(a),i.appendChild(r),t.appendChild(i),_.appendChild(t)}),document.getElementById("edit_for_flow_horizontal").checked&&flow_hor(l)}if("select"==d){var i=document.getElementById(l+"_elementform_id_temp");i.innerHTML="",jQuery(".change_pos").each(function(){var e=jQuery(this)[0].id,t=document.createElement("option");t.setAttribute("id",l+"_option"+e),jQuery(this).find(jQuery("input[type='checkbox']")).prop("checked")?t.value="":t.setAttribute("value",jQuery(this).find(jQuery("#el_option_price"+e))[0].value),jQuery(this).find(jQuery(".el_option_params")).val()&&(w_params=jQuery(this).find(jQuery(".el_option_params")).val().split("[where_order_by]"),t.setAttribute("where",w_params[0]),w_params=w_params[1].split("[db_info]"),t.setAttribute("order_by",w_params[0]),t.setAttribute("db_info",w_params[1])),t.setAttribute("onselect","set_select('"+l+"_option"+e+"')"),t.innerHTML=jQuery(this).find(jQuery("#el_option"+e))[0].value,i.appendChild(t)})}}function create_payment_relative_position(e,t,i){var n=jQuery('<label class="fm-field-label">Relative Position</label>'),a=jQuery('<input type="radio" id="edit_for_flow_vertical" name="edit_for_flow" value="ver" onchange="flow_ver('+e+')"'+("hor"==t?"":' checked="checked"')+" />"),r=jQuery('<label for="edit_for_flow_vertical">Vertical</label>'),l=jQuery('<input type="radio" id="edit_for_flow_horizontal" name="edit_for_flow" value="hor" onchange="flow_hor('+e+',)"'+("hor"==t?' checked="checked"':"")+" />"),d=jQuery('<label for="edit_for_flow_horizontal">Horizontal</label>'),_=a;return create_option_container(n,_=(_=(_=_.add(r)).add(l)).add(d))}function create_paypal_radio_options(e,t,i,a,r){var l=jQuery('<label class="fm-field-label">Options</label>'),d=jQuery('<button id="el_choices_add" class="fm-add-option button-secondary" onClick="add_choise_price(\''+r+"', "+e+'); return false;" title="Add option"><span class="field-type-button fm-add-attribute dashicons dashicons-plus-alt"></span>Option</button>');if(form_maker.is_demo)var _=jQuery('<button class="fm-add-option button-secondary" onClick="alert(\'This feature is disabled in demo.\')" title="Add options from database"><span class="field-type-button fm-add-attribute dashicons dashicons-plus-alt"></span>From Database</button>');else _=jQuery("<button class=\"fm-add-option button-secondary\" onClick=\"tb_show('', 'admin-ajax.php?action=select_data_from_db&field_id="+e+"&nonce="+fm_ajax.ajaxnonce+"&field_type=paypal_"+r+'&width=530&height=370&TB_iframe=1\'); return false;" title="Add options from database"><span class="field-type-button fm-add-attribute dashicons dashicons-plus-alt"></span>From Database</button>');var o=jQuery('<div id="choices" class="fm-width-100 ui-sortable"></div>'),s=jQuery('<div class="fm-width-100"><div class="fm-header-label fm-width-60">Product name</div><div class="fm-header-label fm-width-20">Price</div><div class="fm-header-label fm-width-10">Delete</div><div class="fm-header-label fm-width-10">Move</div></div>');for(o.append(s),n=t.length,j=0;j<n;j++){var m=jQuery('<div id="'+j+'" class="change_pos fm-width-100"><div class="fm-table-col fm-width-60"><input type="text" class="fm-field-choice" id="el_choices'+j+'" value="'+t[j].replace(/"/g,"&quot;")+'" onKeyUp="change_label(\''+e+"_label_element"+j+"', this.value); change_label_1('"+e+"_elementlabel_form_id_temp"+j+"', this.value);\""+(i[j]?' disabled="disabled"':"")+' /></div><div class="fm-table-col fm-width-20"><input type="text" class="fm-field-choice" id="el_option_price'+j+'" value="'+a[j]+'" onKeyPress="return check_isnum_point(event)" onKeyUp="change_value_price(\''+e+"_elementform_id_temp"+j+"', this.value)\""+(i[j]?' disabled="disabled"':"")+' /></div><input type="hidden" id="el_option_params'+j+'" value="'+i[j]+'" /><div class="fm-table-col fm-width-10"><span class="fm-remove-attribute dashicons dashicons-dismiss" id="el_option'+j+'_remove" onClick="remove_choise_price('+j+","+e+')"></span></div><div class="fm-table-col fm-width-10"><span class="fm-move-attribute fm-ico-draggable el_choices_sortable"></span></div></div>');o.append(m)}var u=l;return create_option_container(null,u=(u=(u=u.add(d)).add(_)).add(o))}function change_label_1(e,t){document.getElementById(e).value=t}function remove_choise_price(e,t){var i=0;document.getElementById(t+"_hor")&&(i=1,flow_ver(t));var n=document.getElementById(t+"_table_little"),a=document.getElementById(t+"_element_tr"+e);n.removeChild(a);var r=document.getElementById("choices"),l=document.getElementById(e);r.removeChild(l),1==i&&flow_hor(t)}function go_to_type_paypal_radio(e){w_choices=["product 1","product 2"],w_choices_price=["100","200"],w_choices_checked=["0","0"],w_choices_params=["","",""],w_attr_name=[],w_attr_value=[],w_property=[],w_property_values=[],type_paypal_radio(e,"Payment Single Choice","","top","right","no","ver",w_choices,w_choices_price,w_choices_checked,"no","no","no","0","",w_attr_name,w_attr_value,w_property,w_property_values,"no","1",w_choices_params)}function type_paypal_radio(i,e,t,a,r,l,d,_,o,s,m,u,c,p,f,h,y,b,v,g,w,E){jQuery("#element_type").val("type_paypal_radio"),delete_last_child();var A=jQuery("#edit_table"),x=jQuery('<div id="edit_div"></div>');A.append(x);var k=jQuery('<div id="edit_main_table"></div>');x.append(k),k.append(create_field_type("type_paypal_radio")),k.append(create_label(i,e)),k.append(create_label_position(i,a)),k.append(create_hide_label(i,l)),k.append(create_required(i,m)),k.append(create_payment_relative_position(i,d,"radio")),k.append(create_option_label_position(i,r,"radio")),k.append(create_paypal_radio_options(i,_,E,o,"radio"));var C=jQuery('<div class="inside"></div>');k.append(create_advanced_options_container(C)),C.append(create_payment_quantity(i,w,g)),C.append(create_payment_property(i)),C.append(create_field_label_size(i,t)),C.append(create_class(i,f)),C.append(create_additional_attributes(i,h,"type_paypal_radio"));var I=document.createElement("br"),B=document.createElement("input");B.setAttribute("type","hidden"),B.setAttribute("value","type_paypal_radio"),B.setAttribute("name",i+"_typeform_id_temp"),B.setAttribute("id",i+"_typeform_id_temp");var Q=document.createElement("input");Q.setAttribute("type","hidden"),Q.setAttribute("value",m),Q.setAttribute("name",i+"_requiredform_id_temp"),Q.setAttribute("id",i+"_requiredform_id_temp");var T=document.createElement("input");T.setAttribute("type","hidden"),T.setAttribute("value",l),T.setAttribute("name",i+"_hide_labelform_id_temp"),T.setAttribute("id",i+"_hide_labelform_id_temp");var M=document.createElement("input");M.setAttribute("type","hidden"),M.setAttribute("value",u),M.setAttribute("name",i+"_randomizeform_id_temp"),M.setAttribute("id",i+"_randomizeform_id_temp");var L=document.createElement("input");L.setAttribute("type","hidden"),L.setAttribute("value",c),L.setAttribute("name",i+"_allow_otherform_id_temp"),L.setAttribute("id",i+"_allow_otherform_id_temp");var z=document.createElement("input");z.setAttribute("type","hidden"),z.setAttribute("value",r),z.setAttribute("id",i+"_option_left_right");var q=document.createElement("div");q.setAttribute("id","main_div");var S=document.createElement("div");S.setAttribute("id",i+"_elemet_tableform_id_temp");var N="yes"==l?"none":"table-cell",H=document.createElement("div");H.setAttribute("align","left"),H.style.display=N,H.style.width=t+"px",H.setAttribute("id",i+"_label_sectionform_id_temp");var D=document.createElement("div");D.setAttribute("align","left"),D.style.display="table-cell",D.setAttribute("id",i+"_element_sectionform_id_temp");var O=document.createElement("div");O.style.display="table";var P=document.createElement("div");P.setAttribute("id",i+"_table_little"),P.style.display="table-row-group",O.appendChild(P);var F=document.createElement("div");F.setAttribute("id",i+"_element_tr1"),F.style.display="table-row";var R=document.createElement("div");R.setAttribute("id",i+"_element_tr2"),R.style.display="table-row";var W=document.createElement("div");W.setAttribute("valign","top"),W.setAttribute("id",i+"_td_little1"),W.style.display="table-cell";var K=document.createElement("div");K.setAttribute("valign","top"),K.setAttribute("id",i+"_td_little2"),K.style.display="table-cell";var U=document.createElement("span");U.setAttribute("id",i+"_element_labelform_id_temp"),U.innerHTML=e,U.setAttribute("class","wd_form_label"),U.style.verticalAlign="top";var V=document.createElement("span");for(V.setAttribute("id",i+"_required_elementform_id_temp"),V.innerHTML="",V.setAttribute("class","required"),V.style.verticalAlign="top","yes"==m&&(V.innerHTML=" *"),n=_.length,j=0;j<n;j++){var $=document.createElement("div");$.setAttribute("id",i+"_element_tr"+j),$.style.display="table-row";var G=document.createElement("div");G.setAttribute("valign","top"),G.setAttribute("id",i+"_td_little"+j),G.setAttribute("idi",j),G.style.display="table-cell";var Y=document.createElement("input");Y.setAttribute("type","radio"),Y.setAttribute("id",i+"_elementform_id_temp"+j),Y.setAttribute("name",i+"_elementform_id_temp"),Y.setAttribute("value",o[j]),"right"==r&&(Y.style.cssText="float: left !important"),Y.setAttribute("onclick","set_default('"+i+"','"+j+"','form_id_temp')"),"1"==s[j]&&Y.setAttribute("checked","checked");var X=document.createElement("label");X.setAttribute("id",i+"_label_element"+j),X.setAttribute("class","ch-rad-label"),X.setAttribute("for",i+"_elementform_id_temp"+j),X.innerHTML=_[j].replace(/"/g,"&quot;"),"right"==r&&(X.style.cssText="float: none !important"),E[j]&&(w_params=E[j].split("[where_order_by]"),X.setAttribute("where",w_params[0]),w_params=w_params[1].split("[db_info]"),X.setAttribute("order_by",w_params[0]),X.setAttribute("db_info",w_params[1]));var Z=document.createElement("input");Z.setAttribute("type","hidden"),Z.setAttribute("id",i+"_elementlabel_form_id_temp"+j),Z.setAttribute("name",i+"_elementform_id_temp"+j+"_label"),Z.setAttribute("value",_[j].replace(/"/g,"&quot;")),G.appendChild(Y),G.appendChild(X),G.appendChild(Z),$.appendChild(G),P.appendChild($)}var J=document.createElement("div");J.setAttribute("id",i+"_divform_id_temp");var ee=document.getElementById("show_table");H.appendChild(U),H.appendChild(V),D.appendChild(B),D.appendChild(Q),D.appendChild(T),D.appendChild(M),D.appendChild(L),D.appendChild(z),D.appendChild(O),D.appendChild(J),S.appendChild(H),S.appendChild(D),q.appendChild(S),q.appendChild(I),ee.appendChild(q),jQuery("#main_div").append(form_maker.type_payment_radio_description),"top"==a&&label_top(i),"hor"==d&&flow_hor(i),"yes"==g&&add_quantity(i,w),change_class(f,i),refresh_attr(i,"type_checkbox"),add_properties(i,b,v),jQuery(function(){jQuery("#choices").sortable({items:".change_pos",handle:".el_choices_sortable",update:function(e,t){refresh_paypal_fields(i,"radio")}})})}function go_to_type_paypal_checkbox(e){w_choices=["product 1","product 2"],w_choices_price=["100","200"],w_choices_checked=["0","0"],w_choices_params=["","",""],w_attr_name=[],w_attr_value=[],w_property=[],w_property_values=[],type_paypal_checkbox(e,"Payment Multiple Choice","","top","right","no","ver",w_choices,w_choices_price,w_choices_checked,"no","no","no","0","",w_attr_name,w_attr_value,w_property,w_property_values,"no","1",w_choices_params)}function type_paypal_checkbox(i,e,t,a,r,l,d,_,o,s,m,u,c,p,f,h,y,b,v,g,w,E){jQuery("#element_type").val("type_paypal_checkbox"),delete_last_child();var A=jQuery("#edit_table"),x=jQuery('<div id="edit_div"></div>');A.append(x);var k=jQuery('<div id="edit_main_table"></div>');x.append(k),k.append(create_field_type("type_paypal_checkbox")),k.append(create_label(i,e)),k.append(create_label_position(i,a)),k.append(create_hide_label(i,l)),k.append(create_required(i,m)),k.append(create_payment_relative_position(i,d,"checkbox")),k.append(create_option_label_position(i,r,"checkbox")),k.append(create_paypal_radio_options(i,_,E,o,"checkbox"));var C=jQuery('<div class="inside"></div>');k.append(create_advanced_options_container(C)),C.append(create_payment_quantity(i,w,g)),C.append(create_payment_property(i)),C.append(create_field_label_size(i,t)),C.append(create_class(i,f)),C.append(create_additional_attributes(i,h,"type_paypal_checkbox")),element="input",type="checkbox";var I=document.createElement("input");I.setAttribute("type","hidden"),I.setAttribute("value","type_paypal_checkbox"),I.setAttribute("name",i+"_typeform_id_temp"),I.setAttribute("id",i+"_typeform_id_temp");var B=document.createElement("input");B.setAttribute("type","hidden"),B.setAttribute("value",m),B.setAttribute("name",i+"_requiredform_id_temp"),B.setAttribute("id",i+"_requiredform_id_temp");var Q=document.createElement("input");Q.setAttribute("type","hidden"),Q.setAttribute("value",l),Q.setAttribute("name",i+"_hide_labelform_id_temp"),Q.setAttribute("id",i+"_hide_labelform_id_temp");var T=document.createElement("input");T.setAttribute("type","hidden"),T.setAttribute("value",u),T.setAttribute("name",i+"_randomizeform_id_temp"),T.setAttribute("id",i+"_randomizeform_id_temp");var M=document.createElement("input");M.setAttribute("type","hidden"),M.setAttribute("value",c),M.setAttribute("name",i+"_allow_otherform_id_temp"),M.setAttribute("id",i+"_allow_otherform_id_temp");var L=document.createElement("input");L.setAttribute("type","hidden"),L.setAttribute("value",p),L.setAttribute("name",i+"_allow_other_numform_id_temp"),L.setAttribute("id",i+"_allow_other_numform_id_temp");var z=document.createElement("input");z.setAttribute("type","hidden"),z.setAttribute("value",r),z.setAttribute("id",i+"_option_left_right");var q=document.createElement("div");q.setAttribute("id","main_div");var S=document.createElement("div");S.setAttribute("id",i+"_elemet_tableform_id_temp");var N="yes"==l?"none":"table-cell",H=document.createElement("div");H.setAttribute("align","left"),H.style.display=N,H.style.width=t+"px",H.setAttribute("id",i+"_label_sectionform_id_temp");var D=document.createElement("div");D.setAttribute("align","left"),D.style.display="table-cell",D.setAttribute("id",i+"_element_sectionform_id_temp");document.createElement("br"),document.createElement("br");var O=document.createElement("br"),P=(document.createElement("br"),document.createElement("div"));P.style.display="table";var F=document.createElement("div");F.setAttribute("id",i+"_table_little"),F.style.display="table-row-group",P.appendChild(F);var R=document.createElement("span");R.setAttribute("id",i+"_element_labelform_id_temp"),R.innerHTML=e,R.setAttribute("class","label"),R.style.verticalAlign="top";var W=document.createElement("span");for(W.setAttribute("id",i+"_required_elementform_id_temp"),W.innerHTML="",W.setAttribute("class","required"),W.style.verticalAlign="top","yes"==m&&(W.innerHTML=" *"),n=_.length,j=0;j<n;j++){var K=document.createElement("div");K.setAttribute("id",i+"_element_tr"+j),K.style.display="table-row";var U=document.createElement("div");U.setAttribute("valign","top"),U.setAttribute("id",i+"_td_little"+j),U.setAttribute("idi",j),U.style.display="table-cell";var V=document.createElement(element);V.setAttribute("type",type),V.setAttribute("id",i+"_elementform_id_temp"+j),V.setAttribute("name",i+"_elementform_id_temp"+j),V.setAttribute("value",o[j]),"right"==r&&(V.style.cssText="float: left !important"),"yes"==c&&j==p?(V.setAttribute("other","1"),V.setAttribute("onclick","if(set_checked('"+i+"','"+j+"','form_id_temp')) show_other_input('"+i+"','form_id_temp');")):V.setAttribute("onclick","set_checked('"+i+"','"+j+"','form_id_temp')"),"1"==s[j]&&V.setAttribute("checked","checked");var $=document.createElement("label");$.setAttribute("id",i+"_label_element"+j),$.setAttribute("class","ch-rad-label"),$.setAttribute("for",i+"_elementform_id_temp"+j),$.innerHTML=_[j].replace(/"/g,"&quot;"),"right"==r&&($.style.cssText="float: none !important"),E[j]&&(w_params=E[j].split("[where_order_by]"),$.setAttribute("where",w_params[0]),w_params=w_params[1].split("[db_info]"),$.setAttribute("order_by",w_params[0]),$.setAttribute("db_info",w_params[1]));var G=document.createElement("input");G.setAttribute("type","hidden"),G.setAttribute("id",i+"_elementlabel_form_id_temp"+j),G.setAttribute("name",i+"_elementform_id_temp"+j+"_label"),G.setAttribute("value",_[j].replace(/"/g,"&quot;")),U.appendChild(V),U.appendChild($),U.appendChild(G),K.appendChild(U),F.appendChild(K)}var Y=document.createElement("div");Y.setAttribute("id",i+"_divform_id_temp");var X=document.getElementById("show_table");H.appendChild(R),H.appendChild(W),D.appendChild(I),D.appendChild(B),D.appendChild(Q),D.appendChild(T),D.appendChild(M),D.appendChild(L),D.appendChild(z),D.appendChild(P),D.appendChild(Y),S.appendChild(H),S.appendChild(D),q.appendChild(S),q.appendChild(O),X.appendChild(q),jQuery("#main_div").append(form_maker.type_payment_checkbox_description),"top"==a&&label_top(i),"hor"==d&&flow_hor(i),change_class(f,i),refresh_attr(i,"type_checkbox"),"yes"==g&&add_quantity(i,w),add_properties(i,b,v),jQuery(function(){jQuery("#choices").sortable({items:".change_pos",handle:".el_choices_sortable",update:function(e,t){refresh_paypal_fields(i,"checkbox")}})})}function go_to_type_paypal_shipping(e){w_choices=["type 1","type 2"],w_choices_price=["100","200"],w_choices_checked=["0","0"],w_choices_params=["","",""],w_attr_name=[],w_attr_value=[],w_property=[],w_property_values=[],type_paypal_shipping(e,"Shipping","","top","right","no","ver",w_choices,w_choices_price,w_choices_checked,"no","no","no","0","",w_attr_name,w_attr_value,w_property,w_property_values,w_choices_params)}function type_paypal_shipping(i,e,t,a,r,l,d,_,o,s,m,u,c,p,f,h,y,b,v,g){jQuery("#element_type").val("type_paypal_shipping"),delete_last_child();var w=jQuery("#edit_table"),E=jQuery('<div id="edit_div"></div>');w.append(E);var A=jQuery('<div id="edit_main_table"></div>');E.append(A),A.append(create_field_type("type_paypal_shipping")),A.append(create_label(i,e)),A.append(create_label_position(i,a)),A.append(create_hide_label(i,l)),A.append(create_required(i,m)),A.append(create_payment_relative_position(i,d,"radio")),A.append(create_option_label_position(i,r,"radio")),A.append(create_paypal_radio_options(i,_,g,o,"radio"));var x=jQuery('<div class="inside"></div>');A.append(create_advanced_options_container(x)),x.append(create_field_label_size(i,t)),x.append(create_class(i,f)),x.append(create_additional_attributes(i,h,"type_paypal_shipping")),element="input",type="radio";var k=document.createElement("input");k.setAttribute("type","hidden"),k.setAttribute("value","type_paypal_shipping"),k.setAttribute("name",i+"_typeform_id_temp"),k.setAttribute("id",i+"_typeform_id_temp");var C=document.createElement("input");C.setAttribute("type","hidden"),C.setAttribute("value",m),C.setAttribute("name",i+"_requiredform_id_temp"),C.setAttribute("id",i+"_requiredform_id_temp");var I=document.createElement("input");I.setAttribute("type","hidden"),I.setAttribute("value",l),I.setAttribute("name",i+"_hide_labelform_id_temp"),I.setAttribute("id",i+"_hide_labelform_id_temp");var B=document.createElement("input");B.setAttribute("type","hidden"),B.setAttribute("value",u),B.setAttribute("name",i+"_randomizeform_id_temp"),B.setAttribute("id",i+"_randomizeform_id_temp");var Q=document.createElement("input");Q.setAttribute("type","hidden"),Q.setAttribute("value",c),Q.setAttribute("name",i+"_allow_otherform_id_temp"),Q.setAttribute("id",i+"_allow_otherform_id_temp");var T=document.createElement("input");T.setAttribute("type","hidden"),T.setAttribute("value",r),T.setAttribute("id",i+"_option_left_right");var M=document.createElement("div");M.setAttribute("id","main_div");var L=document.createElement("div");L.setAttribute("id",i+"_elemet_tableform_id_temp");var z="yes"==l?"none":"table-cell",q=document.createElement("div");q.setAttribute("align","left"),q.style.display=z,q.style.width=t+"px",q.setAttribute("id",i+"_label_sectionform_id_temp");var S=document.createElement("div");S.setAttribute("align","left"),S.style.display="table-cell",S.setAttribute("id",i+"_element_sectionform_id_temp");document.createElement("br"),document.createElement("br");var N=document.createElement("br"),H=(document.createElement("br"),document.createElement("div"));H.style.display="table";var D=document.createElement("div");D.setAttribute("id",i+"_table_little"),D.style.display="table-row-group",H.appendChild(D);var O=document.createElement("div");O.setAttribute("id",i+"_element_tr1"),O.style.display="table-row";var P=document.createElement("div");P.setAttribute("id",i+"_element_tr2"),P.style.display="table-row";var F=document.createElement("div");F.setAttribute("valign","top"),F.setAttribute("id",i+"_td_little1"),F.style.display="table-cell";var R=document.createElement("div");R.setAttribute("valign","top"),R.setAttribute("id",i+"_td_little2"),R.style.display="table-cell";var W=document.createElement("span");W.setAttribute("id",i+"_element_labelform_id_temp"),W.innerHTML=e,W.setAttribute("class","label"),W.style.verticalAlign="top";var K=document.createElement("span");for(K.setAttribute("id",i+"_required_elementform_id_temp"),K.innerHTML="",K.setAttribute("class","required"),K.style.verticalAlign="top","yes"==m&&(K.innerHTML=" *"),n=_.length,j=0;j<n;j++){var U=document.createElement("div");U.setAttribute("id",i+"_element_tr"+j),U.style.display="table-row";var V=document.createElement("td");V.setAttribute("valign","top"),V.setAttribute("id",i+"_td_little"+j),V.setAttribute("idi",j),V.style.display="table-cell";var $=document.createElement(element);$.setAttribute("type",type),$.setAttribute("id",i+"_elementform_id_temp"+j),$.setAttribute("name",i+"_elementform_id_temp"),$.setAttribute("value",o[j]),"right"==r&&($.style.cssText="float: left !important"),$.setAttribute("onclick","set_default('"+i+"','"+j+"','form_id_temp')"),"1"==s[j]&&$.setAttribute("checked","checked");var G=document.createElement("label");G.setAttribute("id",i+"_label_element"+j),G.setAttribute("class","ch-rad-label"),G.setAttribute("for",i+"_elementform_id_temp"+j),G.innerHTML=_[j].replace(/"/g,"&quot;"),"right"==r&&(G.style.cssText="float: none !important"),g[j]&&(w_params=g[j].split("[where_order_by]"),G.setAttribute("where",w_params[0]),w_params=w_params[1].split("[db_info]"),G.setAttribute("order_by",w_params[0]),G.setAttribute("db_info",w_params[1]));var Y=document.createElement("input");Y.setAttribute("type","hidden"),Y.setAttribute("id",i+"_elementlabel_form_id_temp"+j),Y.setAttribute("name",i+"_elementform_id_temp"+j+"_label"),Y.setAttribute("value",_[j].replace(/"/g,"&quot;")),V.appendChild($),V.appendChild(G),V.appendChild(Y),U.appendChild(V),D.appendChild(U)}var X=document.createElement("div");X.setAttribute("id",i+"_divform_id_temp");var Z=document.getElementById("show_table");q.appendChild(W),q.appendChild(K),S.appendChild(k),S.appendChild(C),S.appendChild(I),S.appendChild(B),S.appendChild(Q),S.appendChild(T),S.appendChild(H),S.appendChild(X),L.appendChild(q),L.appendChild(S),M.appendChild(L),M.appendChild(N),Z.appendChild(M),jQuery("#main_div").append(form_maker.type_shipping_description),"top"==a&&label_top(i),"hor"==d&&flow_hor(i),change_class(f,i),refresh_attr(i,"type_checkbox"),add_properties(i,b,v),jQuery(function(){jQuery("#choices").sortable({items:".change_pos",handle:".el_choices_sortable",update:function(e,t){refresh_paypal_fields(i,"radio")}})})}function go_to_type_paypal_total(e){type_paypal_total(e,"Total","","top","no","","","no")}function type_paypal_total(e,t,i,n,a,r,l,d){jQuery("#element_type").val("type_paypal_total"),delete_last_child();var _=jQuery("#edit_table"),o=jQuery('<div id="edit_div"></div>');_.append(o);var s=jQuery('<div id="edit_main_table"></div>');o.append(s),s.append(create_field_type("type_paypal_total")),s.append(create_label(e,t)),s.append(create_label_position(e,n)),s.append(create_hide_label(e,a));var m=jQuery('<div class="inside"></div>');s.append(create_advanced_options_container(m)),m.append(create_field_label_size(e,i)),m.append(create_hide_total_currency(e,d)),m.append(create_class(e,r));var u=document.createElement("input");u.setAttribute("type","hidden"),u.setAttribute("value","type_paypal_total"),u.setAttribute("name",e+"_typeform_id_temp"),u.setAttribute("id",e+"_typeform_id_temp");var c=document.createElement("input");c.setAttribute("type","hidden"),c.setAttribute("value",a),c.setAttribute("name",e+"_hide_labelform_id_temp"),c.setAttribute("id",e+"_hide_labelform_id_temp");var p=document.createElement("input");p.setAttribute("type","hidden"),p.setAttribute("value",d),p.setAttribute("name",e+"_hide_totalcurrency_id_temp"),p.setAttribute("id",e+"_hide_totalcurrency_id_temp");var f=document.createElement("div");f.setAttribute("id","main_div");var h=document.createElement("div");h.setAttribute("id",e+"_elemet_tableform_id_temp");var y="yes"==a?"none":"table-cell",b=document.createElement("div");b.setAttribute("align","left"),b.style.display=y,b.style.width=i+"px",b.setAttribute("id",e+"_label_sectionform_id_temp");var v=document.createElement("div");v.setAttribute("align","left"),v.style.display="table-cell",v.setAttribute("id",e+"_element_sectionform_id_temp");document.createElement("br"),document.createElement("br");var g=document.createElement("br"),w=(document.createElement("br"),document.createElement("span"));w.setAttribute("id",e+"_element_labelform_id_temp"),w.innerHTML=t,w.setAttribute("class","label");var E=document.createElement("div");E.setAttribute("id",e+"paypal_totalform_id_temp"),E.setAttribute("class","wdform_paypal_total paypal_totalform_id_temp"),E.style.cssText="width:"+l+"px;";var A=document.createElement("div");A.setAttribute("id",e+"div_totalform_id_temp"),A.setAttribute("class","div_totalform_id_temp"),A.style.cssText="margin-bottom:10px;",A.innerHTML="300";var x="yes"==d?"wd-hidden":"wd-inline-block",k=document.createElement("span");k.setAttribute("id",e+"toggle_currency"),k.setAttribute("class",x),k.style.float="left",k.innerHTML="$";var j=document.createElement("div");j.setAttribute("id",e+"paypal_productsform_id_temp"),j.setAttribute("class","paypal_productsform_id_temp"),j.style.cssText="border-spacing: 2px;";var C=document.createElement("div");C.style.cssText="border-spacing: 2px;",C.innerHTML="\x3c!--repstart--\x3eproduct 1 $100\x3c!--repend--\x3e";var I=document.createElement("div");I.style.cssText="border-spacing: 2px;",I.innerHTML="\x3c!--repstart--\x3eproduct 2 $200\x3c!--repend--\x3e";var B=document.createElement("div");B.style.cssText="border-spacing: 2px; margin-top:7px;",B.setAttribute("id",e+"paypal_taxform_id_temp"),B.setAttribute("class","paypal_taxform_id_temp");var Q=document.createElement("input");Q.setAttribute("type","hidden"),Q.setAttribute("value",""),Q.setAttribute("name",e+"_paypal_totalform_id_temp"),Q.setAttribute("class","input_paypal_totalform_id_temp"),E.appendChild(Q),j.appendChild(C),j.appendChild(I),E.appendChild(A),E.appendChild(j),E.appendChild(B),A.appendChild(k);var T=document.getElementById("show_table"),M=Q=document.createElement("p");M.style.cssText="color: red;";var L=document.createTextNode("This is sample calculation. On front-end you will see the calculation based on your Payment field values.");M.appendChild(L),b.appendChild(w),v.appendChild(c),v.appendChild(p),v.appendChild(u),v.appendChild(E),h.appendChild(b),h.appendChild(v),f.appendChild(h),f.appendChild(g),f.appendChild(M),T.appendChild(f),jQuery("#main_div").append(form_maker.type_total_description),"top"==n&&label_top(e),change_class(r,e)}function create_map_locations(e){var t=jQuery('<label class="fm-field-label">Location</label>'),i=jQuery('<span class="fm-add-attribute dashicons dashicons-plus-alt" title="Add" onClick="add_marker('+e+', -1)"></span>'),n=jQuery('<div class="notice notice-info"><p>Drag the marker to change default marker position.</p></div>'),a=jQuery('<div id="markers" class="fm-width-100"></div>'),r=t;return create_option_container(null,r=(r=(r=r.add(i)).add(n)).add(a))}function add_marker(e,t,i,n,a){var r=jQuery("#markers");if(-1==t){var l=r.children().last();t=0<l.length?parseInt(l.prop("idi"))+1:0,n=i=null,a=""}var d=jQuery('<div class="fm-width-100 fm-fields-set" id="marker_opt'+t+'" idi="'+t+'"></div>'),_=jQuery('<div class="fm-width-90"></div>');_.append(create_markmap_address(e,t)),_.append(create_markmap_longitude(e,i,t)),_.append(create_markmap_latitude(e,n,t)),_.append(create_markmap_info(e,a,t)),d.append(_);var o=jQuery('<div class="fm-width-10 fm-remove-button"><span class="fm-remove-attribute dashicons dashicons-dismiss" onClick="remove_map('+e+","+t+')"></span></div>');d.append(o),r.append(d);var s=document.getElementById(e+"_elementform_id_temp");s.setAttribute("long"+t,i),s.setAttribute("lat"+t,n),s.setAttribute("info"+t,a),add_marker_on_map(e,t,i,n,a,!0)}function remove_map(e,t){table=document.getElementById("marker_opt"+t),table.parentNode.removeChild(table),map=document.getElementById(e+"_elementform_id_temp"),map.removeAttribute("long"+t),map.removeAttribute("lat"+t),map.removeAttribute("info"+t),remove_marker(e,t)}function type_map(e,t,i,a,r,l,d,_,o,s,m,u){jQuery("#element_type").val("type_map"),delete_last_child();var c=jQuery("#edit_table"),p=jQuery('<div id="edit_div"></div>');c.append(p);var f=jQuery('<div id="edit_main_table"></div>');p.append(f),f.append(create_field_type("type_map")),f.append(create_map_locations(e)),f.append(create_markmap_size(e,d,_)),f.append(create_keys(e,"To set up map key click here"));var h=jQuery('<div class="inside"></div>');f.append(create_advanced_options_container(h)),h.append(create_class(e,o)),h.append(create_additional_attributes(e,m,"type_map"));var y=document.createElement("br"),b=document.createElement("input");b.setAttribute("type","hidden"),b.setAttribute("value","type_map"),b.setAttribute("name",e+"_typeform_id_temp"),b.setAttribute("id",e+"_typeform_id_temp");var v=document.createElement("div");v.setAttribute("id",e+"_elementform_id_temp"),v.style.cssText="width:"+d+"px; height: "+_+"px;",v.setAttribute("zoom",l),v.setAttribute("center_x",t),v.setAttribute("center_y",i);var g=document.createElement("span");g.setAttribute("id",e+"_element_labelform_id_temp"),g.innerHTML="map_"+e,g.style.cssText="display:none";var w=document.createElement("div");w.setAttribute("id","main_div");var E=document.createElement("div");E.setAttribute("id",e+"_elemet_tableform_id_temp");var A=document.createElement("div");A.setAttribute("align","left"),A.style.display="table-cell",A.setAttribute("id",e+"_label_sectionform_id_temp");var x=document.createElement("div");x.setAttribute("align","left"),x.style.display="block",x.setAttribute("id",e+"_element_sectionform_id_temp");var k=document.getElementById("show_table");for(A.appendChild(g),x.appendChild(b),x.appendChild(v),E.appendChild(A),E.appendChild(x),w.appendChild(E),w.appendChild(y),k.appendChild(w),jQuery("#main_div").append(form_maker.type_map_description),change_class(o,e),refresh_attr(e,"type_text"),if_gmap_init(e),n=a.length,j=0;j<n;j++)add_marker(e,j,a[j],r[j],s[j])}function create_time_format(e,t){var i=jQuery('<label class="fm-field-label">Time Format</label>'),n=jQuery('<input type="radio" id="el_label_time_type1" name="edit_for_time_type" value="format_24" onchange="format_24('+e+')"'+("24"==t?' checked="checked"':"")+" />"),a=jQuery('<label for="el_label_time_type1">24 hour</label>'),r=jQuery('<input type="radio" id="el_label_time_type2" name="edit_for_time_type" value="format_12" onchange="format_12('+e+", 'am', '', '', '')\""+("24"==t?"":' checked="checked"')+" />"),l=jQuery('<label for="el_label_time_type2">12 hour</label>'),d=n;return create_option_container(i,d=(d=(d=d.add(a)).add(r)).add(l))}function format_24(e){tr_time1=document.getElementById(e+"_tr_time1"),td1=document.getElementById(e+"_am_pm_select"),tr_time2=document.getElementById(e+"_tr_time2"),td2=document.getElementById(e+"_am_pm_label"),tr_time1.removeChild(td1),tr_time2.removeChild(td2),document.getElementById(e+"_hhform_id_temp").value="",document.getElementById(e+"_mmform_id_temp").value="",document.getElementById(e+"_ssform_id_temp")&&(document.getElementById(e+"_ssform_id_temp").value="")}function format_12(t,e,i,n,a){tr_time1=document.getElementById(t+"_tr_time1"),tr_time2=document.getElementById(t+"_tr_time2");var r=document.createElement("div");r.setAttribute("id",t+"_am_pm_select"),r.setAttribute("class","td_am_pm_select"),r.style.display="table-cell";var l=document.createElement("div");l.setAttribute("id",t+"_am_pm_label"),l.setAttribute("class","td_am_pm_select"),l.style.display="table-cell";var d=document.createElement("select");d.setAttribute("class","am_pm_select"),d.setAttribute("name",t+"_am_pmform_id_temp"),d.setAttribute("id",t+"_am_pmform_id_temp"),d.setAttribute("onchange","set_sel_am_pm(this)");var _=document.createElement("option");_.setAttribute("value","am"),_.innerHTML="AM";var o=document.createElement("option");o.setAttribute("value","pm"),o.innerHTML="PM","pm"==e?o.setAttribute("selected","selected"):_.setAttribute("selected","selected");var s=document.createElement("label");s.setAttribute("class","mini_label"),s.setAttribute("id",t+"_mini_label_am_pm"),s.innerHTML=w_mini_labels[3],d.appendChild(_),d.appendChild(o),r.appendChild(d),l.appendChild(s),tr_time1.appendChild(r),tr_time2.appendChild(l),document.getElementById(t+"_hhform_id_temp").value=i,document.getElementById(t+"_mmform_id_temp").value=n,document.getElementById(t+"_ssform_id_temp")&&(document.getElementById(t+"_ssform_id_temp").value=a),refresh_attr(t,"type_time"),jQuery(function(){jQuery("label#"+t+"_mini_label_am_pm").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' class='am_pm' size='4' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.am_pm").focus(),jQuery("input.am_pm").blur(function(){var e=jQuery(this).val();jQuery("#"+t+"_mini_label_am_pm").text(e)})}})})}function create_display_seconds(e,t,i){var n=jQuery('<label class="fm-field-label">Display Seconds</label>'),a=jQuery('<input type="radio" id="el_second_yes" name="edit_for_time_second" value="yes" onchange="second_yes('+e+",'"+t+"')\""+("1"==i?' checked="checked"':"")+" />"),r=jQuery('<label for="el_second_yes">Yes</label>'),l=jQuery('<input type="radio" id="el_second_no" name="edit_for_time_second" value="no" onchange="second_no('+e+')"'+("1"==i?"":' checked="checked"')+" />"),d=jQuery('<label for="el_second_no">No</label>'),_=a;return create_option_container(n,_=(_=(_=_.add(r)).add(l)).add(d))}function second_yes(t,e){time_box=document.getElementById(t+"_tr_time1"),text_box=document.getElementById(t+"_tr_time2");var i=document.createElement("div");i.setAttribute("align","center"),i.style.display="table-cell";var n=document.createElement("div");n.setAttribute("id",t+"_td_time_input3"),n.style.display="table-cell";var a=document.createElement("div");a.style.display="table-cell";var r=document.createElement("div");r.setAttribute("id",t+"_td_time_label3"),r.style.display="table-cell";var l=document.createElement("span");l.setAttribute("class","wdform_colon"),l.style.cssText="font-style:bold; vertical-align:middle",l.innerHTML="&nbsp;:&nbsp;",i.appendChild(l);var d=document.createElement("input");d.setAttribute("type","text"),d.setAttribute("value",e),d.setAttribute("class","time_box"),d.setAttribute("id",t+"_ssform_id_temp"),d.setAttribute("name",t+"_ssform_id_temp"),d.setAttribute("onBlur","add_0('"+t+"_ssform_id_temp')");var _=document.createElement("label");_.setAttribute("class","mini_label"),_.innerHTML="SS",_.setAttribute("id",t+"_mini_label_ss"),n.appendChild(d),r.appendChild(_),document.getElementById(t+"_am_pm_select")?(select_=document.getElementById(t+"_am_pm_select"),select_text=document.getElementById(t+"_am_pm_label"),time_box.insertBefore(n,select_),time_box.insertBefore(i,n),text_box.insertBefore(r,select_text),text_box.insertBefore(a,r)):(time_box.appendChild(i),time_box.appendChild(n),text_box.appendChild(a),text_box.appendChild(r)),jQuery(function(){jQuery("label#"+t+"_mini_label_ss").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' class='ss' style='outline:none; border:none; background:none; width:40px;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.ss").focus(),jQuery("input.ss").blur(function(){var e=jQuery(this).val();jQuery("#"+t+"_mini_label_ss").text(e)})}})}),refresh_attr(t,"type_time")}function second_no(e){time_box=document.getElementById(e+"_tr_time1"),text_box=document.getElementById(e+"_tr_time2"),second_box=document.getElementById(e+"_td_time_input3"),second_text=document.getElementById(e+"_td_time_label3"),document.getElementById(e+"_td_time_input2").parentNode.removeChild(document.getElementById(e+"_td_time_input2").nextSibling),time_box.removeChild(second_box),text_box.removeChild(second_text.previousSibling),text_box.removeChild(second_text)}function go_to_type_time(e){w_attr_name=[],w_attr_value=[],w_mini_labels=["HH","MM","SS","AM/PM"],type_time(e,"Time","","top","no","24","0","1","","","",w_mini_labels,"no","",w_attr_name,w_attr_value)}function type_time(t,e,i,n,a,r,l,d,_,o,s,m,u,c,p,f){jQuery("#element_type").val("type_time"),delete_last_child();var h=jQuery("#edit_table"),y=jQuery('<div id="edit_div"></div>');h.append(y);var b=jQuery('<div id="edit_main_table"></div>');y.append(b),b.append(create_field_type("type_time")),b.append(create_label(t,e)),b.append(create_label_position(t,n)),b.append(create_time_format(t,r)),b.append(create_display_seconds(t,s,d)),b.append(create_hide_label(t,a)),b.append(create_required(t,u));var v=jQuery('<div class="inside"></div>');b.append(create_advanced_options_container(v)),v.append(create_field_label_size(t,i)),v.append(create_class(t,c)),v.append(create_additional_attributes(t,p,"type_time"));var g=document.createElement("input");g.setAttribute("type","hidden"),g.setAttribute("value","type_time"),g.setAttribute("name",t+"_typeform_id_temp"),g.setAttribute("id",t+"_typeform_id_temp");var w=document.createElement("input");w.setAttribute("type","hidden"),w.setAttribute("value",u),w.setAttribute("name",t+"_requiredform_id_temp");var E=document.createElement("input");E.setAttribute("type","hidden"),E.setAttribute("value",a),E.setAttribute("name",t+"_hide_labelform_id_temp"),E.setAttribute("id",t+"_hide_labelform_id_temp"),w.setAttribute("id",t+"_requiredform_id_temp");var A=document.createElement("div");A.setAttribute("id","main_div");var x=document.createElement("div");x.setAttribute("class","fm-editable-label"),edit_labels=document.createTextNode("The labels of the fields are editable. Please, click on the label to edit."),x.appendChild(edit_labels);var k=document.createElement("div");k.setAttribute("id",t+"_elemet_tableform_id_temp");var j="yes"==a?"none":"table-cell",C=document.createElement("div");C.setAttribute("align","left"),C.style.display=j,C.style.width=i+"px",C.setAttribute("id",t+"_label_sectionform_id_temp");var I=document.createElement("div");I.setAttribute("align","left"),I.style.display="table-cell",I.setAttribute("id",t+"_element_sectionform_id_temp");var B=document.createElement("div");B.setAttribute("id",t+"_table_time"),B.style.display="table";var Q=document.createElement("div");Q.setAttribute("id",t+"_tr_time1"),Q.style.display="table-row";var T=document.createElement("div");T.setAttribute("id",t+"_tr_time2"),T.style.display="table-row";var M=document.createElement("div");M.setAttribute("id",t+"_td_time_input1"),M.style.cssText="width:32px",M.style.display="table-cell";var L=document.createElement("div");L.setAttribute("align","center"),L.style.display="table-cell";var z=document.createElement("div");z.setAttribute("id",t+"_td_time_input2"),z.style.cssText="width:32px",z.style.display="table-cell";var q=document.createElement("div");q.setAttribute("align","center"),q.style.display="table-cell";var S=document.createElement("div");S.setAttribute("id",t+"_td_time_input3"),S.style.cssText="width:32px",S.style.display="table-cell";var N=document.createElement("div");N.setAttribute("id",t+"_td_time_label1"),N.style.display="table-cell";var H=document.createElement("div");H.style.display="table-cell";var D=document.createElement("div");D.setAttribute("id",t+"_td_time_label2"),D.style.display="table-cell";var O=document.createElement("div");O.style.display="table-cell";var P=document.createElement("div");P.setAttribute("id",t+"_td_time_label3"),P.style.display="table-cell";document.createElement("br"),document.createElement("br");var F=document.createElement("br"),R=(document.createElement("br"),document.createElement("span"));R.setAttribute("id",t+"_element_labelform_id_temp"),R.innerHTML=e,R.setAttribute("class","label"),R.style.verticalAlign="top";var W=document.createElement("span");W.setAttribute("id",t+"_required_elementform_id_temp"),W.innerHTML="",W.setAttribute("class","required"),W.style.verticalAlign="top","yes"==u&&(W.innerHTML=" *");var K=document.createElement("input");K.setAttribute("type","text"),K.setAttribute("value",_),K.setAttribute("class","time_box"),K.setAttribute("id",t+"_hhform_id_temp"),K.setAttribute("name",t+"_hhform_id_temp"),K.setAttribute("onBlur","add_0('"+t+"_hhform_id_temp')");var U=document.createElement("label");U.setAttribute("class","mini_label"),U.setAttribute("id",t+"_mini_label_hh"),U.innerHTML=m[0];var V=document.createElement("span");V.setAttribute("class","wdform_colon"),V.style.cssText="font-style:bold; vertical-align:middle",V.innerHTML="&nbsp;:&nbsp;";var $=document.createElement("input");$.setAttribute("type","text"),$.setAttribute("value",o),$.setAttribute("class","time_box"),$.setAttribute("id",t+"_mmform_id_temp"),$.setAttribute("name",t+"_mmform_id_temp"),$.setAttribute("onBlur","add_0('"+t+"_mmform_id_temp')");var G=document.createElement("label");G.setAttribute("class","mini_label"),G.setAttribute("id",t+"_mini_label_mm"),G.innerHTML=m[1];var Y=document.createElement("span");Y.style.cssText="font-style:bold; vertical-align:middle",Y.innerHTML="&nbsp;:&nbsp;",Y.setAttribute("class","wdform_colon");var X=document.createElement("input");X.setAttribute("type","text"),X.setAttribute("value",s),X.setAttribute("class","time_box"),X.setAttribute("id",t+"_ssform_id_temp"),X.setAttribute("name",t+"_ssform_id_temp"),X.setAttribute("onBlur","add_0('"+t+"_ssform_id_temp')");var Z=document.createElement("label");Z.setAttribute("class","mini_label"),Z.setAttribute("id",t+"_mini_label_ss"),Z.innerHTML=m[2];var J=document.getElementById("show_table");C.appendChild(R),C.appendChild(W),M.appendChild(K),L.appendChild(V),z.appendChild($),q.appendChild(Y),S.appendChild(X),Q.appendChild(M),Q.appendChild(L),Q.appendChild(z),Q.appendChild(q),Q.appendChild(S),N.appendChild(U),D.appendChild(G),P.appendChild(Z),T.appendChild(N),T.appendChild(H),T.appendChild(D),T.appendChild(O),T.appendChild(P),B.appendChild(Q),B.appendChild(T),I.appendChild(g),I.appendChild(w),I.appendChild(E),I.appendChild(B),k.appendChild(C),k.appendChild(I),A.appendChild(k),A.appendChild(F),A.appendChild(x),J.appendChild(A),jQuery("#main_div").append("<br>"+form_maker.type_time_description),"top"==n&&label_top(t),"12"==r&&format_12(t,l,_,o,s),"0"==d&&second_no(t),change_class(c,t),refresh_attr(t,"type_time"),jQuery(function(){jQuery("label#"+t+"_mini_label_hh").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' class='hh' size='4' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.hh").focus(),jQuery("input.hh").blur(function(){var e=jQuery(this).val();jQuery("#"+t+"_mini_label_hh").text(e)})}}),jQuery("label#"+t+"_mini_label_mm").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' class='mm' size='4' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.mm").focus(),jQuery("input.mm").blur(function(){var e=jQuery(this).val();jQuery("#"+t+"_mini_label_mm").text(e)})}}),jQuery("label#"+t+"_mini_label_ss").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' class='ss' size='4' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.ss").focus(),jQuery("input.ss").blur(function(){var e=jQuery(this).val();jQuery("#"+t+"_mini_label_ss").text(e)})}})})}function go_to_type_send_copy(e){if(0!=jQuery("#take").find(jQuery("div[type='type_send_copy']")).length)return alert("This field already has been created."),void delete_last_child();w_attr_name=[],type_send_copy(e,"Send a copy of this message to yourself","","top","no",!(w_attr_value=[]),"no",w_attr_name,w_attr_value)}function type_send_copy(e,t,i,n,a,r,l,d,_){jQuery("#element_type").val("type_send_copy"),delete_last_child();var o=jQuery("#edit_table"),s=jQuery('<div id="edit_div"></div>');o.append(s);var m=jQuery('<div id="edit_main_table"></div>');s.append(m),m.append(create_field_type("type_send_copy")),m.append(create_label(e,t)),m.append(create_hide_label(e,a)),m.append(create_required(e,l));var u=jQuery('<div class="inside"></div>');m.append(create_advanced_options_container(u)),u.append(create_field_label_size(e,i)),u.append(create_additional_attributes(e,d,"type_send_copy")),element="input",type="checkbox";var c=document.createElement("input");c.setAttribute("type","hidden"),c.setAttribute("value","type_send_copy"),c.setAttribute("name",e+"_typeform_id_temp"),c.setAttribute("id",e+"_typeform_id_temp");var p=document.createElement("input");p.setAttribute("type","hidden"),p.setAttribute("value",l),p.setAttribute("name",e+"_requiredform_id_temp"),p.setAttribute("id",e+"_requiredform_id_temp");var f=document.createElement("input");f.setAttribute("type","hidden"),f.setAttribute("value",a),f.setAttribute("name",e+"_hide_labelform_id_temp"),f.setAttribute("id",e+"_hide_labelform_id_temp");var h=document.createElement(element);h.setAttribute("type",type),r&&h.setAttribute("checked","checked"),h.setAttribute("id",e+"_elementform_id_temp"),h.setAttribute("name",e+"_elementform_id_temp"),h.setAttribute("onclick","set_checked('"+e+"','','form_id_temp')");var y=document.createElement("div");y.setAttribute("id","main_div");var b=document.createElement("div");b.setAttribute("class","fm-editable-label"),edit_labels=document.createTextNode("Use the field to allow the user to choose whether to receive a copy of the submitted form or not. Do not forget to fill in User Email section in Email Options in advance."),b.appendChild(edit_labels);var v=document.createElement("div");v.setAttribute("id",e+"_elemet_tableform_id_temp");var g="yes"==a?"none":"table-cell",w=document.createElement("div");w.setAttribute("align","left"),w.style.display=g,w.style.width=i+"px",w.setAttribute("id",e+"_label_sectionform_id_temp");var E=document.createElement("div");E.setAttribute("align","left"),E.style.display="table-cell",E.setAttribute("id",e+"_element_sectionform_id_temp");document.createElement("br"),document.createElement("br");var A=document.createElement("br"),x=(document.createElement("br"),document.createElement("span"));x.setAttribute("id",e+"_element_labelform_id_temp"),x.innerHTML=t,x.setAttribute("class","label"),x.style.verticalAlign="top";var k=document.createElement("span");k.setAttribute("id",e+"_required_elementform_id_temp"),k.innerHTML="",k.setAttribute("class","required"),k.style.verticalAlign="top","yes"==l&&(k.innerHTML=" *");var j=document.getElementById("show_table");w.appendChild(x),w.appendChild(k),E.appendChild(c),E.appendChild(p),E.appendChild(f),E.appendChild(h),v.appendChild(w),v.appendChild(E),y.appendChild(v),y.appendChild(A),y.appendChild(b),j.appendChild(y),jQuery("#main_div").append("<br>"+form_maker.type_send_copy_description),"top"==n&&label_top(e),refresh_attr(e,"type_text")}function create_default_date_range(e,t,i){var n=jQuery("#date_format").val();return create_option_container(jQuery('<label class="fm-field-label" for="default_date_start">Default range</label>'),jQuery('<input type="text" class="fm-width-40" id="default_date_start" placeholder="'+n+"\" onFocusOut=\"change_hidden_input_value_range(this.value, 'default_date', 'start', "+e+", '"+e+'_default_date_id_temp_start\')" value="'+t+'" />-<input type="text" class="fm-width-40" id="default_date_end" placeholder="'+n+"\" onFocusOut=\"change_hidden_input_value_range(this.value, 'default_date', 'end', "+e+", '"+e+'_default_date_id_temp_end\')" value="'+i+'" />'))}function change_hidden_input_value_range(element_value,date_fields,start_end,id_int,id,new_element_value){if(void 0===new_element_value)var new_element_value=element_value;var date_format=jQuery("#"+id_int+"_buttonform_id_temp").attr("format");document.getElementById(id).value=new_element_value;var element_value_new=element_value;if("default_date"==date_fields)if("start"==start_end)if("today"==element_value)jQuery("#"+id_int+"_elementform_id_temp0").datepicker("setDate",new Date),jQuery("#"+id_int+"_elementform_id_temp1").datepicker("option","minDate",new Date);else if(-1==element_value.indexOf("d")&&-1==element_value.indexOf("m")&&-1==element_value.indexOf("y")&&-1==element_value.indexOf("w"))if(""!==element_value)jQuery("#"+id_int+"_elementform_id_temp0").datepicker("setDate",element_value),jQuery("#"+id_int+"_elementform_id_temp1").datepicker("option","minDate",element_value);else{jQuery("#"+id_int+"_elementform_id_temp0").datepicker("setDate",element_value),date_fields="minDate";var element_value=jQuery("#min_date").val();change_hidden_input_value_range(element_value,date_fields,start_end,id_int,id,element_value_new)}else jQuery("#"+id_int+"_elementform_id_temp0").datepicker("setDate",element_value),jQuery("#"+id_int+"_elementform_id_temp1").datepicker("option","minDate",element_value);else"today"==element_value?(jQuery("#"+id_int+"_elementform_id_temp1").datepicker("setDate",new Date),jQuery("#"+id_int+"_elementform_id_temp0").datepicker("option","maxDate",new Date)):-1==element_value.indexOf("d")&&-1==element_value.indexOf("m")&&-1==element_value.indexOf("y")&&-1==element_value.indexOf("w")?""!==element_value?(jQuery("#"+id_int+"_elementform_id_temp1").datepicker("setDate",element_value),jQuery("#"+id_int+"_elementform_id_temp0").datepicker("option","maxDate",new Date(element_value))):(jQuery("#"+id_int+"_elementform_id_temp1").datepicker("setDate",element_value),date_fields="maxDate",element_value=jQuery("#max_date").val(),change_hidden_input_value_range(element_value,date_fields,start_end,id_int,id,element_value_new)):(jQuery("#"+id_int+"_elementform_id_temp1").datepicker("setDate",element_value),jQuery("#"+id_int+"_elementform_id_temp0").datepicker("option","maxDate",element_value));"minDate"!=date_fields&&"maxDate"!=date_fields||("today"==element_value?("minDate"==date_fields&&""==jQuery("#default_date_start").val()&&(jQuery("#"+id_int+"_elementform_id_temp0").datepicker("option",date_fields,new Date),jQuery("#"+id_int+"_elementform_id_temp1").datepicker("option",date_fields,new Date)),"minDate"==date_fields&&""!=jQuery("#default_date_start").val()&&(jQuery("#"+id_int+"_elementform_id_temp0").datepicker("option",date_fields,new Date),element_value=jQuery("#default_date_start").val(),date_fields="default_date",start_end="start",change_hidden_input_value_range(element_value,date_fields,start_end,id_int,id,element_value_new)),"maxDate"==date_fields&&""==jQuery("#default_date_end").val()&&(jQuery("#"+id_int+"_elementform_id_temp0").datepicker("option",date_fields,new Date),jQuery("#"+id_int+"_elementform_id_temp1").datepicker("option",date_fields,new Date)),"maxDate"==date_fields&&""!=jQuery("#default_date_end").val()&&(jQuery("#"+id_int+"_elementform_id_temp1").datepicker("option",date_fields,new Date),element_value=jQuery("#default_date_end").val(),date_fields="default_date",start_end="end",change_hidden_input_value_range(element_value,date_fields,start_end,id_int,id,element_value_new))):(-1==element_value.indexOf("d")&&-1==element_value.indexOf("m")&&-1==element_value.indexOf("w")&&-1==element_value.indexOf("y")&&""!==element_value&&(element_value=jQuery.datepicker.formatDate(date_format,new Date(element_value))),("minDate"==date_fields&&""==jQuery("#default_date_start").val()||"maxDate"==date_fields&&""==jQuery("#default_date_end").val())&&(jQuery("#"+id_int+"_elementform_id_temp0").datepicker("option",date_fields,element_value),jQuery("#"+id_int+"_elementform_id_temp1").datepicker("option",date_fields,element_value)),"minDate"==date_fields&&""!=jQuery("#default_date_start").val()&&(jQuery("#"+id_int+"_elementform_id_temp0").datepicker("option",date_fields,element_value),element_value=jQuery("#default_date_start").val(),date_fields="default_date",start_end="start",change_hidden_input_value_range(element_value,date_fields,start_end,id_int,id,element_value_new)),"maxDate"==date_fields&&""!=jQuery("#default_date_end").val()&&(jQuery("#"+id_int+"_elementform_id_temp1").datepicker("option",date_fields,element_value),element_value=jQuery("#default_date_end").val(),date_fields="default_date",start_end="end",change_hidden_input_value_range(element_value,date_fields,start_end,id_int,id,element_value_new)))),"invalide_date"==date_fields&&jQuery("input[id^="+id_int+"_elementform_id_temp]").datepicker("option","beforeShowDay",function(date){for(var invalid_dates=element_value,invalid_dates_finish=[],invalid_dates_start=invalid_dates.split(","),invalid_date_range=[],i=0;i<invalid_dates_start.length;i++)if(invalid_dates_start[i]=invalid_dates_start[i].trim(),invalid_dates_start[i].length<11)invalid_dates_finish.push(invalid_dates_start[i]);else if(4<invalid_dates_start[i].indexOf("-"))invalid_date_range.push(invalid_dates_start[i].split("-"));else{var invalid_date_array=invalid_dates_start[i].split("-"),start_invalid_day=invalid_date_array[0]+"-"+invalid_date_array[1]+"-"+invalid_date_array[2],end_invalid_day=invalid_date_array[3]+"-"+invalid_date_array[4]+"-"+invalid_date_array[5];invalid_date_range.push([start_invalid_day,end_invalid_day])}jQuery.each(invalid_date_range,function(e,t){for(var i=new Date(t[0]);i<=new Date(t[1]);i.setDate(i.getDate()+1))invalid_dates_finish.push(jQuery.datepicker.formatDate(date_format,i))});var w_hide_sunday="yes"==jQuery("#"+id_int+"_show_week_days").attr("sunday")?"true":"day != 0",w_hide_monday="yes"==jQuery("#"+id_int+"_show_week_days").attr("monday")?"true":"day != 1",w_hide_tuesday="yes"==jQuery("#"+id_int+"_show_week_days").attr("tuesday")?"true":"day != 2",w_hide_wednesday="yes"==jQuery("#"+id_int+"_show_week_days").attr("wednesday")?"true":"day != 3",w_hide_thursday="yes"==jQuery("#"+id_int+"_show_week_days").attr("thursday")?"true":"day != 4",w_hide_friday="yes"==jQuery("#"+id_int+"_show_week_days").attr("friday")?"true":"day != 5",w_hide_saturday="yes"==jQuery("#"+id_int+"_show_week_days").attr("saturday")?"true":"day != 6",day=date.getDay(),string_days=jQuery.datepicker.formatDate(date_format,date);return[-1==invalid_dates_finish.indexOf(string_days)&&eval(w_hide_sunday)&&eval(w_hide_monday)&&eval(w_hide_tuesday)&&eval(w_hide_wednesday)&&eval(w_hide_thursday)&&eval(w_hide_friday)&&eval(w_hide_saturday)]})}function go_to_type_date_range(e){w_attr_name=[],w_attr_value=[],w_show_days=["yes","yes","yes","yes","yes","yes","yes"],type_date_range(e,"Date range","","top","no","","","no","no","","mm/dd/yy","0","","","","","",w_show_days,"yes","...",w_attr_name,w_attr_value,"no")}function type_date_range(i,w_field_label,w_field_label_size,w_field_label_pos,w_hide_label,w_size,w_date,w_required,w_show_image,w_class,w_format,w_start_day,w_default_date_start,w_default_date_end,w_min_date,w_max_date,w_invalid_dates,w_show_days,w_hide_time,w_but_val,w_attr_name,w_attr_value,w_disable_past_days){jQuery("#element_type").val("type_date_range"),delete_last_child();var t=jQuery("#edit_table"),edit_div=jQuery('<div id="edit_div"></div>');t.append(edit_div);var edit_main_table=jQuery('<div id="edit_main_table"></div>');edit_div.append(edit_main_table),edit_main_table.append(create_field_type("type_date_range")),edit_main_table.append(create_label(i,w_field_label)),edit_main_table.append(create_label_position(i,w_field_label_pos)),edit_main_table.append(create_hide_label(i,w_hide_label)),edit_main_table.append(create_required(i,w_required)),edit_main_table.append(create_field_size(i,w_size,"'"+i+"_elementform_id_temp0'","'"+i+"_elementform_id_temp1'")),edit_main_table.append(create_date_format(i,w_format)),edit_main_table.append(create_week_start(i,w_start_day));var advanced_options_container=jQuery('<div class="inside"></div>');edit_main_table.append(create_advanced_options_container(advanced_options_container)),advanced_options_container.append(create_default_date_range(i,w_default_date_start,w_default_date_end)),advanced_options_container.append(create_minimum_date(i,w_min_date,!0)),advanced_options_container.append(create_maximum_date(i,w_max_date,!0)),advanced_options_container.append(create_excluded_dates(i,w_invalid_dates,!0)),advanced_options_container.append(create_selectable_week_days(i,w_show_days)),advanced_options_container.append(create_field_label_size(i,w_field_label_size)),advanced_options_container.append(create_class(i,w_class)),advanced_options_container.append(create_show_date_picker_button(i,w_show_image,"date_range")),advanced_options_container.append(create_additional_attributes(i,w_attr_name,"type_date_range"));var adding_type=document.createElement("input");adding_type.setAttribute("type","hidden"),adding_type.setAttribute("value","type_date_range"),adding_type.setAttribute("name",i+"_typeform_id_temp"),adding_type.setAttribute("id",i+"_typeform_id_temp");var adding_required=document.createElement("input");adding_required.setAttribute("type","hidden"),adding_required.setAttribute("value",w_required),adding_required.setAttribute("name",i+"_requiredform_id_temp"),adding_required.setAttribute("id",i+"_requiredform_id_temp");var adding_hide_label=document.createElement("input");adding_hide_label.setAttribute("type","hidden"),adding_hide_label.setAttribute("value",w_hide_label),adding_hide_label.setAttribute("name",i+"_hide_labelform_id_temp"),adding_hide_label.setAttribute("id",i+"_hide_labelform_id_temp");var adding_dis_past_days=document.createElement("input");adding_dis_past_days.setAttribute("type","hidden"),adding_dis_past_days.setAttribute("value",w_disable_past_days),adding_dis_past_days.setAttribute("id",i+"_dis_past_daysform_id_temp"),adding_dis_past_days.setAttribute("name",i+"_dis_past_daysform_id_temp");var adding_start_day=document.createElement("input");adding_start_day.setAttribute("type","hidden"),adding_start_day.setAttribute("value",w_start_day),adding_start_day.setAttribute("name",i+"_start_dayform_id_temp"),adding_start_day.setAttribute("id",i+"_start_dayform_id_temp");var adding_default_date_start=document.createElement("input");adding_default_date_start.setAttribute("type","hidden"),adding_default_date_start.setAttribute("name",i+"_default_date_id_temp_start"),adding_default_date_start.setAttribute("id",i+"_default_date_id_temp_start"),adding_default_date_start.setAttribute("value",w_default_date_start);var adding_default_date_end=document.createElement("input");adding_default_date_end.setAttribute("type","hidden"),adding_default_date_end.setAttribute("name",i+"_default_date_id_temp_end"),adding_default_date_end.setAttribute("id",i+"_default_date_id_temp_end"),adding_default_date_end.setAttribute("value",w_default_date_end);var adding_min_date=document.createElement("input");adding_min_date.setAttribute("type","hidden"),adding_min_date.setAttribute("name",i+"_min_date_id_temp"),adding_min_date.setAttribute("id",i+"_min_date_id_temp"),adding_min_date.setAttribute("value",w_min_date);var adding_max_date=document.createElement("input");adding_max_date.setAttribute("type","hidden"),adding_max_date.setAttribute("name",i+"_max_date_id_temp"),adding_max_date.setAttribute("id",i+"_max_date_id_temp"),adding_max_date.setAttribute("value",w_max_date);var adding_invalid_dates=document.createElement("input");adding_invalid_dates.setAttribute("type","hidden"),adding_invalid_dates.setAttribute("name",i+"_invalid_dates_id_temp"),adding_invalid_dates.setAttribute("id",i+"_invalid_dates_id_temp"),adding_invalid_dates.setAttribute("value",w_invalid_dates);var adding_show_days=document.createElement("input");adding_show_days.setAttribute("type","hidden"),adding_show_days.setAttribute("name",i+"_show_week_days"),adding_show_days.setAttribute("id",i+"_show_week_days"),adding_show_days.setAttribute("sunday",w_show_days[0]),adding_show_days.setAttribute("monday",w_show_days[1]),adding_show_days.setAttribute("tuesday",w_show_days[2]),adding_show_days.setAttribute("wednesday",w_show_days[3]),adding_show_days.setAttribute("thursday",w_show_days[4]),adding_show_days.setAttribute("friday",w_show_days[5]),adding_show_days.setAttribute("saturday",w_show_days[6]);var adding_show_image=document.createElement("input");adding_show_image.setAttribute("type","hidden"),adding_show_image.setAttribute("value",w_show_image),adding_show_image.setAttribute("name",i+"_show_imageform_id_temp"),adding_show_image.setAttribute("id",i+"_show_imageform_id_temp");var adding_hide_time=document.createElement("input");adding_hide_time.setAttribute("type","hidden"),adding_hide_time.setAttribute("value",w_hide_time),adding_hide_time.setAttribute("name",i+"_hide_timeform_id_temp"),adding_hide_time.setAttribute("id",i+"_hide_timeform_id_temp");var div=document.createElement("div");div.setAttribute("id","main_div");var div_field=document.createElement("div");div_field.setAttribute("id",i+"_elemet_tableform_id_temp");var display_label_div="yes"==w_hide_label?"none":"table-cell",div_label=document.createElement("div");div_label.setAttribute("align","left"),div_label.style.display=display_label_div,div_label.style.width=w_field_label_size+"px",div_label.setAttribute("id",i+"_label_sectionform_id_temp");var div_element=document.createElement("div");div_element.setAttribute("align","left"),div_element.style.display="table-cell",div_element.style.position="relative",div_element.setAttribute("id",i+"_element_sectionform_id_temp");var table_date=document.createElement("div");table_date.setAttribute("id",i+"_table_date"),table_date.style.display="table";var tr_date1=document.createElement("div");tr_date1.setAttribute("id",i+"_tr_date1"),tr_date1.style.display="table-row";var tr_date2=document.createElement("div");tr_date2.setAttribute("id",i+"_tr_date2"),tr_date2.style.display="table-row";var td_date_input1=document.createElement("div");td_date_input1.setAttribute("id",i+"_td_date_input1"),td_date_input1.style.display="table-cell";var td_date_input2=document.createElement("div");td_date_input2.setAttribute("id",i+"_td_date_input2"),td_date_input2.style.display="table-cell";var td_date_input3=document.createElement("div");td_date_input3.setAttribute("id",i+"_td_date_input3"),td_date_input3.style.display="table-cell";var td_date_label1=document.createElement("div");td_date_label1.setAttribute("id",i+"_td_date_label1"),td_date_label1.style.display="table-cell";var td_date_label2=document.createElement("div");td_date_label2.setAttribute("id",i+"_td_date_label2"),td_date_label2.style.display="table-cell";var td_date_label3=document.createElement("div");td_date_label3.setAttribute("id",i+"_td_date_label3"),td_date_label3.style.display="table-cell";var br3=document.createElement("br"),br4=document.createElement("br"),label=document.createElement("span");label.setAttribute("id",i+"_element_labelform_id_temp"),label.innerHTML=w_field_label,label.setAttribute("class","label"),label.style.verticalAlign="top";var required=document.createElement("span");required.setAttribute("id",i+"_required_elementform_id_temp"),required.innerHTML="",required.setAttribute("class","required"),required.style.verticalAlign="top","yes"==w_required&&(required.innerHTML=" *");var adding_desc_p=document.createElement("p"),adding_desc_b=document.createElement("b"),text_format_1=document.createTextNode("The format can be combinations of the following:"),text_format_2=document.createTextNode("d - day of month (no leading zero)"),text_format_3=document.createTextNode("dd - day of month (two digit)"),text_format_4=document.createTextNode("o - day of the year (no leading zeros)"),text_format_5=document.createTextNode("oo - day of the year (three digit)"),text_format_6=document.createTextNode("D - day name short"),text_format_7=document.createTextNode("DD - day name long"),text_format_8=document.createTextNode("m - month of year (no leading zero)"),text_format_9=document.createTextNode("mm - month of year (two digit)"),text_format_10=document.createTextNode("M - month name short"),text_format_11=document.createTextNode("MM - month name long"),text_format_12=document.createTextNode("y - year (two digit)"),text_format_13=document.createTextNode("yy - year (four digit)"),format_br_1=document.createElement("br"),format_br_2=document.createElement("br"),format_br_3=document.createElement("br"),format_br_4=document.createElement("br"),format_br_5=document.createElement("br"),format_br_6=document.createElement("br"),format_br_7=document.createElement("br"),format_br_8=document.createElement("br"),format_br_9=document.createElement("br"),format_br_10=document.createElement("br"),format_br_11=document.createElement("br"),format_br_12=document.createElement("br"),format_br_13=document.createElement("br"),adding_desc_p_2=document.createElement("p"),adding_desc_b_2=document.createElement("b"),text_default_1=document.createTextNode("Accepted values of Default, Minimum and Maximum:"),text_default_2=document.createTextNode("Empty: No default / minimum / maximum"),text_default_4=document.createTextNode("Current date : 'today'"),text_default_5=document.createTextNode("Relative date: A number of days/weeks/months/years from today, e.g. '-1d' will be yesterday, '+1y+3m+2w+3d' will be 1 year, 3 months, 2 weeks and 3 days from today."),default_br_1=document.createElement("br"),default_br_2=document.createElement("br"),default_br_4=document.createElement("br"),default_br_6=document.createElement("br"),default_br_7=document.createElement("br"),adding_desc_p_3=document.createElement("p"),adding_desc_b_3=document.createElement("b"),text_default_6=document.createTextNode("Dates to exclude:"),text_default_7=document.createTextNode("Enter comma-separated list of dates and date ranges using the date format 'mm/dd/yy', e.g. 08/15/2016, 06/15/2016-06/20/2016"),adding_0=document.createElement("input");adding_0.setAttribute("type","text"),adding_0.setAttribute("value",w_default_date_start),adding_0.setAttribute("id",i+"_elementform_id_temp0"),adding_0.setAttribute("name",i+"_elementform_id_temp0"),adding_0.style.cssText="width:"+w_size+"px;",adding_0.setAttribute("onChange","change_value_range('"+i+"_elementform_id_temp1', 'minDate', this.value)");var adding_1=document.createElement("input");adding_1.setAttribute("type","text"),adding_1.setAttribute("value",w_default_date_end),adding_1.setAttribute("id",i+"_elementform_id_temp1"),adding_1.setAttribute("name",i+"_elementform_id_temp1"),adding_1.style.cssText="width:"+w_size+"px;",adding_1.setAttribute("onChange","change_value_range('"+i+"_elementform_id_temp0', 'maxDate', this.value)");var adding_from=document.createTextNode("-"),adding_image_start=document.createElement("span");adding_image_start.setAttribute("id",i+"_show_imagedateform_id_temp0"),adding_image_start.setAttribute("class","dashicons dashicons-calendar-alt wd-calendar-button "+("yes"==w_show_image?"wd-inline-block":"wd-hidden")),adding_image_start.setAttribute("onClick","show_datepicker('"+i+"_elementform_id_temp0')");var adding_image_end=document.createElement("span");adding_image_end.setAttribute("id",i+"_show_imagedateform_id_temp1"),adding_image_end.setAttribute("class","dashicons dashicons-calendar-alt wd-calendar-button "+("yes"==w_show_image?"wd-inline-block":"wd-hidden")),adding_image_end.setAttribute("onClick","show_datepicker('"+i+"_elementform_id_temp1')");var dis_past_days="yes"==w_disable_past_days,adding_button=document.createElement("input");adding_button.setAttribute("id",i+"_buttonform_id_temp"),adding_button.setAttribute("class","button"),adding_button.setAttribute("type","hidden"),adding_button.setAttribute("value",w_but_val),adding_button.setAttribute("format",w_format);var main_td=document.getElementById("show_table"),w_min_date_start,w_max_date_end;adding_desc_b.appendChild(text_format_1),adding_desc_p.appendChild(adding_desc_b),adding_desc_p.appendChild(format_br_1),adding_desc_p.appendChild(text_format_2),adding_desc_p.appendChild(format_br_2),adding_desc_p.appendChild(text_format_3),adding_desc_p.appendChild(format_br_3),adding_desc_p.appendChild(text_format_4),adding_desc_p.appendChild(format_br_4),adding_desc_p.appendChild(text_format_5),adding_desc_p.appendChild(format_br_5),adding_desc_p.appendChild(text_format_6),adding_desc_p.appendChild(format_br_6),adding_desc_p.appendChild(text_format_7),adding_desc_p.appendChild(format_br_7),adding_desc_p.appendChild(text_format_8),adding_desc_p.appendChild(format_br_8),adding_desc_p.appendChild(text_format_9),adding_desc_p.appendChild(format_br_9),adding_desc_p.appendChild(text_format_10),adding_desc_p.appendChild(format_br_10),adding_desc_p.appendChild(text_format_11),adding_desc_p.appendChild(format_br_11),adding_desc_p.appendChild(text_format_12),adding_desc_p.appendChild(format_br_12),adding_desc_p.appendChild(text_format_13),adding_desc_p.appendChild(format_br_13),adding_desc_b_2.appendChild(text_default_1),adding_desc_p_2.appendChild(adding_desc_b_2),adding_desc_p_2.appendChild(default_br_1),adding_desc_p_2.appendChild(text_default_2),adding_desc_p_2.appendChild(default_br_2),adding_desc_p_2.appendChild(text_default_4),adding_desc_p_2.appendChild(default_br_4),adding_desc_p_2.appendChild(text_default_5),adding_desc_b_3.appendChild(text_default_6),adding_desc_p_3.appendChild(adding_desc_b_3),adding_desc_p_3.appendChild(default_br_6),adding_desc_p_3.appendChild(text_default_7),adding_desc_p_3.appendChild(default_br_7),div_label.appendChild(label),div_label.appendChild(required),div_element.appendChild(adding_type),div_element.appendChild(adding_required),div_element.appendChild(adding_hide_label),div_element.appendChild(adding_show_image),div_element.appendChild(adding_dis_past_days),div_element.appendChild(adding_0),div_element.appendChild(adding_image_start),div_element.appendChild(adding_from),div_element.appendChild(adding_1),div_element.appendChild(adding_image_end),div_element.appendChild(adding_start_day),div_element.appendChild(adding_default_date_start),div_element.appendChild(adding_default_date_end),div_element.appendChild(adding_min_date),div_element.appendChild(adding_max_date),div_element.appendChild(adding_invalid_dates),div_element.appendChild(adding_hide_time),div_element.appendChild(adding_show_days),div_element.appendChild(adding_button),div_field.appendChild(div_label),div_field.appendChild(div_element),div.appendChild(div_field),div.appendChild(br3),div.appendChild(adding_desc_p),div.appendChild(adding_desc_p_2),div.appendChild(adding_desc_p_3),main_td.appendChild(div),"top"==w_field_label_pos&&label_top(i),change_class(w_class,i),refresh_attr(i,"type_range"),w_min_date_start=w_default_date_start&&"today"!=w_default_date_start?w_default_date_start:"today"==w_default_date_start?jQuery.datepicker.formatDate(w_format,new Date):w_min_date,"today"==w_default_date_start?jQuery("#"+i+"_elementform_id_temp0").datepicker("setDate",new Date):(-1==w_default_date_start.indexOf("d")&&-1==w_default_date_start.indexOf("m")&&-1==w_default_date_start.indexOf("y")&&-1==w_default_date_start.indexOf("w")&&""!==w_default_date_start&&(w_default_date_start=jQuery.datepicker.formatDate(w_format,new Date(w_default_date_start))),jQuery("#"+i+"_elementform_id_temp0").datepicker("setDate",w_default_date_start)),w_max_date_end=w_default_date_end&&"today"!=w_default_date_end?w_default_date_end:"today"==w_default_date_end?jQuery.datepicker.formatDate(w_format,new Date):w_max_date,"today"==w_default_date_end?jQuery("#"+i+"_elementform_id_temp1").datepicker("setDate",new Date):(-1==w_default_date_end.indexOf("d")&&-1==w_default_date_end.indexOf("m")&&-1==w_default_date_end.indexOf("y")&&-1==w_default_date_end.indexOf("w")&&""!==w_default_date_end&&(w_default_date_end=jQuery.datepicker.formatDate(w_format,new Date(w_default_date_end))),jQuery("#"+i+"_elementform_id_temp1").datepicker("setDate",w_default_date_end)),jQuery("#"+i+"_elementform_id_temp0").datepicker({dateFormat:w_format,minDate:w_min_date,maxDate:w_max_date,firstDay:w_start_day,setDate:w_default_date_start,changeMonth:!0,changeYear:!0,yearRange:"-100:+50",showOtherMonths:!0,selectOtherMonths:!0,beforeShowDay:function(date){for(var invalid_dates=w_invalid_dates,invalid_dates_finish=[],invalid_dates_start=invalid_dates.split(","),invalid_date_range=[],i=0;i<invalid_dates_start.length;i++)if(invalid_dates_start[i]=invalid_dates_start[i].trim(),invalid_dates_start[i].length<11)invalid_dates_finish.push(invalid_dates_start[i]);else if(4<invalid_dates_start[i].indexOf("-"))invalid_date_range.push(invalid_dates_start[i].split("-"));else{var invalid_date_array=invalid_dates_start[i].split("-"),start_invalid_day=invalid_date_array[0]+"-"+invalid_date_array[1]+"-"+invalid_date_array[2],end_invalid_day=invalid_date_array[3]+"-"+invalid_date_array[4]+"-"+invalid_date_array[5];invalid_date_range.push([start_invalid_day,end_invalid_day])}jQuery.each(invalid_date_range,function(e,t){for(var i=new Date(t[0]);i<=new Date(t[1]);i.setDate(i.getDate()+1))invalid_dates_finish.push(jQuery.datepicker.formatDate(w_format,i))});var string_days=jQuery.datepicker.formatDate(w_format,date),day=date.getDay(),w_hide_sunday="yes"==w_show_days[0]?"true":"day != 0",w_hide_monday="yes"==w_show_days[1]?"true":"day != 1",w_hide_tuesday="yes"==w_show_days[2]?"true":"day != 2",w_hide_wednesday="yes"==w_show_days[3]?"true":"day != 3",w_hide_thursday="yes"==w_show_days[4]?"true":"day != 4",w_hide_friday="yes"==w_show_days[5]?"true":"day != 5",w_hide_saturday="yes"==w_show_days[6]?"true":"day != 6";return[-1==invalid_dates_finish.indexOf(string_days)&&eval(w_hide_sunday)&&eval(w_hide_monday)&&eval(w_hide_tuesday)&&eval(w_hide_wednesday)&&eval(w_hide_thursday)&&eval(w_hide_friday)&&eval(w_hide_saturday)]}}),jQuery("#"+i+"_elementform_id_temp0").datepicker("option","dateFormat",w_format),jQuery("#"+i+"_elementform_id_temp1").datepicker({dateFormat:w_format,minDate:w_min_date,maxDate:w_max_date,firstDay:w_start_day,setDate:w_default_date_end,changeMonth:!0,changeYear:!0,yearRange:"-100:+50",showOtherMonths:!0,selectOtherMonths:!0,beforeShowDay:function(date){for(var invalid_dates=w_invalid_dates,invalid_dates_finish=[],invalid_dates_start=invalid_dates.split(","),invalid_date_range=[],i=0;i<invalid_dates_start.length;i++)if(invalid_dates_start[i]=invalid_dates_start[i].trim(),invalid_dates_start[i].length<11)invalid_dates_finish.push(invalid_dates_start[i]);else if(4<invalid_dates_start[i].indexOf("-"))invalid_date_range.push(invalid_dates_start[i].split("-"));else{var invalid_date_array=invalid_dates_start[i].split("-"),start_invalid_day=invalid_date_array[0]+"-"+invalid_date_array[1]+"-"+invalid_date_array[2],end_invalid_day=invalid_date_array[3]+"-"+invalid_date_array[4]+"-"+invalid_date_array[5];invalid_date_range.push([start_invalid_day,end_invalid_day])}jQuery.each(invalid_date_range,function(e,t){for(var i=new Date(t[0]);i<=new Date(t[1]);i.setDate(i.getDate()+1))invalid_dates_finish.push(jQuery.datepicker.formatDate(w_format,i))});var string_days=jQuery.datepicker.formatDate(w_format,date),day=date.getDay(),w_hide_sunday="yes"==w_show_days[0]?"true":"day != 0",w_hide_monday="yes"==w_show_days[1]?"true":"day != 1",w_hide_tuesday="yes"==w_show_days[2]?"true":"day != 2",w_hide_wednesday="yes"==w_show_days[3]?"true":"day != 3",w_hide_thursday="yes"==w_show_days[4]?"true":"day != 4",w_hide_friday="yes"==w_show_days[5]?"true":"day != 5",w_hide_saturday="yes"==w_show_days[6]?"true":"day != 6";return[-1==invalid_dates_finish.indexOf(string_days)&&eval(w_hide_sunday)&&eval(w_hide_monday)&&eval(w_hide_tuesday)&&eval(w_hide_wednesday)&&eval(w_hide_thursday)&&eval(w_hide_friday)&&eval(w_hide_saturday)]}}),jQuery("#"+i+"_elementform_id_temp1").datepicker("option","dateFormat",w_format)}function create_star_amount(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_star_size">Number of Stars</label>'),jQuery('<input class="fm-width-100" type="text" id="edit_for_star_size" onKeyPress="return check_isnum(event)" onKeyUp="change_star_amount(this.value, '+e+", 'form_id_temp')\" value=\""+t+'" />'))}function change_star_amount(e,t,i){var n=document.getElementById(t+"_element_sectionform_id_temp"),a=document.getElementById(t+"_elementform_id_temp");n.removeChild(a);var r=document.createElement("div");r.setAttribute("id",t+"_elementform_id_temp");for(var l=0;l<e;l++){var d=document.createElement("img");d.setAttribute("id",t+"_star_"+l),d.setAttribute("src",plugin_url+"/images/star.png"),d.setAttribute("onmouseover","change_src("+l+","+t+",'form_id_temp')"),d.setAttribute("onmouseout","reset_src("+l+","+t+")"),d.setAttribute("onclick","select_star_rating("+l+","+t+",'form_id_temp')"),r.appendChild(d)}n.appendChild(r),document.getElementById(t+"_star_amountform_id_temp").value=e}function create_star_color(e,t){var i=jQuery('<label class="fm-field-label">Star Color</label>'),n=jQuery('<select class="fm-width-100" id="edit_for_label_color" name="edit_for_label_color" onChange="label_color(this.value, '+e+')"></select>'),a=[];for(var r in a.yellow="Yellow",a.green="Green",a.blue="Blue",a.red="Red",a)if(a.hasOwnProperty(r)){var l=jQuery('<option value="'+r+'"'+(t==r?' selected="selected"':"")+">"+a[r]+"</option>");n.append(l)}return create_option_container(i,n)}function label_color(e,t){document.getElementById(t+"_star_colorform_id_temp").value=e}function go_to_type_star_rating(e){w_attr_name=[],w_attr_value=[],type_star_rating(e,"Star Rating","","top","no","yellow","5","no","wdform_star_rating",w_attr_name,w_attr_value)}function type_star_rating(e,t,i,n,a,r,l,d,_,o,s){jQuery("#element_type").val("type_star_rating"),delete_last_child();var m=jQuery("#edit_table"),u=jQuery('<div id="edit_div"></div>');m.append(u);var c=jQuery('<div id="edit_main_table"></div>');u.append(c),c.append(create_field_type("type_star_rating")),c.append(create_label(e,t)),c.append(create_label_position(e,n)),c.append(create_hide_label(e,a)),c.append(create_required(e,d)),c.append(create_star_amount(e,l)),c.append(create_star_color(e,r));var p=jQuery('<div class="inside"></div>');c.append(create_advanced_options_container(p)),p.append(create_field_label_size(e,i)),p.append(create_class(e,_)),p.append(create_additional_attributes(e,o,"type_star_rating"));var f=document.createElement("input");f.setAttribute("type","hidden"),f.setAttribute("value","type_star_rating"),f.setAttribute("name",e+"_typeform_id_temp"),f.setAttribute("id",e+"_typeform_id_temp");var h=document.createElement("input");h.setAttribute("type","hidden"),h.setAttribute("value",d),h.setAttribute("name",e+"_requiredform_id_temp"),h.setAttribute("id",e+"_requiredform_id_temp");var y=document.createElement("input");y.setAttribute("type","hidden"),y.setAttribute("value",a),y.setAttribute("name",e+"_hide_labelform_id_temp"),y.setAttribute("id",e+"_hide_labelform_id_temp");var b=document.createElement("input");b.setAttribute("type","hidden"),b.setAttribute("value",l),b.setAttribute("id",e+"_star_amountform_id_temp"),b.setAttribute("name",e+"_star_amountform_id_temp");var v=document.createElement("input");v.setAttribute("type","hidden"),v.setAttribute("value",r),v.setAttribute("name",e+"_star_colorform_id_temp"),v.setAttribute("id",e+"_star_colorform_id_temp");var g=document.createElement("div");g.setAttribute("id","main_div");var w=document.createElement("div");w.setAttribute("id",e+"_elemet_tableform_id_temp");var E="yes"==a?"none":"table-cell",A=document.createElement("div");A.setAttribute("align","left"),A.style.cssText="display:"+E+"; vertical-align:top; width:"+i+"px;",A.setAttribute("id",e+"_label_sectionform_id_temp");var x=document.createElement("div");x.setAttribute("align","left"),x.style.display="table-cell",x.setAttribute("id",e+"_element_sectionform_id_temp");var k=document.createElement("div");k.setAttribute("id",e+"_elementform_id_temp"),k.setAttribute("class","wdform_stars");var j=document.createElement("br"),C=document.createElement("span");C.setAttribute("id",e+"_element_labelform_id_temp"),C.innerHTML=t,C.setAttribute("class","label");var I=document.createElement("span");I.setAttribute("id",e+"_required_elementform_id_temp"),I.innerHTML="",I.setAttribute("class","required"),"yes"==d&&(I.innerHTML=" *");var B=document.getElementById("show_table");A.appendChild(C),A.appendChild(I),x.appendChild(y),x.appendChild(f),x.appendChild(h),x.appendChild(b),x.appendChild(v);for(var Q=0;Q<l;Q++){var T=document.createElement("img");T.setAttribute("id",e+"_star_"+Q),T.setAttribute("src",plugin_url+"/images/star.png"),T.setAttribute("onmouseover","change_src("+Q+","+e+",'form_id_temp')"),T.setAttribute("onmouseout","reset_src("+Q+","+e+")"),T.setAttribute("onclick","select_star_rating("+Q+","+e+",'form_id_temp')"),k.appendChild(T)}x.appendChild(k),w.appendChild(A),w.appendChild(x),g.appendChild(w),g.appendChild(j),B.appendChild(g),jQuery("#main_div").append(form_maker.type_stars_description),"top"==n&&label_top(e),change_class(_,e),refresh_attr(e,"type_star_rating")}function create_scale_amount(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_scale_amount">Scale Range</label>'),jQuery('<input class="fm-width-100" type="text" id="edit_for_scale_amount" onKeyPress="return check_isnum(event)" onKeyUp="change_scale_amount(this.value, '+e+", 'form_id_temp')\" value=\""+t+'" />'))}function change_scale_amount(e,t,i){var n=document.getElementById(t+"_scale_tableform_id_temp"),a=document.getElementById(t+"_elementform_id_temp");a.removeChild(n);var r=document.createElement("div");r.setAttribute("id",t+"_scale_tableform_id_temp"),r.style.cssText="display:inline-table;";var l=document.createElement("div");l.setAttribute("id",t+"_scale_tr1form_id_temp"),l.style.cssText="display:table-row;";var d=document.createElement("div");d.setAttribute("id",t+"_scale_tr2form_id_temp"),d.style.cssText="display:table-row;",r.appendChild(l);for(var _=1;_<=e;_++)adding_num=document.createElement("span"),adding_num.innerHTML=_,adding_td=document.createElement("div"),adding_td.setAttribute("id",t+"_scale_td1_"+_+"form_id_temp"),adding_td.style.cssText="text-align:center; display:table-cell;",adding_td.appendChild(adding_num),l.appendChild(adding_td);for(var o=1;o<=e;o++){var s=document.createElement("input");s.setAttribute("id",t+"_scale_radioform_id_temp_"+o),s.setAttribute("name",t+"_scale_radioform_id_temp"),s.setAttribute("value",o),s.setAttribute("type","radio");var m=document.createElement("div");m.setAttribute("id",t+"_scale_td2_"+o+"form_id_temp"),m.style.cssText=" display:table-cell;",m.appendChild(s),d.appendChild(m)}r.appendChild(d),a.insertBefore(r,a.childNodes[1]),document.getElementById(t+"_scale_amountform_id_temp").value=e}function go_to_type_scale_rating(e){w_attr_name=[],w_attr_value=[],w_mini_labels=["Worst","Best"],type_scale_rating(e,"Scale Rating","","top","no",w_mini_labels,"5","no","wdform_scale_rating",w_attr_name,w_attr_value)}function type_scale_rating(t,e,i,n,a,r,l,d,_,o,s){jQuery("#element_type").val("type_scale_rating"),delete_last_child();var m=jQuery("#edit_table"),u=jQuery('<div id="edit_div"></div>');m.append(u);var c=jQuery('<div id="edit_main_table"></div>');u.append(c),c.append(create_field_type("type_scale_rating")),c.append(create_label(t,e)),c.append(create_label_position(t,n)),c.append(create_hide_label(t,a)),c.append(create_required(t,d)),c.append(create_scale_amount(t,l));var p=jQuery('<div class="inside"></div>');c.append(create_advanced_options_container(p)),p.append(create_field_label_size(t,i)),p.append(create_class(t,_)),p.append(create_additional_attributes(t,o,"type_scale_rating"));var f=document.createElement("input");f.setAttribute("type","hidden"),f.setAttribute("value","type_scale_rating"),f.setAttribute("name",t+"_typeform_id_temp"),f.setAttribute("id",t+"_typeform_id_temp");var h=document.createElement("input");h.setAttribute("type","hidden"),h.setAttribute("value",d),h.setAttribute("name",t+"_requiredform_id_temp"),h.setAttribute("id",t+"_requiredform_id_temp");var y=document.createElement("input");y.setAttribute("type","hidden"),y.setAttribute("value",a),y.setAttribute("name",t+"_hide_labelform_id_temp"),y.setAttribute("id",t+"_hide_labelform_id_temp");var b=document.createElement("input");b.setAttribute("type","hidden"),b.setAttribute("value",l),b.setAttribute("id",t+"_scale_amountform_id_temp"),b.setAttribute("name",t+"_scale_amountform_id_temp");var v=document.createElement("div");v.setAttribute("id","main_div"),edit_labels=document.createTextNode("The labels of the fields are editable. Please, click on the label to edit.");var g=document.createElement("div");g.setAttribute("class","fm-editable-label"),g.appendChild(edit_labels);var w=document.createElement("div");w.setAttribute("id",t+"_elemet_tableform_id_temp");var E="yes"==a?"none":"table-cell",A=document.createElement("div");A.setAttribute("align","left"),A.style.cssText="display:"+E+"; vertical-align:top; width:"+i+"px;",A.setAttribute("id",t+"_label_sectionform_id_temp");var x=document.createElement("div");x.setAttribute("align","left"),x.style.display="table-cell",x.setAttribute("id",t+"_element_sectionform_id_temp");var k=document.createElement("div");k.setAttribute("id",t+"_elementform_id_temp");var j=document.createElement("div");j.setAttribute("id",t+"_scale_tableform_id_temp"),j.style.cssText="display:inline-table;";var C=document.createElement("div");C.setAttribute("id",t+"_scale_tr1form_id_temp"),C.style.display="table-row";var I=document.createElement("div");I.setAttribute("id",t+"_scale_tr2form_id_temp"),I.style.display="table-row";var B=document.createElement("br"),Q=document.createElement("span");Q.setAttribute("id",t+"_element_labelform_id_temp"),Q.innerHTML=e,Q.setAttribute("class","label");var T=document.createElement("label");T.setAttribute("class","mini_label"),T.setAttribute("id",t+"_mini_label_worst"),T.innerHTML=r[0],T.style.cssText="position:relative; top:6px; font-size:11px; display:inline-table;";var M=document.createElement("label");M.setAttribute("class","mini_label"),M.setAttribute("id",t+"_mini_label_best"),M.innerHTML=r[1],M.style.cssText="position:relative; top:6px; font-size:11px; display:inline-table;";var L=document.createElement("span");L.setAttribute("id",t+"_required_elementform_id_temp"),L.innerHTML="",L.setAttribute("class","required"),"yes"==d&&(L.innerHTML=" *");var z=document.getElementById("show_table");A.appendChild(Q),A.appendChild(L),x.appendChild(y),x.appendChild(f),x.appendChild(h),x.appendChild(b),k.appendChild(T),j.appendChild(C);for(var q=1;q<=l;q++)adding_num=document.createElement("span"),adding_num.innerHTML=q,adding_td=document.createElement("td"),adding_td.setAttribute("id",t+"_scale_td1_"+q+"form_id_temp"),adding_td.style.cssText="text-align:center;",adding_td.style.display="table-cell",adding_td.appendChild(adding_num),C.appendChild(adding_td);for(var S=1;S<=l;S++){var N=document.createElement("input");N.setAttribute("id",t+"_scale_radioform_id_temp_"+S),N.setAttribute("name",t+"_scale_radioform_id_temp"),N.setAttribute("value",S),N.setAttribute("type","radio");var H=document.createElement("div");H.setAttribute("id",t+"_scale_td2_"+S+"form_id_temp"),H.style.display="table-cell",H.appendChild(N),I.appendChild(H),j.appendChild(I),k.appendChild(j)}j.appendChild(I),k.appendChild(j),k.appendChild(M),x.appendChild(k),w.appendChild(A),w.appendChild(x),v.appendChild(w),v.appendChild(B),v.appendChild(g),z.appendChild(v),jQuery("#main_div").append("<br>"+form_maker.type_rating_description),"top"==n&&label_top(t),change_class(_,t),refresh_attr(t,"type_scale_rating"),jQuery(function(){jQuery("label#"+t+"_mini_label_worst").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' class='worst' size='6' style='outline:none; border:none; background:none; font-size:11px;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.worst").focus(),jQuery("input.worst").blur(function(){var e=jQuery(this).val();jQuery("#"+t+"_mini_label_worst").text(e)})}}),jQuery("label#"+t+"_mini_label_best").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' class='best' size='6' style='outline:none; border:none; background:none; font-size:11px;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.best").focus(),jQuery("input.best").blur(function(){var e=jQuery(this).val();jQuery("#"+t+"_mini_label_best").text(e)})}})})}function create_slider_minvalue(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_slider_min_value">Min Value</label>'),jQuery('<input class="fm-width-100" type="text" id="edit_for_slider_min_value" onKeyPress="return check_isnum_or_minus(event)" onKeyUp="change_slider_min_or_max_value(this.value, '+e+", 'form_id_temp', 'min')\" onChange=\"change_slider_min_value(this.value, "+e+", 'form_id_temp')\" value=\""+t+'" />'))}function change_slider_min_or_max_value(e,t,i,n){document.getElementById(t+"_element_"+n+"form_id_temp").innerHTML=e}function change_slider_min_value(a,id,form_id){document.getElementById(id+"_slider_min_valueform_id_temp").value=a,eval(a)>document.getElementById(id+"_element_valueform_id_temp").innerHTML?(document.getElementById(id+"_element_valueform_id_temp").innerHTML=a,document.getElementById(id+"_slider_valueform_id_temp").value=a,jQuery("#"+id+"_elementform_id_temp").slider({min:eval(a),slide:function(e,t){document.getElementById(id+"_element_valueform_id_temp").innerHTML=""+t.value,document.getElementById(id+"_slider_valueform_id_temp").value=""+t.value}})):jQuery("#"+id+"_elementform_id_temp").slider({min:eval(a),slide:function(e,t){document.getElementById(id+"_element_valueform_id_temp").innerHTML=""+t.value,document.getElementById(id+"_slider_valueform_id_temp").value=""+t.value}})}function create_slider_maxvalue(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_slider_max_value">Max Value</label>'),jQuery('<input class="fm-width-100" type="text" id="edit_for_slider_max_value" onKeyPress="return check_isnum_or_minus(event)" onKeyUp="change_slider_min_or_max_value(this.value, '+e+", 'form_id_temp', 'max')\" onChange=\"change_slider_max_value(this.value, "+e+", 'form_id_temp')\" value=\""+t+'" />'))}function change_slider_max_value(a,id,form_id){document.getElementById(id+"_slider_max_valueform_id_temp").value=a,eval(a)<parseInt(document.getElementById(id+"_slider_valueform_id_temp").value)?(document.getElementById(id+"_element_valueform_id_temp").innerHTML=a,document.getElementById(id+"_slider_valueform_id_temp").value=a,jQuery("#"+id+"_elementform_id_temp").slider({min:eval(document.getElementById(id+"_slider_min_valueform_id_temp").value),max:eval(a),value:eval(document.getElementById(id+"_slider_valueform_id_temp").value),slide:function(e,t){document.getElementById(id+"_element_valueform_id_temp").innerHTML=""+t.value,document.getElementById(id+"_slider_valueform_id_temp").value=""+t.value}})):jQuery("#"+id+"_elementform_id_temp").slider({min:eval(document.getElementById(id+"_slider_min_valueform_id_temp").value),max:eval(a),value:eval(document.getElementById(id+"_slider_valueform_id_temp").value),slide:function(e,t){document.getElementById(id+"_element_valueform_id_temp").innerHTML=""+t.value,document.getElementById(id+"_slider_valueform_id_temp").value=""+t.value}})}function create_slider_step(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_slider_step">Step</label>'),jQuery('<input class="fm-width-100" type="text" id="edit_for_slider_step" onKeyPress="return check_isnum(event)" onChange="change_slider_step(this.value, '+e+", 'form_id_temp')\" value=\""+t+'" />'))}function change_slider_step(a,id,form_id){jQuery("#"+id+"_elementform_id_temp").slider({step:eval(a)}),document.getElementById(id+"_slider_stepform_id_temp").value=a}function create_slider_width(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_slider_width">Width(px)</label>'),jQuery('<input class="fm-width-100" type="text" id="edit_for_slider_width" onKeyPress="return check_isnum(event)" onKeyUp="change_slider_width(this.value,'+e+",'form_id_temp')\" value=\""+t+'" /><p class="description">'+form_maker.leave_empty+"</p>"))}function change_slider_width(e,t,i){document.getElementById(t+"_elementform_id_temp").style.cssText="width:"+e+"px",document.getElementById(t+"_slider_table2form_id_temp").style.cssText="width:"+e+"px",document.getElementById(t+"_slider_widthform_id_temp").value=e}function go_to_type_slider(e){w_attr_name=[],w_attr_value=[],type_slider(e,"Slider","","top","no","","0","100","1","0","no","",w_attr_name,w_attr_value)}function type_slider(i,w_field_label,w_field_label_size,w_field_label_pos,w_hide_label,w_field_width,w_field_min_value,w_field_max_value,w_field_step,w_field_value,w_required,w_class,w_attr_name,w_attr_value){jQuery("#element_type").val("type_slider"),delete_last_child();var t=jQuery("#edit_table"),edit_div=jQuery('<div id="edit_div"></div>');t.append(edit_div);var edit_main_table=jQuery('<div id="edit_main_table"></div>');edit_div.append(edit_main_table),edit_main_table.append(create_field_type("type_slider")),edit_main_table.append(create_label(i,w_field_label)),edit_main_table.append(create_label_position(i,w_field_label_pos)),edit_main_table.append(create_hide_label(i,w_hide_label)),edit_main_table.append(create_required(i,w_required)),edit_main_table.append(create_slider_minvalue(i,w_field_min_value)),edit_main_table.append(create_slider_maxvalue(i,w_field_max_value)),edit_main_table.append(create_slider_step(i,w_field_step)),edit_main_table.append(create_slider_width(i,w_field_width));var advanced_options_container=jQuery('<div class="inside"></div>');edit_main_table.append(create_advanced_options_container(advanced_options_container)),advanced_options_container.append(create_field_label_size(i,w_field_label_size)),advanced_options_container.append(create_class(i,w_class)),advanced_options_container.append(create_additional_attributes(i,w_attr_name,"type_slider"));var adding_type=document.createElement("input");adding_type.setAttribute("type","hidden"),adding_type.setAttribute("value","type_slider"),adding_type.setAttribute("name",i+"_typeform_id_temp"),adding_type.setAttribute("id",i+"_typeform_id_temp");var adding_required=document.createElement("input");adding_required.setAttribute("type","hidden"),adding_required.setAttribute("value",w_required),adding_required.setAttribute("name",i+"_requiredform_id_temp"),adding_required.setAttribute("id",i+"_requiredform_id_temp");var adding_hide_label=document.createElement("input");adding_hide_label.setAttribute("type","hidden"),adding_hide_label.setAttribute("value",w_hide_label),adding_hide_label.setAttribute("name",i+"_hide_labelform_id_temp"),adding_hide_label.setAttribute("id",i+"_hide_labelform_id_temp");var adding_slider_min_value=document.createElement("input");adding_slider_min_value.setAttribute("type","hidden"),adding_slider_min_value.setAttribute("value",w_field_min_value),adding_slider_min_value.setAttribute("id",i+"_slider_min_valueform_id_temp"),adding_slider_min_value.setAttribute("name",i+"_slider_min_valueform_id_temp");var adding_slider_max_value=document.createElement("input");adding_slider_max_value.setAttribute("type","hidden"),adding_slider_max_value.setAttribute("value",w_field_max_value),adding_slider_max_value.setAttribute("id",i+"_slider_max_valueform_id_temp"),adding_slider_max_value.setAttribute("name",i+"_slider_max_valueform_id_temp");var adding_slider_step=document.createElement("input");adding_slider_step.setAttribute("type","hidden"),adding_slider_step.setAttribute("value",w_field_step),adding_slider_step.setAttribute("id",i+"_slider_stepform_id_temp"),adding_slider_step.setAttribute("name",i+"_slider_stepform_id_temp");var adding_slider_value=document.createElement("input");adding_slider_value.setAttribute("type","hidden"),adding_slider_value.setAttribute("value",w_field_value),adding_slider_value.setAttribute("id",i+"_slider_valueform_id_temp"),adding_slider_value.setAttribute("name",i+"_slider_valueform_id_temp");var adding_slider_width=document.createElement("input");adding_slider_width.setAttribute("type","hidden"),adding_slider_width.setAttribute("value",w_field_width),adding_slider_width.setAttribute("name",i+"_slider_widthform_id_temp"),adding_slider_width.setAttribute("id",i+"_slider_widthform_id_temp");var adding_slider_div=document.createElement("div");adding_slider_div.style.cssText="width:"+w_field_width+"px",adding_slider_div.setAttribute("name",i+"_elementform_id_temp"),adding_slider_div.setAttribute("id",i+"_elementform_id_temp");var div=document.createElement("div");div.setAttribute("id","main_div");var div_field=document.createElement("div");div_field.setAttribute("id",i+"_elemet_tableform_id_temp");var display_label_div="yes"==w_hide_label?"none":"table-cell",div_label=document.createElement("div");div_label.setAttribute("align","left"),div_label.style.cssText="display:"+display_label_div+"; vertical-align:top; width:"+w_field_label_size+"px;",div_label.setAttribute("id",i+"_label_sectionform_id_temp");var div_element=document.createElement("div");div_element.setAttribute("align","left"),div_element.style.display="table-cell",div_element.setAttribute("id",i+"_element_sectionform_id_temp");var slider_table=document.createElement("div");slider_table.setAttribute("id",i+"_slider_tableform_id_temp");var slider_tr1=document.createElement("div"),slider_tr2=document.createElement("div");slider_tr2.setAttribute("id",i+"_slider_table2form_id_temp"),slider_tr2.style.cssText="width:"+w_field_width+"px";var slider_td1=document.createElement("div");slider_td1.setAttribute("id",i+"_slider_td1form_id_temp");var slider_td2=document.createElement("div");slider_td2.setAttribute("align","left"),slider_td2.setAttribute("id",i+"_slider_td2form_id_temp"),slider_td2.style.cssText="display:inline-table; width:33.3%; text-align:left;";var slider_td3=document.createElement("div");slider_td3.setAttribute("align","right"),slider_td3.setAttribute("id",i+"_slider_td3form_id_temp"),slider_td3.style.cssText="display:inline-table; width:33.3%; text-align:center;";var slider_td4=document.createElement("div");slider_td4.setAttribute("align","right"),slider_td4.setAttribute("id",i+"_slider_td4form_id_temp"),slider_td4.style.cssText="display:inline-table; width:33.3%; text-align:right; ";var br1=document.createElement("br"),label=document.createElement("span");label.setAttribute("id",i+"_element_labelform_id_temp"),label.innerHTML=w_field_label,label.setAttribute("class","label");var required=document.createElement("span");required.setAttribute("id",i+"_required_elementform_id_temp"),required.innerHTML="",required.setAttribute("class","required"),"yes"==w_required&&(required.innerHTML=" *");var main_td=document.getElementById("show_table");div_label.appendChild(label),div_label.appendChild(required),div_element.appendChild(adding_hide_label),div_element.appendChild(adding_type),div_element.appendChild(adding_required),div_element.appendChild(adding_slider_width),div_element.appendChild(adding_slider_min_value),div_element.appendChild(adding_slider_max_value),div_element.appendChild(adding_slider_step),div_element.appendChild(adding_slider_value);var slider_min=document.createElement("span");slider_min.setAttribute("id",i+"_element_minform_id_temp"),slider_min.innerHTML=w_field_min_value,slider_min.setAttribute("class","label");var slider_max=document.createElement("span");slider_max.setAttribute("id",i+"_element_maxform_id_temp"),slider_max.innerHTML=w_field_max_value,slider_max.setAttribute("class","label");var slider_value=document.createElement("span");slider_value.setAttribute("id",i+"_element_valueform_id_temp"),slider_value.innerHTML=w_field_value,slider_value.setAttribute("class","label"),slider_td1.appendChild(adding_slider_div),slider_tr1.appendChild(slider_td1),slider_table.appendChild(slider_tr1),slider_td2.appendChild(slider_min),slider_tr2.appendChild(slider_td2),slider_table.appendChild(slider_tr2),slider_td3.appendChild(slider_value),slider_tr2.appendChild(slider_td3),slider_table.appendChild(slider_tr2),slider_td4.appendChild(slider_max),slider_tr2.appendChild(slider_td4),slider_table.appendChild(slider_tr2),div_element.appendChild(slider_table),div_field.appendChild(div_label),div_field.appendChild(div_element),div.appendChild(div_field),div.appendChild(br1),main_td.appendChild(div),jQuery("#main_div").append(form_maker.type_slider_description),"top"==w_field_label_pos&&label_top(i),change_class(w_class,i),refresh_attr(i,"type_slider"),jQuery("#"+i+"_elementform_id_temp")[0].slide=null,jQuery(function(){jQuery("#"+i+"_elementform_id_temp").slider({step:eval(w_field_step),range:"min",value:eval(w_field_value),min:eval(w_field_min_value),max:eval(w_field_max_value),slide:function(e,t){document.getElementById(i+"_element_valueform_id_temp").innerHTML=""+t.value,document.getElementById(i+"_slider_valueform_id_temp").value=""+t.value}})})}function create_range_step(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_spinner_step">Step</label>'),jQuery('<input class="fm-width-100" type="text" id="edit_for_spinner_step" onKeyPress="return check_isnum(event)" onChange="change_range_step(this.value, '+e+", 'form_id_temp')\" value=\""+t+'" />'))}function change_range_step(e,t,i){jQuery("#"+t+"_elementform_id_temp0").spinner({step:e}),jQuery("#"+t+"_elementform_id_temp1").spinner({step:e}),document.getElementById(t+"_range_stepform_id_temp").value=e}function create_range_width(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_spinner_width">Width(px)</label>'),jQuery('<input class="fm-width-100" type="text" id="edit_for_spinner_width" onKeyPress="return check_isnum(event)" onKeyUp="change_range_width(this.value, '+e+", 'form_id_temp')\" value=\""+t+'" />'))}function go_to_type_range(e){w_attr_name=[],w_attr_value=[],w_mini_labels=["From","To"],type_range(e,"Range","","top","no","70","1","","",w_mini_labels,"no","",w_attr_name,w_attr_value)}function type_range(t,e,i,n,a,r,l,d,_,o,s,m,u,c){jQuery("#element_type").val("type_range"),delete_last_child();var p=jQuery("#edit_table"),f=jQuery('<div id="edit_div"></div>');p.append(f);var h=jQuery('<div id="edit_main_table"></div>');f.append(h),h.append(create_field_type("type_range")),h.append(create_label(t,e)),h.append(create_label_position(t,n)),h.append(create_hide_label(t,a)),h.append(create_required(t,s)),h.append(create_range_step(t,l)),h.append(create_range_width(t,r));var y=jQuery('<div class="inside"></div>');h.append(create_advanced_options_container(y)),y.append(create_field_label_size(t,i)),y.append(create_class(t,m)),y.append(create_additional_attributes(t,u,"type_range"));var b=document.createElement("input");b.setAttribute("type","hidden"),b.setAttribute("value","type_range"),b.setAttribute("name",t+"_typeform_id_temp"),b.setAttribute("id",t+"_typeform_id_temp");var v=document.createElement("input");v.setAttribute("type","hidden"),v.setAttribute("value",s),v.setAttribute("name",t+"_requiredform_id_temp"),v.setAttribute("id",t+"_requiredform_id_temp");var g=document.createElement("input");g.setAttribute("type","hidden"),g.setAttribute("value",a),g.setAttribute("name",t+"_hide_labelform_id_temp"),g.setAttribute("id",t+"_hide_labelform_id_temp");var w=document.createElement("input");w.setAttribute("type","hidden"),w.setAttribute("value",r),w.setAttribute("name",t+"_range_widthform_id_temp"),w.setAttribute("id",t+"_range_widthform_id_temp");var E=document.createElement("input");E.setAttribute("type","hidden"),E.setAttribute("value",l),E.setAttribute("name",t+"_range_stepform_id_temp"),E.setAttribute("id",t+"_range_stepform_id_temp");var A=document.createElement("input");A.setAttribute("type",""),A.setAttribute("value",d),A.style.cssText="width:"+r+"px",A.setAttribute("name",t+"_elementform_id_temp0"),A.setAttribute("id",t+"_elementform_id_temp0"),A.setAttribute("onKeyPress","return check_isnum_or_minus(event)");var x=document.createElement("input");x.setAttribute("type",""),x.setAttribute("value",_),x.style.cssText="width:"+r+"px",x.setAttribute("name",t+"_elementform_id_temp1"),x.setAttribute("id",t+"_elementform_id_temp1"),x.setAttribute("onKeyPress","return check_isnum_or_minus(event)");var k=document.createElement("label");k.setAttribute("class","mini_label mini_label_from"),k.setAttribute("id",t+"_mini_label_from"),k.innerHTML=o[0];var j=document.createElement("label");j.setAttribute("class","mini_label mini_label_to"),j.setAttribute("id",t+"_mini_label_to"),j.innerHTML=o[1];var C=document.createElement("div");C.setAttribute("id","main_div"),edit_labels=document.createTextNode("The labels of the fields are editable. Please, click on the label to edit.");var I=document.createElement("div");I.setAttribute("class","fm-editable-label"),I.appendChild(edit_labels);var B=document.createElement("div");B.setAttribute("id",t+"_elemet_tableform_id_temp");var Q="yes"==a?"none":"table-cell",T=document.createElement("div");T.setAttribute("align","left"),T.style.display=Q,T.style.width=i+"px",T.setAttribute("id",t+"_label_sectionform_id_temp");var M=document.createElement("div");M.setAttribute("align","left"),M.style.display="table-cell",M.setAttribute("id",t+"_element_sectionform_id_temp");var L=document.createElement("div");L.setAttribute("id",t+"_elemet_table_littleform_id_temp"),L.style.display="table";var z=document.createElement("div");z.style.display="table-row";var q=document.createElement("div");q.style.display="table-row";var S=document.createElement("div");S.setAttribute("valign","middle"),S.setAttribute("align","left"),S.style.display="table-cell";var N=document.createElement("div");N.setAttribute("valign","middle"),N.setAttribute("align","left"),N.style.cssText="display:table-cell; padding-left:4px;";var H=document.createElement("div");H.setAttribute("valign","top"),H.setAttribute("align","left"),H.style.display="table-cell";var D=document.createElement("div");D.setAttribute("valign","top"),D.setAttribute("align","left"),D.style.display="table-cell";var O=document.createElement("br"),P=document.createElement("span");P.setAttribute("id",t+"_element_labelform_id_temp"),P.innerHTML=e,P.setAttribute("class","label");var F=document.createElement("span");F.setAttribute("id",t+"_required_elementform_id_temp"),F.innerHTML="",F.setAttribute("class","required"),"yes"==s&&(F.innerHTML=" *");var R=document.getElementById("show_table");T.appendChild(P),T.appendChild(F),M.appendChild(b),M.appendChild(v),M.appendChild(g),M.appendChild(w),M.appendChild(E),S.appendChild(A),N.appendChild(x),H.appendChild(k),D.appendChild(j),z.appendChild(S),z.appendChild(N),q.appendChild(H),q.appendChild(D),L.appendChild(z),L.appendChild(q),M.appendChild(L),B.appendChild(T),B.appendChild(M),C.appendChild(B),C.appendChild(O),C.appendChild(I),R.appendChild(C),jQuery("#main_div").append("<br>"+form_maker.type_range_description),"top"==n&&label_top(t),change_class(m,t),refresh_attr(t,"type_range"),jQuery("#"+t+"_elementform_id_temp0").spinner();jQuery("#"+t+"_elementform_id_temp0").spinner();jQuery("#"+t+"_elementform_id_temp0").spinner({step:l}),jQuery("#"+t+"_elementform_id_temp1").spinner();jQuery("#"+t+"_elementform_id_temp1").spinner();jQuery("#"+t+"_elementform_id_temp1").spinner({step:l}),jQuery(function(){jQuery("label#"+t+"_mini_label_from").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' class='form' size='8' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.form").focus(),jQuery("input.form").blur(function(){var e=jQuery(this).val();jQuery("#"+t+"_mini_label_from").text(e)})}}),jQuery("label#"+t+"_mini_label_to").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' class='to' size='8' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.to").focus(),jQuery("input.to").blur(function(){var e=jQuery(this).val();jQuery("#"+t+"_mini_label_to").text(e)})}})})}function create_hidden_name(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_hidden_name">Name</label>'),jQuery('<input type="text" class="fm-width-100" id="el_hidden_name" onChange="change_field_name('+e+', this)" value="'+t+'" />'))}function change_field_name(e,t){if(value=t.value,value==parseInt(value))return alert("The name of the field cannot be a number."),t.value="",document.getElementById(e+"_elementform_id_temp").name="",document.getElementById(e+"_element_labelform_id_temp").innerHTML="",void(document.getElementById(e+"_hidden_nameform_id_temp").innerHTML="");value==e+"_elementform_id_temp"?(alert('"Field Name" should differ from "Field Id".'),t.value=""):(document.getElementById(e+"_elementform_id_temp").name=value,document.getElementById(e+"_element_labelform_id_temp").innerHTML=value,document.getElementById(e+"_hidden_nameform_id_temp").innerHTML=value)}function create_hidden_value(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_hidden_value">Value</label>'),jQuery('<input type="text" class="fm-width-100" id="el_hidden_value" onChange="change_field_value('+e+', this.value)" value="'+t+'" /><span class="dashicons dashicons-list-view" data-id="el_hidden_value"></span>'))}function change_field_value(e,t){document.getElementById(e+"_elementform_id_temp").value=t,document.getElementById(e+"_hidden_valueform_id_temp").innerHTML=t}function go_to_type_hidden(e){w_attr_name=[],w_attr_value=[],type_hidden(e,"","","",w_attr_name,w_attr_value)}function type_hidden(e,t,i,n,a){jQuery("#element_type").val("type_hidden"),delete_last_child();var r=jQuery("#edit_table"),l=jQuery('<div id="edit_div"></div>');r.append(l);var d=jQuery('<div id="edit_main_table" class="js"></div>');l.append(d),d.append(create_field_type("type_hidden")),d.append(create_hidden_name(e,t)),d.append(create_hidden_value(e,i));var _=jQuery('<div class="inside"></div>');d.append(create_advanced_options_container(_)),_.append(create_additional_attributes(e,n,"type_hidden")),element="input",type="hidden";var o=document.createElement("input");o.setAttribute("type","hidden"),o.setAttribute("value","type_hidden"),o.setAttribute("name",e+"_typeform_id_temp"),o.setAttribute("id",e+"_typeform_id_temp");var s=document.createElement(element);s.setAttribute("type",type),s.setAttribute("value",i),s.setAttribute("id",e+"_elementform_id_temp"),s.setAttribute("name",t);var m=document.createElement("div");m.setAttribute("id","main_div");var u=document.createElement("div");u.setAttribute("id",e+"_elemet_tableform_id_temp");var c=document.createElement("div");c.setAttribute("align","left"),c.style.display="table-cell",c.setAttribute("id",e+"_label_sectionform_id_temp");var p=document.createElement("div");p.setAttribute("align","left"),p.style.cssText="display:table-cell; padding-left: 7px;",p.setAttribute("id",e+"_element_sectionform_id_temp");document.createElement("br"),document.createElement("br");var f=document.createElement("br"),h=(document.createElement("br"),document.createElement("span"));h.setAttribute("id",e+"_element_labelform_id_temp"),h.style.cssText="display:none",h.innerHTML=t;var y=document.createElement("span");y.style.cssText="color:red; font-size:13px;",y.innerHTML="Hidden field";var b=document.createElement("div"),v=document.createElement("span");v.setAttribute("align","left"),v.innerHTML="Name: ";var g=document.createElement("span");g.setAttribute("align","left"),g.innerHTML=t,g.setAttribute("id",e+"_hidden_nameform_id_temp");var w=document.createElement("div"),E=document.createElement("span");E.setAttribute("align","left"),E.innerHTML="Value: ";var A=document.createElement("span");A.setAttribute("align","left"),A.innerHTML=i,A.setAttribute("id",e+"_hidden_valueform_id_temp"),b.appendChild(v),b.appendChild(g),w.appendChild(E),w.appendChild(A);var x=document.getElementById("show_table");c.appendChild(h),c.appendChild(y),p.appendChild(s),p.appendChild(o),p.appendChild(b),p.appendChild(w),u.appendChild(c),u.appendChild(p),m.appendChild(u),m.appendChild(f),x.appendChild(m),jQuery("#main_div").append(form_maker.type_hidden_description),refresh_attr(e,"type_text")}function create_captcha_digits(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="captcha_digit">Symbols (3 - 9)</label>'),jQuery('<input class="fm-width-100" type="text" id="captcha_digit" onKeyPress="return check_isnum_3_10(event)" onKeyUp="change_captcha_digit(this.value, '+e+')" value="'+t+'" />'))}function check_isnum_3_10(e){var t=e.which||e.keyCode;return!(31<t&&(t<51||57<t))&&!(9<document.getElementById("captcha_digit").value+(t-48))}function go_to_type_captcha(e){w_attr_name=[],w_attr_value=[],type_captcha(e,"Word Verification","","top","yes","6","",w_attr_name,w_attr_value)}function type_captcha(e,t,i,n,a,r,l,d,_){jQuery("#element_type").val("type_captcha"),delete_last_child();var o=jQuery("#edit_table"),s=jQuery('<div id="edit_div"></div>');o.append(s);var m=jQuery('<div id="edit_main_table"></div>');s.append(m),m.append(create_field_type("type_captcha")),m.append(create_label(e,t)),m.append(create_label_position(e,n)),m.append(create_hide_label(e,a)),m.append(create_captcha_digits(e,r));var u=jQuery('<div class="inside"></div>');m.append(create_advanced_options_container(u)),u.append(create_field_label_size(e,i)),u.append(create_class(e,l)),u.append(create_additional_attributes(e,d,"type_captcha")),element="img",type="captcha";var c=document.createElement("input");c.setAttribute("type","hidden"),c.setAttribute("value","type_captcha"),c.setAttribute("name",e+"_typeform_id_temp"),c.setAttribute("id",e+"_typeform_id_temp");var p=document.createElement(element);p.setAttribute("type",type),p.setAttribute("digit",r),p.setAttribute("src",url_for_ajax+"?action=formmakerwdcaptcha&digit="+r+"&i=form_id_temp"),p.setAttribute("id","_wd_captchaform_id_temp"),p.setAttribute("class","captcha_img"),p.setAttribute("onClick","captcha_refresh('_wd_captcha','form_id_temp')");var f=document.createElement("input");f.setAttribute("type","hidden"),f.setAttribute("value",a),f.setAttribute("name",e+"_hide_labelform_id_temp"),f.setAttribute("id",e+"_hide_labelform_id_temp");var h=document.createElement("div");h.setAttribute("class","captcha_refresh"),h.setAttribute("id","_element_refreshform_id_temp"),h.setAttribute("onClick","captcha_refresh('_wd_captcha','form_id_temp')");var y=document.createElement("input");y.setAttribute("type","text"),y.style.cssText="width:"+(10*r+15)+"px;",y.setAttribute("class","captcha_input"),y.setAttribute("id","_wd_captcha_inputform_id_temp"),y.setAttribute("name","captcha_input");var b=document.createElement("div");b.setAttribute("id","main_div");var v=document.createElement("div");v.setAttribute("id",e+"_elemet_tableform_id_temp");var g="yes"==a?"none":"table-cell",w=document.createElement("div");w.setAttribute("align","left"),w.style.display=g,w.style.width=i+"px",w.setAttribute("id",e+"_label_sectionform_id_temp");var E=document.createElement("div");E.setAttribute("align","left"),E.style.display="table-cell",E.setAttribute("id",e+"_element_sectionform_id_temp");var A=document.createElement("div");A.style.display="table";var x=document.createElement("div");x.style.display="table-row";var k=document.createElement("div");k.style.display="table-row";var j=document.createElement("div");j.setAttribute("valign","middle"),j.style.display="table-cell";var C=document.createElement("div");C.setAttribute("valign","middle"),C.style.display="table-cell";var I=document.createElement("div");I.style.display="table-cell",A.appendChild(x),A.appendChild(k),x.appendChild(j),x.appendChild(C),k.appendChild(I),j.appendChild(p),C.appendChild(h),I.appendChild(y);document.createElement("br"),document.createElement("br");var B=document.createElement("br"),Q=(document.createElement("br"),document.createElement("span"));Q.setAttribute("id",e+"_element_labelform_id_temp"),Q.innerHTML=t,Q.setAttribute("class","label"),Q.style.verticalAlign="top";var T=document.getElementById("show_table");w.appendChild(Q),E.appendChild(c),E.appendChild(f),E.appendChild(A),v.appendChild(w),v.appendChild(E),b.appendChild(v),b.appendChild(B),T.appendChild(b),jQuery("#main_div").append(form_maker.type_captcha_description),"top"==n&&label_top(e),change_class(l,e),refresh_attr(e,"type_captcha")}function create_arithmetic_operations(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_operations">Operations</label>'),jQuery('<input type="text" class="fm-width-100" id="el_operations" onKeyPress="return check_is_operation_valid(event)" onChange="change_arithmetic_captcha(this.value, \'operations\')" value="'+t+'" />'))}function check_is_operation_valid(e){var t=e.which||e.keyCode;return!(46==t||t<42||47<t)}function change_arithmetic_captcha(e,t){arithmetic_captcha=document.getElementById("_wd_arithmetic_captchaform_id_temp"),"oper_count"==t?(oper_count=e||1,operations=document.getElementById("el_operations")?document.getElementById("el_operations").value:"+, -, *, /"):oper_count=(operations="el_operations"==t?e||"+, -, *, /":document.getElementById("el_operations")?document.getElementById("el_operations").value:"+, -, *, /",document.getElementById("el_oper_count")?document.getElementById("el_oper_count").value:1),input_size=document.getElementById("el_captcha_input_size")?document.getElementById("el_captcha_input_size").value:60,arithmetic_captcha.setAttribute("operations_count",oper_count),arithmetic_captcha.setAttribute("operations",operations),arithmetic_captcha.setAttribute("input_size",input_size),arithmetic_captcha.setAttribute("src",url_for_ajax+"?action=formmakerwdmathcaptcha&operations_count="+oper_count+"&nonce="+fm_ajax.ajaxnonce+"&operations="+operations.replace("+","@")+"&i=form_id_temp")}function create_arithmetic_operations_count(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_oper_count">Operations count (1 - 5)</label>'),jQuery('<input type="text" class="fm-width-100" id="el_oper_count" onKeyPress="return check_isnum_less_then_5(event)" onChange="change_arithmetic_captcha(this.value, \'oper_count\')" value="'+t+'" />'))}function check_isnum_less_then_5(e){var t=e.which||e.keyCode;return!(31<t&&(t<49||57<t))&&!(5<document.getElementById("el_oper_count").value+(t-48))}function create_arithmetic_width(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_captcha_input_size">Input width(px)</label>'),jQuery('<input class="fm-width-100" type="text" id="el_captcha_input_size" onKeyPress="return check_isnum(event)" onKeyUp="change_w_style(\'_wd_arithmetic_captcha_inputform_id_temp\', this.value); change_arithmetic_captcha();" value="'+t+'" />'))}function go_to_type_arithmetic_captcha(e){w_attr_name=[],w_attr_value=[],type_arithmetic_captcha(e,"Word Verification","","top","yes","1","+, -, *, /","","60",w_attr_name,w_attr_value)}function type_arithmetic_captcha(e,t,i,n,a,r,l,d,_,o,s){jQuery("#element_type").val("type_arithmetic_captcha"),delete_last_child();var m=jQuery("#edit_table"),u=jQuery('<div id="edit_div"></div>');m.append(u);var c=jQuery('<div id="edit_main_table"></div>');u.append(c),c.append(create_field_type("type_arithmetic_captcha")),c.append(create_label(e,t)),c.append(create_label_position(e,n)),c.append(create_hide_label(e,a)),c.append(create_arithmetic_operations(e,l)),c.append(create_arithmetic_operations_count(e,r)),c.append(create_arithmetic_width(e,_));var p=jQuery('<div class="inside"></div>');c.append(create_advanced_options_container(p)),p.append(create_field_label_size(e,i)),p.append(create_class(e,d)),p.append(create_additional_attributes(e,o,"type_arithmetic_captcha"));var f=document.createElement("input");f.setAttribute("type","hidden"),f.setAttribute("value","type_arithmetic_captcha"),f.setAttribute("name",e+"_typeform_id_temp"),f.setAttribute("id",e+"_typeform_id_temp");var h=document.createElement("img");h.setAttribute("type","captcha"),h.setAttribute("operations_count",r),h.setAttribute("operations",l),h.setAttribute("input_size",_),h.setAttribute("src",url_for_ajax+"?action=formmakerwdmathcaptcha&operations_count="+r+"&operations="+l.replace("+","@")+"&i=form_id_temp"),h.setAttribute("id","_wd_arithmetic_captchaform_id_temp"),h.setAttribute("class","arithmetic_captcha_img"),h.setAttribute("onClick","captcha_refresh('_wd_arithmetic_captcha','form_id_temp')");var y=document.createElement("input");y.setAttribute("type","hidden"),y.setAttribute("value",a),y.setAttribute("name",e+"_hide_labelform_id_temp"),y.setAttribute("id",e+"_hide_labelform_id_temp");var b=document.createElement("div");b.setAttribute("class","captcha_refresh"),b.setAttribute("id","_element_refreshform_id_temp"),b.setAttribute("onClick","captcha_refresh('_wd_arithmetic_captcha','form_id_temp')");var v=document.createElement("input");v.setAttribute("type","text"),v.style.cssText="width:"+_+"px;",v.setAttribute("class","arithmetic_captcha_input"),v.setAttribute("id","_wd_arithmetic_captcha_inputform_id_temp"),v.setAttribute("name","arithmetic_captcha_input"),v.setAttribute("onKeyPress","return check_isnum(event)");var g=document.createElement("div");g.setAttribute("id","main_div");var w=document.createElement("div");w.setAttribute("id",e+"_elemet_tableform_id_temp");var E="yes"==a?"none":"table-cell",A=document.createElement("div");A.setAttribute("align","left"),A.style.display=E,A.style.width=i+"px",A.setAttribute("id",e+"_label_sectionform_id_temp");var x=document.createElement("div");x.setAttribute("align","left"),x.style.display="table-cell",x.setAttribute("id",e+"_element_sectionform_id_temp");var k=document.createElement("div");k.style.display="table";var j=document.createElement("div");j.style.display="table-row";var C=document.createElement("div");C.style.display="table-row";var I=document.createElement("div");I.style.display="table-cell";var B=document.createElement("div");B.style.cssText="display:table-cell; vertical-align:middle;";var Q=document.createElement("div");Q.style.display="table-cell",k.appendChild(j),k.appendChild(C),j.appendChild(I),j.appendChild(Q),j.appendChild(B),I.appendChild(h),B.appendChild(b),Q.appendChild(v);document.createElement("br"),document.createElement("br");var T=document.createElement("br"),M=(document.createElement("br"),document.createElement("span"));M.setAttribute("id",e+"_element_labelform_id_temp"),M.innerHTML=t,M.setAttribute("class","label"),M.style.verticalAlign="top";var L=document.getElementById("show_table");A.appendChild(M),x.appendChild(f),x.appendChild(y),x.appendChild(k),w.appendChild(A),w.appendChild(x),g.appendChild(w),g.appendChild(T),L.appendChild(g),jQuery("#main_div").append(form_maker.type_arithmetic_captcha_description),"top"==n&&label_top(e),change_class(d,e),refresh_attr(e,"type_arithmetic_captcha")}function create_field_size_phone(e,t,i){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_input_size">Width(px)</label>'),jQuery('<input class="fm-width-100" type="text" id="edit_for_input_size" onKeyPress="return check_isnum(event)" onKeyUp="change_w_style(\''+e+'_element_lastform_id_temp\', this.value)" value="'+t+'" /><p class="description">'+form_maker.leave_empty+"</p>"))}function create_placeholder_phone(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_first_value_area">Placeholder</label>'),jQuery('<input type="text" class="fm-width-20" id="el_first_value_area" onKeyUp="change_input_value(this.value,\''+e+'_element_firstform_id_temp\')" value="'+t[0].replace(/"/g,"&quot;")+'" />-<input type="text" class="fm-width-60" id="el_first_value_phone" onKeyUp="change_input_value(this.value,\''+e+'_element_lastform_id_temp\')" value="'+t[1].replace(/"/g,"&quot;")+'" />'))}function go_to_type_phone(e){w_attr_name=[],w_attr_value=[],w_first_val=["",""],w_title=["",""],w_mini_labels=["Area Code","Phone Number"],type_phone(e,"Phone-Area Code","","top","no","",w_first_val,w_title,w_mini_labels,"no","no","",w_attr_name,w_attr_value)}function type_phone(t,e,i,n,a,r,l,d,_,o,s,m,u,c){jQuery("#element_type").val("type_phone"),delete_last_child();var p=jQuery("#edit_table"),f=jQuery('<div id="edit_div"></div>');p.append(f);var h=jQuery('<div id="edit_main_table"></div>');f.append(h),h.append(create_field_type("type_phone")),h.append(create_label(t,e)),h.append(create_label_position(t,n)),h.append(create_hide_label(t,a)),h.append(create_required(t,o)),h.append(create_field_size_phone(t,r)),h.append(create_placeholder_phone(t,d));var y=jQuery('<div class="inside"></div>');h.append(create_advanced_options_container(y)),y.append(create_unique_values(t,s)),y.append(create_field_label_size(t,i)),y.append(create_class(t,m)),y.append(create_additional_attributes(t,u,"type_phone"));var b=document.createElement("br"),v=document.createElement("input");v.setAttribute("type","hidden"),v.setAttribute("value","type_phone"),v.setAttribute("name",t+"_typeform_id_temp"),v.setAttribute("id",t+"_typeform_id_temp");var g=document.createElement("input");g.setAttribute("type","hidden"),g.setAttribute("value",o),g.setAttribute("name",t+"_requiredform_id_temp"),g.setAttribute("id",t+"_requiredform_id_temp");var w=document.createElement("input");w.setAttribute("type","hidden"),w.setAttribute("value",a),w.setAttribute("name",t+"_hide_labelform_id_temp"),w.setAttribute("id",t+"_hide_labelform_id_temp");var E=document.createElement("input");E.setAttribute("type","hidden"),E.setAttribute("value",s),E.setAttribute("name",t+"_uniqueform_id_temp"),E.setAttribute("id",t+"_uniqueform_id_temp");var A=document.createElement("div");A.setAttribute("id","main_div");var x=document.createElement("div");x.setAttribute("class","fm-editable-label"),edit_labels=document.createTextNode("The labels of the fields are editable. Please, click on the label to edit."),x.appendChild(edit_labels);var k=document.createElement("div");k.setAttribute("id",t+"_elemet_tableform_id_temp");var j="yes"==a?"none":"table-cell",C=document.createElement("div");C.setAttribute("align","left"),C.style.display=j,C.style.width=i+"px",C.setAttribute("id",t+"_label_sectionform_id_temp");var I=document.createElement("div");I.setAttribute("align","left"),I.style.display="table-cell",I.setAttribute("id",t+"_element_sectionform_id_temp");var B=document.createElement("div");B.style.display="table",B.setAttribute("id",t+"_table_name");var Q=document.createElement("div");Q.style.display="table-row",Q.setAttribute("id",t+"_tr_name1");var T=document.createElement("div");T.style.display="table-row",T.setAttribute("id",t+"_tr_name2");var M=document.createElement("div");M.style.display="table-cell",M.setAttribute("id",t+"_td_name_input_first");var L=document.createElement("div");L.style.display="table-cell",L.setAttribute("id",t+"_td_name_input_last");var z=document.createElement("div");z.style.display="table-cell",z.setAttribute("id",t+"_td_name_label_first"),z.setAttribute("align","left");var q=document.createElement("div");q.style.display="table-cell",q.setAttribute("id",t+"_td_name_label_last"),q.setAttribute("align","left");var S=document.createElement("span");S.setAttribute("id",t+"_element_labelform_id_temp"),S.innerHTML=e,S.setAttribute("class","label"),S.style.verticalAlign="top";var N=document.createElement("span");N.setAttribute("id",t+"_required_elementform_id_temp"),N.innerHTML="",N.setAttribute("class","required"),"yes"==o&&(N.innerHTML=" *");var H=document.createElement("input");H.setAttribute("type","text"),H.style.cssText="width:50px",H.setAttribute("id",t+"_element_firstform_id_temp"),H.setAttribute("name",t+"_element_firstform_id_temp"),H.setAttribute("value",l[0]),H.setAttribute("title",d[0]),H.setAttribute("placeholder",d[0]),H.setAttribute("onKeyPress","return check_isnum(event)");var D=document.createElement("span");D.setAttribute("class","wdform_line"),D.style.cssText="margin: 0px 4px 0px 4px; padding: 0px;",D.innerHTML="-";var O=document.createElement("label");O.setAttribute("class","mini_label mini_label_area_code"),O.setAttribute("id",t+"_mini_label_area_code"),O.innerHTML=_[0];var P=document.createElement("input");P.setAttribute("type","text"),P.style.cssText="width:"+r+"px",P.setAttribute("id",t+"_element_lastform_id_temp"),P.setAttribute("name",t+"_element_lastform_id_temp"),P.setAttribute("value",l[1]),P.setAttribute("title",d[1]),P.setAttribute("placeholder",d[1]),P.setAttribute("onKeyPress","return check_isnum(event)");var F=document.createElement("label");F.setAttribute("class","mini_label mini_label_phone_number"),F.setAttribute("id",t+"_mini_label_phone_number"),F.innerHTML=_[1];var R=document.getElementById("show_table");C.appendChild(S),C.appendChild(N),M.appendChild(H),M.appendChild(D),L.appendChild(P),Q.appendChild(M),Q.appendChild(L),z.appendChild(O),q.appendChild(F),T.appendChild(z),T.appendChild(q),B.appendChild(Q),B.appendChild(T),I.appendChild(v),I.appendChild(g),I.appendChild(w),I.appendChild(E),I.appendChild(B),k.appendChild(C),k.appendChild(I),A.appendChild(k),A.appendChild(b),A.appendChild(x),R.appendChild(A),jQuery("#main_div").append("<br>"+form_maker.type_phone_area_code_description),"top"==n&&label_top(t),change_class(m,t),refresh_attr(t,"type_name"),jQuery(function(){jQuery("label#"+t+"_mini_label_area_code").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' class='area_code' size='10' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.area_code").focus(),jQuery("input.area_code").blur(function(){var e=jQuery(this).val();jQuery("#"+t+"_mini_label_area_code").text(e)})}}),jQuery("label#"+t+"_mini_label_phone_number").click(function(){if(0==jQuery(this).children("input").length){var e="<input type='text' class='phone_number' style='outline:none; border:none; background:none;' value=\""+jQuery(this).text()+'">';jQuery(this).html(e),jQuery("input.phone_number").focus(),jQuery("input.phone_number").blur(function(){var e=jQuery(this).val();jQuery("#"+t+"_mini_label_phone_number").text(e)})}})})}function create_confirmation_password(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="el_verification_password">Password Confirmation</label>'),jQuery('<input type="checkbox" id="el_verification_password" onclick="verification_password('+e+')"'+("yes"==t?' checked="checked"':"")+" />"))}function verification_password(e){document.getElementById("el_verification_password").checked?(document.getElementById("confirm_validation_label").style.display="block",document.getElementById(e+"_verification_id_temp").value="yes",document.getElementById(e+"_1_label_sectionform_id_temp").style.display=document.getElementById(e+"_label_sectionform_id_temp").style.display,document.getElementById(e+"_1_element_sectionform_id_temp").style.display=document.getElementById(e+"_element_sectionform_id_temp").style.display):(document.getElementById("confirm_validation_label").style.display="none",document.getElementById(e+"_verification_id_temp").value="no",document.getElementById(e+"_1_label_sectionform_id_temp").style.display="none",document.getElementById(e+"_1_element_sectionform_id_temp").style.display="none")}function create_confirmation_password_label(e,t,i){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_label">Confirmation label</label>'),jQuery('<textarea id="edit_for_label" class="fm-width-100" onKeyUp="change_label(\''+e+"_element_labelform_id_temp', this.value, '"+e+'_1_element_labelform_id_temp\')" rows="4">'+i+"</textarea>"),"confirm_validation_label","yes"==t)}function go_to_type_password(e){w_placeholder_value="",w_attr_name=[],w_attr_value=[],type_password(e,"Password","","top","no","","no","no","wdform_input","no","Password confirmation",w_placeholder_value,w_attr_name,w_attr_value)}function type_password(e,t,i,n,a,r,l,d,_,o,s,m,u,c){jQuery("#element_type").val("type_password"),delete_last_child();var p=jQuery("#edit_table"),f=jQuery('<div id="edit_div"></div>');p.append(f);var h=jQuery('<div id="edit_main_table"></div>');f.append(h),h.append(create_field_type("type_password")),h.append(create_label(e,t)),h.append(create_label_position(e,n)),h.append(create_hide_label(e,a)),h.append(create_required(e,l)),h.append(create_field_size(e,r,"'"+e+"_elementform_id_temp'","'"+e+"_1_elementform_id_temp'"));var y=jQuery('<div class="inside"></div>');h.append(create_advanced_options_container(y)),y.append(create_confirmation_password(e,o)),y.append(create_confirmation_password_label(e,o,s)),y.append(create_field_label_size(e,i,"'"+e+"_label_sectionform_id_temp'","'"+e+"_1_label_sectionform_id_temp'")),y.append(create_class(e,_)),y.append(create_additional_attributes(e,u,"type_password")),element="input",type="password";var b=document.createElement("input");b.setAttribute("type","hidden"),b.setAttribute("value","type_password"),b.setAttribute("name",e+"_typeform_id_temp"),b.setAttribute("id",e+"_typeform_id_temp");var v=document.createElement("input");v.setAttribute("type","hidden"),v.setAttribute("value",l),v.setAttribute("name",e+"_requiredform_id_temp"),v.setAttribute("id",e+"_requiredform_id_temp");var g=document.createElement("input");g.setAttribute("type","hidden"),g.setAttribute("value",d),g.setAttribute("name",e+"_uniqueform_id_temp"),g.setAttribute("id",e+"_uniqueform_id_temp");var w=document.createElement(element);w.setAttribute("type",type),w.setAttribute("autocomplete","new-password"),w.setAttribute("id",e+"_elementform_id_temp"),w.setAttribute("name",e+"_elementform_id_temp"),w.setAttribute("placeholder",m),w.style.cssText="width:"+r+"px;";var E=document.createElement("input");E.setAttribute("type","hidden"),E.setAttribute("value",a),E.setAttribute("name",e+"_hide_labelform_id_temp"),E.setAttribute("id",e+"_hide_labelform_id_temp");var A=document.createElement("input");A.setAttribute("type","hidden"),A.setAttribute("value",o),A.setAttribute("name",e+"_verification_id_temp"),A.setAttribute("id",e+"_verification_id_temp");var x=document.createElement(element);x.setAttribute("type",type),x.setAttribute("autocomplete","new-password"),x.style.cssText="width:"+r+"px;",x.setAttribute("id",e+"_1_elementform_id_temp"),x.setAttribute("name",e+"_1_elementform_id_temp");var k="yes"==a||"no"==o?"none":"table-cell",j=document.createElement("div");j.setAttribute("align","left"),j.style.display=k,j.style.width=i+"px",j.setAttribute("id",e+"_1_label_sectionform_id_temp");var C="no"==o?"none":"table-cell",I=document.createElement("div");I.setAttribute("align","left"),I.style.display=C,I.setAttribute("id",e+"_1_element_sectionform_id_temp");var B=document.createElement("span");B.setAttribute("id",e+"_1_element_labelform_id_temp"),B.innerHTML=s,B.setAttribute("class","label"),B.style.verticalAlign="top";var Q=document.createElement("span");Q.setAttribute("id",e+"_1_required_elementform_id_temp"),Q.innerHTML="",Q.setAttribute("class","required"),Q.style.verticalAlign="top","yes"==l&&(Q.innerHTML=" *"),j.appendChild(B),j.appendChild(Q);var T=document.createElement("div");T.setAttribute("id","main_div");var M=document.createElement("div");M.setAttribute("id",e+"_elemet_tableform_id_temp");var L="yes"==a?"none":"table-cell",z=document.createElement("div");z.setAttribute("align","left"),z.style.display=L,z.style.width=i+"px",z.setAttribute("id",e+"_label_sectionform_id_temp");var q=document.createElement("div");q.setAttribute("align","left"),q.style.display="table-cell",q.setAttribute("id",e+"_element_sectionform_id_temp");var S=document.createElement("span");S.setAttribute("id",e+"_element_labelform_id_temp"),S.innerHTML=t,S.setAttribute("class","label"),S.style.verticalAlign="top";var N=document.createElement("span");N.setAttribute("id",e+"_required_elementform_id_temp"),N.innerHTML="",N.setAttribute("class","required"),N.style.verticalAlign="top","yes"==l&&(N.innerHTML=" *");var H=document.getElementById("show_table"),D=document.createElement("br");z.appendChild(S),z.appendChild(N),q.appendChild(b),q.appendChild(v),q.appendChild(E),q.appendChild(A),q.appendChild(g),q.appendChild(w),M.appendChild(z),M.appendChild(q),I.appendChild(x),M.appendChild(D),M.appendChild(j),M.appendChild(I),T.appendChild(M),H.appendChild(T),jQuery("#main_div").append(form_maker.type_password_description),"top"==n&&label_top(e),change_class(_,e),refresh_attr(e,"type_text")}function create_custom_button_add(e,t,i){var a=jQuery('<label class="fm-field-label">Add a new button</label>'),r=jQuery('<span class="fm-add-attribute dashicons dashicons-plus-alt" title="Add" onClick="add_button('+e+')"></span>'),l=jQuery('<div id="buttons" class="fm-width-100"></div>');for(n=t.length,j=0;j<n;j++){var d=jQuery('<div class="fm-width-100 fm-fields-set" id="button_opt'+j+'" idi="'+j+'"></div>'),_=jQuery('<div class="fm-width-90"></div>');_.append(create_custom_button_name(e,j,t[j])),_.append(create_custom_button_function(e,j,i[j])),d.append(_);var o=jQuery('<div class="fm-width-10 fm-remove-button"><span class="fm-remove-attribute dashicons dashicons-dismiss" onClick="remove_button('+j+", "+e+')"></span></div>');d.append(o),l.append(d)}var s=a;return create_option_container(null,s=(s=s.add(r)).add(l))}function create_custom_button_name(e,t,i){return create_option_container(jQuery('<label class="fm-field-label" for="el_title'+t+'">Name</label>'),jQuery('<input type="text" class="fm-width-100" id="el_title'+t+'" onChange="change_label(\''+e+"_elementform_id_temp"+t+'\', this.value)" value="'+i+'" />'))}function create_custom_button_function(e,t,i){return create_option_container(jQuery('<label class="fm-field-label" for="el_func'+t+'">OnClick</label>'),jQuery('<input type="text" class="fm-width-100" id="el_func'+t+'" onChange="change_func(\''+e+"_elementform_id_temp"+t+'\', this.value)" value="'+i+'" />'))}function add_button(e){var t=jQuery("#buttons"),i=t.children().last();0<i.length?j=parseInt(i.prop("idi"))+1:j=0;var n=jQuery('<div class="fm-width-100 fm-fields-set" id="button_opt'+j+'" idi="'+j+'"></div>'),a=jQuery('<div class="fm-width-90"></div>');a.append(create_custom_button_name(e,j,"Button")),a.append(create_custom_button_function(e,j,"")),n.append(a);var r=jQuery('<div class="fm-width-10 fm-remove-button"><span class="fm-remove-attribute dashicons dashicons-dismiss" onClick="remove_button('+j+", "+e+')"></span></div>');n.append(r),t.append(n),element="button",type="button",td2=document.getElementById(e+"_element_sectionform_id_temp");var l=document.createElement(element);l.setAttribute("type",type),l.setAttribute("id",e+"_elementform_id_temp"+j),l.setAttribute("name",e+"_elementform_id_temp"+j),l.setAttribute("value","Button"),l.innerHTML="Button",l.setAttribute("onclick",""),td2.appendChild(l),refresh_attr(e,"type_checkbox")}function remove_button(e,t){table=document.getElementById("button_opt"+e),button=document.getElementById(t+"_elementform_id_temp"+e),table.parentNode.removeChild(table),button.parentNode.removeChild(button)}function go_to_type_button(e){w_title=["Button"],w_func=[""],w_attr_name=[],w_attr_value=[],type_button(e,w_title,w_func,"wdform_button",w_attr_name,w_attr_value)}function type_button(e,t,i,a,r,l){jQuery("#element_type").val("type_button"),delete_last_child();var d=jQuery("#edit_table"),_=jQuery('<div id="edit_div"></div>');d.append(_);var o=jQuery('<div id="edit_main_table"></div>');_.append(o),o.append(create_field_type("type_button")),o.append(create_custom_button_add(e,t,i));var s=jQuery('<div class="inside"></div>');o.append(create_advanced_options_container(s)),s.append(create_class(e,a)),s.append(create_additional_attributes(e,r,"type_button")),element="button",type="button";var m=document.createElement("input");m.setAttribute("type","hidden"),m.setAttribute("value","type_button"),m.setAttribute("name",e+"_typeform_id_temp"),m.setAttribute("id",e+"_typeform_id_temp");var u=document.createElement("div");u.setAttribute("id","main_div");var c=document.createElement("div");c.setAttribute("id",e+"_elemet_tableform_id_temp");var p=document.createElement("div");p.setAttribute("align","left"),p.style.display="table-cell",p.setAttribute("id",e+"_label_sectionform_id_temp");var f=document.createElement("div");f.setAttribute("align","left"),f.style.display="table-cell",f.setAttribute("id",e+"_element_sectionform_id_temp");var h=document.createElement("br"),y=(document.createElement("br"),document.createElement("br"),document.createElement("br"),document.createElement("span"));for(y.setAttribute("id",e+"_element_labelform_id_temp"),y.innerHTML="button_"+e,y.style.cssText="display:none",n=t.length,j=0;j<n;j++){var b=document.createElement(element);b.setAttribute("type",type),b.setAttribute("id",e+"_elementform_id_temp"+j),b.setAttribute("class","button button-secondary button-large"),b.setAttribute("name",e+"_elementform_id_temp"+j),b.setAttribute("value",t[j]),b.innerHTML=t[j],b.setAttribute("onclick",i[j]),f.appendChild(b)}var v=document.getElementById("show_table");p.appendChild(y),f.appendChild(m),c.appendChild(p),c.appendChild(f),u.appendChild(c),u.appendChild(h),v.appendChild(u),jQuery("#main_div").append(form_maker.type_button_description),change_class(a,e),refresh_attr(e,"type_checkbox")}function create_grading_total(e,t){return create_option_container(jQuery('<label class="fm-field-label" for="element_total">Total</label>'),jQuery('<input class="fm-width-100" type="text" id="element_total" onKeyPress="return check_isnum_or_minus(event)" onKeyUp="change_total(this.value,'+e+')" value="'+t+'" />'))}function check_isnum_or_minus(e){var t=e.which||e.keyCode;return!(31<t&&(t<48||57<t)&&46!=t&&45!=t&&(t<35||40<t))}function change_total(e,t){""==e&&(e=0),document.getElementById(t+"_grading_totalform_id_temp").value=e,0==(document.getElementById(t+"_total_elementform_id_temp").innerHTML=e)?jQuery("#"+t+"_element_total_divform_id_temp").hide():jQuery("#"+t+"_element_total_divform_id_temp").show()}function create_grading_items(e,t){var i=jQuery('<label class="fm-field-label">Items</label>'),a=jQuery('<span class="fm-add-attribute dashicons dashicons-plus-alt" title="Add" id="el_items_add" onClick="add_grading_items('+e+')"></span>'),r=jQuery('<div id="items" class="fm-width-100"></div>');for(n=t.length,j=0;j<n;j++){var l=jQuery('<div class="fm-width-100 fm-fields-set" id="item_row_'+j+'" idi="'+j+'"></div>'),d=jQuery('<div class="fm-width-90"></div>');d.append(create_grading_item(e,j,t[j])),l.append(d);var _=jQuery('<div class="fm-width-10 fm-remove-button"><span class="fm-remove-attribute dashicons dashicons-dismiss" onClick="remove_grading_items('+j+", "+e+')"></span></div>');l.append(_),r.append(l)}var o=i;return create_option_container(null,o=(o=o.add(a)).add(r))}function create_grading_item(e,t,i){jQuery('<label class="fm-field-label" for="el_title'+t+'">Name</label>');return create_option_container(null,jQuery('<input type="text" class="fm-width-100" id="el_items'+t+'" onChange="change_label(\''+e+"_label_elementform_id_temp"+t+"', this.value); change_in_value('"+e+"_label_elementform_id_temp"+t+'\', this.value)" value="'+i+'" />'))}function add_grading_items(e){for(i=100;0<i&&!document.getElementById("el_items"+i);i--);m=i+1;var t=jQuery("#items"),n=jQuery('<div class="fm-width-100 fm-fields-set" id="item_row_'+m+'" idi="'+m+'"></div>'),a=jQuery('<div class="fm-width-90"></div>');a.append(create_grading_item(e,m,"")),n.append(a);var r=jQuery('<div class="fm-width-10 fm-remove-button"><span class="fm-remove-attribute dashicons dashicons-dismiss" onClick="remove_grading_items('+m+", "+e+')"></span></div>');n.append(r),t.append(n),refresh_grading_items(e)}function remove_grading_items(e,t){var i=document.getElementById("items"),n=document.getElementById("item_row_"+e);i.removeChild(n),refresh_grading_items(t)}function refresh_grading_items(e){for(i=100;0<i&&!document.getElementById("el_items"+i);i--);m=i;var t=document.getElementById(e+"_elementform_id_temp");for(t.innerHTML="",i=0;i<=m;i++)if(document.getElementById("el_items"+i)){var n=document.createElement("div");n.setAttribute("id",e+"_element_div"+i),n.setAttribute("class","grading");var a=document.createElement("input");a.setAttribute("id",e+"_elementform_id_temp_"+i),a.setAttribute("name",e+"_elementform_id_temp_"+i),a.setAttribute("onKeyPress","return check_isnum_or_minus(event)"),a.setAttribute("value",""),a.setAttribute("size","5"),a.setAttribute("type","text"),a.setAttribute("onKeyUp","sum_grading_values("+e+",'form_id_temp')"),a.setAttribute("onChange","sum_grading_values("+e+",'form_id_temp')");var r=document.createElement("label");r.setAttribute("id",e+"_label_elementform_id_temp"+i),r.setAttribute("class","ch-rad-label"),r.innerHTML=document.getElementById("el_items"+i).value,n.appendChild(a),n.appendChild(r),t.appendChild(n)}var l=document.createElement("div");l.setAttribute("id",e+"_element_total_divform_id_temp"),l.setAttribute("class","grading_div");var d=document.getElementById(e+"_grading_totalform_id_temp").value;l.style.display=""!=d&&"0"!=d?"block":"none";var _=document.createTextNode("Total:"),o=document.createTextNode("/"),s=document.createElement("span");s.setAttribute("id",e+"_total_elementform_id_temp"),s.setAttribute("name",e+"_total_elementform_id_temp"),s.innerHTML=d;var u=document.createElement("span");u.setAttribute("id",e+"_sum_elementform_id_temp"),u.setAttribute("name",e+"_sum_elementform_id_temp"),u.innerHTML=0;var c=document.createElement("span");c.setAttribute("id",e+"_text_elementform_id_temp"),c.setAttribute("name",e+"_text_elementform_id_temp"),c.innerHTML="",l.appendChild(_),l.appendChild(u),l.appendChild(o),l.appendChild(s),l.appendChild(c),t.appendChild(l)}function sum_grading_values(e,t){for(var i=0,n=0;n<100;n++)document.getElementById(e+"_element"+t+"_"+n)&&document.getElementById(e+"_element"+t+"_"+n).value&&(i+=parseInt(document.getElementById(e+"_element"+t+"_"+n).value)),document.getElementById(e+"_total_element"+t)&&(i>document.getElementById(e+"_total_element"+t).innerHTML?document.getElementById(e+"_text_element"+t).innerHTML=" Total should be less than "+document.getElementById(e+"_total_element"+t).innerHTML:document.getElementById(e+"_text_element"+t).innerHTML="");document.getElementById(e+"_sum_element"+t)&&(document.getElementById(e+"_sum_element"+t).innerHTML=i)}function go_to_type_grading(e){w_attr_name=[],w_attr_value=[],w_items=["item1","item2","item3"],type_grading(e,"Grading","","top","no",w_items,"100","no","wdform_grading",w_attr_name,w_attr_value)}function type_grading(e,t,i,n,a,r,l,d,_,o,s){jQuery("#element_type").val("type_grading"),delete_last_child();var m=jQuery("#edit_table"),u=jQuery('<div id="edit_div"></div>');m.append(u);var c=jQuery('<div id="edit_main_table"></div>');u.append(c),c.append(create_field_type("type_grading")),c.append(create_label(e,t)),c.append(create_label_position(e,n)),c.append(create_hide_label(e,a)),c.append(create_required(e,d)),c.append(create_grading_total(e,l)),c.append(create_grading_items(e,r));var p=jQuery('<div class="inside"></div>');c.append(create_advanced_options_container(p)),p.append(create_field_label_size(e,i)),p.append(create_class(e,_)),p.append(create_additional_attributes(e,o,"type_grading")),element="input",type="grading";var f=document.createElement("input");f.setAttribute("type","hidden"),f.setAttribute("value","type_grading"),f.setAttribute("name",e+"_typeform_id_temp"),f.setAttribute("id",e+"_typeform_id_temp");var h=document.createElement("input");h.setAttribute("type","hidden"),h.setAttribute("value",d),h.setAttribute("name",e+"_requiredform_id_temp"),h.setAttribute("id",e+"_requiredform_id_temp");var y=document.createElement("input");y.setAttribute("type","hidden"),y.setAttribute("value",a),y.setAttribute("name",e+"_hide_labelform_id_temp"),y.setAttribute("id",e+"_hide_labelform_id_temp");var b=document.createElement("input");b.setAttribute("type","hidden"),b.setAttribute("value",l),b.setAttribute("name",e+"_grading_totalform_id_temp"),b.setAttribute("id",e+"_grading_totalform_id_temp");var v=document.createElement("div");v.setAttribute("id","main_div");var g=document.createElement("div");g.setAttribute("id",e+"_elemet_tableform_id_temp");var w="yes"==a?"none":"table-cell",E=document.createElement("div");E.setAttribute("align","left"),E.style.display="table-cell",E.style.cssText="display:"+w+"; vertical-align:top; width:"+i+"px;",E.setAttribute("id",e+"_label_sectionform_id_temp");var A=document.createElement("div");A.setAttribute("align","left"),A.style.display="table-cell",A.setAttribute("id",e+"_element_sectionform_id_temp");document.createElement("br"),document.createElement("br");var x=document.createElement("br"),k=(document.createElement("br"),document.createElement("div"));k.setAttribute("id",e+"_elementform_id_temp");var j=document.createElement("span");j.setAttribute("id",e+"_element_labelform_id_temp"),j.innerHTML=t,j.setAttribute("class","label");var C=document.createElement("span");C.setAttribute("id",e+"_required_elementform_id_temp"),C.innerHTML="",C.setAttribute("class","required"),"yes"==d&&(C.innerHTML=" *");var I=document.getElementById("show_table");E.appendChild(j),E.appendChild(C),A.appendChild(y),A.appendChild(f),A.appendChild(h),A.appendChild(b),A.appendChild(k),g.appendChild(E),g.appendChild(A),v.appendChild(g),v.appendChild(x),I.appendChild(v),jQuery("#main_div").append(form_maker.type_grades_description),"top"==n&&label_top(e),change_class(_,e),refresh_attr(e,"type_grading"),refresh_grading_items(e)}function create_matrix_input_type(e,t){var i=jQuery('<label class="fm-field-label">Input Type</label>'),n=jQuery('<select class="fm-width-100" id="edit_for_select_input_type" name="edit_for_select_input_type" onChange="change_input_type('+e+",this.value); refresh_matrix("+e+')"></select>');return n.append(jQuery('<option id="edit_for_input_type_radio" value="radio"'+("radio"==t?' selected="selected"':"")+">Radio Button</option>")),n.append(jQuery('<option id="edit_for_input_type_checkbox" value="checkbox"'+("checkbox"==t?' selected="selected"':"")+">Check Box</option>")),n.append(jQuery('<option id="edit_for_input_type_text" value="text"'+("text"==t?' selected="selected"':"")+">Text Box</option>")),n.append(jQuery('<option id="edit_for_input_type_select" value="select"'+("select"==t?' selected="selected"':"")+">Drop Down</option>")),create_option_container(i,n)}function change_input_type(e,t){document.getElementById(e+"_input_typeform_id_temp").value=t}function refresh_matrix(e){for(i=100;0<i&&!document.getElementById("el_rows"+i);i--);for(m=i,i=100;0<i&&!document.getElementById("el_columns"+i);i--);n=i;var t=document.getElementById(e+"_table_little");t.innerHTML="";var a=document.createElement("div");for(a.setAttribute("id",e+"_element_tr0"),a.style.display="table-row",t.appendChild(a),(l=document.createElement("div")).setAttribute("id",e+"_element_td0_0"),l.style.display="table-cell",l.innerHTML="",a.appendChild(l),k=1;k<=n;k++)if(document.getElementById("el_columns"+k)){(o=document.createElement("div")).setAttribute("id",e+"_element_td0_"+k),o.setAttribute("class","matrix_"),o.style.display="table-cell";var r=document.createElement("label");r.setAttribute("id",e+"_label_elementform_id_temp0_"+k),r.setAttribute("name",e+"_label_elementform_id_temp0_"+k),r.setAttribute("class","ch-rad-label"),r.setAttribute("for",e+"_elementform_id_temp"+k),r.innerHTML=document.getElementById("el_columns"+k).value,o.appendChild(r),a.appendChild(o)}for(i=1;i<=m;i++)if(document.getElementById("el_rows"+i)){var l,d=document.createElement("div");d.setAttribute("id",e+"_element_tr"+i),d.style.display="table-row",(l=document.createElement("div")).setAttribute("id",e+"_element_td"+i+"_0"),l.setAttribute("class","matrix_"),l.style.display="table-cell";var _=document.createElement("label");for(_.setAttribute("id",e+"_label_elementform_id_temp"+i+"_0"),_.setAttribute("class","ch-rad-label"),_.setAttribute("for",e+"_elementform_id_temp"+i),_.innerHTML=document.getElementById("el_rows"+i).value,l.appendChild(_),d.appendChild(l),t.appendChild(d),"text"==document.getElementById("edit_for_select_input_type").value?document.getElementById("el_textbox").removeAttribute("style"):document.getElementById("el_textbox").style.display="none",k=1;k<=n;k++)if(document.getElementById("el_columns"+k)){var o;if((o=document.createElement("div")).setAttribute("id",e+"_element_td"+i+"_"+k),o.style.cssText="display:table-cell; text-align:center; padding:5px 0 0 5px;","select"==document.getElementById("edit_for_select_input_type").value){var s=document.createElement("select");s.setAttribute("id",e+"_select_yes_noform_id_temp"+i+"_"+k),s.setAttribute("name",e+"_select_yes_noform_id_temp"+i+"_"+k);var u=document.createElement("option");u.setAttribute("value",""),Nothing=document.createTextNode(" ");var c=document.createElement("option");c.setAttribute("value","yes"),Yes=document.createTextNode("Yes");var p=document.createElement("option");p.setAttribute("value","no"),No=document.createTextNode("No"),u.appendChild(Nothing),c.appendChild(Yes),p.appendChild(No),s.appendChild(u),s.appendChild(c),s.appendChild(p),o.appendChild(s)}else{var f=document.createElement("input");f.setAttribute("id",e+"_input_elementform_id_temp"+i+"_"+k),f.setAttribute("align","center"),f.setAttribute("size","14"),f.setAttribute("type",document.getElementById("edit_for_select_input_type").value),"radio"==document.getElementById("edit_for_select_input_type").value?(f.setAttribute("name",e+"_input_elementform_id_temp"+i),f.setAttribute("value",i+"_"+k)):"checkbox"==document.getElementById("edit_for_select_input_type").value?(f.setAttribute("name",e+"_input_elementform_id_temp"+i+"_"+k),f.setAttribute("value",1)):(document.getElementById(e+"_textbox_sizeform_id_temp").value=document.getElementById("edit_for_label_textbox_size").value,f.setAttribute("name",e+"_input_elementform_id_temp"+i+"_"+k),f.setAttribute("value",""),f.style.cssText="width:"+document.getElementById("edit_for_label_textbox_size").value+"px;"),o.appendChild(f)}d.appendChild(o)}}}function create_matrix_input_size(e,t,i){return create_option_container(jQuery('<label class="fm-field-label" for="edit_for_label_textbox_size">Text Box width(px)</label>'),jQuery('<input class="fm-width-100" type="text" id="edit_for_label_textbox_size" onKeyPress="return check_isnum(event)" onKeyUp="refresh_matrix('+e+')" value="'+t+'" />'),"el_textbox","text"==i)}function create_matrix_rows(e,t){var i=jQuery('<label class="fm-field-label">Rows</label>'),a=jQuery('<span class="fm-add-attribute dashicons dashicons-plus-alt" title="Add" id="el_rows_add" onClick="add_to_matrix(\'rows\', '+e+')"></span>'),r=jQuery('<div id="rows" class="fm-width-100"></div>');for(n=t.length,j=1;j<n;j++){var l=jQuery('<div class="fm-width-100 fm-fields-set" id="el_row'+j+'" idi="'+j+'"></div>'),d=jQuery('<div class="fm-width-90"></div>');d.append(create_matrix_row_item(e,j,t[j])),l.append(d);var _=jQuery('<div class="fm-width-10 fm-remove-button"><span class="fm-remove-attribute dashicons dashicons-dismiss" id="el_rows'+j+'_remove" onClick="remove_rowcols('+j+", "+e+", 'row')\"></span></div>");l.append(_),r.append(l)}var o=i;return create_option_container(null,o=(o=o.add(a)).add(r))}function create_matrix_row_item(e,t,i){jQuery('<label class="fm-field-label" for="el_title'+t+'">Name</label>');return create_option_container(null,jQuery('<input type="text" class="fm-width-100" id="el_rows'+t+'" onChange="change_label(\''+e+"_label_elementform_id_temp"+t+"_0', this.value); change_in_value('"+e+"_label_elementform_id_temp"+t+'_0\', this.value)" value="'+i+'" />'))}function create_matrix_columns(e,t){var i=jQuery('<label class="fm-field-label">Columns</label>'),a=jQuery('<span class="fm-add-attribute dashicons dashicons-plus-alt" title="Add" id="el_columns_add" onClick="add_to_matrix(\'columns\', '+e+')"></span>'),r=jQuery('<div id="columns" class="fm-width-100"></div>');for(n=t.length,j=1;j<n;j++){var l=jQuery('<div class="fm-width-100 fm-fields-set" id="el_column'+j+'" idi="'+j+'"></div>'),d=jQuery('<div class="fm-width-90"></div>');d.append(create_matrix_column_item(e,j,t[j])),l.append(d);var _=jQuery('<div class="fm-width-10 fm-remove-button"><span class="fm-remove-attribute dashicons dashicons-dismiss" id="el_rows'+j+'_remove" onClick="remove_rowcols('+j+", "+e+", 'column')\"></span></div>");l.append(_),r.append(l)}var o=i;return create_option_container(null,o=(o=o.add(a)).add(r))}function create_matrix_column_item(e,t,i){jQuery('<label class="fm-field-label" for="el_title'+t+'">Name</label>');return create_option_container(null,jQuery('<input type="text" class="fm-width-100" id="el_columns'+t+'" onChange="change_label(\''+e+"_label_elementform_id_temp0_"+t+"', this.value); change_in_value('"+e+"_label_elementform_id_temp0_"+t+'\', this.value)" value="'+i+'" />'))}function add_to_matrix(e,t){for(i=100;0<i&&!document.getElementById("el_rows"+i);i--);for(m="rows"==e?i+1:i,i=100;0<i&&!document.getElementById("el_columns"+i);i--);if(n="columns"==e?i+1:i,"rows"==e){var a=jQuery("#rows"),r=jQuery('<div class="fm-width-100 fm-fields-set" id="item_row_'+m+'" idi="'+m+'"></div>');(d=jQuery('<div class="fm-width-90"></div>')).append(create_matrix_row_item(t,m,"")),r.append(d);var l=jQuery('<div class="fm-width-10 fm-remove-button"><span class="fm-remove-attribute dashicons dashicons-dismiss" onClick="remove_rowcols('+m+", "+t+", 'row')\"></span></div>");r.append(l),a.append(r)}else{var d,_=jQuery("#columns");r=jQuery('<div class="fm-width-100 fm-fields-set" id="item_column_'+n+'" idi="'+n+'"></div>');(d=jQuery('<div class="fm-width-90"></div>')).append(create_matrix_column_item(t,n,"")),r.append(d);var o=jQuery('<div class="fm-width-10 fm-remove-button"><span class="fm-remove-attribute dashicons dashicons-dismiss" onClick="remove_rowcols('+n+", "+t+", 'column')\"></span></div>");r.append(o),_.append(r)}refresh_matrix(t)}function remove_rowcols(e,t,i){jQuery("#el_"+i+e).remove(),jQuery("#item_"+i+"_"+e).remove(),refresh_matrix(t)}function go_to_type_matrix(e){w_attr_name=[],w_attr_value=[],w_rows=["","row1","row2"],w_columns=["","column1","column2"],type_matrix(e,"Matrix","","top","no","radio",w_rows,w_columns,"no","wdform_matrix",w_attr_name,w_attr_value,"100")}function type_matrix(e,t,i,n,a,r,l,d,_,o,s,m,u){jQuery("#element_type").val("type_matrix"),delete_last_child();var c=jQuery("#edit_table"),p=jQuery('<div id="edit_div"></div>');c.append(p);var f=jQuery('<div id="edit_main_table"></div>');p.append(f),f.append(create_field_type("type_matrix")),f.append(create_label(e,t)),f.append(create_label_position(e,n)),f.append(create_hide_label(e,a)),f.append(create_required(e,_)),f.append(create_matrix_input_type(e,r)),f.append(create_matrix_input_size(e,u,r)),f.append(create_matrix_rows(e,l)),f.append(create_matrix_columns(e,d));var h=jQuery('<div class="inside"></div>');f.append(create_advanced_options_container(h)),h.append(create_field_label_size(e,i)),h.append(create_class(e,o)),h.append(create_additional_attributes(e,s,"type_matrix")),element="input",type="matrix";var y=document.createElement("input");y.setAttribute("type","hidden"),y.setAttribute("value","type_matrix"),y.setAttribute("name",e+"_typeform_id_temp"),y.setAttribute("id",e+"_typeform_id_temp");var b=document.createElement("input");b.setAttribute("type","hidden"),b.setAttribute("value",_),b.setAttribute("name",e+"_requiredform_id_temp"),b.setAttribute("id",e+"_requiredform_id_temp");var v=document.createElement("input");v.setAttribute("type","hidden"),v.setAttribute("value",a),v.setAttribute("name",e+"_hide_labelform_id_temp"),v.setAttribute("id",e+"_hide_labelform_id_temp");var g=document.createElement("input");g.setAttribute("type","hidden"),g.setAttribute("value",r),g.setAttribute("name",e+"_input_typeform_id_temp"),g.setAttribute("id",e+"_input_typeform_id_temp");var w=document.createElement("input");w.setAttribute("type","hidden"),w.setAttribute("value",u),w.setAttribute("name",e+"_textbox_sizeform_id_temp"),w.setAttribute("id",e+"_textbox_sizeform_id_temp");var E=document.createElement("div");E.setAttribute("id","main_div");var A=document.createElement("div");A.setAttribute("id",e+"_elemet_tableform_id_temp");var x="yes"==a?"none":"table-cell",k=document.createElement("div");k.setAttribute("align","left"),k.style.display=x,k.style.width=i+"px",k.setAttribute("id",e+"_label_sectionform_id_temp");var j=document.createElement("div");j.setAttribute("align","left"),j.style.display="table-cell",j.setAttribute("id",e+"_element_sectionform_id_temp");document.createElement("br"),document.createElement("br");var C=document.createElement("br"),I=(document.createElement("br"),document.createElement("div"));I.setAttribute("id",e+"_elementform_id_temp"),I.style.display="table";var B=document.createElement("div");B.setAttribute("id",e+"_table_little"),B.style.display="table-row-group",I.appendChild(B);var Q=document.createElement("span");Q.setAttribute("id",e+"_element_labelform_id_temp"),Q.innerHTML=t,Q.setAttribute("class","label");var T=document.createElement("span");T.setAttribute("id",e+"_required_elementform_id_temp"),T.innerHTML="",T.setAttribute("class","required"),"yes"==_&&(T.innerHTML=" *");var M=document.getElementById("show_table");k.appendChild(Q),k.appendChild(T),j.appendChild(y),j.appendChild(b),j.appendChild(v),j.appendChild(g),j.appendChild(w),j.appendChild(I),A.appendChild(k),A.appendChild(j),E.appendChild(A),E.appendChild(C),M.appendChild(E),jQuery("#main_div").append(form_maker.type_matrix_description),"top"==n&&label_top(e),change_class(o,e),refresh_attr(e,"type_matrix"),refresh_matrix(e)}function create_pagination_type(e){var t=jQuery('<label class="fm-field-label">Pagination Options</label>'),i=jQuery('<input type="radio" id="el_pagination_steps" name="el_pagination" onclick="pagination_type(\'steps\')"'+("steps"==e?' checked="checked"':"")+" />"),n=jQuery('<label for="el_pagination_steps">Steps</label>'),a=jQuery('<input type="radio" id="el_pagination_percentage" name="el_pagination" onclick="pagination_type(\'percentage\')"'+("percentage"==e?' checked="checked"':"")+" />"),r=jQuery('<label for="el_pagination_percentage">Percentage</label>'),l=jQuery('<input type="radio" id="el_pagination_none" name="el_pagination" onclick="pagination_type(\'none\')"'+("steps"!=e&&"percentage"!=e?' checked="checked"':"")+" />"),d=jQuery('<label for="el_pagination_none">No Context</label>'),_=i;return create_option_container(t,_=(_=(_=(_=(_=_.add(n)).add(a)).add(r)).add(l)).add(d))}function pagination_type(e){for(document.getElementById("pages_div").innerHTML="",w_pages=[],k=0,j=1;j<=form_view_max;j++)document.getElementById("form_id_tempform_view"+j)&&(k++,document.getElementById("form_id_tempform_view"+j).getAttribute("page_title")?w_pages[j]=document.getElementById("form_id_tempform_view"+j).getAttribute("page_title"):w_pages[j]="none");"steps"==e?make_page_steps(w_pages):"percentage"==e?make_page_percentage(w_pages):make_page_none()}function make_page_none(){document.getElementById("pages_div").innerHTML=""}function make_page_percentage(e){document.getElementById("pages_div").innerHTML="",show_title=document.getElementById("el_show_title_input").checked;var t=document.createElement("div");t.setAttribute("class","page_percentage_deactive");var i=document.createElement("div");i.setAttribute("id","div_percentage"),i.setAttribute("class","page_percentage_active");var n=document.createElement("b");for(i.appendChild(n),k=0,a="",j=1;j<=form_view_max;j++)if(e[j]&&(k++,"none"==e[j]&&(e[j]=""),j==form_view)){if(show_title){var a=document.createElement("span");1==k?a.style.paddingLeft="40px":a.style.paddingLeft="5px",a.innerHTML=e[j]}page_number=k}n.innerHTML=Math.round((page_number-1)/k*100)+"%",i.style.width=(page_number-1)/k*100+"%",t.appendChild(i),a&&t.appendChild(a),document.getElementById("pages_div").appendChild(t)}function make_page_steps(e){for(document.getElementById("pages_div").innerHTML="",show_title=document.getElementById("el_show_title_input").checked,k=0,j=1;j<=form_view_max;j++)e[j]&&(k++,"none"==e[j]&&(e[j]=""),page_number=document.createElement("span"),j==form_view?page_number.setAttribute("class","page_active"):page_number.setAttribute("class","page_deactive"),show_title?page_number.innerHTML=e[j]:page_number.innerHTML=k,document.getElementById("pages_div").appendChild(page_number))}function create_pagination_title(e){return create_option_container(jQuery('<label class="fm-field-label" for="el_show_title_input">Show Page Titles in Progress Bar</label>'),jQuery('<input type="checkbox" id="el_show_title_input" onClick="show_title_pagebreak()"'+(e?' checked="checked"':"")+" />"))}function show_title_pagebreak(){document.getElementById("pages_div").innerHTML="",document.getElementById("el_pagination_steps").checked?pagination_type("steps"):document.getElementById("el_pagination_percentage").checked&&pagination_type("percentage")}function create_pagination_numbers(e){return create_option_container(jQuery('<label class="fm-field-label" for="el_show_numbers_input">Show Page Numbers in Footer</label>'),jQuery('<input type="checkbox" id="el_show_numbers_input" onClick="show_numbers_pagebreak()"'+(e?' checked="checked"':"")+" />"))}function show_numbers_pagebreak(){if(document.getElementById("numbers_div").innerHTML="",document.getElementById("el_show_numbers_input").checked){for(k=0,j=1;j<=form_view_max;j++)document.getElementById("form_id_tempform_view"+j)&&(k++,j==form_view&&(page_number=k));var e=document.createElement("span");e.setAttribute("class","page_numbersform_id_temp"),e.innerHTML=page_number+"/"+k,document.getElementById("numbers_div").appendChild(e)}}function create_page_titles(){var e=jQuery('<label class="fm-field-label">Pages Titles</label>'),t=jQuery('<div id="items" class="fm-width-100"></div>');for(k=0,j=1;j<=form_view_max;j++){var i=jQuery("#form_id_tempform_view"+j);if(0<i.length){var n=jQuery('<div class="fm-width-100"></div>'),a=i.prop("page_title");null==typeof a&&(a="Untitled Page");var r=jQuery('<input type="text" class="fm-width-90" id="page_title_'+j+'" onKeyUp="set_page_title(this.value, '+j+')" value="'+a+'" />');n.append(jQuery("<label>"+j+". </label>")),n.append(r),t.append(n)}}return create_option_container(null,r=(r=e).add(t))}function set_page_title(e,t){e=e.replace(/(<([^>]+)>)/gi,""),document.getElementById("form_id_tempform_view"+t).setAttribute("page_title",e),show_title_pagebreak()}function el_page_navigation(){w_type=document.getElementById("pages").getAttribute("type"),w_show_numbers=!1,w_show_title=!1,"true"==document.getElementById("pages").getAttribute("show_numbers")&&(w_show_numbers=!0),"true"==document.getElementById("pages").getAttribute("show_title")&&(w_show_title=!0),w_attr_name=[],w_attr_value=[],type_page_navigation(w_type,w_show_title,w_show_numbers,w_attr_name,w_attr_value)}function type_page_navigation(e,t,i,n,a){fm_need_enable&&enable2(),jQuery("#element_type").val("type_page_navigation"),delete_last_child();var r=jQuery("#edit_table"),l=jQuery('<div id="edit_div"></div>');r.append(l);var d=jQuery('<div id="edit_main_table"></div>');for(l.append(d),d.append(create_field_type("type_page_navigation")),d.append(create_pagination_type(e)),d.append(create_pagination_title(t)),d.append(create_pagination_numbers(i)),d.append(create_page_titles()),w_pages=[],k=0,j=1;j<=form_view_max;j++)document.getElementById("form_id_tempform_view"+j)&&(document.getElementById("form_id_tempform_view"+j).getAttribute("page_title")?w_pages[j]=document.getElementById("form_id_tempform_view"+j).getAttribute("page_title"):w_pages[j]="Untitled Page");var _=document.createElement("div");_.setAttribute("id","main_div");var o=document.createElement("table");o.setAttribute("id","_elemet_tableform_id_temp"),o.setAttribute("width","90%");var s=document.createElement("tr"),m=document.createElement("td");m.setAttribute("valign","top"),m.setAttribute("align","left"),m.setAttribute("id","_element_sectionform_id_temp"),m.setAttribute("width","100%");var u=document.createElement("br"),c=document.createElement("div");c.setAttribute("align","left"),c.setAttribute("id","pages_div"),c.style.width="100%",c.innerHTML="";var p=document.createElement("div");p.setAttribute("align","center"),p.setAttribute("id","numbers_div"),p.style.width="100%",p.style.paddingTop="100px",p.innerHTML="",m.appendChild(c),m.appendChild(p);var f=document.getElementById("show_table");s.appendChild(m),o.appendChild(s),_.appendChild(o),_.appendChild(u),f.appendChild(_),"steps"==e?make_page_steps(w_pages):"percentage"==e?make_page_percentage(w_pages):make_page_none(w_pages),i&&show_numbers_pagebreak()}function refresh_page_numbers(){var n=jQuery(".wdform-page-and-images"),a="true"==document.getElementById("pages").getAttribute("show_numbers");n.each(function(e){var t=jQuery(this).find(".form_id_tempform_view_img").attr("id").split("form_id_tempform_view_img");if(j=t[1],document.getElementById("page_numbersform_id_temp"+j)&&(document.getElementById("page_numbersform_id_temp"+j).innerHTML="",a)){var i=document.createElement("span");i.setAttribute("class","page_numbersform_id_temp"),i.innerHTML=e+1+"/"+n.length,document.getElementById("page_numbersform_id_temp"+j).appendChild(i)}})}function gen_form_fields(){switch(wdtype){case"type_editor":w_editor=document.getElementById("wdform_field"+id).innerHTML,form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_editor+"*:*w_editor*:*",form_fields+="*:*new_field*:*";break;case"type_send_copy":for(w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,w_first_val=document.getElementById(id+"_elementform_id_temp").checked,atrs=return_attributes(id+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_first_val+"*:*w_first_val*:*",form_fields+=w_required+"*:*w_required*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_text":for(w_first_val=document.getElementById(id+"_elementform_id_temp").value,w_title=document.getElementById(id+"_elementform_id_temp").title,w_regExp_status=document.getElementById(id+"_regExpStatusform_id_temp").value,w_regExp_value=document.getElementById(id+"_regExp_valueform_id_temp").value,w_regExp_common=document.getElementById(id+"_regExp_commonform_id_temp").value,w_regExp_arg=document.getElementById(id+"_regArgumentform_id_temp").value,w_regExp_alert=document.getElementById(id+"_regExp_alertform_id_temp").value,w_readonly=document.getElementById(id+"_readonlyform_id_temp").value,w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,atrs=return_attributes(id+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_size+"*:*w_size*:*",form_fields+=w_first_val+"*:*w_first_val*:*",form_fields+=w_title+"*:*w_title*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_regExp_status+"*:*w_regExp_status*:*",form_fields+=w_regExp_value+"*:*w_regExp_value*:*",form_fields+=w_regExp_common+"*:*w_regExp_common*:*",form_fields+=w_regExp_arg+"*:*w_regExp_arg*:*",form_fields+=w_regExp_alert+"*:*w_regExp_alert*:*",form_fields+=w_unique+"*:*w_unique*:*",form_fields+=w_readonly+"*:*w_readonly*:*",form_fields+=w_class+"*:*w_class*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_number":for(w_first_val=document.getElementById(id+"_elementform_id_temp").value,w_title=document.getElementById(id+"_elementform_id_temp").title,atrs=return_attributes(id+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_size+"*:*w_size*:*",form_fields+=w_first_val+"*:*w_first_val*:*",form_fields+=w_title+"*:*w_title*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_unique+"*:*w_unique*:*",form_fields+=w_class+"*:*w_class*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_password":for(w_verification=document.getElementById(id+"_verification_id_temp").value,w_placeholder=document.getElementById(id+"_elementform_id_temp").placeholder,document.getElementById(id+"_1_element_labelform_id_temp").innerHTML?w_verification_label=document.getElementById(id+"_1_element_labelform_id_temp").innerHTML:w_verification_label=" ",w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,atrs=return_attributes(id+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_size+"*:*w_size*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_unique+"*:*w_unique*:*",form_fields+=w_class+"*:*w_class*:*",form_fields+=w_verification+"*:*w_verification*:*",form_fields+=w_verification_label+"*:*w_verification_label*:*",form_fields+=w_placeholder+"*:*w_placeholder*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_textarea":for(w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,w_first_val=document.getElementById(id+"_elementform_id_temp").value,w_characters_limit=document.getElementById(id+"_charlimitform_id_temp").value,w_title=document.getElementById(id+"_elementform_id_temp").title,s=document.getElementById(id+"_elementform_id_temp").style.height,w_size_h=s.substring(0,s.length-2),w=document.getElementById(id+"_elementform_id_temp").style.width,w_size_w=w.substring(0,w.length-2),atrs=return_attributes(id+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_size+"*:*w_size_w*:*",form_fields+=w_size_h+"*:*w_size_h*:*",form_fields+=w_first_val+"*:*w_first_val*:*",form_fields+=w_characters_limit+"*:*w_characters_limit*:*",form_fields+=w_title+"*:*w_title*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_unique+"*:*w_unique*:*",form_fields+=w_class+"*:*w_class*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_wdeditor":for(w_title=document.getElementById(id+"_elementform_id_temp").title,s=document.getElementById(id+"_elementform_id_temp").style.height,w_size_h=s.substring(0,s.length-2),w=document.getElementById(id+"_elementform_id_temp").style.width,w_size_w=w.substring(0,w.length-2),atrs=return_attributes(id+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_size+"*:*w_size_w*:*",form_fields+=w_size_h+"*:*w_size_h*:*",form_fields+=w_title+"*:*w_title*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_class+"*:*w_class*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_phone":for(w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,w_first_val=[document.getElementById(id+"_element_firstform_id_temp").value,document.getElementById(id+"_element_lastform_id_temp").value],w_title=[document.getElementById(id+"_element_firstform_id_temp").title,document.getElementById(id+"_element_lastform_id_temp").title],s=document.getElementById(id+"_element_lastform_id_temp").style.width,w_size=s.substring(0,s.length-2),w_mini_labels=[document.getElementById(id+"_mini_label_area_code").innerHTML,document.getElementById(id+"_mini_label_phone_number").innerHTML],atrs=return_attributes(id+"_element_firstform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_size+"*:*w_size*:*",form_fields+=w_first_val.join("***")+"*:*w_first_val*:*",form_fields+=w_title.join("***")+"*:*w_title*:*",form_fields+=w_mini_labels.join("***")+"*:*w_mini_labels*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_unique+"*:*w_unique*:*",form_fields+=w_class+"*:*w_class*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_phone_new":for(w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,w_first_val=document.getElementById(id+"_elementform_id_temp").value,w_top_country=document.getElementById(id+"_elementform_id_temp").getAttribute("top-country"),atrs=return_attributes(id+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_size+"*:*w_size*:*",form_fields+=w_first_val+"*:*w_first_val*:*",form_fields+=w_top_country+"*:*w_top_country*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_unique+"*:*w_unique*:*",form_fields+=w_class+"*:*w_class*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_name":if(document.getElementById(id+"_enable_fieldsform_id_temp")){w_name_format="normal",w_first_val=[document.getElementById(id+"_element_firstform_id_temp").value,document.getElementById(id+"_element_lastform_id_temp").value],w_title=[document.getElementById(id+"_element_firstform_id_temp").title,document.getElementById(id+"_element_lastform_id_temp").title];for(var e=["title","middle"],t=0;t<2;t++)w_first_val.push(document.getElementById(id+"_element_"+e[t]+"form_id_temp")?document.getElementById(id+"_element_"+e[t]+"form_id_temp").value:""),w_title.push(document.getElementById(id+"_element_"+e[t]+"form_id_temp")?document.getElementById(id+"_element_"+e[t]+"form_id_temp").title:"")}else document.getElementById(id+"_element_middleform_id_temp")?w_name_format="extended":w_name_format="normal","normal"==w_name_format?(w_first_val=[document.getElementById(id+"_element_firstform_id_temp").value,document.getElementById(id+"_element_lastform_id_temp").value],w_title=[document.getElementById(id+"_element_firstform_id_temp").title,document.getElementById(id+"_element_lastform_id_temp").title]):(w_first_val=[document.getElementById(id+"_element_firstform_id_temp").value,document.getElementById(id+"_element_lastform_id_temp").value,document.getElementById(id+"_element_titleform_id_temp").value,document.getElementById(id+"_element_middleform_id_temp").value],w_title=[document.getElementById(id+"_element_firstform_id_temp").title,document.getElementById(id+"_element_lastform_id_temp").title,document.getElementById(id+"_element_titleform_id_temp").title,document.getElementById(id+"_element_middleform_id_temp").title]);for(document.getElementById(id+"_mini_label_title")?w_mini_title=document.getElementById(id+"_mini_label_title").innerHTML:w_mini_title="Title",document.getElementById(id+"_mini_label_middle")?w_mini_middle=document.getElementById(id+"_mini_label_middle").innerHTML:w_mini_middle="Middle",w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,w_mini_labels=[w_mini_title,document.getElementById(id+"_mini_label_first").innerHTML,document.getElementById(id+"_mini_label_last").innerHTML,w_mini_middle],w_name_title=document.getElementById(id+"_enable_fieldsform_id_temp")?document.getElementById(id+"_enable_fieldsform_id_temp").getAttribute("title"):"normal"==w_name_format?"no":"yes",w_name_middle=document.getElementById(id+"_enable_fieldsform_id_temp")?document.getElementById(id+"_enable_fieldsform_id_temp").getAttribute("middle"):"normal"==w_name_format?"no":"yes",w_name_fields=[w_name_title,w_name_middle],w_autofill=document.getElementById(id+"_autofillform_id_temp").value,s=document.getElementById(id+"_element_firstform_id_temp").style.width,w_size=s.substring(0,s.length-2),atrs=return_attributes(id+"_element_firstform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_first_val.join("***")+"*:*w_first_val*:*",form_fields+=w_title.join("***")+"*:*w_title*:*",form_fields+=w_mini_labels.join("***")+"*:*w_mini_labels*:*",form_fields+=w_size+"*:*w_size*:*",form_fields+=w_name_format+"*:*w_name_format*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_unique+"*:*w_unique*:*",form_fields+=w_class+"*:*w_class*:*",form_fields+=w_name_fields.join("***")+"*:*w_name_fields*:*",form_fields+=w_autofill+"*:*w_autofill*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_paypal_price":for(w_first_val=[document.getElementById(id+"_element_dollarsform_id_temp").value,document.getElementById(id+"_element_centsform_id_temp").value],w_title=[document.getElementById(id+"_element_dollarsform_id_temp").title,document.getElementById(id+"_element_centsform_id_temp").title],"none"==document.getElementById(id+"_td_name_cents").style.display?w_hide_cents="yes":w_hide_cents="no",s=document.getElementById(id+"_element_dollarsform_id_temp").style.width,w_size=s.substring(0,s.length-2),atrs=return_attributes(id+"_element_dollarsform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],w_range_min=document.getElementById(id+"_range_minform_id_temp").value,w_range_max=document.getElementById(id+"_range_maxform_id_temp").value,w_mini_labels=[document.getElementById(id+"_mini_label_dollars").innerHTML,document.getElementById(id+"_mini_label_cents").innerHTML],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_first_val.join("***")+"*:*w_first_val*:*",form_fields+=w_title.join("***")+"*:*w_title*:*",form_fields+=w_mini_labels.join("***")+"*:*w_mini_labels*:*",form_fields+=w_size+"*:*w_size*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_hide_cents+"*:*w_hide_cents*:*",form_fields+=w_class+"*:*w_class*:*",form_fields+=w_range_min+"*:*w_range_min*:*",form_fields+=w_range_max+"*:*w_range_max*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_paypal_price_new":for(w_first_val=document.getElementById(id+"_elementform_id_temp").value,w_title=document.getElementById(id+"_elementform_id_temp").title,s=document.getElementById(id+"_elementform_id_temp").style.width,w_size=s.substring(0,s.length-2),atrs=return_attributes(id+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],w_range_min=document.getElementById(id+"_range_minform_id_temp").value,w_range_max=document.getElementById(id+"_range_maxform_id_temp").value,w_readonly=document.getElementById(id+"_readonlyform_id_temp").value,w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,"none"==document.getElementById(id+"_td_name_currency").style.display?w_currency="yes":w_currency="no",form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_first_val+"*:*w_first_val*:*",form_fields+=w_title+"*:*w_title*:*",form_fields+=w_size+"*:*w_size*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_class+"*:*w_class*:*",form_fields+=w_range_min+"*:*w_range_min*:*",form_fields+=w_range_max+"*:*w_range_max*:*",form_fields+=w_readonly+"*:*w_readonly*:*",form_fields+=w_currency+"*:*w_currency*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_address":s=document.getElementById(id+"_div_address").style.width,w_size=s.substring(0,s.length-2),document.getElementById(id+"_mini_label_street1")?w_street1=document.getElementById(id+"_mini_label_street1").innerHTML:w_street1=document.getElementById(id+"_street1form_id_temp").value,document.getElementById(id+"_mini_label_street2")?w_street2=document.getElementById(id+"_mini_label_street2").innerHTML:w_street2=document.getElementById(id+"_street2form_id_temp").value,document.getElementById(id+"_mini_label_city")?w_city=document.getElementById(id+"_mini_label_city").innerHTML:w_city=document.getElementById(id+"_cityform_id_temp").value,document.getElementById(id+"_mini_label_state")?w_state=document.getElementById(id+"_mini_label_state").innerHTML:w_state=document.getElementById(id+"_stateform_id_temp").value,document.getElementById(id+"_mini_label_postal")?w_postal=document.getElementById(id+"_mini_label_postal").innerHTML:w_postal=document.getElementById(id+"_postalform_id_temp").value,document.getElementById(id+"_mini_label_country")?w_country=document.getElementById(id+"_mini_label_country").innerHTML:w_country=document.getElementById(id+"_countryform_id_temp").value,w_mini_labels=[w_street1,w_street2,w_city,w_state,w_postal,w_country];var i=document.getElementById(id+"_disable_fieldsform_id_temp");for(w_street1_dis=i.getAttribute("street1"),w_street2_dis=i.getAttribute("street2"),w_city_dis=i.getAttribute("city"),w_state_dis=i.getAttribute("state"),w_us_states_dis=i.getAttribute("us_states"),w_postal_dis=i.getAttribute("postal"),w_country_dis=i.getAttribute("country"),w_disabled_fields=[w_street1_dis,w_street2_dis,w_city_dis,w_state_dis,w_postal_dis,w_country_dis,w_us_states_dis],w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,atrs=return_attributes(id+"_street1form_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_size+"*:*w_size*:*",form_fields+=w_mini_labels.join("***")+"*:*w_mini_labels*:*",form_fields+=w_disabled_fields.join("***")+"*:*w_disabled_fields*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_class+"*:*w_class*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_submitter_mail":for(w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,w_first_val=document.getElementById(id+"_elementform_id_temp").value,w_title=document.getElementById(id+"_elementform_id_temp").title,w_autofill=document.getElementById(id+"_autofillform_id_temp").value,w_verification=document.getElementById(id+"_verification_id_temp").value,w_verification_placeholder=document.getElementById(id+"_1_elementform_id_temp").title,document.getElementById(id+"_1_element_labelform_id_temp").innerHTML?w_verification_label=document.getElementById(id+"_1_element_labelform_id_temp").innerHTML:w_verification_label=" ",atrs=return_attributes(id+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_size+"*:*w_size*:*",form_fields+=w_first_val+"*:*w_first_val*:*",form_fields+=w_title+"*:*w_title*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_unique+"*:*w_unique*:*",form_fields+=w_class+"*:*w_class*:*",form_fields+=w_verification+"*:*w_verification*:*",form_fields+=w_verification_label+"*:*w_verification_label*:*",form_fields+=w_verification_placeholder+"*:*w_verification_placeholder*:*",form_fields+=w_autofill+"*:*w_autofill*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_checkbox":if(w_randomize=document.getElementById(id+"_randomizeform_id_temp").value,w_allow_other=document.getElementById(id+"_allow_otherform_id_temp").value,w_limit_choice=document.getElementById(id+"_limitchoice_numform_id_temp").value,w_limit_choice_alert=document.getElementById(id+"_limitchoicealert_numform_id_temp").value,tt=0,v=0,w_randomize=document.getElementById(id+"_randomizeform_id_temp").value,w_allow_other=document.getElementById(id+"_allow_otherform_id_temp").value,document.getElementById(id+"_rowcol_numform_id_temp").value?(document.getElementById(id+"_table_little").getAttribute("for_hor")?w_flow="hor":w_flow="ver",w_rowcol=document.getElementById(id+"_rowcol_numform_id_temp").value):(document.getElementById(id+"_hor")?w_flow="hor":w_flow="ver",w_rowcol=1),"ver"==w_flow){var n=document.getElementById(id+"_table_little");for(k=0;k<n.childNodes.length;k++){var a=n.childNodes[k];for(m=0;m<a.childNodes.length;m++){var r=a.childNodes[m].getAttribute("idi");document.getElementById(id+"_elementform_id_temp"+r).getAttribute("other")&&"1"==document.getElementById(id+"_elementform_id_temp"+r).getAttribute("other")&&(w_allow_other_num=tt),w_choices[tt]=document.getElementById(id+"_label_element"+r).innerHTML,w_choices_checked[tt]=document.getElementById(id+"_elementform_id_temp"+r).checked,w_choices_value[tt]=document.getElementById(id+"_elementform_id_temp"+r).value,w_choices_value[tt]=w_choices_value[tt].replaceAll("'",""),document.getElementById(id+"_label_element"+r).getAttribute("where")?w_choices_params[tt]=document.getElementById(id+"_label_element"+r).getAttribute("where")+"[where_order_by]"+document.getElementById(id+"_label_element"+r).getAttribute("order_by")+"[db_info]"+document.getElementById(id+"_label_element"+r).getAttribute("db_info"):w_choices_params[tt]="",tt++,v=r}}}else{var l=(d=(n=document.getElementById(id+"_table_little")).childNodes)[0].childNodes;for(k=0;k<l.length;k++)for(m=0;m<d.length;m++)if(d[m].childNodes[k]){r=(a=d[m].childNodes[k]).getAttribute("idi");document.getElementById(id+"_elementform_id_temp"+r).getAttribute("other")&&"1"==document.getElementById(id+"_elementform_id_temp"+r).getAttribute("other")&&(w_allow_other_num=tt),w_choices[tt]=document.getElementById(id+"_label_element"+r).innerHTML,w_choices_checked[tt]=document.getElementById(id+"_elementform_id_temp"+r).checked,w_choices_value[tt]=document.getElementById(id+"_elementform_id_temp"+r).value,w_choices_value[tt]=w_choices_value[tt].replaceAll("'",""),document.getElementById(id+"_label_element"+r).getAttribute("where")?w_choices_params[tt]=document.getElementById(id+"_label_element"+r).getAttribute("where")+"[where_order_by]"+document.getElementById(id+"_label_element"+r).getAttribute("order_by")+"[db_info]"+document.getElementById(id+"_label_element"+r).getAttribute("db_info"):w_choices_params[tt]="",tt++,v=r}}for(document.getElementById(id+"_option_left_right")?w_field_option_pos=document.getElementById(id+"_option_left_right").value:w_field_option_pos="left",w_value_disabled=document.getElementById(id+"_value_disabledform_id_temp").value,w_use_for_submission=document.getElementById(id+"_use_for_submissionform_id_temp").value,w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,atrs=return_attributes(id+"_elementform_id_temp"+v),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_field_option_pos+"*:*w_field_option_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_flow+"*:*w_flow*:*",form_fields+=w_choices.join("***")+"*:*w_choices*:*",form_fields+=w_choices_checked.join("***")+"*:*w_choices_checked*:*",form_fields+=w_rowcol+"*:*w_rowcol*:*",form_fields+=w_limit_choice+"*:*w_limit_choice*:*",form_fields+=w_limit_choice_alert+"*:*w_limit_choice_alert*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_randomize+"*:*w_randomize*:*",form_fields+=w_allow_other+"*:*w_allow_other*:*",form_fields+=w_allow_other_num+"*:*w_allow_other_num*:*",form_fields+=w_value_disabled+"*:*w_value_disabled*:*",form_fields+=w_use_for_submission+"*:*w_use_for_submission*:*",form_fields+=w_choices_value.join("***")+"*:*w_choices_value*:*",form_fields+=w_choices_params.join("***")+"*:*w_choices_params*:*",form_fields+=w_class+"*:*w_class*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_paypal_checkbox":for(document.getElementById(id+"_hor")?w_flow="hor":w_flow="ver",w_randomize=document.getElementById(id+"_randomizeform_id_temp").value,w_allow_other=document.getElementById(id+"_allow_otherform_id_temp").value,tt=0,v=0,k=0;k<100;k++)if(document.getElementById(id+"_elementform_id_temp"+k)&&(document.getElementById(id+"_elementform_id_temp"+k).getAttribute("other")&&"1"==document.getElementById(id+"_elementform_id_temp"+k).getAttribute("other")&&(w_allow_other_num=tt),w_choices[tt]=document.getElementById(id+"_label_element"+k).innerHTML," "==w_choices[tt][w_choices[tt].length-1]&&(w_choices[tt]=w_choices[tt].substring(0,w_choices[tt].length-1)),w_choices_price[tt]=document.getElementById(id+"_elementform_id_temp"+k).value,w_choices_checked[tt]=document.getElementById(id+"_elementform_id_temp"+k).checked,document.getElementById(id+"_label_element"+k).getAttribute("where")?w_choices_params[tt]=document.getElementById(id+"_label_element"+k).getAttribute("where")+"[where_order_by]"+document.getElementById(id+"_label_element"+k).getAttribute("order_by")+"[db_info]"+document.getElementById(id+"_label_element"+k).getAttribute("db_info"):w_choices_params[tt]="",tt++,v=k),document.getElementById(id+"_propertyform_id_temp"+k))if(w_property.push(document.getElementById(id+"_property_label_form_id_temp"+k).innerHTML),document.getElementById(id+"_propertyform_id_temp"+k).childNodes.length)for(w_property_values[w_property.length-1]="",m=0;m<document.getElementById(id+"_propertyform_id_temp"+k).childNodes.length;m++)w_property_values[w_property.length-1]+="###"+document.getElementById(id+"_propertyform_id_temp"+k).childNodes[m].value;else w_property_values.push("");for(w_quantity="no",w_quantity_value=1,document.getElementById(id+"_element_quantityform_id_temp")&&(w_quantity="yes",w_quantity_value=document.getElementById(id+"_element_quantityform_id_temp").value),document.getElementById(id+"_option_left_right")?w_field_option_pos=document.getElementById(id+"_option_left_right").value:w_field_option_pos="left",w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,atrs=return_attributes(id+"_elementform_id_temp"+v),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_field_option_pos+"*:*w_field_option_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_flow+"*:*w_flow*:*",form_fields+=w_choices.join("***")+"*:*w_choices*:*",form_fields+=w_choices_price.join("***")+"*:*w_choices_price*:*",form_fields+=w_choices_checked.join("***")+"*:*w_choices_checked*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_randomize+"*:*w_randomize*:*",form_fields+=w_allow_other+"*:*w_allow_other*:*",form_fields+=w_allow_other_num+"*:*w_allow_other_num*:*",form_fields+=w_choices_params.join("***")+"*:*w_choices_params*:*",form_fields+=w_class+"*:*w_class*:*",form_fields+=w_property.join("***")+"*:*w_property*:*",form_fields+=w_property_values.join("***")+"*:*w_property_values*:*",form_fields+=w_quantity+"*:*w_quantity*:*",form_fields+=w_quantity_value+"*:*w_quantity_value*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_radio":if(w_randomize=document.getElementById(id+"_randomizeform_id_temp").value,w_allow_other=document.getElementById(id+"_allow_otherform_id_temp").value,document.getElementById(id+"_rowcol_numform_id_temp").value?(document.getElementById(id+"_table_little").getAttribute("for_hor")?w_flow="hor":w_flow="ver",w_rowcol=document.getElementById(id+"_rowcol_numform_id_temp").value):(document.getElementById(id+"_table_little").getAttribute("for_hor")?w_flow="hor":w_flow="ver",w_rowcol=1),v=0,tt=0,"ver"==w_flow){n=document.getElementById(id+"_table_little");for(k=0;k<n.childNodes.length;k++){a=n.childNodes[k];for(m=0;m<a.childNodes.length;m++){r=a.childNodes[m].getAttribute("idi");document.getElementById(id+"_elementform_id_temp"+r).getAttribute("other")&&"1"==document.getElementById(id+"_elementform_id_temp"+r).getAttribute("other")&&(w_allow_other_num=tt),w_choices[tt]=document.getElementById(id+"_label_element"+r).innerHTML,w_choices_checked[tt]=document.getElementById(id+"_elementform_id_temp"+r).checked,w_choices_value[tt]=document.getElementById(id+"_elementform_id_temp"+r).value,document.getElementById(id+"_label_element"+r).getAttribute("where")?w_choices_params[tt]=document.getElementById(id+"_label_element"+r).getAttribute("where")+"[where_order_by]"+document.getElementById(id+"_label_element"+r).getAttribute("order_by")+"[db_info]"+document.getElementById(id+"_label_element"+r).getAttribute("db_info"):w_choices_params[tt]="",tt++,v=r}}}else{var d;l=(d=(n=document.getElementById(id+"_table_little")).childNodes)[0].childNodes;for(k=0;k<l.length;k++)for(m=0;m<d.length;m++)if(d[m].childNodes[k]){r=(a=d[m].childNodes[k]).getAttribute("idi");document.getElementById(id+"_elementform_id_temp"+r).getAttribute("other")&&"1"==document.getElementById(id+"_elementform_id_temp"+r).getAttribute("other")&&(w_allow_other_num=tt),w_choices[tt]=document.getElementById(id+"_label_element"+r).innerHTML,w_choices_checked[tt]=document.getElementById(id+"_elementform_id_temp"+r).checked,w_choices_value[tt]=document.getElementById(id+"_elementform_id_temp"+r).value,document.getElementById(id+"_label_element"+r).getAttribute("where")?w_choices_params[tt]=document.getElementById(id+"_label_element"+r).getAttribute("where")+"[where_order_by]"+document.getElementById(id+"_label_element"+r).getAttribute("order_by")+"[db_info]"+document.getElementById(id+"_label_element"+r).getAttribute("db_info"):w_choices_params[tt]="",tt++,v=r}}for(document.getElementById(id+"_option_left_right")?w_field_option_pos=document.getElementById(id+"_option_left_right").value:w_field_option_pos="left",w_value_disabled=document.getElementById(id+"_value_disabledform_id_temp").value,w_use_for_submission=document.getElementById(id+"_use_for_submissionform_id_temp").value,w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,atrs=return_attributes(id+"_elementform_id_temp"+v),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_field_option_pos+"*:*w_field_option_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_flow+"*:*w_flow*:*",form_fields+=w_choices.join("***")+"*:*w_choices*:*",form_fields+=w_choices_checked.join("***")+"*:*w_choices_checked*:*",form_fields+=w_rowcol+"*:*w_rowcol*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_randomize+"*:*w_randomize*:*",form_fields+=w_allow_other+"*:*w_allow_other*:*",form_fields+=w_allow_other_num+"*:*w_allow_other_num*:*",form_fields+=w_value_disabled+"*:*w_value_disabled*:*",form_fields+=w_use_for_submission+"*:*w_use_for_submission*:*",form_fields+=w_choices_value.join("***")+"*:*w_choices_value*:*",form_fields+=w_choices_params.join("***")+"*:*w_choices_params*:*",form_fields+=w_class+"*:*w_class*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_paypal_radio":for(document.getElementById(id+"_hor")?w_flow="hor":w_flow="ver",w_randomize=document.getElementById(id+"_randomizeform_id_temp").value,w_allow_other=document.getElementById(id+"_allow_otherform_id_temp").value,v=0,tt=0,k=0;k<100;k++)if(document.getElementById(id+"_elementform_id_temp"+k)&&(document.getElementById(id+"_elementform_id_temp"+k).getAttribute("other")&&"1"==document.getElementById(id+"_elementform_id_temp"+k).getAttribute("other")&&(w_allow_other_num=tt),w_choices[tt]=document.getElementById(id+"_label_element"+k).innerHTML," "==w_choices[tt][w_choices[tt].length-1]&&(w_choices[tt]=w_choices[tt].substring(0,w_choices[tt].length-1)),w_choices_price[tt]=document.getElementById(id+"_elementform_id_temp"+k).value,w_choices_checked[tt]="checked"==document.getElementById(id+"_elementform_id_temp"+k).getAttribute("checked"),document.getElementById(id+"_label_element"+k).getAttribute("where")?w_choices_params[tt]=document.getElementById(id+"_label_element"+k).getAttribute("where")+"[where_order_by]"+document.getElementById(id+"_label_element"+k).getAttribute("order_by")+"[db_info]"+document.getElementById(id+"_label_element"+k).getAttribute("db_info"):w_choices_params[tt]="",tt++,v=k),document.getElementById(id+"_propertyform_id_temp"+k))if(w_property.push(document.getElementById(id+"_property_label_form_id_temp"+k).innerHTML),document.getElementById(id+"_propertyform_id_temp"+k).childNodes.length)for(w_property_values[w_property.length-1]="",m=0;m<document.getElementById(id+"_propertyform_id_temp"+k).childNodes.length;m++)w_property_values[w_property.length-1]+="###"+document.getElementById(id+"_propertyform_id_temp"+k).childNodes[m].value;else w_property_values.push("");for(w_quantity="no",w_quantity_value=1,document.getElementById(id+"_element_quantityform_id_temp")&&(w_quantity="yes",w_quantity_value=document.getElementById(id+"_element_quantityform_id_temp").value),document.getElementById(id+"_option_left_right")?w_field_option_pos=document.getElementById(id+"_option_left_right").value:w_field_option_pos="left",w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,atrs=return_attributes(id+"_elementform_id_temp"+v),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_field_option_pos+"*:*w_field_option_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_flow+"*:*w_flow*:*",form_fields+=w_choices.join("***")+"*:*w_choices*:*",form_fields+=w_choices_price.join("***")+"*:*w_choices_price*:*",form_fields+=w_choices_checked.join("***")+"*:*w_choices_checked*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_randomize+"*:*w_randomize*:*",form_fields+=w_allow_other+"*:*w_allow_other*:*",form_fields+=w_allow_other_num+"*:*w_allow_other_num*:*",form_fields+=w_choices_params.join("***")+"*:*w_choices_params*:*",form_fields+=w_class+"*:*w_class*:*",form_fields+=w_property.join("***")+"*:*w_property*:*",form_fields+=w_property_values.join("***")+"*:*w_property_values*:*",form_fields+=w_quantity+"*:*w_quantity*:*",form_fields+=w_quantity_value+"*:*w_quantity_value*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_paypal_shipping":for(document.getElementById(id+"_hor")?w_flow="hor":w_flow="ver",w_randomize=document.getElementById(id+"_randomizeform_id_temp").value,w_allow_other=document.getElementById(id+"_allow_otherform_id_temp").value,v=0,tt=0,k=0;k<100;k++)if(document.getElementById(id+"_elementform_id_temp"+k)&&(document.getElementById(id+"_elementform_id_temp"+k).getAttribute("other")&&"1"==document.getElementById(id+"_elementform_id_temp"+k).getAttribute("other")&&(w_allow_other_num=tt),w_choices[tt]=document.getElementById(id+"_label_element"+k).innerHTML," "==w_choices[tt][w_choices[tt].length-1]&&(w_choices[tt]=w_choices[tt].substring(0,w_choices[tt].length-1)),w_choices_price[tt]=document.getElementById(id+"_elementform_id_temp"+k).value,w_choices_checked[tt]="checked"==document.getElementById(id+"_elementform_id_temp"+k).getAttribute("checked"),document.getElementById(id+"_label_element"+k).getAttribute("where")?w_choices_params[tt]=document.getElementById(id+"_label_element"+k).getAttribute("where")+"[where_order_by]"+document.getElementById(id+"_label_element"+k).getAttribute("order_by")+"[db_info]"+document.getElementById(id+"_label_element"+k).getAttribute("db_info"):w_choices_params[tt]="",tt++,v=k),document.getElementById(id+"_propertyform_id_temp"+k))if(w_property.push(document.getElementById(id+"_property_label_form_id_temp"+k).innerHTML),document.getElementById(id+"_propertyform_id_temp"+k).childNodes.length)for(w_property_values[w_property.length-1]=new Array,m=0;m<document.getElementById(id+"_propertyform_id_temp"+k).childNodes.length;m++)w_property_values[w_property.length-1].push(document.getElementById(id+"_propertyform_id_temp"+k).childNodes[m].value);else w_property_values.push("");for(document.getElementById(id+"_option_left_right")?w_field_option_pos=document.getElementById(id+"_option_left_right").value:w_field_option_pos="left",w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,atrs=return_attributes(id+"_elementform_id_temp"+v),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_field_option_pos+"*:*w_field_option_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_flow+"*:*w_flow*:*",form_fields+=w_choices.join("***")+"*:*w_choices*:*",form_fields+=w_choices_price.join("***")+"*:*w_choices_price*:*",form_fields+=w_choices_checked.join("***")+"*:*w_choices_checked*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_randomize+"*:*w_randomize*:*",form_fields+=w_allow_other+"*:*w_allow_other*:*",form_fields+=w_allow_other_num+"*:*w_allow_other_num*:*",form_fields+=w_choices_params.join("***")+"*:*w_choices_params*:*",form_fields+=w_class+"*:*w_class*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_paypal_total":w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,w_size=jQuery("#"+id+"paypal_totalform_id_temp").css("width")?jQuery("#"+id+"paypal_totalform_id_temp").css("width").substring(0,jQuery("#"+id+"paypal_totalform_id_temp").css("width").length-2):"300",w_hide_total_currency=document.getElementById(id+"_hide_totalcurrency_id_temp").value,form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_class+"*:*w_class*:*",form_fields+=w_size+"*:*w_size*:*",form_fields+=w_hide_total_currency+"*:*w_hide_total_currency*:*",form_fields+="*:*new_field*:*";break;case"type_stripe":w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_size+"*:*w_size*:*",form_fields+=w_class+"*:*w_class*:*",form_fields+="*:*new_field*:*";break;case"type_star_rating":for(w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,w_star_amount=document.getElementById(id+"_star_amountform_id_temp").value,w_field_label_col=document.getElementById(id+"_star_colorform_id_temp").value,atrs=return_attributes(id+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_field_label_col+"*:*w_field_label_col*:*",form_fields+=w_star_amount+"*:*w_star_amount*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_class+"*:*w_class*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_scale_rating":for(w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,w_mini_labels=[document.getElementById(id+"_mini_label_worst").innerHTML,document.getElementById(id+"_mini_label_best").innerHTML],w_scale_amount=document.getElementById(id+"_scale_amountform_id_temp").value,atrs=return_attributes(id+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_mini_labels.join("***")+"*:*w_mini_labels*:*",form_fields+=w_scale_amount+"*:*w_scale_amount*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_class+"*:*w_class*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_spinner":for(w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,w_field_min_value=document.getElementById(id+"_min_valueform_id_temp").value,w_field_max_value=document.getElementById(id+"_max_valueform_id_temp").value,w_field_width=document.getElementById(id+"_spinner_widthform_id_temp").value,w_field_step=document.getElementById(id+"_stepform_id_temp").value,w_field_value=document.getElementById(id+"_elementform_id_temp").getAttribute("aria-valuenow"),atrs=return_attributes(id+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_field_width+"*:*w_field_width*:*",form_fields+=w_field_min_value+"*:*w_field_min_value*:*",form_fields+=w_field_max_value+"*:*w_field_max_value*:*",form_fields+=w_field_step+"*:*w_field_step*:*",form_fields+=w_field_value+"*:*w_field_value*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_class+"*:*w_class*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_slider":for(w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,w_field_min_value=document.getElementById(id+"_slider_min_valueform_id_temp").value,w_field_max_value=document.getElementById(id+"_slider_max_valueform_id_temp").value,w_field_step=document.getElementById(id+"_slider_stepform_id_temp")&&document.getElementById(id+"_slider_stepform_id_temp").value?document.getElementById(id+"_slider_stepform_id_temp").value:1,w_field_width=document.getElementById(id+"_slider_widthform_id_temp").value,w_field_value=document.getElementById(id+"_slider_valueform_id_temp").value,atrs=return_attributes(id+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_field_width+"*:*w_field_width*:*",form_fields+=w_field_min_value+"*:*w_field_min_value*:*",form_fields+=w_field_max_value+"*:*w_field_max_value*:*",form_fields+=w_field_step+"*:*w_field_step*:*",form_fields+=w_field_value+"*:*w_field_value*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_class+"*:*w_class*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_range":for(w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,w_field_range_width=document.getElementById(id+"_range_widthform_id_temp").value,w_field_range_step=document.getElementById(id+"_range_stepform_id_temp").value,w_field_value1=document.getElementById(id+"_elementform_id_temp0").getAttribute("aria-valuenow"),w_field_value2=document.getElementById(id+"_elementform_id_temp1").getAttribute("aria-valuenow"),atrs=return_attributes(id+"_elementform_id_temp0"),w_attr_name=atrs[0],w_attr_value=atrs[1],w_mini_labels=[document.getElementById(id+"_mini_label_from").innerHTML,document.getElementById(id+"_mini_label_to").innerHTML],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_field_range_width+"*:*w_field_range_width*:*",form_fields+=w_field_range_step+"*:*w_field_range_step*:*",form_fields+=w_field_value1+"*:*w_field_value1*:*",form_fields+=w_field_value2+"*:*w_field_value2*:*",form_fields+=w_mini_labels.join("***")+"*:*w_mini_labels*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_class+"*:*w_class*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_grading":for(w_total=document.getElementById(id+"_grading_totalform_id_temp").value,w_items=[],k=0;k<100;k++)document.getElementById(id+"_label_elementform_id_temp"+k)&&w_items.push(document.getElementById(id+"_label_elementform_id_temp"+k).innerHTML);for(w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,atrs=return_attributes(id+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_items.join("***")+"*:*w_items*:*",form_fields+=w_total+"*:*w_total*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_class+"*:*w_class*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_matrix":for(w_rows=[],w_rows[0]="",k=1;k<100;k++)document.getElementById(id+"_label_elementform_id_temp"+k+"_0")&&w_rows.push(document.getElementById(id+"_label_elementform_id_temp"+k+"_0").innerHTML);for(w_columns=[],w_columns[0]="",k=1;k<100;k++)document.getElementById(id+"_label_elementform_id_temp0_"+k)&&w_columns.push(document.getElementById(id+"_label_elementform_id_temp0_"+k).innerHTML);for(w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,w_field_input_type=document.getElementById(id+"_input_typeform_id_temp").value,w_textbox_size=document.getElementById(id+"_textbox_sizeform_id_temp")?document.getElementById(id+"_textbox_sizeform_id_temp").value:"100",atrs=return_attributes(id+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_field_input_type+"*:*w_field_input_type*:*",form_fields+=w_rows.join("***")+"*:*w_rows*:*",form_fields+=w_columns.join("***")+"*:*w_columns*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_class+"*:*w_class*:*",form_fields+=w_textbox_size+"*:*w_textbox_size*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_time":for(w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,atrs=return_attributes(id+"_hhform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],w_hh=document.getElementById(id+"_hhform_id_temp").value,w_mm=document.getElementById(id+"_mmform_id_temp").value,document.getElementById(id+"_ssform_id_temp")?(w_ss=document.getElementById(id+"_ssform_id_temp").value,w_sec="1",w_sec_label=document.getElementById(id+"_mini_label_ss").innerHTML):(w_ss="",w_sec="0",w_sec_label="SS"),document.getElementById(id+"_am_pm_select")?(w_am_pm=document.getElementById(id+"_am_pmform_id_temp").value,w_time_type="12",w_mini_labels=[document.getElementById(id+"_mini_label_hh").innerHTML,document.getElementById(id+"_mini_label_mm").innerHTML,w_sec_label,document.getElementById(id+"_mini_label_am_pm").innerHTML]):(w_am_pm=0,w_time_type="24",w_mini_labels=[document.getElementById(id+"_mini_label_hh").innerHTML,document.getElementById(id+"_mini_label_mm").innerHTML,w_sec_label,"AM/PM"]),form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_time_type+"*:*w_time_type*:*",form_fields+=w_am_pm+"*:*w_am_pm*:*",form_fields+=w_sec+"*:*w_sec*:*",form_fields+=w_hh+"*:*w_hh*:*",form_fields+=w_mm+"*:*w_mm*:*",form_fields+=w_ss+"*:*w_ss*:*",form_fields+=w_mini_labels.join("***")+"*:*w_mini_labels*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_class+"*:*w_class*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_date":for(atrs=return_attributes(id+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],w_date=document.getElementById(id+"_elementform_id_temp").value,w_format=document.getElementById(id+"_buttonform_id_temp").getAttribute("format"),w_but_val=document.getElementById(id+"_buttonform_id_temp").value,w_disable_past_days=document.getElementById(id+"_dis_past_daysform_id_temp")?document.getElementById(id+"_dis_past_daysform_id_temp").value:"no",form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_date+"*:*w_date*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_class+"*:*w_class*:*",form_fields+=w_format+"*:*w_format*:*",form_fields+=w_but_val+"*:*w_but_val*:*",form_fields+=w_disable_past_days+"*:*w_disable_past_days*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_date_new":atrs=return_attributes(id+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,w_format=document.getElementById(id+"_buttonform_id_temp").getAttribute("format"),w_but_val=document.getElementById(id+"_buttonform_id_temp").value,w_start_day=document.getElementById(id+"_start_dayform_id_temp").value,w_default_date=document.getElementById(id+"_default_date_id_temp").value,w_min_date=document.getElementById(id+"_min_date_id_temp").value,w_max_date=document.getElementById(id+"_max_date_id_temp").value,w_invalid_dates=document.getElementById(id+"_invalid_dates_id_temp").value,w_hide_time=document.getElementById(id+"_hide_timeform_id_temp").value,w_show_image=document.getElementById(id+"_show_imageform_id_temp").value,w_date=document.getElementById(id+"_elementform_id_temp").value,w_disable_past_days=document.getElementById(id+"_dis_past_daysform_id_temp")?document.getElementById(id+"_dis_past_daysform_id_temp").value:"no";var _=document.getElementById(id+"_show_week_days");for(w_sunday=_.getAttribute("sunday"),w_monday=_.getAttribute("monday"),w_tuesday=_.getAttribute("tuesday"),w_wednesday=_.getAttribute("wednesday"),w_thursday=_.getAttribute("thursday"),w_friday=_.getAttribute("friday"),w_saturday=_.getAttribute("saturday"),w_show_days=[w_sunday,w_monday,w_tuesday,w_wednesday,w_thursday,w_friday,w_saturday],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_size+"*:*w_size*:*",form_fields+=w_date+"*:*w_date*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_show_image+"*:*w_show_image*:*",form_fields+=w_class+"*:*w_class*:*",form_fields+=w_format+"*:*w_format*:*",form_fields+=w_start_day+"*:*w_start_day*:*",form_fields+=w_default_date+"*:*w_default_date*:*",form_fields+=w_min_date+"*:*w_min_date*:*",form_fields+=w_max_date+"*:*w_max_date*:*",form_fields+=w_invalid_dates+"*:*w_invalid_dates*:*",form_fields+=w_show_days.join("***")+"*:*w_show_days*:*",form_fields+=w_hide_time+"*:*w_hide_time*:*",form_fields+=w_but_val+"*:*w_but_val*:*",form_fields+=w_disable_past_days+"*:*w_disable_past_days*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_date_range":atrs=return_attributes(id+"_elementform_id_temp0"),w_attr_name=atrs[0],w_attr_value=atrs[1],w_date=document.getElementById(id+"_elementform_id_temp0").value+","+document.getElementById(id+"_elementform_id_temp1").value,w_format=document.getElementById(id+"_buttonform_id_temp").getAttribute("format"),w_but_val=document.getElementById(id+"_buttonform_id_temp").value,w_start_day=document.getElementById(id+"_start_dayform_id_temp").value,w_default_date_start=document.getElementById(id+"_default_date_id_temp_start").value,w_default_date_end=document.getElementById(id+"_default_date_id_temp_end").value,w_min_date=document.getElementById(id+"_min_date_id_temp").value,w_max_date=document.getElementById(id+"_max_date_id_temp").value,w_invalid_dates=document.getElementById(id+"_invalid_dates_id_temp").value,w_hide_time=document.getElementById(id+"_hide_timeform_id_temp").value,w_show_image=document.getElementById(id+"_show_imageform_id_temp").value,w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,s=document.getElementById(id+"_elementform_id_temp0").style.width,w_size=s.substring(0,s.length-2),w_disable_past_days=document.getElementById(id+"_dis_past_daysform_id_temp")?document.getElementById(id+"_dis_past_daysform_id_temp").value:"no";_=document.getElementById(id+"_show_week_days");for(w_sunday=_.getAttribute("sunday"),w_monday=_.getAttribute("monday"),w_tuesday=_.getAttribute("tuesday"),w_wednesday=_.getAttribute("wednesday"),w_thursday=_.getAttribute("thursday"),w_friday=_.getAttribute("friday"),w_saturday=_.getAttribute("saturday"),w_show_days=[w_sunday,w_monday,w_tuesday,w_wednesday,w_thursday,w_friday,w_saturday],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_size+"*:*w_size*:*",form_fields+=w_date+"*:*w_date*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_show_image+"*:*w_show_image*:*",form_fields+=w_class+"*:*w_class*:*",form_fields+=w_format+"*:*w_format*:*",form_fields+=w_start_day+"*:*w_start_day*:*",form_fields+=w_default_date_start+"*:*w_default_date_start*:*",form_fields+=w_default_date_end+"*:*w_default_date_end*:*",form_fields+=w_min_date+"*:*w_min_date*:*",form_fields+=w_max_date+"*:*w_max_date*:*",form_fields+=w_invalid_dates+"*:*w_invalid_dates*:*",form_fields+=w_show_days.join("***")+"*:*w_show_days*:*",form_fields+=w_hide_time+"*:*w_hide_time*:*",form_fields+=w_but_val+"*:*w_but_val*:*",form_fields+=w_disable_past_days+"*:*w_disable_past_days*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_date_fields":for(atrs=return_attributes(id+"_dayform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],w_day=document.getElementById(id+"_dayform_id_temp").value,w_month=document.getElementById(id+"_monthform_id_temp").value,w_year=document.getElementById(id+"_yearform_id_temp").value,w_day_type=document.getElementById(id+"_dayform_id_temp").tagName,w_month_type=document.getElementById(id+"_monthform_id_temp").tagName,w_year_type=document.getElementById(id+"_yearform_id_temp").tagName,w_day_label=document.getElementById(id+"_day_label").innerHTML,w_month_label=document.getElementById(id+"_month_label").innerHTML,w_year_label=document.getElementById(id+"_year_label").innerHTML,w_min_day=document.getElementById(id+"_min_day_id_temp").value,w_min_month=document.getElementById(id+"_min_month_id_temp").value,w_min_year=document.getElementById(id+"_min_year_id_temp").value,w_min_dob_alert=document.getElementById(id+"_min_dob_alert_id_temp").value,s=document.getElementById(id+"_dayform_id_temp").style.width,w_day_size=s.substring(0,s.length-2),s=document.getElementById(id+"_monthform_id_temp").style.width,w_month_size=s.substring(0,s.length-2),s=document.getElementById(id+"_yearform_id_temp").style.width,w_year_size=s.substring(0,s.length-2),w_from=document.getElementById(id+"_yearform_id_temp").getAttribute("from"),w_to=document.getElementById(id+"_yearform_id_temp").getAttribute("to"),w_divider=document.getElementById(id+"_separator1").innerHTML,w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_day+"*:*w_day*:*",form_fields+=w_month+"*:*w_month*:*",form_fields+=w_year+"*:*w_year*:*",form_fields+=w_day_type+"*:*w_day_type*:*",form_fields+=w_month_type+"*:*w_month_type*:*",form_fields+=w_year_type+"*:*w_year_type*:*",form_fields+=w_day_label+"*:*w_day_label*:*",form_fields+=w_month_label+"*:*w_month_label*:*",form_fields+=w_year_label+"*:*w_year_label*:*",form_fields+=w_day_size+"*:*w_day_size*:*",form_fields+=w_month_size+"*:*w_month_size*:*",form_fields+=w_year_size+"*:*w_year_size*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_class+"*:*w_class*:*",form_fields+=w_from+"*:*w_from*:*",form_fields+=w_to+"*:*w_to*:*",form_fields+=w_min_day+"*:*w_min_day*:*",form_fields+=w_min_month+"*:*w_min_month*:*",form_fields+=w_min_year+"*:*w_min_year*:*",form_fields+=w_min_dob_alert+"*:*w_min_dob_alert*:*",form_fields+=w_divider+"*:*w_divider*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_own_select":for(tt=0,jQuery("#"+id+"_elementform_id_temp option").each(function(){w_choices[tt]=jQuery(this).html(),w_choices_value[tt]=jQuery(this).val(),w_choices_checked[tt]=jQuery(this)[0].selected,jQuery(this).attr("where")?w_choices_params[tt]=jQuery(this).attr("where")+"[where_order_by]"+jQuery(this).attr("order_by")+"[db_info]"+jQuery(this).attr("db_info"):w_choices_params[tt]="",jQuery(this).val()?w_choices_disabled[tt]=!1:w_choices_disabled[tt]=!0,tt++}),w_value_disabled=document.getElementById(id+"_value_disabledform_id_temp").value,w_use_for_submission=document.getElementById(id+"_use_for_submissionform_id_temp").value,w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,atrs=return_attributes(id+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_size+"*:*w_size*:*",form_fields+=w_choices.join("***")+"*:*w_choices*:*",form_fields+=w_choices_checked.join("***")+"*:*w_choices_checked*:*",form_fields+=w_choices_disabled.join("***")+"*:*w_choices_disabled*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_value_disabled+"*:*w_value_disabled*:*",form_fields+=w_use_for_submission+"*:*w_use_for_submission*:*",form_fields+=w_choices_value.join("***")+"*:*w_choices_value*:*",form_fields+=w_choices_params.join("***")+"*:*w_choices_params*:*",form_fields+=w_class+"*:*w_class*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_paypal_select":for(tt=0,jQuery("#"+id+"_elementform_id_temp option").each(function(){w_choices[tt]=jQuery(this).html(),w_choices_price[tt]=jQuery(this).val(),w_choices_checked[tt]=jQuery(this)[0].selected,jQuery(this).attr("where")?w_choices_params[tt]=jQuery(this).attr("where")+"[where_order_by]"+jQuery(this).attr("order_by")+"[db_info]"+jQuery(this).attr("db_info"):w_choices_params[tt]="",""==jQuery(this)[0].value?w_choices_disabled[tt]=!0:w_choices_disabled[tt]=!1,tt++}),k=0;k<100;k++)if(document.getElementById(id+"_propertyform_id_temp"+k))if(w_property.push(document.getElementById(id+"_property_label_form_id_temp"+k).innerHTML),document.getElementById(id+"_propertyform_id_temp"+k).childNodes.length)for(w_property_values[w_property.length-1]="",m=0;m<document.getElementById(id+"_propertyform_id_temp"+k).childNodes.length;m++)w_property_values[w_property.length-1]+="###"+document.getElementById(id+"_propertyform_id_temp"+k).childNodes[m].value;else w_property_values.push("");for(w_quantity="no",w_quantity_value=1,document.getElementById(id+"_element_quantityform_id_temp")&&(w_quantity="yes",w_quantity_value=document.getElementById(id+"_element_quantityform_id_temp").value),w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,atrs=return_attributes(id+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_size+"*:*w_size*:*",form_fields+=w_choices.join("***")+"*:*w_choices*:*",form_fields+=w_choices_price.join("***")+"*:*w_choices_price*:*",form_fields+=w_choices_checked.join("***")+"*:*w_choices_checked*:*",form_fields+=w_choices_disabled.join("***")+"*:*w_choices_disabled*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_quantity+"*:*w_quantity*:*",form_fields+=w_quantity_value+"*:*w_quantity_value*:*",form_fields+=w_choices_params.join("***")+"*:*w_choices_params*:*",form_fields+=w_class+"*:*w_class*:*",form_fields+=w_property.join("***")+"*:*w_property*:*",form_fields+=w_property_values.join("***")+"*:*w_property_values*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_country":for(w_countries=[],select_=document.getElementById(id+"_elementform_id_temp"),k=select_.childNodes.length,j=0;j<k;j++)w_countries.push(select_.childNodes[j].value);for(w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,atrs=return_attributes(id+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_size+"*:*w_size*:*",form_fields+=w_countries.join("***")+"*:*w_countries*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_class+"*:*w_class*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_file_upload":for(w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,w_destination=document.getElementById(id+"_destination").value.replace("***destinationverj"+id+"***","").replace("***destinationskizb"+id+"***",""),w_extension=document.getElementById(id+"_extension").value.replace("***extensionverj"+id+"***","").replace("***extensionskizb"+id+"***",""),w_max_size=document.getElementById(id+"_max_size").value.replace("***max_sizeverj"+id+"***","").replace("***max_sizeskizb"+id+"***",""),w_multiple=document.getElementById(id+"_elementform_id_temp").getAttribute("multiple")?"yes":"no",atrs=return_attributes(id+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_destination+"*:*w_destination*:*",form_fields+=w_extension+"*:*w_extension*:*",form_fields+=w_max_size+"*:*w_max_size*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_multiple+"*:*w_multiple*:*",form_fields+=w_class+"*:*w_class*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_captcha":for(w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,w_digit=document.getElementById("_wd_captchaform_id_temp").getAttribute("digit"),atrs=return_attributes("_wd_captchaform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_digit+"*:*w_digit*:*",form_fields+=w_class+"*:*w_class*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_arithmetic_captcha":for(w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,w_count=document.getElementById("_wd_arithmetic_captchaform_id_temp").getAttribute("operations_count"),w_operations=document.getElementById("_wd_arithmetic_captchaform_id_temp").getAttribute("operations"),w_input_size=document.getElementById("_wd_arithmetic_captchaform_id_temp").getAttribute("input_size"),atrs=return_attributes("_wd_captchaform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_count+"*:*w_count*:*",form_fields+=w_operations+"*:*w_operations*:*",form_fields+=w_class+"*:*w_class*:*",form_fields+=w_input_size+"*:*w_input_size*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_recaptcha":w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,w_type=document.getElementById("wd_recaptchaform_id_temp").getAttribute("w_type"),w_position=document.getElementById("wd_recaptchaform_id_temp").getAttribute("position"),form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_type+"*:*w_type*:*",form_fields+=w_position+"*:*w_position*:*",form_fields+="*:*new_field*:*",document.getElementById("public_key").value=document.getElementById("wd_recaptchaform_id_temp").getAttribute("public_key"),document.getElementById("private_key").value=document.getElementById("wd_recaptchaform_id_temp").getAttribute("private_key");break;case"type_map":for(w_lat=[],w_long=[],w_info=[],w_center_x=document.getElementById(id+"_elementform_id_temp").getAttribute("center_x"),w_center_y=document.getElementById(id+"_elementform_id_temp").getAttribute("center_y"),w_zoom=document.getElementById(id+"_elementform_id_temp").getAttribute("zoom"),w_width=""==document.getElementById(id+"_elementform_id_temp").style.width?"":parseInt(document.getElementById(id+"_elementform_id_temp").style.width),w_height=parseInt(document.getElementById(id+"_elementform_id_temp").style.height),j=0;j<=20;j++)document.getElementById(id+"_elementform_id_temp").getAttribute("lat"+j)&&(w_lat.push(document.getElementById(id+"_elementform_id_temp").getAttribute("lat"+j)),w_long.push(document.getElementById(id+"_elementform_id_temp").getAttribute("long"+j)),w_info.push(document.getElementById(id+"_elementform_id_temp").getAttribute("info"+j)));for(atrs=return_attributes(id+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_center_x+"*:*w_center_x*:*",form_fields+=w_center_y+"*:*w_center_y*:*",form_fields+=w_long.join("***")+"*:*w_long*:*",form_fields+=w_lat.join("***")+"*:*w_lat*:*",form_fields+=w_zoom+"*:*w_zoom*:*",form_fields+=w_width+"*:*w_width*:*",form_fields+=w_height+"*:*w_height*:*",form_fields+=w_info.join("***")+"*:*w_info*:*",form_fields+=w_class+"*:*w_class*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_mark_map":for(w_info=document.getElementById(id+"_elementform_id_temp").getAttribute("info0"),w_long=document.getElementById(id+"_elementform_id_temp").getAttribute("long0"),w_lat=document.getElementById(id+"_elementform_id_temp").getAttribute("lat0"),w_zoom=document.getElementById(id+"_elementform_id_temp").getAttribute("zoom"),w_width=""==document.getElementById(id+"_elementform_id_temp").style.width?"":parseInt(document.getElementById(id+"_elementform_id_temp").style.width),w_height=parseInt(document.getElementById(id+"_elementform_id_temp").style.height),w_center_x=document.getElementById(id+"_elementform_id_temp").getAttribute("center_x"),w_center_y=document.getElementById(id+"_elementform_id_temp").getAttribute("center_y"),w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,atrs=return_attributes(id+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_center_x+"*:*w_center_x*:*",form_fields+=w_center_y+"*:*w_center_y*:*",form_fields+=w_long+"*:*w_long*:*",form_fields+=w_lat+"*:*w_lat*:*",form_fields+=w_zoom+"*:*w_zoom*:*",form_fields+=w_width+"*:*w_width*:*",form_fields+=w_height+"*:*w_height*:*",form_fields+=w_info+"*:*w_info*:*",form_fields+=w_class+"*:*w_class*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_submit_reset":for(atrs=return_attributes(id+"_element_submitform_id_temp"),w_act=!("none"==document.getElementById(id+"_element_resetform_id_temp").style.display),w_attr_name=atrs[0],w_attr_value=atrs[1],w_submit_title=document.getElementById(id+"_element_submitform_id_temp").value,w_reset_title=document.getElementById(id+"_element_resetform_id_temp").value,form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_submit_title+"*:*w_submit_title*:*",form_fields+=w_reset_title+"*:*w_reset_title*:*",form_fields+=w_class+"*:*w_class*:*",form_fields+=w_act+"*:*w_act*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_button":for(w_title=new Array,w_func=new Array,tt=0,v=0,k=0;k<100;k++)document.getElementById(id+"_elementform_id_temp"+k)&&(w_title[tt]=document.getElementById(id+"_elementform_id_temp"+k).value,w_func[tt]=document.getElementById(id+"_elementform_id_temp"+k).getAttribute("onclick"),tt++,v=k);for(atrs=return_attributes(id+"_elementform_id_temp"+v),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_title.join("***")+"*:*w_title*:*",form_fields+=w_func.join("***")+"*:*w_func*:*",form_fields+=w_class+"*:*w_class*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_hidden":for(w_value=document.getElementById(id+"_elementform_id_temp").value,w_name=document.getElementById(id+"_elementform_id_temp").name,atrs=return_attributes(id+"_elementform_id_temp"),w_attr_name=atrs[0],w_attr_value=atrs[1],form_fields+=w_name+"*:*w_field_label*:*",form_fields+=w_name+"*:*w_name*:*",form_fields+=w_value+"*:*w_value*:*",j=0;j<w_attr_name.length;j++)form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";form_fields+="*:*new_field*:*";break;case"type_signature":w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value,w_canvas_width=document.getElementById(id+"_canvas_widthform_id_temp").value,w_canvas_height=document.getElementById(id+"_canvas_heightform_id_temp").value,w_destination=document.getElementById(id+"_destination").value.replace("***destinationskizb"+id+"***","").replace("***destinationverj"+id+"***",""),form_fields+=w_field_label+"*:*w_field_label*:*",form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*",form_fields+=w_hide_label+"*:*w_hide_label*:*",form_fields+=w_required+"*:*w_required*:*",form_fields+=w_field_label_size+"*:*w_field_label_size*:*",form_fields+=w_canvas_width+"*:*w_canvas_width*:*",form_fields+=w_canvas_height+"*:*w_canvas_height*:*",form_fields+=w_class+"*:*w_class*:*",form_fields+=w_destination+"*:*w_destination*:*",form_fields+="*:*new_field*:*"}}function fm_options_ready(){jQuery(".filed_label").each(function(){document.getElementById("frontend_submit_fields").value==document.getElementById("all_fields").value&&(document.getElementById("all_fields").checked=!0),inArray(this.value,document.getElementById("frontend_submit_fields").value.split(","))&&(this.checked=!0)}),jQuery(".stats_filed_label").each(function(){document.getElementById("frontend_submit_stat_fields").value==document.getElementById("all_stats_fields").value&&(document.getElementById("all_stats_fields").checked=!0),inArray(this.value,document.getElementById("frontend_submit_stat_fields").value.split(","))&&(this.checked=!0)}),jQuery(document).on("change",'input[name="all_fields"]',function(){jQuery(".filed_label").prop("checked",this.checked)}),jQuery(document).on("change",'input[name="all_stats_fields"]',function(){jQuery(".stats_filed_label").prop("checked",this.checked)}),fm_toggle_options("#div_gdpr_checkbox_text","1"==jQuery("input[name=gdpr_checkbox]:checked").val()),jQuery(".placeholders-filter").on("keyup input",function(){filter_placeholders(this)}),jQuery("#placeholders_overlay").on("click",function(){fm_placeholders_popup_close()}),jQuery(document).on("keydown",function(e){27===e.keyCode&&jQuery("#placeholders_overlay").is(":visible")&&fm_placeholders_popup_close()}),jQuery(".fm_condition_is_select").change(function(){show_hide_condition_input_field(this)}),fm_remove_validate_error_message()}function fm_email_options_ready(){fm_toggle_options(".fm_email_options","1"==jQuery("input[name=sendemail]:checked").val()),jQuery(".placeholders-filter").on("keyup input",function(){filter_placeholders(this)}),jQuery("#placeholders_overlay").on("click",function(){fm_placeholders_popup_close()}),jQuery(document).on("keydown",function(e){27===e.keyCode&&jQuery("#placeholders_overlay").is(":visible")&&fm_placeholders_popup_close()}),fm_remove_validate_error_message()}function fm_document_ready(){var e=jQuery("#fieldset_id").val();form_maker_options_tabs(e),fm_change_payment_method(jQuery("input[name=paypal_mode]:checked").val()),void 0!==e&&"javascript"==e&&setTimeout(function(){codemirror_for_javascript()},300),fm_popup()}function filter_placeholders(e){var t=jQuery(e).val().toLowerCase();if(jQuery(".filtered-placeholders .inside").html(""),""!=t){var i=!1;jQuery(".placeholders_cont .postbox").addClass("hide"),jQuery(".placeholders .postbox:not(.filtered-placeholders) .wd-button").each(function(){"-1"!=jQuery(this).html().toLowerCase().indexOf(t)&&(jQuery(".filtered-placeholders .inside").append(jQuery(this).clone()),i=!0)}),i||jQuery(".filtered-placeholders .inside").html(form_maker.nothing_found),jQuery(".placeholders_cont .filtered-placeholders").removeClass("hide")}else jQuery(".placeholders_cont .postbox").removeClass("hide"),jQuery(".placeholders_cont .filtered-placeholders").addClass("hide")}function wd_fm_apply_options(){var e=JSON.parse(jQuery("#fm_tabs_loaded").val());if(!inArray("form_options_tab",e)&&!inArray("form_email_options_tab",e))return!0;var o=!0;return jQuery(".fm-validate").each(function(){var e=jQuery(this).data("type"),t=form_maker_manage.not_valid_value;"required"==e?t=form_maker_manage.required_field:"email"==e&&(t=form_maker_manage.not_valid_email),t="<p class='description fm-validate-description'>"+t+"</p>";var i=jQuery(this).data("callback"),n=jQuery(this).data("callback-parameter"),a=jQuery(this).data("tab-id"),r=jQuery(this).data("content-id"),l=jQuery(this).val();if("function"==typeof window[i]&&!window[i](l,n)){var d=jQuery("#"+r).closest(".ui-tabs-panel");if(jQuery("#fm-tabs").tabs({active:jQuery(".ui-tabs-panel").index(d)}),0!==jQuery(".fm_fieldset_active:visible").length&&(jQuery(".fm_fieldset_active").addClass("fm_fieldset_deactive").removeClass("fm_fieldset_active"),jQuery(".fm_fieldset_tab").removeClass("active"),jQuery("#"+r).removeClass("fm_fieldset_deactive").addClass("fm_fieldset_active"),jQuery("#"+a).addClass("active"),jQuery("#fieldset_id").val(a)),0===jQuery(this).parent().parent().find(".fm-validate-description").length){var _=jQuery(this).parent().find(".description");_.length?_.before(t):jQuery(this).parent().append(t),jQuery(this).addClass("fm-validate-field")}return jQuery("html, body").animate({scrollTop:jQuery(this).offset().top-200},500),o=!1}}),o&&set_condition(),o}function fm_remove_validate_error_message(){jQuery(".fm-validate").each(function(){jQuery(this).on("keypress change",function(){jQuery(this).parent().find(".fm-validate-description").remove(),jQuery(this).removeClass("fm-validate-field")})})}function fm_validate_email(e,t){if(""!=t&&!jQuery(t).is(":checked"))return!0;var i=e.split(","),n=/^[\u0400-\u04FFa-zA-Z0-9'.+_-]+@[\u0400-\u04FFa-zA-Z0-9.-]+\.[\u0400-\u04FFa-zA-Z]{2,61}$/,a=/^({)[0-9]+(})$/,r=["{adminemail}","{useremail}"];for(var l in i){var d=i[l].replace(/^\s+|\s+$/g,"");if(!r.includes(d)&&d&&!n.test(d)&&!a.test(d))return!1}return!0}function fm_add_inline_email_validation_message(e){var t=jQuery(e).parent().parent().find(".fm_email_to"),i=t.parent().parent().find(".fm-validate-description");return fm_validate_email(t.val(),"")?(jQuery(".fm-validate-description").remove(),!0):(t.hasClass("fm_email_to")&&!i.length&&t.parent().after("<p class='description fm-validate-description'>"+form_maker_manage.not_valid_email+"</p>"),t.addClass("fm-validate-field"),jQuery("html, body").animate({scrollTop:t.offset().top-200},500),!1)}function fm_placeholders_popup(e){var t=jQuery("#"+e),i=t.closest(".wd-group");i.addClass("placeholders-active");var n=i.data("exclude-placeholder");jQuery(".fm-placeholder-item").show(),n&&1<n.length&&jQuery.each(n,function(e,t){jQuery("#fm-placeholder-"+t).hide()}),jQuery("html").animate({scrollTop:i.offset().top-50},500);var a=jQuery(".placeholder-popup");if(i.prepend(jQuery("#placeholders_overlay")),i.find(".wp-editor-wrap").length)i.find(".wp-editor-wrap").append(a);else{t.after(a);var r=t.val();t.focus().val("").val(r)}a.show()}function fm_placeholders_popup_close(){jQuery("#placeholders_overlay").closest(".wd-group").removeClass("placeholders-active");var e=jQuery("#placeholders_overlay"),t=jQuery(".placeholder-popup");jQuery(e).appendTo(".fm-placeholders-popup-wrap"),jQuery(t).appendTo(".fm-placeholders-popup-wrap"),t.hide()}function set_condition(){for(field_condition="",i=0;i<500;i++)if(conditions="",document.getElementById("condition"+i)){for(field_condition+=document.getElementById("show_hide"+i).value+"*:*show_hide*:*",field_condition+=document.getElementById("fields"+i).value+"*:*field_label*:*",field_condition+=document.getElementById("all_any"+i).value+"*:*all_any*:*",k=0;k<500;k++)if(document.getElementById("condition_div"+i+"_"+k)){if(conditions+=document.getElementById("field_labels"+i+"_"+k).value+"***",conditions+=document.getElementById("is_select"+i+"_"+k).value+"***","SELECT"==document.getElementById("field_value"+i+"_"+k).tagName)if(document.getElementById("field_value"+i+"_"+k).getAttribute("multiple")){var e=document.getElementById("field_value"+i+"_"+k),t="";for(m=0;m<e.length;m++)e.options[m].selected&&(t+=e.options[m].value+"@@@");conditions+=t}else conditions+=document.getElementById("field_value"+i+"_"+k).value;else conditions+=fm_html_entities(document.getElementById("field_value"+i+"_"+k).value);conditions+="*:*next_condition*:*"}field_condition+=conditions,field_condition+="*:*new_condition*:*"}jQuery("#condition").length&&(document.getElementById("condition").value=field_condition)}function show_verify_options(e){e?(jQuery(".verification_div").removeAttr("style"),jQuery(".expire_link").removeAttr("style")):(jQuery(".verification_div").css("display","none"),jQuery(".expire_link").css("display","none"))}function inArray(e,t){for(var i=t.length,n=0;n<i;n++)if(t[n]==e)return!0;return!1}function checkAllByParentId(e){var t=document.getElementById(e).getElementsByTagName("input");if(t[0].checked)for(var i=0;i<t.length;i++)"checkbox"==t[i].type&&(t[i].checked=!0);else for(i=0;i<t.length;i++)"checkbox"==t[i].type&&(t[i].checked=!1)}function checked_labels(e){var t="";jQuery("."+e).each(function(){this.checked&&(t+=this.value+",")}),"filed_label"==e?(document.getElementById("frontend_submit_fields").value=t)==document.getElementById("all_fields").value?document.getElementById("all_fields").checked=!0:document.getElementById("all_fields").checked=!1:(document.getElementById("frontend_submit_stat_fields").value=t)==document.getElementById("all_stats_fields").value?document.getElementById("all_stats_fields").checked=!0:document.getElementById("all_stats_fields").checked=!1}function codemirror_for_javascript(){if(!jQuery("#form_javascript").next().length&&"undefined"!=typeof CodeMirror){var e=CodeMirror.fromTextArea(document.getElementById("form_javascript"),{lineNumbers:!0,lineWrapping:!0,mode:"javascript"});void 0!==e.autoFormatRange&&(CodeMirror.commands.selectAll(e),e.autoFormatRange(e.getCursor(!0),e.getCursor(!1)),e.scrollTo(0,0))}}function fm_toggle_options(e,t){t?jQuery(e).show():jQuery(e).hide()}function show_hide_condition_input_field(e){var t=jQuery(e).val(),i=new Array("empty","checked","unchecked","!","=");-1!==jQuery.inArray(t,i)?(jQuery(e).parent().find(".fm_condition_field_input_value").hide(),jQuery(e).parent().find(".fm_condition_field_select_value").hide(),jQuery(e).parent().find(".fm_condition_field_input_notice").hide()):(jQuery(e).parent().find(".fm_condition_field_input_value").show(),jQuery(e).parent().find(".fm_condition_field_select_value").show(),jQuery(e).parent().find(".fm_condition_field_input_notice").show())}function fm_apply_advanced_layout(){return inArray("form_layout_tab",JSON.parse(jQuery("#fm_tabs_loaded").val()))&&(jQuery("#autogen_layout").is(":checked")?jQuery("#custom_front").val(custom_front.replace(/\s+/g," ").replace(/> </g,"><")):jQuery("#custom_front").val(editor.getValue().replace(/\s+/g," ").replace(/> </g,"><"))),!0}function insertAtCursor_form(e,t){if(jQuery("#autogen_layout").is(":checked"))alert("Uncheck the Auto-Generate Layout box.");else{var i='<div wdid="'+e+'" class="wdform_row">%'+e+" - "+t+"%</div>\n",n=editor.getDoc(),a=n.getCursor(),r=n.getLine(a.line),l={line:a.line,ch:r.length};n.replaceRange(i,l),editor.focus()}}function autogen(e){e?(custom_front=editor.getValue(),editor.setValue(form_front),editor.setOption("readOnly",!0)):(editor.setValue(custom_front),editor.setOption("readOnly",!1)),autoFormat()}function autoFormat(){setTimeout(function(){return CodeMirror.commands.selectAll(editor),editor.autoFormatRange(editor.getCursor(!0),editor.getCursor(!1)),editor.scrollTo(0,0),!1},500)}jQuery(window).on("beforeunload",function(){if(form_changed=!FormManageSubmitButton(!0),form_changed)return"Changes you made may not be saved."}),jQuery(window).on("load",function(){formOnload(gen)}),jQuery(function(){all_sortable_events(),1==is_sortable?jQuery(".wdform_arrows_advanced").hide():(jQuery(".wdform_column").sortable("disable"),jQuery(".wdform_arrows_advanced").show()),enable_drag(),jQuery(".wdform-page-and-images").hasClass("fm-form-builder")||jQuery(".fm-edit-content").append(jQuery('<div id="fm-edit-disable-overlay" class="wdform_arrows"><div class="fm-edit-disable-overlay-text"><span>This form is currently disabled for editing.<br />Please click <b>Convert</b> to adapt the form structure and enable editing.</span><div class="fm-edit-disable-overlay-button"><button class="button button-primary button-large" onclick="fm_convert_form_structure(); return false;">Convert</button></div></div></div>'))}),jQuery(document).on("keydown",function(e){27===e.keyCode&&(jQuery("#fm_popup_container").is(":visible")&&fm_popup_toggle("fm_popup_container"),jQuery("#fm_delete_page_popup_container").is(":visible")&&fm_popup_toggle("fm_delete_page_popup_container"),jQuery("#fm_revision_popup_container").is(":visible")&&fm_popup_toggle("fm_revision_popup_container"))}),jQuery(window).on("load",function(){storageAvailable("localStorage")&&localStorage.getItem("wd-form-first-time-use")||jQuery(".first-time-use").show(),jQuery(window).on("scroll",function(e){if(!jQuery("#add_field").hasClass("ui-sortable-helper")){var t=jQuery(".fm-edit-content").offset().top,i=jQuery(window).scrollTop();if(t-75<i)var n=i-t+75;else n=10;jQuery("#add_field_cont").css("top",n)}}),jQuery("#placeholders_overlay").on("click",function(){var e=jQuery(".fm-input-container.placeholders-active input").val();jQuery(".fm-input-container.placeholders-active input").val(e).change(),fm_placeholders_popup_close()})}),jQuery(function(){jQuery(".first-time-use-close").on("click",function(){storageAvailable("localStorage")&&localStorage.setItem("wd-form-first-time-use",!0),jQuery(".first-time-use").hide()}),jQuery(".wdform_column").on("sortstart",function(e,t){jQuery(".first-time-use").hide()}),jQuery(".field-types-filter").on("keyup input",function(){filter(this)})}),jQuery(document).on("keydown",function(e){if(27===e.keyCode)if(jQuery("#placeholders_overlay").is(":visible")){var t=jQuery(".fm-input-container.placeholders-active input").val();jQuery(".fm-input-container.placeholders-active input").val(t).change(),fm_placeholders_popup_close()}else jQuery(".add-popup").is(":visible")&&close_window()}),jQuery(document).on("fm_tab_loaded",function(){fm_options_ready(),fm_document_ready()}),jQuery(document).on("fm_tab_email_loaded",function(){fm_email_options_ready()}),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).CodeMirror=t()}(this,function(){"use strict";var e=navigator.userAgent,t=navigator.platform,h=/gecko\/\d/i.test(e),i=/MSIE \d/.test(e),n=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),a=/Edge\/(\d+)/.exec(e),x=i||n||a,w=x&&(i?document.documentMode||6:+(a||n)[1]),v=!a&&/WebKit\//.test(e),r=v&&/Qt\/\d+\.\d+/.test(e),l=!a&&/Chrome\//.test(e),y=/Opera\//.test(e),b=/Apple Computer/.test(navigator.vendor),d=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),_=/PhantomJS/.test(e),o=b&&(/Mobile\/\w+/.test(e)||2<navigator.maxTouchPoints),s=/Android/.test(e),m=o||s||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),g=o||/Mac/.test(t),E=/\bCrOS\b/.test(e),u=/win/i.test(t),c=y&&e.match(/Version\/(\d*\.\d*)/);c&&(c=Number(c[1])),c&&15<=c&&(v=!(y=!1));var p=g&&(r||y&&(null==c||c<12.11)),f=h||x&&9<=w;function A(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var k,j=function(e,t){var i=e.className,n=A(t).exec(i);if(n){var a=i.slice(n.index+n[0].length);e.className=i.slice(0,n.index)+(a?n[1]+a:"")}};function C(e){for(var t=e.childNodes.length;0<t;--t)e.removeChild(e.firstChild);return e}function I(e,t){return C(e).appendChild(t)}function Q(e,t,i,n){var a=document.createElement(e);if(i&&(a.className=i),n&&(a.style.cssText=n),"string"==typeof t)a.appendChild(document.createTextNode(t));else if(t)for(var r=0;r<t.length;++r)a.appendChild(t[r]);return a}function B(e,t,i,n){var a=Q(e,t,i,n);return a.setAttribute("role","presentation"),a}function T(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if(11==t.nodeType&&(t=t.host),t==e)return!0}while(t=t.parentNode)}function M(){var t;try{t=document.activeElement}catch(e){t=document.body||null}for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t}function L(e,t){var i=e.className;A(t).test(i)||(e.className+=(i?" ":"")+t)}function z(e,t){for(var i=e.split(" "),n=0;n<i.length;n++)i[n]&&!A(i[n]).test(t)&&(t+=" "+i[n]);return t}k=document.createRange?function(e,t,i,n){var a=document.createRange();return a.setEnd(n||e,i),a.setStart(e,t),a}:function(e,t,i){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(e){return n}return n.collapse(!0),n.moveEnd("character",i),n.moveStart("character",t),n};var q=function(e){e.select()};function S(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function N(e,t,i){for(var n in t||(t={}),e)!e.hasOwnProperty(n)||!1===i&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function H(e,t,i,n,a){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var r=n||0,l=a||0;;){var d=e.indexOf("\t",r);if(d<0||t<=d)return l+(t-r);l+=d-r,l+=i-l%i,r=d+1}}o?q=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:x&&(q=function(e){try{e.select()}catch(e){}});var D=function(){this.id=null,this.f=null,this.time=0,this.handler=S(this.onTimeout,this)};function O(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}D.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},D.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=i)};var P=50,F={toString:function(){return"CodeMirror.Pass"}},R={scroll:!1},W={origin:"*mouse"},K={origin:"+move"};function U(e,t,i){for(var n=0,a=0;;){var r=e.indexOf("\t",n);-1==r&&(r=e.length);var l=r-n;if(r==e.length||t<=a+l)return n+Math.min(l,t-a);if(a+=r-n,n=r+1,(a+=i-a%i)>=t)return n}}var V=[""];function $(e){for(;V.length<=e;)V.push(G(V)+" ");return V[e]}function G(e){return e[e.length-1]}function Y(e,t){for(var i=[],n=0;n<e.length;n++)i[n]=t(e[n],n);return i}function X(){}function Z(e,t){var i;return i=Object.create?Object.create(e):(X.prototype=e,new X),t&&N(t,i),i}var J=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ee(e){return/\w/.test(e)||"€"<e&&(e.toUpperCase()!=e.toLowerCase()||J.test(e))}function te(e,t){return t?!!(-1<t.source.indexOf("\\w")&&ee(e))||t.test(e):ee(e)}function ie(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ne=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ae(e){return 768<=e.charCodeAt(0)&&ne.test(e)}function re(e,t,i){for(;(i<0?0<t:t<e.length)&&ae(e.charAt(t));)t+=i;return t}function le(e,t,i){for(var n=i<t?-1:1;;){if(t==i)return t;var a=(t+i)/2,r=n<0?Math.ceil(a):Math.floor(a);if(r==t)return e(r)?t:i;e(r)?i=r:t=r+n}}var de=null;function _e(e,t,i){var n;de=null;for(var a=0;a<e.length;++a){var r=e[a];if(r.from<t&&r.to>t)return a;r.to==t&&(r.from!=r.to&&"before"==i?n=a:de=a),r.from==t&&(r.from!=r.to&&"before"!=i?n=a:de=a)}return null!=n?n:de}var oe=function(){var H=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,D=/[stwN]/,O=/[LRr]/,P=/[Lb1n]/,F=/[1n]/;function R(e,t,i){this.level=e,this.from=t,this.to=i}return function(e,t){var i="ltr"==t?"L":"R";if(0==e.length||"ltr"==t&&!H.test(e))return!1;for(var n,a=e.length,r=[],l=0;l<a;++l)r.push((n=e.charCodeAt(l))<=247?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1785?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(n-1536):1774<=n&&n<=2220?"r":8192<=n&&n<=8203?"w":8204==n?"b":"L");for(var d=0,_=i;d<a;++d){var o=r[d];"m"==o?r[d]=_:_=o}for(var s=0,m=i;s<a;++s){var u=r[s];"1"==u&&"r"==m?r[s]="n":O.test(u)&&("r"==(m=u)&&(r[s]="R"))}for(var c=1,p=r[0];c<a-1;++c){var f=r[c];"+"==f&&"1"==p&&"1"==r[c+1]?r[c]="1":","!=f||p!=r[c+1]||"1"!=p&&"n"!=p||(r[c]=p),p=f}for(var h=0;h<a;++h){var y=r[h];if(","==y)r[h]="N";else if("%"==y){var b=void 0;for(b=h+1;b<a&&"%"==r[b];++b);for(var v=h&&"!"==r[h-1]||b<a&&"1"==r[b]?"1":"N",g=h;g<b;++g)r[g]=v;h=b-1}}for(var w=0,E=i;w<a;++w){var A=r[w];"L"==E&&"1"==A?r[w]="L":O.test(A)&&(E=A)}for(var x=0;x<a;++x)if(D.test(r[x])){var k=void 0;for(k=x+1;k<a&&D.test(r[k]);++k);for(var j="L"==(x?r[x-1]:i),C=j==("L"==(k<a?r[k]:i))?j?"L":"R":i,I=x;I<k;++I)r[I]=C;x=k-1}for(var B,Q=[],T=0;T<a;)if(P.test(r[T])){var M=T;for(++T;T<a&&P.test(r[T]);++T);Q.push(new R(0,M,T))}else{var L=T,z=Q.length,q="rtl"==t?1:0;for(++T;T<a&&"L"!=r[T];++T);for(var S=L;S<T;)if(F.test(r[S])){L<S&&(Q.splice(z,0,new R(1,L,S)),z+=q);var N=S;for(++S;S<T&&F.test(r[S]);++S);Q.splice(z,0,new R(2,N,S)),z+=q,L=S}else++S;L<T&&Q.splice(z,0,new R(1,L,T))}return"ltr"==t&&(1==Q[0].level&&(B=e.match(/^\s+/))&&(Q[0].from=B[0].length,Q.unshift(new R(0,0,B[0].length))),1==G(Q).level&&(B=e.match(/\s+$/))&&(G(Q).to-=B[0].length,Q.push(new R(0,a-B[0].length,a)))),"rtl"==t?Q.reverse():Q}}();function se(e,t){var i=e.order;return null==i&&(i=e.order=oe(e.text,t)),i}var me=[],ue=function(e,t,i){if(e.addEventListener)e.addEventListener(t,i,!1);else if(e.attachEvent)e.attachEvent("on"+t,i);else{var n=e._handlers||(e._handlers={});n[t]=(n[t]||me).concat(i)}};function ce(e,t){return e._handlers&&e._handlers[t]||me}function pe(e,t,i){if(e.removeEventListener)e.removeEventListener(t,i,!1);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var n=e._handlers,a=n&&n[t];if(a){var r=O(a,i);-1<r&&(n[t]=a.slice(0,r).concat(a.slice(r+1)))}}}function fe(e,t){var i=ce(e,t);if(i.length)for(var n=Array.prototype.slice.call(arguments,2),a=0;a<i.length;++a)i[a].apply(null,n)}function he(e,t,i){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),fe(e,i||t.type,e,t),Ee(t)||t.codemirrorIgnore}function ye(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var i=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)-1==O(i,t[n])&&i.push(t[n])}function be(e,t){return 0<ce(e,t).length}function ve(e){e.prototype.on=function(e,t){ue(this,e,t)},e.prototype.off=function(e,t){pe(this,e,t)}}function ge(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function we(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Ee(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Ae(e){ge(e),we(e)}function xe(e){return e.target||e.srcElement}function ke(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),g&&e.ctrlKey&&1==t&&(t=3),t}var je,Ce,Ie=function(){if(x&&w<9)return!1;var e=Q("div");return"draggable"in e||"dragDrop"in e}();function Be(e){if(null==je){var t=Q("span","​");I(e,Q("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(je=t.offsetWidth<=1&&2<t.offsetHeight&&!(x&&w<8))}var i=je?Q("span","​"):Q("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}function Qe(e){if(null!=Ce)return Ce;var t=I(e,document.createTextNode("AخA")),i=k(t,0,1).getBoundingClientRect(),n=k(t,1,2).getBoundingClientRect();return C(e),!(!i||i.left==i.right)&&(Ce=n.right-i.right<3)}var Te,Me=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,i=[],n=e.length;t<=n;){var a=e.indexOf("\n",t);-1==a&&(a=e.length);var r=e.slice(t,"\r"==e.charAt(a-1)?a-1:a),l=r.indexOf("\r");-1!=l?(i.push(r.slice(0,l)),t+=l+1):(i.push(r),t=a+1)}return i}:function(e){return e.split(/\r\n?|\n/)},Le=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},ze="oncopy"in(Te=Q("div"))||(Te.setAttribute("oncopy","return;"),"function"==typeof Te.oncopy),qe=null,Se={},Ne={};function He(e){if("string"==typeof e&&Ne.hasOwnProperty(e))e=Ne[e];else if(e&&"string"==typeof e.name&&Ne.hasOwnProperty(e.name)){var t=Ne[e.name];"string"==typeof t&&(t={name:t}),(e=Z(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return He("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return He("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function De(e,t){t=He(t);var i=Se[t.name];if(!i)return De(e,"text/plain");var n=i(e,t);if(Oe.hasOwnProperty(t.name)){var a=Oe[t.name];for(var r in a)a.hasOwnProperty(r)&&(n.hasOwnProperty(r)&&(n["_"+r]=n[r]),n[r]=a[r])}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var l in t.modeProps)n[l]=t.modeProps[l];return n}var Oe={};function Pe(e,t){N(t,Oe.hasOwnProperty(e)?Oe[e]:Oe[e]={})}function Fe(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var i={};for(var n in t){var a=t[n];a instanceof Array&&(a=a.concat([])),i[n]=a}return i}function Re(e,t){for(var i;e.innerMode&&(i=e.innerMode(t))&&i.mode!=e;)t=i.state,e=i.mode;return i||{mode:e,state:t}}function We(e,t,i){return!e.startState||e.startState(t,i)}var Ke=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};function Ue(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var i=e;!i.lines;)for(var n=0;;++n){var a=i.children[n],r=a.chunkSize();if(t<r){i=a;break}t-=r}return i.lines[t]}function Ve(e,i,n){var a=[],r=i.line;return e.iter(i.line,n.line+1,function(e){var t=e.text;r==n.line&&(t=t.slice(0,n.ch)),r==i.line&&(t=t.slice(i.ch)),a.push(t),++r}),a}function $e(e,t,i){var n=[];return e.iter(t,i,function(e){n.push(e.text)}),n}function Ge(e,t){var i=t-e.height;if(i)for(var n=e;n;n=n.parent)n.height+=i}function Ye(e){if(null==e.parent)return null;for(var t=e.parent,i=O(t.lines,e),n=t.parent;n;n=(t=n).parent)for(var a=0;n.children[a]!=t;++a)i+=n.children[a].chunkSize();return i+t.first}function Xe(e,t){var i=e.first;e:do{for(var n=0;n<e.children.length;++n){var a=e.children[n],r=a.height;if(t<r){e=a;continue e}t-=r,i+=a.chunkSize()}return i}while(!e.lines);for(var l=0;l<e.lines.length;++l){var d=e.lines[l].height;if(t<d)break;t-=d}return i+l}function Ze(e,t){return t>=e.first&&t<e.first+e.size}function Je(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function et(e,t,i){if(void 0===i&&(i=null),!(this instanceof et))return new et(e,t,i);this.line=e,this.ch=t,this.sticky=i}function tt(e,t){return e.line-t.line||e.ch-t.ch}function it(e,t){return e.sticky==t.sticky&&0==tt(e,t)}function nt(e){return et(e.line,e.ch)}function at(e,t){return tt(e,t)<0?t:e}function rt(e,t){return tt(e,t)<0?e:t}function lt(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function dt(e,t){if(t.line<e.first)return et(e.first,0);var i,n,a,r=e.first+e.size-1;return t.line>r?et(r,Ue(e,r).text.length):(n=Ue(e,(i=t).line).text.length,null==(a=i.ch)||n<a?et(i.line,n):a<0?et(i.line,0):i)}function _t(e,t){for(var i=[],n=0;n<t.length;n++)i[n]=dt(e,t[n]);return i}Ke.prototype.eol=function(){return this.pos>=this.string.length},Ke.prototype.sol=function(){return this.pos==this.lineStart},Ke.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ke.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ke.prototype.eat=function(e){var t=this.string.charAt(this.pos);if("string"==typeof e?t==e:t&&(e.test?e.test(t):e(t)))return++this.pos,t},Ke.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ke.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ke.prototype.skipToEnd=function(){this.pos=this.string.length},Ke.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(-1<t)return this.pos=t,!0},Ke.prototype.backUp=function(e){this.pos-=e},Ke.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=H(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Ke.prototype.indentation=function(){return H(this.string,null,this.tabSize)-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Ke.prototype.match=function(e,t,i){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&0<n.index?null:(n&&!1!==t&&(this.pos+=n[0].length),n)}var a=function(e){return i?e.toLowerCase():e};if(a(this.string.substr(this.pos,e.length))==a(e))return!1!==t&&(this.pos+=e.length),!0},Ke.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ke.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ke.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ke.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var ot=function(e,t){this.state=e,this.lookAhead=t},st=function(e,t,i,n){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};function mt(t,i,n,e){var _=[t.state.modeGen],a={};gt(t,i.text,t.doc.mode,n,function(e,t){return _.push(e,t)},a,e);for(var o=n.state,r=function(e){n.baseTokens=_;var r=t.state.overlays[e],l=1,d=0;n.state=!0,gt(t,i.text,r.mode,n,function(e,t){for(var i=l;d<e;){var n=_[l];e<n&&_.splice(l,1,e,_[l+1],n),l+=2,d=Math.min(e,n)}if(t)if(r.opaque)_.splice(i,l-i,e,"overlay "+t),l=i+2;else for(;i<l;i+=2){var a=_[i+1];_[i+1]=(a?a+" ":"")+"overlay "+t}},a),n.state=o,n.baseTokens=null,n.baseTokenPos=1},l=0;l<t.state.overlays.length;++l)r(l);return{styles:_,classes:a.bgClass||a.textClass?a:null}}function ut(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=ct(e,Ye(t)),a=t.text.length>e.options.maxHighlightLength&&Fe(e.doc.mode,n.state),r=mt(e,t,n);a&&(n.state=a),t.stateAfter=n.save(!a),t.styles=r.styles,r.classes?t.styleClasses=r.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function ct(i,n,e){var t=i.doc,a=i.display;if(!t.mode.startState)return new st(t,!0,n);var r=function(e,t,i){for(var n,a,r=e.doc,l=i?-1:t-(e.doc.mode.innerMode?1e3:100),d=t;l<d;--d){if(d<=r.first)return r.first;var _=Ue(r,d-1),o=_.stateAfter;if(o&&(!i||d+(o instanceof ot?o.lookAhead:0)<=r.modeFrontier))return d;var s=H(_.text,null,e.options.tabSize);(null==a||s<n)&&(a=d-1,n=s)}return a}(i,n,e),l=r>t.first&&Ue(t,r-1).stateAfter,d=l?st.fromSaved(t,l,r):new st(t,We(t.mode),r);return t.iter(r,n,function(e){pt(i,e.text,d);var t=d.line;e.stateAfter=t==n-1||t%5==0||t>=a.viewFrom&&t<a.viewTo?d.save():null,d.nextLine()}),e&&(t.modeFrontier=d.line),d}function pt(e,t,i,n){var a=e.doc.mode,r=new Ke(t,e.options.tabSize,i);for(r.start=r.pos=n||0,""==t&&ft(a,i.state);!r.eol();)ht(a,r,i.state),r.start=r.pos}function ft(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var i=Re(e,t);return i.mode.blankLine?i.mode.blankLine(i.state):void 0}}function ht(e,t,i,n){for(var a=0;a<10;a++){n&&(n[0]=Re(e,i).mode);var r=e.token(t,i);if(t.pos>t.start)return r}throw new Error("Mode "+e.name+" failed to advance stream.")}st.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},st.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},st.prototype.nextLine=function(){this.line++,0<this.maxLookAhead&&this.maxLookAhead--},st.fromSaved=function(e,t,i){return t instanceof ot?new st(e,Fe(e.mode,t.state),i,t.lookAhead):new st(e,Fe(e.mode,t),i)},st.prototype.save=function(e){var t=!1!==e?Fe(this.doc.mode,this.state):this.state;return 0<this.maxLookAhead?new ot(t,this.maxLookAhead):t};var yt=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function bt(e,t,i,n){var a,r,l=e.doc,d=l.mode,_=Ue(l,(t=dt(l,t)).line),o=ct(e,t.line,i),s=new Ke(_.text,e.options.tabSize,o);for(n&&(r=[]);(n||s.pos<t.ch)&&!s.eol();)s.start=s.pos,a=ht(d,s,o.state),n&&r.push(new yt(s,a,Fe(l.mode,o.state)));return n?r:new yt(s,a,o.state)}function vt(e,t){if(e)for(;;){var i=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i)break;e=e.slice(0,i.index)+e.slice(i.index+i[0].length);var n=i[1]?"bgClass":"textClass";null==t[n]?t[n]=i[2]:new RegExp("(?:^|\\s)"+i[2]+"(?:$|\\s)").test(t[n])||(t[n]+=" "+i[2])}return e}function gt(e,t,i,n,a,r,l){var d=i.flattenSpans;null==d&&(d=e.options.flattenSpans);var _,o=0,s=null,m=new Ke(t,e.options.tabSize,n),u=e.options.addModeClass&&[null];for(""==t&&vt(ft(i,n.state),r);!m.eol();){if(_=m.pos>e.options.maxHighlightLength?(d=!1,l&&pt(e,t,n,m.pos),m.pos=t.length,null):vt(ht(i,m,n.state,u),r),u){var c=u[0].name;c&&(_="m-"+(_?c+" "+_:c))}if(!d||s!=_){for(;o<m.start;)a(o=Math.min(m.start,o+5e3),s);s=_}m.start=m.pos}for(;o<m.pos;){var p=Math.min(m.pos,o+5e3);a(p,s),o=p}}var wt=!1,Et=!1;function At(e,t,i){this.marker=e,this.from=t,this.to=i}function xt(e,t){if(e)for(var i=0;i<e.length;++i){var n=e[i];if(n.marker==t)return n}}function kt(e,t){for(var i,n=0;n<e.length;++n)e[n]!=t&&(i||(i=[])).push(e[n]);return i}function jt(e,t){if(t.full)return null;var i=Ze(e,t.from.line)&&Ue(e,t.from.line).markedSpans,n=Ze(e,t.to.line)&&Ue(e,t.to.line).markedSpans;if(!i&&!n)return null;var a=t.from.ch,r=t.to.ch,l=0==tt(t.from,t.to),d=function(e,t,i){var n;if(e)for(var a=0;a<e.length;++a){var r=e[a],l=r.marker;if(null==r.from||(l.inclusiveLeft?r.from<=t:r.from<t)||r.from==t&&"bookmark"==l.type&&(!i||!r.marker.insertLeft)){var d=null==r.to||(l.inclusiveRight?r.to>=t:r.to>t);(n||(n=[])).push(new At(l,r.from,d?null:r.to))}}return n}(i,a,l),_=function(e,t,i){var n;if(e)for(var a=0;a<e.length;++a){var r=e[a],l=r.marker;if(null==r.to||(l.inclusiveRight?r.to>=t:r.to>t)||r.from==t&&"bookmark"==l.type&&(!i||r.marker.insertLeft)){var d=null==r.from||(l.inclusiveLeft?r.from<=t:r.from<t);(n||(n=[])).push(new At(l,d?null:r.from-t,null==r.to?null:r.to-t))}}return n}(n,r,l),o=1==t.text.length,s=G(t.text).length+(o?a:0);if(d)for(var m=0;m<d.length;++m){var u=d[m];if(null==u.to){var c=xt(_,u.marker);c?o&&(u.to=null==c.to?null:c.to+s):u.to=a}}if(_)for(var p=0;p<_.length;++p){var f=_[p];null!=f.to&&(f.to+=s),null==f.from?xt(d,f.marker)||(f.from=s,o&&(d||(d=[])).push(f)):(f.from+=s,o&&(d||(d=[])).push(f))}d&&(d=Ct(d)),_&&_!=d&&(_=Ct(_));var h=[d];if(!o){var y,b=t.text.length-2;if(0<b&&d)for(var v=0;v<d.length;++v)null==d[v].to&&(y||(y=[])).push(new At(d[v].marker,null,null));for(var g=0;g<b;++g)h.push(y);h.push(_)}return h}function Ct(e){for(var t=0;t<e.length;++t){var i=e[t];null!=i.from&&i.from==i.to&&!1!==i.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function It(e){var t=e.markedSpans;if(t){for(var i=0;i<t.length;++i)t[i].marker.detachLine(e);e.markedSpans=null}}function Bt(e,t){if(t){for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}}function Qt(e){return e.inclusiveLeft?-1:0}function Tt(e){return e.inclusiveRight?1:0}function Mt(e,t){var i=e.lines.length-t.lines.length;if(0!=i)return i;var n=e.find(),a=t.find(),r=tt(n.from,a.from)||Qt(e)-Qt(t);return r?-r:tt(n.to,a.to)||Tt(e)-Tt(t)||t.id-e.id}function Lt(e,t){var i,n=Et&&e.markedSpans;if(n)for(var a=void 0,r=0;r<n.length;++r)(a=n[r]).marker.collapsed&&null==(t?a.from:a.to)&&(!i||Mt(i,a.marker)<0)&&(i=a.marker);return i}function zt(e){return Lt(e,!0)}function qt(e){return Lt(e,!1)}function St(e,t){var i,n=Et&&e.markedSpans;if(n)for(var a=0;a<n.length;++a){var r=n[a];r.marker.collapsed&&(null==r.from||r.from<t)&&(null==r.to||r.to>t)&&(!i||Mt(i,r.marker)<0)&&(i=r.marker)}return i}function Nt(e,t,i,n,a){var r=Ue(e,t),l=Et&&r.markedSpans;if(l)for(var d=0;d<l.length;++d){var _=l[d];if(_.marker.collapsed){var o=_.marker.find(0),s=tt(o.from,i)||Qt(_.marker)-Qt(a),m=tt(o.to,n)||Tt(_.marker)-Tt(a);if(!(0<=s&&m<=0||s<=0&&0<=m)&&(s<=0&&(_.marker.inclusiveRight&&a.inclusiveLeft?0<=tt(o.to,i):0<tt(o.to,i))||0<=s&&(_.marker.inclusiveRight&&a.inclusiveLeft?tt(o.from,n)<=0:tt(o.from,n)<0)))return!0}}}function Ht(e){for(var t;t=zt(e);)e=t.find(-1,!0).line;return e}function Dt(e,t){var i=Ue(e,t),n=Ht(i);return i==n?t:Ye(n)}function Ot(e,t){if(t>e.lastLine())return t;var i,n=Ue(e,t);if(!Pt(e,n))return t;for(;i=qt(n);)n=i.find(1,!0).line;return Ye(n)+1}function Pt(e,t){var i=Et&&t.markedSpans;if(i)for(var n=void 0,a=0;a<i.length;++a)if((n=i[a]).marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&Ft(e,t,n))return!0}}function Ft(e,t,i){if(null==i.to){var n=i.marker.find(1,!0);return Ft(e,n.line,xt(n.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var a=void 0,r=0;r<t.markedSpans.length;++r)if((a=t.markedSpans[r]).marker.collapsed&&!a.marker.widgetNode&&a.from==i.to&&(null==a.to||a.to!=i.from)&&(a.marker.inclusiveLeft||i.marker.inclusiveRight)&&Ft(e,t,a))return!0}function Rt(e){for(var t=0,i=(e=Ht(e)).parent,n=0;n<i.lines.length;++n){var a=i.lines[n];if(a==e)break;t+=a.height}for(var r=i.parent;r;r=(i=r).parent)for(var l=0;l<r.children.length;++l){var d=r.children[l];if(d==i)break;t+=d.height}return t}function Wt(e){if(0==e.height)return 0;for(var t,i=e.text.length,n=e;t=zt(n);){var a=t.find(0,!0);n=a.from.line,i+=a.from.ch-a.to.ch}for(n=e;t=qt(n);){var r=t.find(0,!0);i-=n.text.length-r.from.ch,i+=(n=r.to.line).text.length-r.to.ch}return i}function Kt(e){var i=e.display,t=e.doc;i.maxLine=Ue(t,t.first),i.maxLineLength=Wt(i.maxLine),i.maxLineChanged=!0,t.iter(function(e){var t=Wt(e);t>i.maxLineLength&&(i.maxLineLength=t,i.maxLine=e)})}var Ut=function(e,t,i){this.text=e,Bt(this,t),this.height=i?i(this):1};Ut.prototype.lineNo=function(){return Ye(this)},ve(Ut);var Vt={},$t={};function Gt(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?$t:Vt;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function Yt(e,t){var i=B("span",null,null,v?"padding-right: .1px":null),n={pre:B("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var a=0;a<=(t.rest?t.rest.length:0);a++){var r=a?t.rest[a-1]:t.line,l=void 0;n.pos=0,n.addToken=Zt,Qe(e.display.measure)&&(l=se(r,e.doc.direction))&&(n.addToken=Jt(n.addToken,l)),n.map=[],ti(r,n,ut(e,r,t!=e.display.externalMeasured&&Ye(r))),r.styleClasses&&(r.styleClasses.bgClass&&(n.bgClass=z(r.styleClasses.bgClass,n.bgClass||"")),r.styleClasses.textClass&&(n.textClass=z(r.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(Be(e.display.measure))),0==a?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(v){var d=n.content.lastChild;(/\bcm-tab\b/.test(d.className)||d.querySelector&&d.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return fe(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=z(n.pre.className,n.textClass||"")),n}function Xt(e){var t=Q("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Zt(e,t,i,n,a,r,l){if(t){var d,_=e.splitSpaces?function(e,t){if(1<e.length&&!/ /.test(e))return e;for(var i=t,n="",a=0;a<e.length;a++){var r=e.charAt(a);" "!=r||!i||a!=e.length-1&&32!=e.charCodeAt(a+1)||(r=" "),n+=r,i=" "==r}return n}(t,e.trailingSpace):t,o=e.cm.state.specialChars,s=!1;if(o.test(t)){d=document.createDocumentFragment();for(var m=0;;){o.lastIndex=m;var u=o.exec(t),c=u?u.index-m:t.length-m;if(c){var p=document.createTextNode(_.slice(m,m+c));x&&w<9?d.appendChild(Q("span",[p])):d.appendChild(p),e.map.push(e.pos,e.pos+c,p),e.col+=c,e.pos+=c}if(!u)break;m+=c+1;var f=void 0;if("\t"==u[0]){var h=e.cm.options.tabSize,y=h-e.col%h;(f=d.appendChild(Q("span",$(y),"cm-tab"))).setAttribute("role","presentation"),f.setAttribute("cm-text","\t"),e.col+=y}else"\r"==u[0]||"\n"==u[0]?(f=d.appendChild(Q("span","\r"==u[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",u[0]):((f=e.cm.options.specialCharPlaceholder(u[0])).setAttribute("cm-text",u[0]),x&&w<9?d.appendChild(Q("span",[f])):d.appendChild(f)),e.col+=1;e.map.push(e.pos,e.pos+1,f),e.pos++}}else e.col+=t.length,d=document.createTextNode(_),e.map.push(e.pos,e.pos+t.length,d),x&&w<9&&(s=!0),e.pos+=t.length;if(e.trailingSpace=32==_.charCodeAt(t.length-1),i||n||a||s||r||l){var b=i||"";n&&(b+=n),a&&(b+=a);var v=Q("span",[d],b,r);if(l)for(var g in l)l.hasOwnProperty(g)&&"style"!=g&&"class"!=g&&v.setAttribute(g,l[g]);return e.content.appendChild(v)}e.content.appendChild(d)}}function Jt(m,u){return function(e,t,i,n,a,r,l){i=i?i+" cm-force-border":"cm-force-border";for(var d=e.pos,_=d+t.length;;){for(var o=void 0,s=0;s<u.length&&!((o=u[s]).to>d&&o.from<=d);s++);if(o.to>=_)return m(e,t,i,n,a,r,l);m(e,t.slice(0,o.to-d),i,n,null,r,l),n=null,t=t.slice(o.to-d),d=o.to}}}function ei(e,t,i,n){var a=!n&&i.widgetNode;a&&e.map.push(e.pos,e.pos+t,a),!n&&e.cm.display.input.needsContentAttribute&&(a||(a=e.content.appendChild(document.createElement("span"))),a.setAttribute("cm-marker",i.id)),a&&(e.cm.display.input.setUneditable(a),e.content.appendChild(a)),e.pos+=t,e.trailingSpace=!1}function ti(e,t,i){var n=e.markedSpans,a=e.text,r=0;if(n)for(var l,d,_,o,s,m,u,c=a.length,p=0,f=1,h="",y=0;;){if(y==p){_=o=s=d="",m=u=null,y=1/0;for(var b=[],v=void 0,g=0;g<n.length;++g){var w=n[g],E=w.marker;if("bookmark"==E.type&&w.from==p&&E.widgetNode)b.push(E);else if(w.from<=p&&(null==w.to||w.to>p||E.collapsed&&w.to==p&&w.from==p)){if(null!=w.to&&w.to!=p&&y>w.to&&(y=w.to,o=""),E.className&&(_+=" "+E.className),E.css&&(d=(d?d+";":"")+E.css),E.startStyle&&w.from==p&&(s+=" "+E.startStyle),E.endStyle&&w.to==y&&(v||(v=[])).push(E.endStyle,w.to),E.title&&((u||(u={})).title=E.title),E.attributes)for(var A in E.attributes)(u||(u={}))[A]=E.attributes[A];E.collapsed&&(!m||Mt(m.marker,E)<0)&&(m=w)}else w.from>p&&y>w.from&&(y=w.from)}if(v)for(var x=0;x<v.length;x+=2)v[x+1]==y&&(o+=" "+v[x]);if(!m||m.from==p)for(var k=0;k<b.length;++k)ei(t,0,b[k]);if(m&&(m.from||0)==p){if(ei(t,(null==m.to?c+1:m.to)-p,m.marker,null==m.from),null==m.to)return;m.to==p&&(m=!1)}}if(c<=p)break;for(var j=Math.min(c,y);;){if(h){var C=p+h.length;if(!m){var I=j<C?h.slice(0,j-p):h;t.addToken(t,I,l?l+_:_,s,p+I.length==y?o:"",d,u)}if(j<=C){h=h.slice(j-p),p=j;break}p=C,s=""}h=a.slice(r,r=i[f++]),l=Gt(i[f++],t.cm.options)}}else for(var B=1;B<i.length;B+=2)t.addToken(t,a.slice(r,r=i[B]),Gt(i[B+1],t.cm.options))}function ii(e,t,i){this.line=t,this.rest=function(e){for(var t,i;t=qt(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}(t),this.size=this.rest?Ye(G(this.rest))-i+1:1,this.node=this.text=null,this.hidden=Pt(e,t)}function ni(e,t,i){for(var n,a=[],r=t;r<i;r=n){var l=new ii(e.doc,Ue(e.doc,r),r);n=r+l.size,a.push(l)}return a}var ai=null,ri=null;function li(e,t){var i=ce(e,t);if(i.length){var n,a=Array.prototype.slice.call(arguments,2);ai?n=ai.delayedCallbacks:ri?n=ri:(n=ri=[],setTimeout(di,0));for(var r=function(e){n.push(function(){return i[e].apply(null,a)})},l=0;l<i.length;++l)r(l)}}function di(){var e=ri;ri=null;for(var t=0;t<e.length;++t)e[t]()}function _i(e,t,i,n){for(var a=0;a<t.changes.length;a++){var r=t.changes[a];"text"==r?(l=e,void 0,_=(d=t).text.className,o=si(l,d),d.text==d.node&&(d.node=o.pre),d.text.parentNode.replaceChild(o.pre,d.text),d.text=o.pre,o.bgClass!=d.bgClass||o.textClass!=d.textClass?(d.bgClass=o.bgClass,d.textClass=o.textClass,mi(l,d)):_&&(d.text.className=_)):"gutter"==r?ui(e,t,i,n):"class"==r?mi(e,t):"widget"==r&&ci(e,t,n)}var l,d,_,o;t.changes=null}function oi(e){return e.node==e.text&&(e.node=Q("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),x&&w<8&&(e.node.style.zIndex=2)),e.node}function si(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):Yt(e,t)}function mi(e,t){!function(e,t){var i=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(i&&(i+=" CodeMirror-linebackground"),t.background)i?t.background.className=i:(t.background.parentNode.removeChild(t.background),t.background=null);else if(i){var n=oi(t);t.background=n.insertBefore(Q("div",null,i),n.firstChild),e.display.input.setUneditable(t.background)}}(e,t),t.line.wrapClass?oi(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function ui(e,t,i,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var a=oi(t);t.gutterBackground=Q("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),a.insertBefore(t.gutterBackground,t.text)}var r=t.line.gutterMarkers;if(e.options.lineNumbers||r){var l=oi(t),d=t.gutter=Q("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(d.setAttribute("aria-hidden","true"),e.display.input.setUneditable(d),l.insertBefore(d,t.text),t.line.gutterClass&&(d.className+=" "+t.line.gutterClass),!e.options.lineNumbers||r&&r["CodeMirror-linenumbers"]||(t.lineNumber=d.appendChild(Q("div",Je(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),r)for(var _=0;_<e.display.gutterSpecs.length;++_){var o=e.display.gutterSpecs[_].className,s=r.hasOwnProperty(o)&&r[o];s&&d.appendChild(Q("div",[s],"CodeMirror-gutter-elt","left: "+n.gutterLeft[o]+"px; width: "+n.gutterWidth[o]+"px"))}}}function ci(e,t,i){t.alignable&&(t.alignable=null);for(var n=A("CodeMirror-linewidget"),a=t.node.firstChild,r=void 0;a;a=r)r=a.nextSibling,n.test(a.className)&&t.node.removeChild(a);pi(e,t,i)}function pi(e,t,i){if(fi(e,t.line,t,i,!0),t.rest)for(var n=0;n<t.rest.length;n++)fi(e,t.rest[n],t,i,!1)}function fi(e,t,i,n,a){if(t.widgets)for(var r=oi(i),l=0,d=t.widgets;l<d.length;++l){var _=d[l],o=Q("div",[_.node],"CodeMirror-linewidget"+(_.className?" "+_.className:""));_.handleMouseEvents||o.setAttribute("cm-ignore-events","true"),hi(_,o,i,n),e.display.input.setUneditable(o),a&&_.above?r.insertBefore(o,i.gutter||i.text):r.appendChild(o),li(_,"redraw")}}function hi(e,t,i,n){if(e.noHScroll){(i.alignable||(i.alignable=[])).push(t);var a=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(a-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=a+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function yi(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!T(document.body,e.node)){var i="position: relative;";e.coverGutter&&(i+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(i+="width: "+t.display.wrapper.clientWidth+"px;"),I(t.display.measure,Q("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function bi(e,t){for(var i=xe(t);i!=e.wrapper;i=i.parentNode)if(!i||1==i.nodeType&&"true"==i.getAttribute("cm-ignore-events")||i.parentNode==e.sizer&&i!=e.mover)return!0}function vi(e){return e.lineSpace.offsetTop}function gi(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function wi(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=I(e.measure,Q("pre","x","CodeMirror-line-like")),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return isNaN(n.left)||isNaN(n.right)||(e.cachedPaddingH=n),n}function Ei(e){return P-e.display.nativeBarWidth}function Ai(e){return e.display.scroller.clientWidth-Ei(e)-e.display.barWidth}function xi(e){return e.display.scroller.clientHeight-Ei(e)-e.display.barHeight}function ki(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var a=0;a<e.rest.length;a++)if(Ye(e.rest[a])>i)return{map:e.measure.maps[a],cache:e.measure.caches[a],before:!0}}function ji(e,t,i,n){return Bi(e,Ii(e,t),i,n)}function Ci(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[rn(e,t)];var i=e.display.externalMeasured;return i&&t>=i.lineN&&t<i.lineN+i.size?i:void 0}function Ii(e,t){var i=Ye(t),n=Ci(e,i);n&&!n.text?n=null:n&&n.changes&&(_i(e,n,i,Ji(e)),e.curOp.forceUpdate=!0),n||(n=function(e,t){var i=Ye(t=Ht(t)),n=e.display.externalMeasured=new ii(e.doc,t,i);n.lineN=i;var a=n.built=Yt(e,n);return n.text=a.pre,I(e.display.lineMeasure,a.pre),n}(e,t));var a=ki(n,t,i);return{line:t,view:n,rect:null,map:a.map,cache:a.cache,before:a.before,hasHeights:!1}}function Bi(e,t,i,n,a){t.before&&(i=-1);var r,l=i+(n||"");return t.cache.hasOwnProperty(l)?r=t.cache[l]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(function(e,t,i){var n=e.options.lineWrapping,a=n&&Ai(e);if(!t.measure.heights||n&&t.measure.width!=a){var r=t.measure.heights=[];if(n){t.measure.width=a;for(var l=t.text.firstChild.getClientRects(),d=0;d<l.length-1;d++){var _=l[d],o=l[d+1];2<Math.abs(_.bottom-o.bottom)&&r.push((_.bottom+o.top)/2-i.top)}}r.push(i.bottom-i.top)}}(e,t.view,t.rect),t.hasHeights=!0),(r=function(e,t,i,n){var a,r=Mi(t.map,i,n),l=r.node,d=r.start,_=r.end,o=r.collapse;if(3==l.nodeType){for(var s=0;s<4;s++){for(;d&&ae(t.line.text.charAt(r.coverStart+d));)--d;for(;r.coverStart+_<r.coverEnd&&ae(t.line.text.charAt(r.coverStart+_));)++_;if((a=x&&w<9&&0==d&&_==r.coverEnd-r.coverStart?l.parentNode.getBoundingClientRect():Li(k(l,d,_).getClientRects(),n)).left||a.right||0==d)break;_=d,d-=1,o="right"}x&&w<11&&(a=function(a,e){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=qe)return qe;var t=I(a,Q("span","x")),i=t.getBoundingClientRect(),n=k(t,0,1).getBoundingClientRect();return qe=1<Math.abs(i.left-n.left)}())return e;var t=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:e.left*t,right:e.right*t,top:e.top*i,bottom:e.bottom*i}}(e.display.measure,a))}else{var m;0<d&&(o=n="right"),a=e.options.lineWrapping&&1<(m=l.getClientRects()).length?m["right"==n?m.length-1:0]:l.getBoundingClientRect()}if(x&&w<9&&!d&&(!a||!a.left&&!a.right)){var u=l.parentNode.getClientRects()[0];a=u?{left:u.left,right:u.left+Zi(e.display),top:u.top,bottom:u.bottom}:Ti}for(var c=a.top-t.rect.top,p=a.bottom-t.rect.top,f=(c+p)/2,h=t.view.measure.heights,y=0;y<h.length-1&&!(f<h[y]);y++);var b=y?h[y-1]:0,v=h[y],g={left:("right"==o?a.right:a.left)-t.rect.left,right:("left"==o?a.left:a.right)-t.rect.left,top:b,bottom:v};return a.left||a.right||(g.bogus=!0),e.options.singleCursorHeightPerLine||(g.rtop=c,g.rbottom=p),g}(e,t,i,n)).bogus||(t.cache[l]=r)),{left:r.left,right:r.right,top:a?r.rtop:r.top,bottom:a?r.rbottom:r.bottom}}var Qi,Ti={left:0,right:0,top:0,bottom:0};function Mi(e,t,i){for(var n,a,r,l,d,_,o=0;o<e.length;o+=3)if(d=e[o],_=e[o+1],t<d?(a=0,r=1,l="left"):t<_?r=1+(a=t-d):(o==e.length-3||t==_&&e[o+3]>t)&&(a=(r=_-d)-1,_<=t&&(l="right")),null!=a){if(n=e[o+2],d==_&&i==(n.insertLeft?"left":"right")&&(l=i),"left"==i&&0==a)for(;o&&e[o-2]==e[o-3]&&e[o-1].insertLeft;)n=e[2+(o-=3)],l="left";if("right"==i&&a==_-d)for(;o<e.length-3&&e[o+3]==e[o+4]&&!e[o+5].insertLeft;)n=e[(o+=3)+2],l="right";break}return{node:n,start:a,end:r,collapse:l,coverStart:d,coverEnd:_}}function Li(e,t){var i=Ti;if("left"==t)for(var n=0;n<e.length&&(i=e[n]).left==i.right;n++);else for(var a=e.length-1;0<=a&&(i=e[a]).left==i.right;a--);return i}function zi(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function qi(e){e.display.externalMeasure=null,C(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)zi(e.display.view[t])}function Si(e){qi(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Ni(){return l&&s?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Hi(){return l&&s?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Di(e){var t=0;if(e.widgets)for(var i=0;i<e.widgets.length;++i)e.widgets[i].above&&(t+=yi(e.widgets[i]));return t}function Oi(e,t,i,n,a){if(!a){var r=Di(t);i.top+=r,i.bottom+=r}if("line"==n)return i;n||(n="local");var l=Rt(t);if("local"==n?l+=vi(e.display):l-=e.display.viewOffset,"page"==n||"window"==n){var d=e.display.lineSpace.getBoundingClientRect();l+=d.top+("window"==n?0:Hi());var _=d.left+("window"==n?0:Ni());i.left+=_,i.right+=_}return i.top+=l,i.bottom+=l,i}function Pi(e,t,i){if("div"==i)return t;var n=t.left,a=t.top;if("page"==i)n-=Ni(),a-=Hi();else if("local"==i||!i){var r=e.display.sizer.getBoundingClientRect();n+=r.left,a+=r.top}var l=e.display.lineSpace.getBoundingClientRect();return{left:n-l.left,top:a-l.top}}function Fi(e,t,i,n,a){return n||(n=Ue(e.doc,t.line)),Oi(e,n,ji(e,n,t.ch,a),i)}function Ri(n,e,a,r,l,d){function _(e,t){var i=Bi(n,l,e,t?"right":"left",d);return t?i.left=i.right:i.right=i.left,Oi(n,r,i,a)}r=r||Ue(n.doc,e.line),l||(l=Ii(n,r));var o=se(r,n.doc.direction),t=e.ch,i=e.sticky;if(t>=r.text.length?(t=r.text.length,i="before"):t<=0&&(t=0,i="after"),!o)return _("before"==i?t-1:t,"before"==i);function s(e,t,i){return _(i?e-1:e,1==o[t].level!=i)}var m=_e(o,t,i),u=de,c=s(t,m,"before"==i);return null!=u&&(c.other=s(t,u,"before"!=i)),c}function Wi(e,t){var i=0;t=dt(e.doc,t),e.options.lineWrapping||(i=Zi(e.display)*t.ch);var n=Ue(e.doc,t.line),a=Rt(n)+vi(e.display);return{left:i,right:i,top:a,bottom:a+n.height}}function Ki(e,t,i,n,a){var r=et(e,t,i);return r.xRel=a,n&&(r.outside=n),r}function Ui(e,t,i){var n=e.doc;if((i+=e.display.viewOffset)<0)return Ki(n.first,0,null,-1,-1);var a=Xe(n,i),r=n.first+n.size-1;if(r<a)return Ki(n.first+n.size-1,Ue(n,r).text.length,null,1,1);t<0&&(t=0);for(var l=Ue(n,a);;){var d=Yi(e,l,a,t,i),_=St(l,d.ch+(0<d.xRel||0<d.outside?1:0));if(!_)return d;var o=_.find(1);if(o.line==a)return o;l=Ue(n,a=o.line)}}function Vi(t,e,i,n){n-=Di(e);var a=e.text.length,r=le(function(e){return Bi(t,i,e-1).bottom<=n},a,0);return{begin:r,end:a=le(function(e){return Bi(t,i,e).top>n},r,a)}}function $i(e,t,i,n){return i||(i=Ii(e,t)),Vi(e,t,i,Oi(e,t,Bi(e,i,n),"line").top)}function Gi(e,t,i,n){return!(e.bottom<=i)&&(e.top>i||(n?e.left:e.right)>t)}function Yi(i,e,t,n,a){a-=Rt(e);var r=Ii(i,e),l=Di(e),d=0,_=e.text.length,o=!0,s=se(e,i.doc.direction);if(s){var m=(i.options.lineWrapping?function(e,t,i,n,a,r,l){var d=Vi(e,t,n,l),_=d.begin,o=d.end;/\s/.test(t.text.charAt(o-1))&&o--;for(var s=null,m=null,u=0;u<a.length;u++){var c=a[u];if(!(c.from>=o||c.to<=_)){var p=Bi(e,n,1!=c.level?Math.min(o,c.to)-1:Math.max(_,c.from)).right,f=p<r?r-p+1e9:p-r;(!s||f<m)&&(s=c,m=f)}}return s||(s=a[a.length-1]),s.from<_&&(s={from:_,to:s.to,level:s.level}),s.to>o&&(s={from:s.from,to:o,level:s.level}),s}:function(n,a,r,l,d,_,o){var e=le(function(e){var t=d[e],i=1!=t.level;return Gi(Ri(n,et(r,i?t.to:t.from,i?"before":"after"),"line",a,l),_,o,!0)},0,d.length-1),t=d[e];if(0<e){var i=1!=t.level,s=Ri(n,et(r,i?t.from:t.to,i?"after":"before"),"line",a,l);Gi(s,_,o,!0)&&s.top>o&&(t=d[e-1])}return t})(i,e,t,r,s,n,a);d=(o=1!=m.level)?m.from:m.to-1,_=o?m.to:m.from-1}var u,c,p=null,f=null,h=le(function(e){var t=Bi(i,r,e);return t.top+=l,t.bottom+=l,!!Gi(t,n,a,!1)&&(t.top<=a&&t.left<=n&&(p=e,f=t),!0)},d,_),y=!1;if(f){var b=n-f.left<f.right-n,v=b==o;h=p+(v?0:1),c=v?"after":"before",u=b?f.left:f.right}else{o||h!=_&&h!=d||h++,c=0==h?"after":h==e.text.length?"before":Bi(i,r,h-(o?1:0)).bottom+l<=a==o?"after":"before";var g=Ri(i,et(t,h,c),"line",e,r);u=g.left,y=a<g.top?-1:a>=g.bottom?1:0}return Ki(t,h=re(e.text,h,1),c,y,n-u)}function Xi(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Qi){Qi=Q("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Qi.appendChild(document.createTextNode("x")),Qi.appendChild(Q("br"));Qi.appendChild(document.createTextNode("x"))}I(e.measure,Qi);var i=Qi.offsetHeight/50;return 3<i&&(e.cachedTextHeight=i),C(e.measure),i||1}function Zi(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=Q("span","xxxxxxxxxx"),i=Q("pre",[t],"CodeMirror-line-like");I(e.measure,i);var n=t.getBoundingClientRect(),a=(n.right-n.left)/10;return 2<a&&(e.cachedCharWidth=a),a||10}function Ji(e){for(var t=e.display,i={},n={},a=t.gutters.clientLeft,r=t.gutters.firstChild,l=0;r;r=r.nextSibling,++l){var d=e.display.gutterSpecs[l].className;i[d]=r.offsetLeft+r.clientLeft+a,n[d]=r.clientWidth}return{fixedPos:en(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function en(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function tn(n){var a=Xi(n.display),r=n.options.lineWrapping,l=r&&Math.max(5,n.display.scroller.clientWidth/Zi(n.display)-3);return function(e){if(Pt(n.doc,e))return 0;var t=0;if(e.widgets)for(var i=0;i<e.widgets.length;i++)e.widgets[i].height&&(t+=e.widgets[i].height);return r?t+(Math.ceil(e.text.length/l)||1)*a:t+a}}function nn(e){var t=e.doc,i=tn(e);t.iter(function(e){var t=i(e);t!=e.height&&Ge(e,t)})}function an(e,t,i,n){var a=e.display;if(!i&&"true"==xe(t).getAttribute("cm-not-content"))return null;var r,l,d=a.lineSpace.getBoundingClientRect();try{r=t.clientX-d.left,l=t.clientY-d.top}catch(e){return null}var _,o=Ui(e,r,l);if(n&&0<o.xRel&&(_=Ue(e.doc,o.line).text).length==o.ch){var s=H(_,_.length,e.options.tabSize)-_.length;o=et(o.line,Math.max(0,Math.round((r-wi(e.display).left)/Zi(e.display))-s))}return o}function rn(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var i=e.display.view,n=0;n<i.length;n++)if((t-=i[n].size)<0)return n}function ln(e,t,i,n){null==t&&(t=e.doc.first),null==i&&(i=e.doc.first+e.doc.size),n||(n=0);var a=e.display;if(n&&i<a.viewTo&&(null==a.updateLineNumbers||a.updateLineNumbers>t)&&(a.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=a.viewTo)Et&&Dt(e.doc,t)<a.viewTo&&_n(e);else if(i<=a.viewFrom)Et&&Ot(e.doc,i+n)>a.viewFrom?_n(e):(a.viewFrom+=n,a.viewTo+=n);else if(t<=a.viewFrom&&i>=a.viewTo)_n(e);else if(t<=a.viewFrom){var r=on(e,i,i+n,1);r?(a.view=a.view.slice(r.index),a.viewFrom=r.lineN,a.viewTo+=n):_n(e)}else if(i>=a.viewTo){var l=on(e,t,t,-1);l?(a.view=a.view.slice(0,l.index),a.viewTo=l.lineN):_n(e)}else{var d=on(e,t,t,-1),_=on(e,i,i+n,1);d&&_?(a.view=a.view.slice(0,d.index).concat(ni(e,d.lineN,_.lineN)).concat(a.view.slice(_.index)),a.viewTo+=n):_n(e)}var o=a.externalMeasured;o&&(i<o.lineN?o.lineN+=n:t<o.lineN+o.size&&(a.externalMeasured=null))}function dn(e,t,i){e.curOp.viewChanged=!0;var n=e.display,a=e.display.externalMeasured;if(a&&t>=a.lineN&&t<a.lineN+a.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var r=n.view[rn(e,t)];if(null!=r.node){var l=r.changes||(r.changes=[]);-1==O(l,i)&&l.push(i)}}}function _n(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function on(e,t,i,n){var a,r=rn(e,t),l=e.display.view;if(!Et||i==e.doc.first+e.doc.size)return{index:r,lineN:i};for(var d=e.display.viewFrom,_=0;_<r;_++)d+=l[_].size;if(d!=t){if(0<n){if(r==l.length-1)return null;a=d+l[r].size-t,r++}else a=d-t;t+=a,i+=a}for(;Dt(e.doc,i)!=i;){if(r==(n<0?0:l.length-1))return null;i+=n*l[r-(n<0?1:0)].size,r+=n}return{index:r,lineN:i}}function sn(e){for(var t=e.display.view,i=0,n=0;n<t.length;n++){var a=t[n];a.hidden||a.node&&!a.changes||++i}return i}function mn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function un(e,t){void 0===t&&(t=!0);for(var i=e.doc,n={},a=n.cursors=document.createDocumentFragment(),r=n.selection=document.createDocumentFragment(),l=0;l<i.sel.ranges.length;l++)if(t||l!=i.sel.primIndex){var d=i.sel.ranges[l];if(!(d.from().line>=e.display.viewTo||d.to().line<e.display.viewFrom)){var _=d.empty();(_||e.options.showCursorWhenSelecting)&&cn(e,d.head,a),_||fn(e,d,r)}}return n}function cn(e,t,i){var n=Ri(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),a=i.appendChild(Q("div"," ","CodeMirror-cursor"));if(a.style.left=n.left+"px",a.style.top=n.top+"px",a.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",/\bcm-fat-cursor\b/.test(e.getWrapperElement().className)){var r=Fi(e,t,"div",null,null);0<r.right-r.left&&(a.style.width=r.right-r.left+"px")}if(n.other){var l=i.appendChild(Q("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));l.style.display="",l.style.left=n.other.left+"px",l.style.top=n.other.top+"px",l.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function pn(e,t){return e.top-t.top||e.left-t.left}function fn(l,e,t){var i=l.display,n=l.doc,a=document.createDocumentFragment(),r=wi(l.display),j=r.left,C=Math.max(i.sizerWidth,Ai(l)-i.sizer.offsetLeft)-r.right,I="ltr"==n.direction;function B(e,t,i,n){t<0&&(t=0),t=Math.round(t),n=Math.round(n),a.appendChild(Q("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==i?C-e:i)+"px;\n height: "+(n-t)+"px"))}function d(i,b,v){var g,w,r=Ue(n,i),E=r.text.length;function A(e,t){return Fi(l,et(i,e),"div",r,t)}function x(e,t,i){var n=$i(l,r,null,e),a="ltr"==t==("after"==i)?"left":"right";return A("after"==i?n.begin:n.end-(/\s/.test(r.text.charAt(n.end-1))?2:1),a)[a]}var k=se(r,n.direction);return function(e,t,i,n){if(!e)return n(t,i,"ltr",0);for(var a=!1,r=0;r<e.length;++r){var l=e[r];(l.from<i&&l.to>t||t==i&&l.to==t)&&(n(Math.max(l.from,t),Math.min(l.to,i),1==l.level?"rtl":"ltr",r),a=!0)}a||n(t,i,"ltr")}(k,b||0,null==v?E:v,function(e,t,i,n){var a="ltr"==i,r=A(e,a?"left":"right"),l=A(t-1,a?"right":"left"),d=null==b&&0==e,_=null==v&&t==E,o=0==n,s=!k||n==k.length-1;if(l.top-r.top<=3){var m=(I?_:d)&&s,u=(I?d:_)&&o?j:(a?r:l).left,c=m?C:(a?l:r).right;B(u,r.top,c-u,r.bottom)}else{var p,f,h,y;y=a?(p=I&&d&&o?j:r.left,f=I?C:x(e,i,"before"),h=I?j:x(t,i,"after"),I&&_&&s?C:l.right):(p=I?x(e,i,"before"):j,f=!I&&d&&o?C:r.right,h=!I&&_&&s?j:l.left,I?x(t,i,"after"):C),B(p,r.top,f-p,r.bottom),r.bottom<l.top&&B(j,r.bottom,null,l.top),B(h,l.top,y-h,l.bottom)}(!g||pn(r,g)<0)&&(g=r),pn(l,g)<0&&(g=l),(!w||pn(r,w)<0)&&(w=r),pn(l,w)<0&&(w=l)}),{start:g,end:w}}var _=e.from(),o=e.to();if(_.line==o.line)d(_.line,_.ch,o.ch);else{var s=Ue(n,_.line),m=Ue(n,o.line),u=Ht(s)==Ht(m),c=d(_.line,_.ch,u?s.text.length+1:null).end,p=d(o.line,u?0:null,o.ch).start;u&&(c.top<p.top-2?(B(c.right,c.top,null,c.bottom),B(j,p.top,p.left,p.bottom)):B(c.right,c.top,p.left-c.right,c.bottom)),c.bottom<p.top&&B(j,c.bottom,null,p.top)}t.appendChild(a)}function hn(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var i=!0;t.cursorDiv.style.visibility="",0<e.options.cursorBlinkRate?t.blinker=setInterval(function(){e.hasFocus()||gn(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function yn(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||vn(e))}function bn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&gn(e))},100)}function vn(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(fe(e,"focus",e,t),e.state.focused=!0,L(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),v&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),hn(e))}function gn(e,t){e.state.delayingBlurEvent||(e.state.focused&&(fe(e,"blur",e,t),e.state.focused=!1,j(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function wn(e){for(var t=e.display,i=t.lineDiv.offsetTop,n=Math.max(0,t.scroller.getBoundingClientRect().top),a=t.lineDiv.getBoundingClientRect().top,r=0,l=0;l<t.view.length;l++){var d=t.view[l],_=e.options.lineWrapping,o=void 0,s=0;if(!d.hidden){if(a+=d.line.height,x&&w<8){var m=d.node.offsetTop+d.node.offsetHeight;o=m-i,i=m}else{var u=d.node.getBoundingClientRect();o=u.bottom-u.top,!_&&d.text.firstChild&&(s=d.text.firstChild.getBoundingClientRect().right-u.left-1)}var c=d.line.height-o;if((.005<c||c<-.005)&&(a<n&&(r-=c),Ge(d.line,o),En(d.line),d.rest))for(var p=0;p<d.rest.length;p++)En(d.rest[p]);if(s>e.display.sizerWidth){var f=Math.ceil(s/Zi(e.display));f>e.display.maxLineLength&&(e.display.maxLineLength=f,e.display.maxLine=d.line,e.display.maxLineChanged=!0)}}}2<Math.abs(r)&&(t.scroller.scrollTop+=r)}function En(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var i=e.widgets[t],n=i.node.parentNode;n&&(i.height=n.offsetHeight)}}function An(e,t,i){var n=i&&null!=i.top?Math.max(0,i.top):e.scroller.scrollTop;n=Math.floor(n-vi(e));var a=i&&null!=i.bottom?i.bottom:n+e.wrapper.clientHeight,r=Xe(t,n),l=Xe(t,a);if(i&&i.ensure){var d=i.ensure.from.line,_=i.ensure.to.line;d<r?l=Xe(t,Rt(Ue(t,r=d))+e.wrapper.clientHeight):Math.min(_,t.lastLine())>=l&&(r=Xe(t,Rt(Ue(t,_))-e.wrapper.clientHeight),l=_)}return{from:r,to:Math.max(l,r+1)}}function xn(e,t){var i=e.display,n=Xi(e.display);t.top<0&&(t.top=0);var a=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:i.scroller.scrollTop,r=xi(e),l={};t.bottom-t.top>r&&(t.bottom=t.top+r);var d=e.doc.height+gi(i),_=t.top<n,o=t.bottom>d-n;if(t.top<a)l.scrollTop=_?0:t.top;else if(t.bottom>a+r){var s=Math.min(t.top,(o?d:t.bottom)-r);s!=a&&(l.scrollTop=s)}var m=e.options.fixedGutter?0:i.gutters.offsetWidth,u=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:i.scroller.scrollLeft-m,c=Ai(e)-i.gutters.offsetWidth,p=t.right-t.left>c;return p&&(t.right=t.left+c),t.left<10?l.scrollLeft=0:t.left<u?l.scrollLeft=Math.max(0,t.left+m-(p?0:10)):t.right>c+u-3&&(l.scrollLeft=t.right+(p?0:10)-c),l}function kn(e,t){null!=t&&(In(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function jn(e){In(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Cn(e,t,i){null==t&&null==i||In(e),null!=t&&(e.curOp.scrollLeft=t),null!=i&&(e.curOp.scrollTop=i)}function In(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Bn(e,Wi(e,t.from),Wi(e,t.to),t.margin))}function Bn(e,t,i,n){var a=xn(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-n,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+n});Cn(e,a.scrollLeft,a.scrollTop)}function Qn(e,t){Math.abs(e.doc.scrollTop-t)<2||(h||ea(e,{top:t}),Tn(e,t,!0),h&&ea(e),Gn(e,100))}function Tn(e,t,i){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),(e.display.scroller.scrollTop!=t||i)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Mn(e,t,i,n){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n||(e.doc.scrollLeft=t,na(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Ln(e){var t=e.display,i=t.gutters.offsetWidth,n=Math.round(e.doc.height+gi(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?i:0,docHeight:n,scrollHeight:n+Ei(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var zn=function(e,t,i){this.cm=i;var n=this.vert=Q("div",[Q("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),a=this.horiz=Q("div",[Q("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=a.tabIndex=-1,e(n),e(a),ue(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),ue(a,"scroll",function(){a.clientWidth&&t(a.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,x&&w<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};zn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var a=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+a)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var r=e.viewWidth-e.barLeft-(i?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+r)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&0<e.clientHeight&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?n:0,bottom:t?n:0}},zn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},zn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},zn.prototype.zeroWidthHack=function(){var e=g&&!d?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new D,this.disableVert=new D},zn.prototype.enableZeroWidthBar=function(i,n,a){i.style.pointerEvents="auto",n.set(1e3,function e(){var t=i.getBoundingClientRect();("vert"==a?document.elementFromPoint(t.right-1,(t.top+t.bottom)/2):document.elementFromPoint((t.right+t.left)/2,t.bottom-1))!=i?i.style.pointerEvents="none":n.set(1e3,e)})},zn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var qn=function(){};function Sn(e,t){t||(t=Ln(e));var i=e.display.barWidth,n=e.display.barHeight;Nn(e,t);for(var a=0;a<4&&i!=e.display.barWidth||n!=e.display.barHeight;a++)i!=e.display.barWidth&&e.options.lineWrapping&&wn(e),Nn(e,Ln(e)),i=e.display.barWidth,n=e.display.barHeight}function Nn(e,t){var i=e.display,n=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=n.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=n.bottom)+"px",i.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=n.bottom+"px",i.scrollbarFiller.style.width=n.right+"px"):i.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=n.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}qn.prototype.update=function(){return{bottom:0,right:0}},qn.prototype.setScrollLeft=function(){},qn.prototype.setScrollTop=function(){},qn.prototype.clear=function(){};var Hn={native:zn,null:qn};function Dn(i){i.display.scrollbars&&(i.display.scrollbars.clear(),i.display.scrollbars.addClass&&j(i.display.wrapper,i.display.scrollbars.addClass)),i.display.scrollbars=new Hn[i.options.scrollbarStyle](function(e){i.display.wrapper.insertBefore(e,i.display.scrollbarFiller),ue(e,"mousedown",function(){i.state.focused&&setTimeout(function(){return i.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,t){"horizontal"==t?Mn(i,e):Qn(i,e)},i),i.display.scrollbars.addClass&&L(i.display.wrapper,i.display.scrollbars.addClass)}var On=0;function Pn(e){var t;e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++On,markArrays:null},t=e.curOp,ai?ai.ops.push(t):t.ownsGroup=ai={ops:[t],delayedCallbacks:[]}}function Fn(e){var n=e.curOp;n&&function(e,t){var i=n.ownsGroup;if(i)try{!function(e){var t=e.delayedCallbacks,i=0;do{for(;i<t.length;i++)t[i].call(null);for(var n=0;n<e.ops.length;n++){var a=e.ops[n];if(a.cursorActivityHandlers)for(;a.cursorActivityCalled<a.cursorActivityHandlers.length;)a.cursorActivityHandlers[a.cursorActivityCalled++].call(null,a.cm)}}while(i<t.length)}(i)}finally{ai=null,function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;!function(e){for(var t=e.ops,i=0;i<t.length;i++)r=t[i],void 0,l=r.cm,d=l.display,a=void 0,!(a=(n=l).display).scrollbarsClipped&&a.scroller.offsetWidth&&(a.nativeBarWidth=a.scroller.offsetWidth-a.scroller.clientWidth,a.heightForcer.style.height=Ei(n)+"px",a.sizer.style.marginBottom=-a.nativeBarWidth+"px",a.sizer.style.borderRightWidth=Ei(n)+"px",a.scrollbarsClipped=!0),r.updateMaxLine&&Kt(l),r.mustUpdate=r.viewChanged||r.forceUpdate||null!=r.scrollTop||r.scrollToPos&&(r.scrollToPos.from.line<d.viewFrom||r.scrollToPos.to.line>=d.viewTo)||d.maxLineChanged&&l.options.lineWrapping,r.update=r.mustUpdate&&new Xn(l,r.mustUpdate&&{top:r.scrollTop,ensure:r.scrollToPos},r.forceUpdate);for(var n,a,r,l,d,_,o,s,m,u=0;u<t.length;u++)(_=t[u]).updatedDisplay=_.mustUpdate&&Zn(_.cm,_.update);for(var c=0;c<t.length;c++)o=t[c],m=s=void 0,s=o.cm,m=s.display,o.updatedDisplay&&wn(s),o.barMeasure=Ln(s),m.maxLineChanged&&!s.options.lineWrapping&&(o.adjustWidthTo=ji(s,m.maxLine,m.maxLine.text.length).left+3,s.display.sizerWidth=o.adjustWidthTo,o.barMeasure.scrollWidth=Math.max(m.scroller.clientWidth,m.sizer.offsetLeft+o.adjustWidthTo+Ei(s)+s.display.barWidth),o.maxScrollLeft=Math.max(0,m.sizer.offsetLeft+o.adjustWidthTo-Ai(s))),(o.updatedDisplay||o.selectionChanged)&&(o.preparedSelection=m.input.prepareSelection());for(var p=0;p<t.length;p++)Rn(t[p]);for(var f=0;f<t.length;f++)Wn(t[f])}(e)}(i)}}()}function Rn(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Mn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==M();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Sn(t,e.barMeasure),e.updatedDisplay&&ia(t,e.barMeasure),e.selectionChanged&&hn(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),i&&yn(e.cm)}function Wn(e){var t=e.cm,i=t.display,n=t.doc;e.updatedDisplay&&Jn(t,e.update),null==i.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(i.wheelStartX=i.wheelStartY=null),null!=e.scrollTop&&Tn(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&Mn(t,e.scrollLeft,!0,!0),e.scrollToPos&&function(e,t){if(!he(e,"scrollCursorIntoView")){var i=e.display,n=i.sizer.getBoundingClientRect(),a=null;if(t.top+n.top<0?a=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(a=!1),null!=a&&!_){var r=Q("div","​",null,"position: absolute;\n top: "+(t.top-i.viewOffset-vi(e.display))+"px;\n height: "+(t.bottom-t.top+Ei(e)+i.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(r),r.scrollIntoView(a),e.display.lineSpace.removeChild(r)}}}(t,function(e,t,i,n){var a;null==n&&(n=0),e.options.lineWrapping||t!=i||(i="before"==t.sticky?et(t.line,t.ch+1,"before"):t,t=t.ch?et(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t);for(var r=0;r<5;r++){var l=!1,d=Ri(e,t),_=i&&i!=t?Ri(e,i):d,o=xn(e,a={left:Math.min(d.left,_.left),top:Math.min(d.top,_.top)-n,right:Math.max(d.left,_.left),bottom:Math.max(d.bottom,_.bottom)+n}),s=e.doc.scrollTop,m=e.doc.scrollLeft;if(null!=o.scrollTop&&(Qn(e,o.scrollTop),1<Math.abs(e.doc.scrollTop-s)&&(l=!0)),null!=o.scrollLeft&&(Mn(e,o.scrollLeft),1<Math.abs(e.doc.scrollLeft-m)&&(l=!0)),!l)break}return a}(t,dt(n,e.scrollToPos.from),dt(n,e.scrollToPos.to),e.scrollToPos.margin));var a=e.maybeHiddenMarkers,r=e.maybeUnhiddenMarkers;if(a)for(var l=0;l<a.length;++l)a[l].lines.length||fe(a[l],"hide");if(r)for(var d=0;d<r.length;++d)r[d].lines.length&&fe(r[d],"unhide");i.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&fe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Kn(e,t){if(e.curOp)return t();Pn(e);try{return t()}finally{Fn(e)}}function Un(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Pn(e);try{return t.apply(e,arguments)}finally{Fn(e)}}}function Vn(e){return function(){if(this.curOp)return e.apply(this,arguments);Pn(this);try{return e.apply(this,arguments)}finally{Fn(this)}}}function $n(t){return function(){var e=this.cm;if(!e||e.curOp)return t.apply(this,arguments);Pn(e);try{return t.apply(this,arguments)}finally{Fn(e)}}}function Gn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,S(Yn,e))}function Yn(_){var o=_.doc;if(!(o.highlightFrontier>=_.display.viewTo)){var s=+new Date+_.options.workTime,m=ct(_,o.highlightFrontier),u=[];o.iter(m.line,Math.min(o.first+o.size,_.display.viewTo+500),function(e){if(m.line>=_.display.viewFrom){var t=e.styles,i=e.text.length>_.options.maxHighlightLength?Fe(o.mode,m.state):null,n=mt(_,e,m,!0);i&&(m.state=i),e.styles=n.styles;var a=e.styleClasses,r=n.classes;r?e.styleClasses=r:a&&(e.styleClasses=null);for(var l=!t||t.length!=e.styles.length||a!=r&&(!a||!r||a.bgClass!=r.bgClass||a.textClass!=r.textClass),d=0;!l&&d<t.length;++d)l=t[d]!=e.styles[d];l&&u.push(m.line),e.stateAfter=m.save(),m.nextLine()}else e.text.length<=_.options.maxHighlightLength&&pt(_,e.text,m),e.stateAfter=m.line%5==0?m.save():null,m.nextLine();if(+new Date>s)return Gn(_,_.options.workDelay),!0}),o.highlightFrontier=m.line,o.modeFrontier=Math.max(o.modeFrontier,m.line),u.length&&Kn(_,function(){for(var e=0;e<u.length;e++)dn(_,u[e],"text")})}}var Xn=function(e,t,i){var n=e.display;this.viewport=t,this.visible=An(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Ai(e),this.force=i,this.dims=Ji(e),this.events=[]};function Zn(e,t){var i=e.display,n=e.doc;if(t.editorIsHidden)return _n(e),!1;if(!t.force&&t.visible.from>=i.viewFrom&&t.visible.to<=i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&0==sn(e))return!1;aa(e)&&(_n(e),t.dims=Ji(e));var a=n.first+n.size,r=Math.max(t.visible.from-e.options.viewportMargin,n.first),l=Math.min(a,t.visible.to+e.options.viewportMargin);i.viewFrom<r&&r-i.viewFrom<20&&(r=Math.max(n.first,i.viewFrom)),i.viewTo>l&&i.viewTo-l<20&&(l=Math.min(a,i.viewTo)),Et&&(r=Dt(e.doc,r),l=Ot(e.doc,l));var d,_,o,s,m=r!=i.viewFrom||l!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;_=r,o=l,0==(s=(d=e).display).view.length||_>=s.viewTo||o<=s.viewFrom?(s.view=ni(d,_,o),s.viewFrom=_):(s.viewFrom>_?s.view=ni(d,_,s.viewFrom).concat(s.view):s.viewFrom<_&&(s.view=s.view.slice(rn(d,_))),s.viewFrom=_,s.viewTo<o?s.view=s.view.concat(ni(d,s.viewTo,o)):s.viewTo>o&&(s.view=s.view.slice(0,rn(d,o)))),s.viewTo=o,i.viewOffset=Rt(Ue(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var u=sn(e);if(!m&&0==u&&!t.force&&i.renderedView==i.view&&(null==i.updateLineNumbers||i.updateLineNumbers>=i.viewTo))return!1;var c=function(e){if(e.hasFocus())return null;var t=M();if(!t||!T(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&T(e.display.lineDiv,n.anchorNode)&&(i.anchorNode=n.anchorNode,i.anchorOffset=n.anchorOffset,i.focusNode=n.focusNode,i.focusOffset=n.focusOffset)}return i}(e);return 4<u&&(i.lineDiv.style.display="none"),function(i,e,t){var n,a,r,l,d,_=i.display,o=i.options.lineNumbers,s=_.lineDiv,m=s.firstChild;function u(e){var t=e.nextSibling;return v&&g&&i.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),t}for(var c=_.view,p=_.viewFrom,f=0;f<c.length;f++){var h=c[f];if(h.hidden);else if(h.node&&h.node.parentNode==s){for(;m!=h.node;)m=u(m);var y=o&&null!=e&&e<=p&&h.lineNumber;h.changes&&(-1<O(h.changes,"gutter")&&(y=!1),_i(i,h,p,t)),y&&(C(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(Je(i.options,p)))),m=h.node.nextSibling}else{var b=(r=p,l=t,void 0,d=si(n=i,a=h),a.text=a.node=d.pre,d.bgClass&&(a.bgClass=d.bgClass),d.textClass&&(a.textClass=d.textClass),mi(n,a),ui(n,a,r,l),pi(n,a,l),a.node);s.insertBefore(b,m)}p+=h.size}for(;m;)m=u(m)}(e,i.updateLineNumbers,t.dims),4<u&&(i.lineDiv.style.display=""),i.renderedView=i.view,function(e){if(e&&e.activeElt&&e.activeElt!=M()&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&T(document.body,e.anchorNode)&&T(document.body,e.focusNode))){var t=window.getSelection(),i=document.createRange();i.setEnd(e.anchorNode,e.anchorOffset),i.collapse(!1),t.removeAllRanges(),t.addRange(i),t.extend(e.focusNode,e.focusOffset)}}(c),C(i.cursorDiv),C(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,m&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Gn(e,400)),!(i.updateLineNumbers=null)}function Jn(e,t){for(var i=t.viewport,n=!0;;n=!1){if(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Ai(e))n&&(t.visible=An(e.display,e.doc,i));else if(i&&null!=i.top&&(i={top:Math.min(e.doc.height+gi(e.display)-xi(e),i.top)}),t.visible=An(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!Zn(e,t))break;wn(e);var a=Ln(e);mn(e),Sn(e,a),ia(e,a),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function ea(e,t){var i=new Xn(e,t);if(Zn(e,i)){wn(e),Jn(e,i);var n=Ln(e);mn(e),Sn(e,n),ia(e,n),i.finish()}}function ta(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",li(e,"gutterChanged",e)}function ia(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Ei(e)+"px"}function na(e){var t=e.display,i=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=en(t)-t.scroller.scrollLeft+e.doc.scrollLeft,a=t.gutters.offsetWidth,r=n+"px",l=0;l<i.length;l++)if(!i[l].hidden){e.options.fixedGutter&&(i[l].gutter&&(i[l].gutter.style.left=r),i[l].gutterBackground&&(i[l].gutterBackground.style.left=r));var d=i[l].alignable;if(d)for(var _=0;_<d.length;_++)d[_].style.left=r}e.options.fixedGutter&&(t.gutters.style.left=n+a+"px")}}function aa(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=Je(e.options,t.first+t.size-1),n=e.display;if(i.length==n.lineNumChars)return!1;var a=n.measure.appendChild(Q("div",[Q("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),r=a.firstChild.offsetWidth,l=a.offsetWidth-r;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(r,n.lineGutter.offsetWidth-l)+1,n.lineNumWidth=n.lineNumInnerWidth+l,n.lineNumChars=n.lineNumInnerWidth?i.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",ta(e.display),!0}function ra(e,t){for(var i=[],n=!1,a=0;a<e.length;a++){var r=e[a],l=null;if("string"!=typeof r&&(l=r.style,r=r.className),"CodeMirror-linenumbers"==r){if(!t)continue;n=!0}i.push({className:r,style:l})}return t&&!n&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function la(e){var t=e.gutters,i=e.gutterSpecs;C(t),e.lineGutter=null;for(var n=0;n<i.length;++n){var a=i[n],r=a.className,l=a.style,d=t.appendChild(Q("div",null,"CodeMirror-gutter "+r));l&&(d.style.cssText=l),"CodeMirror-linenumbers"==r&&((e.lineGutter=d).style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",ta(e)}function da(e){la(e.display),ln(e),na(e)}function _a(e,t,i,n){var a=this;this.input=i,a.scrollbarFiller=Q("div",null,"CodeMirror-scrollbar-filler"),a.scrollbarFiller.setAttribute("cm-not-content","true"),a.gutterFiller=Q("div",null,"CodeMirror-gutter-filler"),a.gutterFiller.setAttribute("cm-not-content","true"),a.lineDiv=B("div",null,"CodeMirror-code"),a.selectionDiv=Q("div",null,null,"position: relative; z-index: 1"),a.cursorDiv=Q("div",null,"CodeMirror-cursors"),a.measure=Q("div",null,"CodeMirror-measure"),a.lineMeasure=Q("div",null,"CodeMirror-measure"),a.lineSpace=B("div",[a.measure,a.lineMeasure,a.selectionDiv,a.cursorDiv,a.lineDiv],null,"position: relative; outline: none");var r=B("div",[a.lineSpace],"CodeMirror-lines");a.mover=Q("div",[r],null,"position: relative"),a.sizer=Q("div",[a.mover],"CodeMirror-sizer"),a.sizerWidth=null,a.heightForcer=Q("div",null,null,"position: absolute; height: "+P+"px; width: 1px;"),a.gutters=Q("div",null,"CodeMirror-gutters"),a.lineGutter=null,a.scroller=Q("div",[a.sizer,a.heightForcer,a.gutters],"CodeMirror-scroll"),a.scroller.setAttribute("tabIndex","-1"),a.wrapper=Q("div",[a.scrollbarFiller,a.gutterFiller,a.scroller],"CodeMirror"),a.wrapper.setAttribute("translate","no"),x&&w<8&&(a.gutters.style.zIndex=-1,a.scroller.style.paddingRight=0),v||h&&m||(a.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(a.wrapper):e(a.wrapper)),a.viewFrom=a.viewTo=t.first,a.reportedViewFrom=a.reportedViewTo=t.first,a.view=[],a.renderedView=null,a.externalMeasured=null,a.viewOffset=0,a.lastWrapHeight=a.lastWrapWidth=0,a.updateLineNumbers=null,a.nativeBarWidth=a.barHeight=a.barWidth=0,a.scrollbarsClipped=!1,a.lineNumWidth=a.lineNumInnerWidth=a.lineNumChars=null,a.alignWidgets=!1,a.cachedCharWidth=a.cachedTextHeight=a.cachedPaddingH=null,a.maxLine=null,a.maxLineLength=0,a.maxLineChanged=!1,a.wheelDX=a.wheelDY=a.wheelStartX=a.wheelStartY=null,a.shift=!1,a.selForContextMenu=null,a.activeTouch=null,a.gutterSpecs=ra(n.gutters,n.lineNumbers),la(a),i.init(a)}Xn.prototype.signal=function(e,t){be(e,t)&&this.events.push(arguments)},Xn.prototype.finish=function(){for(var e=0;e<this.events.length;e++)fe.apply(null,this.events[e])};var oa=0,sa=null;function ma(e){var t=e.wheelDeltaX,i=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==i&&e.detail&&e.axis==e.VERTICAL_AXIS?i=e.detail:null==i&&(i=e.wheelDelta),{x:t,y:i}}function ua(e){var t=ma(e);return t.x*=sa,t.y*=sa,t}function ca(e,t){var i=ma(t),n=i.x,a=i.y,r=sa;0===t.deltaMode&&(n=t.deltaX,a=t.deltaY,r=1);var l=e.display,d=l.scroller,_=d.scrollWidth>d.clientWidth,o=d.scrollHeight>d.clientHeight;if(n&&_||a&&o){if(a&&g&&v)e:for(var s=t.target,m=l.view;s!=d;s=s.parentNode)for(var u=0;u<m.length;u++)if(m[u].node==s){e.display.currentWheelTarget=s;break e}if(n&&!h&&!y&&null!=r)return a&&o&&Qn(e,Math.max(0,d.scrollTop+a*r)),Mn(e,Math.max(0,d.scrollLeft+n*r)),(!a||a&&o)&&ge(t),void(l.wheelStartX=null);if(a&&null!=r){var c=a*r,p=e.doc.scrollTop,f=p+l.wrapper.clientHeight;c<0?p=Math.max(0,p+c-50):f=Math.min(e.doc.height,f+c+50),ea(e,{top:p,bottom:f})}oa<20&&0!==t.deltaMode&&(null==l.wheelStartX?(l.wheelStartX=d.scrollLeft,l.wheelStartY=d.scrollTop,l.wheelDX=n,l.wheelDY=a,setTimeout(function(){if(null!=l.wheelStartX){var e=d.scrollLeft-l.wheelStartX,t=d.scrollTop-l.wheelStartY,i=t&&l.wheelDY&&t/l.wheelDY||e&&l.wheelDX&&e/l.wheelDX;l.wheelStartX=l.wheelStartY=null,i&&(sa=(sa*oa+i)/(oa+1),++oa)}},200)):(l.wheelDX+=n,l.wheelDY+=a))}}x?sa=-.53:h?sa=15:l?sa=-.7:b&&(sa=-1/3);var pa=function(e,t){this.ranges=e,this.primIndex=t};pa.prototype.primary=function(){return this.ranges[this.primIndex]},pa.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var i=this.ranges[t],n=e.ranges[t];if(!it(i.anchor,n.anchor)||!it(i.head,n.head))return!1}return!0},pa.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new fa(nt(this.ranges[t].anchor),nt(this.ranges[t].head));return new pa(e,this.primIndex)},pa.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},pa.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var n=this.ranges[i];if(0<=tt(t,n.from())&&tt(e,n.to())<=0)return i}return-1};var fa=function(e,t){this.anchor=e,this.head=t};function ha(e,t,i){var n=e&&e.options.selectionsMayTouch,a=t[i];t.sort(function(e,t){return tt(e.from(),t.from())}),i=O(t,a);for(var r=1;r<t.length;r++){var l=t[r],d=t[r-1],_=tt(d.to(),l.from());if(n&&!l.empty()?0<_:0<=_){var o=rt(d.from(),l.from()),s=at(d.to(),l.to()),m=d.empty()?l.from()==l.head:d.from()==d.head;r<=i&&--i,t.splice(--r,2,new fa(m?s:o,m?o:s))}}return new pa(t,i)}function ya(e,t){return new pa([new fa(e,t||e)],0)}function ba(e){return e.text?et(e.from.line+e.text.length-1,G(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function va(e,t){if(tt(e,t.from)<0)return e;if(tt(e,t.to)<=0)return ba(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=ba(t).ch-t.to.ch),et(i,n)}function ga(e,t){for(var i=[],n=0;n<e.sel.ranges.length;n++){var a=e.sel.ranges[n];i.push(new fa(va(a.anchor,t),va(a.head,t)))}return ha(e.cm,i,e.sel.primIndex)}function wa(e,t,i){return e.line==t.line?et(i.line,e.ch-t.ch+i.ch):et(i.line+(e.line-t.line),e.ch)}function Ea(e){e.doc.mode=De(e.options,e.doc.modeOption),Aa(e)}function Aa(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,Gn(e,100),e.state.modeGen++,e.curOp&&ln(e)}function xa(e,t){return 0==t.from.ch&&0==t.to.ch&&""==G(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function ka(e,n,t,a){function r(e){return t?t[e]:null}function i(e,t,i){!function(e,t,i,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),It(e),Bt(e,i);var a=n?n(e):1;a!=e.height&&Ge(e,a)}(e,t,i,a),li(e,"change",e,n)}function l(e,t){for(var i=[],n=e;n<t;++n)i.push(new Ut(o[n],r(n),a));return i}var d=n.from,_=n.to,o=n.text,s=Ue(e,d.line),m=Ue(e,_.line),u=G(o),c=r(o.length-1),p=_.line-d.line;if(n.full)e.insert(0,l(0,o.length)),e.remove(o.length,e.size-o.length);else if(xa(e,n)){var f=l(0,o.length-1);i(m,m.text,c),p&&e.remove(d.line,p),f.length&&e.insert(d.line,f)}else if(s==m)if(1==o.length)i(s,s.text.slice(0,d.ch)+u+s.text.slice(_.ch),c);else{var h=l(1,o.length-1);h.push(new Ut(u+s.text.slice(_.ch),c,a)),i(s,s.text.slice(0,d.ch)+o[0],r(0)),e.insert(d.line+1,h)}else if(1==o.length)i(s,s.text.slice(0,d.ch)+o[0]+m.text.slice(_.ch),r(0)),e.remove(d.line+1,p);else{i(s,s.text.slice(0,d.ch)+o[0],r(0)),i(m,u+m.text.slice(_.ch),c);var y=l(1,o.length-1);1<p&&e.remove(d.line+1,p-1),e.insert(d.line+1,y)}li(e,"change",e,n)}function ja(e,d,_){!function e(t,i,n){if(t.linked)for(var a=0;a<t.linked.length;++a){var r=t.linked[a];if(r.doc!=i){var l=n&&r.sharedHist;_&&!l||(d(r.doc,l),e(r.doc,t,l))}}}(e,null,!0)}function Ca(e,t){if(t.cm)throw new Error("This document is already in use.");nn((e.doc=t).cm=e),Ea(e),Ia(e),e.options.direction=t.direction,e.options.lineWrapping||Kt(e),e.options.mode=t.modeOption,ln(e)}function Ia(e){("rtl"==e.doc.direction?L:j)(e.display.lineDiv,"CodeMirror-rtl")}function Ba(e){this.done=[],this.undone=[],this.undoDepth=e?e.undoDepth:1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e?e.maxGeneration:1}function Qa(e,t){var i={from:nt(t.from),to:ba(t),text:Ve(e,t.from,t.to)};return za(e,i,t.from.line,t.to.line+1),ja(e,function(e){return za(e,i,t.from.line,t.to.line+1)},!0),i}function Ta(e){for(;e.length&&G(e).ranges;)e.pop()}function Ma(e,t,i,n){var a=e.history;a.undone.length=0;var r,l,d,_=+new Date;if((a.lastOp==n||a.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&a.lastModTime>_-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(r=(d=a).lastOp==n?(Ta(d.done),G(d.done)):d.done.length&&!G(d.done).ranges?G(d.done):1<d.done.length&&!d.done[d.done.length-2].ranges?(d.done.pop(),G(d.done)):void 0))l=G(r.changes),0==tt(t.from,t.to)&&0==tt(t.from,l.to)?l.to=ba(t):r.changes.push(Qa(e,t));else{var o=G(a.done);for(o&&o.ranges||La(e.sel,a.done),r={changes:[Qa(e,t)],generation:a.generation},a.done.push(r);a.done.length>a.undoDepth;)a.done.shift(),a.done[0].ranges||a.done.shift()}a.done.push(i),a.generation=++a.maxGeneration,a.lastModTime=a.lastSelTime=_,a.lastOp=a.lastSelOp=n,a.lastOrigin=a.lastSelOrigin=t.origin,l||fe(e,"historyAdded")}function La(e,t){var i=G(t);i&&i.ranges&&i.equals(e)||t.push(e)}function za(t,i,e,n){var a=i["spans_"+t.id],r=0;t.iter(Math.max(t.first,e),Math.min(t.first+t.size,n),function(e){e.markedSpans&&((a||(a=i["spans_"+t.id]={}))[r]=e.markedSpans),++r})}function qa(e){if(!e)return null;for(var t,i=0;i<e.length;++i)e[i].marker.explicitlyCleared?t||(t=e.slice(0,i)):t&&t.push(e[i]);return t?t.length?t:null:e}function Sa(r,e){var t=function(e,t){var i=t["spans_"+r.id];if(!i)return null;for(var n=[],a=0;a<t.text.length;++a)n.push(qa(i[a]));return n}(0,e),i=jt(r,e);if(!t)return i;if(!i)return t;for(var n=0;n<t.length;++n){var a=t[n],l=i[n];if(a&&l)e:for(var d=0;d<l.length;++d){for(var _=l[d],o=0;o<a.length;++o)if(a[o].marker==_.marker)continue e;a.push(_)}else l&&(t[n]=l)}return t}function Na(e,t,i){for(var n=[],a=0;a<e.length;++a){var r=e[a];if(r.ranges)n.push(i?pa.prototype.deepCopy.call(r):r);else{var l=r.changes,d=[];n.push({changes:d});for(var _=0;_<l.length;++_){var o=l[_],s=void 0;if(d.push({from:o.from,to:o.to,text:o.text}),t)for(var m in o)(s=m.match(/^spans_(\d+)$/))&&-1<O(t,Number(s[1]))&&(G(d)[m]=o[m],delete o[m])}}}return n}function Ha(e,t,i,n){if(n){var a=e.anchor;if(i){var r=tt(t,a)<0;r!=tt(i,a)<0?(a=t,t=i):r!=tt(t,i)<0&&(t=i)}return new fa(a,t)}return new fa(i||t,t)}function Da(e,t,i,n,a){null==a&&(a=e.cm&&(e.cm.display.shift||e.extend)),Wa(e,new pa([Ha(e.sel.primary(),t,i,a)],0),n)}function Oa(e,t,i){for(var n=[],a=e.cm&&(e.cm.display.shift||e.extend),r=0;r<e.sel.ranges.length;r++)n[r]=Ha(e.sel.ranges[r],t[r],null,a);Wa(e,ha(e.cm,n,e.sel.primIndex),i)}function Pa(e,t,i,n){var a=e.sel.ranges.slice(0);a[t]=i,Wa(e,ha(e.cm,a,e.sel.primIndex),n)}function Fa(e,t,i,n){Wa(e,ya(t,i),n)}function Ra(e,t,i){var n=e.history.done,a=G(n);a&&a.ranges?Ka(e,n[n.length-1]=t,i):Wa(e,t,i)}function Wa(e,t,i){var n,a,r,l,d,_,o,s,m,u,c;Ka(e,t,i),a=(n=e).sel,r=e.cm?e.cm.curOp.id:NaN,l=i,u=n.history,c=l&&l.origin,r==u.lastSelOp||c&&u.lastSelOrigin==c&&(u.lastModTime==u.lastSelTime&&u.lastOrigin==c||(d=n,_=c,o=G(u.done),s=a,"*"==(m=_.charAt(0))||"+"==m&&o.ranges.length==s.ranges.length&&o.somethingSelected()==s.somethingSelected()&&new Date-d.history.lastSelTime<=(d.cm?d.cm.options.historyEventDelay:500)))?u.done[u.done.length-1]=a:La(a,u.done),u.lastSelTime=+new Date,u.lastSelOrigin=c,u.lastSelOp=r,l&&!1!==l.clearRedo&&Ta(u.undone)}function Ka(e,t,i){var n,a,r,l;(be(e,"beforeSelectionChange")||e.cm&&be(e.cm,"beforeSelectionChange"))&&(n=e,r=i,l={ranges:(a=t).ranges,update:function(e){this.ranges=[];for(var t=0;t<e.length;t++)this.ranges[t]=new fa(dt(n,e[t].anchor),dt(n,e[t].head))},origin:r&&r.origin},fe(n,"beforeSelectionChange",n,l),n.cm&&fe(n.cm,"beforeSelectionChange",n.cm,l),t=l.ranges!=a.ranges?ha(n.cm,l.ranges,l.ranges.length-1):a),Ua(e,$a(e,t,i&&i.bias||(tt(t.primary().head,e.sel.primary().head)<0?-1:1),!0)),i&&!1===i.scroll||!e.cm||"nocursor"==e.cm.getOption("readOnly")||jn(e.cm)}function Ua(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ye(e.cm)),li(e,"cursorActivity",e))}function Va(e){Ua(e,$a(e,e.sel,null,!1))}function $a(e,t,i,n){for(var a,r=0;r<t.ranges.length;r++){var l=t.ranges[r],d=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[r],_=Ya(e,l.anchor,d&&d.anchor,i,n),o=Ya(e,l.head,d&&d.head,i,n);(a||_!=l.anchor||o!=l.head)&&(a||(a=t.ranges.slice(0,r)),a[r]=new fa(_,o))}return a?ha(e.cm,a,t.primIndex):t}function Ga(e,t,i,n,a){var r=Ue(e,t.line);if(r.markedSpans)for(var l=0;l<r.markedSpans.length;++l){var d=r.markedSpans[l],_=d.marker,o="selectLeft"in _?!_.selectLeft:_.inclusiveLeft,s="selectRight"in _?!_.selectRight:_.inclusiveRight;if((null==d.from||(o?d.from<=t.ch:d.from<t.ch))&&(null==d.to||(s?d.to>=t.ch:d.to>t.ch))){if(a&&(fe(_,"beforeCursorEnter"),_.explicitlyCleared)){if(r.markedSpans){--l;continue}break}if(!_.atomic)continue;if(i){var m=_.find(n<0?1:-1),u=void 0;if((n<0?s:o)&&(m=Xa(e,m,-n,m&&m.line==t.line?r:null)),m&&m.line==t.line&&(u=tt(m,i))&&(n<0?u<0:0<u))return Ga(e,m,t,n,a)}var c=_.find(n<0?-1:1);return(n<0?o:s)&&(c=Xa(e,c,n,c.line==t.line?r:null)),c?Ga(e,c,t,n,a):null}}return t}function Ya(e,t,i,n,a){var r=n||1;return Ga(e,t,i,r,a)||!a&&Ga(e,t,i,r,!0)||Ga(e,t,i,-r,a)||!a&&Ga(e,t,i,-r,!0)||(e.cantEdit=!0,et(e.first,0))}function Xa(e,t,i,n){return i<0&&0==t.ch?t.line>e.first?dt(e,et(t.line-1)):null:0<i&&t.ch==(n||Ue(e,t.line)).text.length?t.line<e.first+e.size-1?et(t.line+1,0):null:new et(t.line,t.ch+i)}function Za(e){e.setSelection(et(e.firstLine(),0),et(e.lastLine()),R)}function Ja(a,e,t){var r={canceled:!1,from:e.from,to:e.to,text:e.text,origin:e.origin,cancel:function(){return r.canceled=!0}};return t&&(r.update=function(e,t,i,n){e&&(r.from=dt(a,e)),t&&(r.to=dt(a,t)),i&&(r.text=i),void 0!==n&&(r.origin=n)}),fe(a,"beforeChange",a,r),a.cm&&fe(a.cm,"beforeChange",a.cm,r),r.canceled?(a.cm&&(a.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function er(e,t,i){if(e.cm){if(!e.cm.curOp)return Un(e.cm,er)(e,t,i);if(e.cm.state.suppressEdits)return}if(!(be(e,"beforeChange")||e.cm&&be(e.cm,"beforeChange"))||(t=Ja(e,t,!0))){var n=wt&&!i&&function(e,t,i){var n=null;if(e.iter(t.line,i.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var i=e.markedSpans[t].marker;!i.readOnly||n&&-1!=O(n,i)||(n||(n=[])).push(i)}}),!n)return null;for(var a=[{from:t,to:i}],r=0;r<n.length;++r)for(var l=n[r],d=l.find(0),_=0;_<a.length;++_){var o=a[_];if(!(tt(o.to,d.from)<0||0<tt(o.from,d.to))){var s=[_,1],m=tt(o.from,d.from),u=tt(o.to,d.to);(m<0||!l.inclusiveLeft&&!m)&&s.push({from:o.from,to:d.from}),(0<u||!l.inclusiveRight&&!u)&&s.push({from:d.to,to:o.to}),a.splice.apply(a,s),_+=s.length-3}}return a}(e,t.from,t.to);if(n)for(var a=n.length-1;0<=a;--a)tr(e,{from:n[a].from,to:n[a].to,text:a?[""]:t.text,origin:t.origin});else tr(e,t)}}function tr(e,i){if(1!=i.text.length||""!=i.text[0]||0!=tt(i.from,i.to)){var t=ga(e,i);Ma(e,i,t,e.cm?e.cm.curOp.id:NaN),ar(e,i,t,jt(e,i));var n=[];ja(e,function(e,t){t||-1!=O(n,e.history)||(_r(e.history,i),n.push(e.history)),ar(e,i,null,jt(e,i))})}}function ir(a,r,e){var t=a.cm&&a.cm.state.suppressEdits;if(!t||e){for(var l,i=a.history,n=a.sel,d="undo"==r?i.done:i.undone,_="undo"==r?i.undone:i.done,o=0;o<d.length&&(l=d[o],e?!l.ranges||l.equals(a.sel):l.ranges);o++);if(o!=d.length){for(i.lastOrigin=i.lastSelOrigin=null;;){if(!(l=d.pop()).ranges){if(t)return void d.push(l);break}if(La(l,_),e&&!l.equals(a.sel))return void Wa(a,l,{clearRedo:!1});n=l}var s=[];La(n,_),_.push({changes:s,generation:i.generation}),i.generation=l.generation||++i.maxGeneration;for(var m=be(a,"beforeChange")||a.cm&&be(a.cm,"beforeChange"),u=function(e){var i=l.changes[e];if(i.origin=r,m&&!Ja(a,i,!1))return d.length=0,{};s.push(Qa(a,i));var t=e?ga(a,i):G(d);ar(a,i,t,Sa(a,i)),!e&&a.cm&&a.cm.scrollIntoView({from:i.from,to:ba(i)});var n=[];ja(a,function(e,t){t||-1!=O(n,e.history)||(_r(e.history,i),n.push(e.history)),ar(e,i,null,Sa(e,i))})},c=l.changes.length-1;0<=c;--c){var p=u(c);if(p)return p.v}}}}function nr(e,t){if(0!=t&&(e.first+=t,e.sel=new pa(Y(e.sel.ranges,function(e){return new fa(et(e.anchor.line+t,e.anchor.ch),et(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){ln(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,n=i.viewFrom;n<i.viewTo;n++)dn(e.cm,n,"gutter")}}function ar(e,t,i,n){if(e.cm&&!e.cm.curOp)return Un(e.cm,ar)(e,t,i,n);if(t.to.line<e.first)nr(e,t.text.length-1-(t.to.line-t.from.line));else if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var a=t.text.length-1-(e.first-t.from.line);nr(e,a),t={from:et(e.first,0),to:et(t.to.line+a,t.to.ch),text:[G(t.text)],origin:t.origin}}var r=e.lastLine();t.to.line>r&&(t={from:t.from,to:et(r,Ue(e,r).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ve(e,t.from,t.to),i||(i=ga(e,t)),e.cm?function(e,t,i){var n=e.doc,a=e.display,r=t.from,l=t.to,d=!1,_=r.line;e.options.lineWrapping||(_=Ye(Ht(Ue(n,r.line))),n.iter(_,l.line+1,function(e){if(e==a.maxLine)return d=!0})),-1<n.sel.contains(t.from,t.to)&&ye(e),ka(n,t,i,tn(e)),e.options.lineWrapping||(n.iter(_,r.line+t.text.length,function(e){var t=Wt(e);t>a.maxLineLength&&(a.maxLine=e,a.maxLineLength=t,a.maxLineChanged=!0,d=!1)}),d&&(e.curOp.updateMaxLine=!0)),function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var i=e.first,n=t-1;i<n;n--){var a=Ue(e,n).stateAfter;if(a&&(!(a instanceof ot)||n+a.lookAhead<t)){i=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}}(n,r.line),Gn(e,400);var o=t.text.length-(l.line-r.line)-1;t.full?ln(e):r.line!=l.line||1!=t.text.length||xa(e.doc,t)?ln(e,r.line,l.line+1,o):dn(e,r.line,"text");var s=be(e,"changes"),m=be(e,"change");if(m||s){var u={from:r,to:l,text:t.text,removed:t.removed,origin:t.origin};m&&li(e,"change",e,u),s&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(u)}e.display.selForContextMenu=null}(e.cm,t,n):ka(e,t,n),Ka(e,i,R),e.cantEdit&&Ya(e,et(e.firstLine(),0))&&(e.cantEdit=!1)}}function rr(e,t,i,n,a){var r;n||(n=i),tt(n,i)<0&&(i=(r=[n,i])[0],n=r[1]),"string"==typeof t&&(t=e.splitLines(t)),er(e,{from:i,to:n,text:t,origin:a})}function lr(e,t,i,n){i<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function dr(e,t,i,n){for(var a=0;a<e.length;++a){var r=e[a],l=!0;if(r.ranges){r.copied||((r=e[a]=r.deepCopy()).copied=!0);for(var d=0;d<r.ranges.length;d++)lr(r.ranges[d].anchor,t,i,n),lr(r.ranges[d].head,t,i,n)}else{for(var _=0;_<r.changes.length;++_){var o=r.changes[_];if(i<o.from.line)o.from=et(o.from.line+n,o.from.ch),o.to=et(o.to.line+n,o.to.ch);else if(t<=o.to.line){l=!1;break}}l||(e.splice(0,a+1),a=0)}}}function _r(e,t){var i=t.from.line,n=t.to.line,a=t.text.length-(n-i)-1;dr(e.done,i,n,a),dr(e.undone,i,n,a)}function or(e,t,i,n){var a=t,r=t;return"number"==typeof t?r=Ue(e,lt(e,t)):a=Ye(t),null==a?null:(n(r,a)&&e.cm&&dn(e.cm,a,i),r)}function sr(e){this.lines=e,this.parent=null;for(var t=0,i=0;i<e.length;++i)e[i].parent=this,t+=e[i].height;this.height=t}function mr(e){this.children=e;for(var t=0,i=0,n=0;n<e.length;++n){var a=e[n];t+=a.chunkSize(),i+=a.height,a.parent=this}this.size=t,this.height=i,this.parent=null}fa.prototype.from=function(){return rt(this.anchor,this.head)},fa.prototype.to=function(){return at(this.anchor,this.head)},fa.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},sr.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var i=e,n=e+t;i<n;++i){var a=this.lines[i];this.height-=a.height,(r=a).parent=null,It(r),li(a,"delete")}var r;this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,i){this.height+=i,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,i){for(var n=e+t;e<n;++e)if(i(this.lines[e]))return!0}},mr.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var i=0;i<this.children.length;++i){var n=this.children[i],a=n.chunkSize();if(e<a){var r=Math.min(t,a-e),l=n.height;if(n.removeInner(e,r),this.height-=l-n.height,a==r&&(this.children.splice(i--,1),n.parent=null),0==(t-=r))break;e=0}else e-=a}if(this.size-t<25&&(1<this.children.length||!(this.children[0]instanceof sr))){var d=[];this.collapse(d),this.children=[new sr(d)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,i){this.size+=t.length,this.height+=i;for(var n=0;n<this.children.length;++n){var a=this.children[n],r=a.chunkSize();if(e<=r){if(a.insertInner(e,t,i),a.lines&&50<a.lines.length){for(var l=a.lines.length%25+25,d=l;d<a.lines.length;){var _=new sr(a.lines.slice(d,d+=25));a.height-=_.height,this.children.splice(++n,0,_),_.parent=this}a.lines=a.lines.slice(0,l),this.maybeSpill()}break}e-=r}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=new mr(e.children.splice(e.children.length-5,5));if(e.parent){e.size-=t.size,e.height-=t.height;var i=O(e.parent.children,e);e.parent.children.splice(i+1,0,t)}else{var n=new mr(e.children);(n.parent=e).children=[n,t],e=n}t.parent=e.parent}while(10<e.children.length);e.parent.maybeSpill()}},iterN:function(e,t,i){for(var n=0;n<this.children.length;++n){var a=this.children[n],r=a.chunkSize();if(e<r){var l=Math.min(t,r-e);if(a.iterN(e,l,i))return!0;if(0==(t-=l))break;e=0}else e-=r}}};var ur=function(e,t,i){if(i)for(var n in i)i.hasOwnProperty(n)&&(this[n]=i[n]);this.doc=e,this.node=t};function cr(e,t,i){Rt(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&kn(e,i)}ur.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,n=Ye(i);if(null!=n&&t){for(var a=0;a<t.length;++a)t[a]==this&&t.splice(a--,1);t.length||(i.widgets=null);var r=yi(this);Ge(i,Math.max(0,i.height-r)),e&&(Kn(e,function(){cr(e,i,-r),dn(e,n,"widget")}),li(e,"lineWidgetCleared",e,this,n))}},ur.prototype.changed=function(){var e=this,t=this.height,i=this.doc.cm,n=this.line;this.height=null;var a=yi(this)-t;a&&(Pt(this.doc,n)||Ge(n,n.height+a),i&&Kn(i,function(){i.curOp.forceUpdate=!0,cr(i,n,a),li(i,"lineWidgetChanged",i,e,Ye(n))}))},ve(ur);var pr=0,fr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++pr};function hr(r,l,d,e,t){if(e&&e.shared)return function(e,i,n,a,r){(a=N(a)).shared=!1;var l=[hr(e,i,n,a,r)],d=l[0],_=a.widgetNode;return ja(e,function(e){_&&(a.widgetNode=_.cloneNode(!0)),l.push(hr(e,dt(e,i),dt(e,n),a,r));for(var t=0;t<e.linked.length;++t)if(e.linked[t].isParent)return;d=G(l)}),new yr(l,d)}(r,l,d,e,t);if(r.cm&&!r.cm.curOp)return Un(r.cm,hr)(r,l,d,e,t);var _=new fr(r,t),i=tt(l,d);if(e&&N(e,_,!1),0<i||0==i&&!1!==_.clearWhenEmpty)return _;if(_.replacedWith&&(_.collapsed=!0,_.widgetNode=B("span",[_.replacedWith],"CodeMirror-widget"),e.handleMouseEvents||_.widgetNode.setAttribute("cm-ignore-events","true"),e.insertLeft&&(_.widgetNode.insertLeft=!0)),_.collapsed){if(Nt(r,l.line,l,d,_)||l.line!=d.line&&Nt(r,d.line,l,d,_))throw new Error("Inserting collapsed marker partially overlapping an existing one");Et=!0}_.addToHistory&&Ma(r,{from:l,to:d,origin:"markText"},r.sel,NaN);var o,s=l.line,m=r.cm;if(r.iter(s,d.line+1,function(e){var t,i,n,a;m&&_.collapsed&&!m.options.lineWrapping&&Ht(e)==m.display.maxLine&&(o=!0),_.collapsed&&s!=l.line&&Ge(e,0),t=e,i=new At(_,s==l.line?l.ch:null,s==d.line?d.ch:null),n=r.cm&&r.cm.curOp,(a=n&&window.WeakSet&&(n.markedSpans||(n.markedSpans=new WeakSet)))&&a.has(t.markedSpans)?t.markedSpans.push(i):(t.markedSpans=t.markedSpans?t.markedSpans.concat([i]):[i],a&&a.add(t.markedSpans)),i.marker.attachLine(t),++s}),_.collapsed&&r.iter(l.line,d.line+1,function(e){Pt(r,e)&&Ge(e,0)}),_.clearOnEnter&&ue(_,"beforeCursorEnter",function(){return _.clear()}),_.readOnly&&(wt=!0,(r.history.done.length||r.history.undone.length)&&r.clearHistory()),_.collapsed&&(_.id=++pr,_.atomic=!0),m){if(o&&(m.curOp.updateMaxLine=!0),_.collapsed)ln(m,l.line,d.line+1);else if(_.className||_.startStyle||_.endStyle||_.css||_.attributes||_.title)for(var n=l.line;n<=d.line;n++)dn(m,n,"text");_.atomic&&Va(m.doc),li(m,"markerAdded",m,_)}return _}fr.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Pn(e),be(this,"clear")){var i=this.find();i&&li(this,"clear",i.from,i.to)}for(var n=null,a=null,r=0;r<this.lines.length;++r){var l=this.lines[r],d=xt(l.markedSpans,this);e&&!this.collapsed?dn(e,Ye(l),"text"):e&&(null!=d.to&&(a=Ye(l)),null!=d.from&&(n=Ye(l))),l.markedSpans=kt(l.markedSpans,d),null==d.from&&this.collapsed&&!Pt(this.doc,l)&&e&&Ge(l,Xi(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var _=0;_<this.lines.length;++_){var o=Ht(this.lines[_]),s=Wt(o);s>e.display.maxLineLength&&(e.display.maxLine=o,e.display.maxLineLength=s,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&ln(e,n,a+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Va(e.doc)),e&&li(e,"markerCleared",e,this,n,a),t&&Fn(e),this.parent&&this.parent.clear()}},fr.prototype.find=function(e,t){var i,n;null==e&&"bookmark"==this.type&&(e=1);for(var a=0;a<this.lines.length;++a){var r=this.lines[a],l=xt(r.markedSpans,this);if(null!=l.from&&(i=et(t?r:Ye(r),l.from),-1==e))return i;if(null!=l.to&&(n=et(t?r:Ye(r),l.to),1==e))return n}return i&&{from:i,to:n}},fr.prototype.changed=function(){var r=this,l=this.find(-1,!0),d=this,_=this.doc.cm;l&&_&&Kn(_,function(){var e=l.line,t=Ye(l.line),i=Ci(_,t);if(i&&(zi(i),_.curOp.selectionChanged=_.curOp.forceUpdate=!0),_.curOp.updateMaxLine=!0,!Pt(d.doc,e)&&null!=d.height){var n=d.height;d.height=null;var a=yi(d)-n;a&&Ge(e,e.height+a)}li(_,"markerChanged",_,r)})},fr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=O(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},fr.prototype.detachLine=function(e){if(this.lines.splice(O(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ve(fr);var yr=function(e,t){this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=this};function br(e){return e.findMarks(et(e.first,0),e.clipPos(et(e.lastLine())),function(e){return e.parent})}function vr(r){for(var e=function(e){var t=r[e],i=[t.primary.doc];ja(t.primary.doc,function(e){return i.push(e)});for(var n=0;n<t.markers.length;n++){var a=t.markers[n];-1==O(i,a.doc)&&(a.parent=null,t.markers.splice(n--,1))}},t=0;t<r.length;t++)e(t)}yr.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();li(this,"clear")}},yr.prototype.find=function(e,t){return this.primary.find(e,t)},ve(yr);var gr=0,wr=function(e,t,i,n,a){if(!(this instanceof wr))return new wr(e,t,i,n,a);null==i&&(i=0),mr.call(this,[new sr([new Ut("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var r=et(i,0);this.sel=ya(r),this.history=new Ba(null),this.id=++gr,this.modeOption=t,this.lineSep=n,this.direction="rtl"==a?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),ka(this,{from:r,to:r,text:e}),Wa(this,ya(r),R)};wr.prototype=Z(mr.prototype,{constructor:wr,iter:function(e,t,i){i?this.iterN(e-this.first,t-e,i):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var i=0,n=0;n<t.length;++n)i+=t[n].height;this.insertInner(e-this.first,t,i)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=$e(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:$n(function(e){var t=et(this.first,0),i=this.first+this.size-1;er(this,{from:t,to:et(i,Ue(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Cn(this.cm,0,0),Wa(this,ya(t),R)}),replaceRange:function(e,t,i,n){rr(this,e,t=dt(this,t),i=i?dt(this,i):t,n)},getRange:function(e,t,i){var n=Ve(this,dt(this,e),dt(this,t));return!1===i?n:""===i?n.join(""):n.join(i||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Ze(this,e))return Ue(this,e)},getLineNumber:function(e){return Ye(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=Ue(this,e)),Ht(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return dt(this,e)},getCursor:function(e){var t=this.sel.primary();return null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:$n(function(e,t,i){Fa(this,dt(this,"number"==typeof e?et(e,t||0):e),null,i)}),setSelection:$n(function(e,t,i){Fa(this,dt(this,e),dt(this,t||e),i)}),extendSelection:$n(function(e,t,i){Da(this,dt(this,e),t&&dt(this,t),i)}),extendSelections:$n(function(e,t){Oa(this,_t(this,e),t)}),extendSelectionsBy:$n(function(e,t){Oa(this,_t(this,Y(this.sel.ranges,e)),t)}),setSelections:$n(function(e,t,i){if(e.length){for(var n=[],a=0;a<e.length;a++)n[a]=new fa(dt(this,e[a].anchor),dt(this,e[a].head||e[a].anchor));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Wa(this,ha(this.cm,n,t),i)}}),addSelection:$n(function(e,t,i){var n=this.sel.ranges.slice(0);n.push(new fa(dt(this,e),dt(this,t||e))),Wa(this,ha(this.cm,n,n.length-1),i)}),getSelection:function(e){for(var t,i=this.sel.ranges,n=0;n<i.length;n++){var a=Ve(this,i[n].from(),i[n].to());t=t?t.concat(a):a}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],i=this.sel.ranges,n=0;n<i.length;n++){var a=Ve(this,i[n].from(),i[n].to());!1!==e&&(a=a.join(e||this.lineSeparator())),t[n]=a}return t},replaceSelection:function(e,t,i){for(var n=[],a=0;a<this.sel.ranges.length;a++)n[a]=e;this.replaceSelections(n,t,i||"+input")},replaceSelections:$n(function(e,t,i){for(var n=[],a=this.sel,r=0;r<a.ranges.length;r++){var l=a.ranges[r];n[r]={from:l.from(),to:l.to(),text:this.splitLines(e[r]),origin:i}}for(var d=t&&"end"!=t&&function(e,t,i){for(var n=[],a=et(e.first,0),r=a,l=0;l<t.length;l++){var d=t[l],_=wa(d.from,a,r),o=wa(ba(d),a,r);if(a=d.to,r=o,"around"==i){var s=e.sel.ranges[l],m=tt(s.head,s.anchor)<0;n[l]=new fa(m?o:_,m?_:o)}else n[l]=new fa(_,_)}return new pa(n,e.sel.primIndex)}(this,n,t),_=n.length-1;0<=_;_--)er(this,n[_]);d?Ra(this,d):this.cm&&jn(this.cm)}),undo:$n(function(){ir(this,"undo")}),redo:$n(function(){ir(this,"redo")}),undoSelection:$n(function(){ir(this,"undo",!0)}),redoSelection:$n(function(){ir(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var a=0;a<e.undone.length;a++)e.undone[a].ranges||++i;return{undo:t,redo:i}},clearHistory:function(){var t=this;this.history=new Ba(this.history),ja(this,function(e){return e.history=t.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Na(this.history.done),undone:Na(this.history.undone)}},setHistory:function(e){var t=this.history=new Ba(this.history);t.done=Na(e.done.slice(0),null,!0),t.undone=Na(e.undone.slice(0),null,!0)},setGutterMarker:$n(function(e,i,n){return or(this,e,"gutter",function(e){var t=e.gutterMarkers||(e.gutterMarkers={});return!(t[i]=n)&&ie(t)&&(e.gutterMarkers=null),!0})}),clearGutter:$n(function(t){var i=this;this.iter(function(e){e.gutterMarkers&&e.gutterMarkers[t]&&or(i,e,"gutter",function(){return e.gutterMarkers[t]=null,ie(e.gutterMarkers)&&(e.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!Ze(this,e))return null;if(!(e=Ue(this,t=e)))return null}else if(null==(t=Ye(e)))return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:$n(function(e,i,n){return or(this,e,"gutter"==i?"gutter":"class",function(e){var t="text"==i?"textClass":"background"==i?"bgClass":"gutter"==i?"gutterClass":"wrapClass";if(e[t]){if(A(n).test(e[t]))return!1;e[t]+=" "+n}else e[t]=n;return!0})}),removeLineClass:$n(function(e,r,l){return or(this,e,"gutter"==r?"gutter":"class",function(e){var t="text"==r?"textClass":"background"==r?"bgClass":"gutter"==r?"gutterClass":"wrapClass",i=e[t];if(!i)return!1;if(null==l)e[t]=null;else{var n=i.match(A(l));if(!n)return!1;var a=n.index+n[0].length;e[t]=i.slice(0,n.index)+(n.index&&a!=i.length?" ":"")+i.slice(a)||null}return!0})}),addLineWidget:$n(function(e,t,i){return a=e,r=new ur(n=this,t,i),(l=n.cm)&&r.noHScroll&&(l.display.alignWidgets=!0),or(n,a,"widget",function(e){var t=e.widgets||(e.widgets=[]);if(null==r.insertAt?t.push(r):t.splice(Math.min(t.length,Math.max(0,r.insertAt)),0,r),r.line=e,l&&!Pt(n,e)){var i=Rt(e)<n.scrollTop;Ge(e,e.height+yi(r)),i&&kn(l,r.height),l.curOp.forceUpdate=!0}return!0}),l&&li(l,"lineWidgetAdded",l,r,"number"==typeof a?a:Ye(a)),r;var n,a,r,l}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return hr(this,dt(this,e),dt(this,t),i,i&&i.type||"range")},setBookmark:function(e,t){var i={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return hr(this,e=dt(this,e),e,i,"bookmark")},findMarksAt:function(e){var t=[],i=Ue(this,(e=dt(this,e)).line).markedSpans;if(i)for(var n=0;n<i.length;++n){var a=i[n];(null==a.from||a.from<=e.ch)&&(null==a.to||a.to>=e.ch)&&t.push(a.marker.parent||a.marker)}return t},findMarks:function(a,r,l){a=dt(this,a),r=dt(this,r);var d=[],_=a.line;return this.iter(a.line,r.line+1,function(e){var t=e.markedSpans;if(t)for(var i=0;i<t.length;i++){var n=t[i];null!=n.to&&_==a.line&&a.ch>=n.to||null==n.from&&_!=a.line||null!=n.from&&_==r.line&&n.from>=r.ch||l&&!l(n.marker)||d.push(n.marker.parent||n.marker)}++_}),d},getAllMarks:function(){var n=[];return this.iter(function(e){var t=e.markedSpans;if(t)for(var i=0;i<t.length;++i)null!=t[i].from&&n.push(t[i].marker)}),n},posFromIndex:function(i){var n,a=this.first,r=this.lineSeparator().length;return this.iter(function(e){var t=e.text.length+r;if(i<t)return n=i,!0;i-=t,++a}),dt(this,et(a,n))},indexFromPos:function(e){var t=(e=dt(this,e)).ch;if(e.line<this.first||e.ch<0)return 0;var i=this.lineSeparator().length;return this.iter(this.first,e.line,function(e){t+=e.text.length+i}),t},copy:function(e){var t=new wr($e(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,i=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<i&&(i=e.to);var n=new wr($e(this,t,i),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],function(e,t){for(var i=0;i<t.length;i++){var n=t[i],a=n.find(),r=e.clipPos(a.from),l=e.clipPos(a.to);if(tt(r,l)){var d=hr(e,r,l,n.primary,n.primary.type);n.markers.push(d),d.parent=n}}}(n,br(this)),n},unlinkDoc:function(e){if(e instanceof hl&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t)if(this.linked[t].doc==e){this.linked.splice(t,1),e.unlinkDoc(this),vr(br(this));break}if(e.history==this.history){var i=[e.id];ja(e,function(e){return i.push(e.id)},!0),e.history=new Ba(null),e.history.done=Na(this.history.done,i),e.history.undone=Na(this.history.undone,i)}},iterLinkedDocs:function(e){ja(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Me(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:$n(function(e){var t;"rtl"!=e&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter(function(e){return e.order=null}),this.cm&&Kn(t=this.cm,function(){Ia(t),ln(t)}))})}),wr.prototype.eachLine=wr.prototype.iter;var Er=0;function Ar(e){var n=this;if(xr(n),!he(n,e)&&!bi(n.display,e)){ge(e),x&&(Er=+new Date);var t=an(n,e,!0),i=e.dataTransfer.files;if(t&&!n.isReadOnly())if(i&&i.length&&window.FileReader&&window.File)for(var a=i.length,r=Array(a),l=0,d=function(){++l==a&&Un(n,function(){var e={from:t=dt(n.doc,t),to:t,text:n.doc.splitLines(r.filter(function(e){return null!=e}).join(n.doc.lineSeparator())),origin:"paste"};er(n.doc,e),Ra(n.doc,ya(dt(n.doc,t),dt(n.doc,ba(e))))})()},_=function(e,t){if(n.options.allowDropFileTypes&&-1==O(n.options.allowDropFileTypes,e.type))d();else{var i=new FileReader;i.onerror=function(){return d()},i.onload=function(){var e=i.result;/[\x00-\x08\x0e-\x1f]{2}/.test(e)||(r[t]=e),d()},i.readAsText(e)}},o=0;o<i.length;o++)_(i[o],o);else{if(n.state.draggingText&&-1<n.doc.sel.contains(t))return n.state.draggingText(e),void setTimeout(function(){return n.display.input.focus()},20);try{var s=e.dataTransfer.getData("Text");if(s){var m;if(n.state.draggingText&&!n.state.draggingText.copy&&(m=n.listSelections()),Ka(n.doc,ya(t,t)),m)for(var u=0;u<m.length;++u)rr(n.doc,"",m[u].anchor,m[u].head,"drag");n.replaceSelection(s,"around","paste"),n.display.input.focus()}}catch(e){}}}}function xr(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function kr(t){if(document.getElementsByClassName){for(var e=document.getElementsByClassName("CodeMirror"),i=[],n=0;n<e.length;n++){var a=e[n].CodeMirror;a&&i.push(a)}i.length&&i[0].operation(function(){for(var e=0;e<i.length;e++)t(i[e])})}}var jr=!1;function Cr(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Ir={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Br=0;Br<10;Br++)Ir[Br+48]=Ir[Br+96]=String(Br);for(var Qr=65;Qr<=90;Qr++)Ir[Qr]=String.fromCharCode(Qr);for(var Tr=1;Tr<=12;Tr++)Ir[Tr+111]=Ir[Tr+63235]="F"+Tr;var Mr={};function Lr(e){var t,i,n,a,r=e.split(/-(?!$)/);e=r[r.length-1];for(var l=0;l<r.length-1;l++){var d=r[l];if(/^(cmd|meta|m)$/i.test(d))a=!0;else if(/^a(lt)?$/i.test(d))t=!0;else if(/^(c|ctrl|control)$/i.test(d))i=!0;else{if(!/^s(hift)?$/i.test(d))throw new Error("Unrecognized modifier name: "+d);n=!0}}return t&&(e="Alt-"+e),i&&(e="Ctrl-"+e),a&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function zr(e){var t={};for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];if(/^(name|fallthrough|(de|at)tach)$/.test(i))continue;if("..."==n){delete e[i];continue}for(var a=Y(i.split(" "),Lr),r=0;r<a.length;r++){var l=void 0,d=void 0;l=r==a.length-1?(d=a.join(" "),n):(d=a.slice(0,r+1).join(" "),"...");var _=t[d];if(_){if(_!=l)throw new Error("Inconsistent bindings for "+d)}else t[d]=l}delete e[i]}for(var o in t)e[o]=t[o];return e}function qr(e,t,i,n){var a=(t=Dr(t)).call?t.call(e,n):t[e];if(!1===a)return"nothing";if("..."===a)return"multi";if(null!=a&&i(a))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return qr(e,t.fallthrough,i,n);for(var r=0;r<t.fallthrough.length;r++){var l=qr(e,t.fallthrough[r],i,n);if(l)return l}}}function Sr(e){var t="string"==typeof e?e:Ir[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function Nr(e,t,i){var n=e;return t.altKey&&"Alt"!=n&&(e="Alt-"+e),(p?t.metaKey:t.ctrlKey)&&"Ctrl"!=n&&(e="Ctrl-"+e),(p?t.ctrlKey:t.metaKey)&&"Mod"!=n&&(e="Cmd-"+e),!i&&t.shiftKey&&"Shift"!=n&&(e="Shift-"+e),e}function Hr(e,t){if(y&&34==e.keyCode&&e.char)return!1;var i=Ir[e.keyCode];return null!=i&&!e.altGraphKey&&(3==e.keyCode&&e.code&&(i=e.code),Nr(i,e,t))}function Dr(e){return"string"==typeof e?Mr[e]:e}function Or(t,e){for(var i=t.doc.sel.ranges,n=[],a=0;a<i.length;a++){for(var r=e(i[a]);n.length&&tt(r.from,G(n).to)<=0;){var l=n.pop();if(tt(l.from,r.from)<0){r.from=l.from;break}}n.push(r)}Kn(t,function(){for(var e=n.length-1;0<=e;e--)rr(t.doc,"",n[e].from,n[e].to,"+delete");jn(t)})}function Pr(e,t,i){var n=re(e.text,t+i,i);return n<0||n>e.text.length?null:n}function Fr(e,t,i){var n=Pr(e,t.ch,i);return null==n?null:new et(t.line,n,i<0?"after":"before")}function Rr(e,t,i,n,a){if(e){"rtl"==t.doc.direction&&(a=-a);var r=se(i,t.doc.direction);if(r){var l,d=a<0?G(r):r[0],_=a<0==(1==d.level)?"after":"before";if(0<d.level||"rtl"==t.doc.direction){var o=Ii(t,i);l=a<0?i.text.length-1:0;var s=Bi(t,o,l).top;l=le(function(e){return Bi(t,o,e).top==s},a<0==(1==d.level)?d.from:d.to-1,l),"before"==_&&(l=Pr(i,l,1))}else l=a<0?d.to:d.from;return new et(n,l,_)}}return new et(n,a<0?i.text.length:0,a<0?"before":"after")}Mr.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Mr.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Mr.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Mr.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Mr.default=g?Mr.macDefault:Mr.pcDefault;var Wr={selectAll:Za,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),R)},killLine:function(i){return Or(i,function(e){if(e.empty()){var t=Ue(i.doc,e.head.line).text.length;return e.head.ch==t&&e.head.line<i.lastLine()?{from:e.head,to:et(e.head.line+1,0)}:{from:e.head,to:et(e.head.line,t)}}return{from:e.from(),to:e.to()}})},deleteLine:function(t){return Or(t,function(e){return{from:et(e.from().line,0),to:dt(t.doc,et(e.to().line+1,0))}})},delLineLeft:function(e){return Or(e,function(e){return{from:et(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(i){return Or(i,function(e){var t=i.charCoords(e.head,"div").top+5;return{from:i.coordsChar({left:0,top:t},"div"),to:e.from()}})},delWrappedLineRight:function(n){return Or(n,function(e){var t=n.charCoords(e.head,"div").top+5,i=n.coordsChar({left:n.display.lineDiv.offsetWidth+100,top:t},"div");return{from:e.from(),to:i}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(et(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(et(e.lastLine()))},goLineStart:function(t){return t.extendSelectionsBy(function(e){return Kr(t,e.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(t){return t.extendSelectionsBy(function(e){return Ur(t,e.head)},{origin:"+move",bias:1})},goLineEnd:function(r){return r.extendSelectionsBy(function(e){return t=r,i=e.head.line,n=Ue(t.doc,i),(a=function(e){for(var t;t=qt(e);)e=t.find(1,!0).line;return e}(n))!=n&&(i=Ye(a)),Rr(!0,t,n,i,-1);var t,i,n,a},{origin:"+move",bias:-1})},goLineRight:function(i){return i.extendSelectionsBy(function(e){var t=i.cursorCoords(e.head,"div").top+5;return i.coordsChar({left:i.display.lineDiv.offsetWidth+100,top:t},"div")},K)},goLineLeft:function(i){return i.extendSelectionsBy(function(e){var t=i.cursorCoords(e.head,"div").top+5;return i.coordsChar({left:0,top:t},"div")},K)},goLineLeftSmart:function(n){return n.extendSelectionsBy(function(e){var t=n.cursorCoords(e.head,"div").top+5,i=n.coordsChar({left:0,top:t},"div");return i.ch<n.getLine(i.line).search(/\S/)?Ur(n,e.head):i},K)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],i=e.listSelections(),n=e.options.tabSize,a=0;a<i.length;a++){var r=i[a].from(),l=H(e.getLine(r.line),r.ch,n);t.push($(n-l%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(l){return Kn(l,function(){for(var e=l.listSelections(),t=[],i=0;i<e.length;i++)if(e[i].empty()){var n=e[i].head,a=Ue(l.doc,n.line).text;if(a)if(n.ch==a.length&&(n=new et(n.line,n.ch-1)),0<n.ch)n=new et(n.line,n.ch+1),l.replaceRange(a.charAt(n.ch-1)+a.charAt(n.ch-2),et(n.line,n.ch-2),n,"+transpose");else if(n.line>l.doc.first){var r=Ue(l.doc,n.line-1).text;r&&(n=new et(n.line,1),l.replaceRange(a.charAt(0)+l.doc.lineSeparator()+r.charAt(r.length-1),et(n.line-1,r.length-1),n,"+transpose"))}t.push(new fa(n,n))}l.setSelections(t)})},newlineAndIndent:function(n){return Kn(n,function(){for(var e=n.listSelections(),t=e.length-1;0<=t;t--)n.replaceRange(n.doc.lineSeparator(),e[t].anchor,e[t].head,"+input");e=n.listSelections();for(var i=0;i<e.length;i++)n.indentLine(e[i].from().line,null,!0);jn(n)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Kr(e,t){var i=Ue(e.doc,t),n=Ht(i);return n!=i&&(t=Ye(n)),Rr(!0,e,n,t,1)}function Ur(e,t){var i=Kr(e,t.line),n=Ue(e.doc,i.line),a=se(n,e.doc.direction);if(a&&0!=a[0].level)return i;var r=Math.max(i.ch,n.text.search(/\S/)),l=t.line==i.line&&t.ch<=r&&t.ch;return et(i.line,l?0:r,i.sticky)}function Vr(e,t,i){if("string"==typeof t&&!(t=Wr[t]))return!1;e.display.input.ensurePolled();var n=e.display.shift,a=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),i&&(e.display.shift=!1),a=t(e)!=F}finally{e.display.shift=n,e.state.suppressEdits=!1}return a}var $r=new D;function Gr(e,t,i,n){var a=e.state.keySeq;if(a){if(Sr(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:$r.set(50,function(){e.state.keySeq==a&&(e.state.keySeq=null,e.display.input.reset())}),Yr(e,a+" "+t,i,n))return!0}return Yr(e,t,i,n)}function Yr(e,t,i,n){var a=function(e,t,i){for(var n=0;n<e.state.keyMaps.length;n++){var a=qr(t,e.state.keyMaps[n],i,e);if(a)return a}return e.options.extraKeys&&qr(t,e.options.extraKeys,i,e)||qr(t,e.options.keyMap,i,e)}(e,t,n);return"multi"==a&&(e.state.keySeq=t),"handled"==a&&li(e,"keyHandled",e,t,i),"handled"!=a&&"multi"!=a||(ge(i),hn(e)),!!a}function Xr(t,e){var i=Hr(e,!0);return!!i&&(e.shiftKey&&!t.state.keySeq?Gr(t,"Shift-"+i,e,function(e){return Vr(t,e,!0)})||Gr(t,i,e,function(e){if("string"==typeof e?/^go[A-Z]/.test(e):e.motion)return Vr(t,e)}):Gr(t,i,e,function(e){return Vr(t,e)}))}var Zr=null;function Jr(e){var n=this;if(!(e.target&&e.target!=this.display.input.getField()||(this.curOp.focus=M(),he(this,e)))){x&&w<11&&27==e.keyCode&&(e.returnValue=!1);var t=e.keyCode;this.display.shift=16==t||e.shiftKey;var i=Xr(this,e);y&&(Zr=i?t:null,!i&&88==t&&!ze&&(g?e.metaKey:e.ctrlKey)&&this.replaceSelection("",null,"cut")),h&&!g&&!i&&46==t&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),18!=t||/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)||function(e){var t=n.display.lineDiv;function i(e){18!=e.keyCode&&e.altKey||(j(t,"CodeMirror-crosshair"),pe(document,"keyup",i),pe(document,"mouseover",i))}L(t,"CodeMirror-crosshair"),ue(document,"keyup",i),ue(document,"mouseover",i)}()}}function el(e){16==e.keyCode&&(this.doc.sel.shift=!1),he(this,e)}function tl(e){var t;if(!(e.target&&e.target!=this.display.input.getField()||bi(this.display,e)||he(this,e)||e.ctrlKey&&!e.altKey||g&&e.metaKey)){var i=e.keyCode,n=e.charCode;if(y&&i==Zr)return Zr=null,void ge(e);if(!y||e.which&&!(e.which<10)||!Xr(this,e)){var a=String.fromCharCode(null==n?i:n);"\b"!=a&&(Gr(t=this,"'"+a+"'",e,function(e){return Vr(t,e,!0)})||this.display.input.onKeyPress(e))}}}var il,nl,al=function(e,t,i){this.time=e,this.pos=t,this.button=i};function rl(e){var i,n,t,a,r,l,d,_=this,o=_.display;if(!(he(_,e)||o.activeTouch&&o.input.supportsTouch()))if(o.input.ensurePolled(),o.shift=e.shiftKey,bi(o,e))v||(o.scroller.draggable=!1,setTimeout(function(){return o.scroller.draggable=!0},100));else if(!_l(_,e)){var s=an(_,e),m=ke(e),u=s?(r=s,l=m,d=+new Date,nl&&nl.compare(d,r,l)?(il=nl=null,"triple"):il&&il.compare(d,r,l)?(nl=new al(d,r,l),il=null,"double"):(il=new al(d,r,l),nl=null,"single")):"single";window.focus(),1==m&&_.state.selectingText&&_.state.selectingText(e),s&&(n=s,a="Click","double"==u?a="Double"+a:"triple"==u&&(a="Triple"+a),Gr(i=_,Nr(a=(1==m?"Left":2==m?"Middle":"Right")+a,t=e),t,function(e){if("string"==typeof e&&(e=Wr[e]),!e)return!1;var t=!1;try{i.isReadOnly()&&(i.state.suppressEdits=!0),t=e(i,n)!=F}finally{i.state.suppressEdits=!1}return t}))||(1==m?s?function(e,t,i,n){x?setTimeout(S(yn,e),0):e.curOp.focus=M();var a,r,l,d,_,o,s,m,u,c,p=function(e,t,i){var n=e.getOption("configureMouse"),a=n?n(e,t,i):{};if(null==a.unit){var r=E?i.shiftKey&&i.metaKey:i.altKey;a.unit=r?"rectangle":"single"==t?"char":"double"==t?"word":"line"}return(null==a.extend||e.doc.extend)&&(a.extend=e.doc.extend||i.shiftKey),null==a.addNew&&(a.addNew=g?i.metaKey:i.ctrlKey),null==a.moveOnDrag&&(a.moveOnDrag=!(g?i.altKey:i.ctrlKey)),a}(e,i,n),f=e.doc.sel;e.options.dragDrop&&Ie&&!e.isReadOnly()&&"single"==i&&-1<(a=f.contains(t))&&(tt((a=f.ranges[a]).from(),t)<0||0<t.xRel)&&(0<tt(a.to(),t)||t.xRel<0)?(l=n,d=t,_=p,o=(r=e).display,s=!1,m=Un(r,function(e){v&&(o.scroller.draggable=!1),r.state.draggingText=!1,r.state.delayingBlurEvent&&(r.hasFocus()?r.state.delayingBlurEvent=!1:bn(r)),pe(o.wrapper.ownerDocument,"mouseup",m),pe(o.wrapper.ownerDocument,"mousemove",u),pe(o.scroller,"dragstart",c),pe(o.scroller,"drop",m),s||(ge(e),_.addNew||Da(r.doc,d,null,null,_.extend),v&&!b||x&&9==w?setTimeout(function(){o.wrapper.ownerDocument.body.focus({preventScroll:!0}),o.input.focus()},20):o.input.focus())}),u=function(e){s=s||10<=Math.abs(l.clientX-e.clientX)+Math.abs(l.clientY-e.clientY)},c=function(){return s=!0},v&&(o.scroller.draggable=!0),(r.state.draggingText=m).copy=!_.moveOnDrag,ue(o.wrapper.ownerDocument,"mouseup",m),ue(o.wrapper.ownerDocument,"mousemove",u),ue(o.scroller,"dragstart",c),ue(o.scroller,"drop",m),r.state.delayingBlurEvent=!0,setTimeout(function(){return o.input.focus()},20),o.scroller.dragDrop&&o.scroller.dragDrop()):function(h,e,y,b){x&&bn(h);var l=h.display,v=h.doc;ge(e);var g,w,E=v.sel,t=E.ranges;if(b.addNew&&!b.extend?(w=v.sel.contains(y),g=-1<w?t[w]:new fa(y,y)):(g=v.sel.primary(),w=v.sel.primIndex),"rectangle"==b.unit)b.addNew||(g=new fa(y,y)),y=an(h,e,!0,!0),w=-1;else{var i=ll(h,y,b.unit);g=b.extend?Ha(g,i.anchor,i.head,b.extend):i}b.addNew?-1==w?(w=t.length,Wa(v,ha(h,t.concat([g]),w),{scroll:!1,origin:"*mouse"})):1<t.length&&t[w].empty()&&"char"==b.unit&&!b.extend?(Wa(v,ha(h,t.slice(0,w).concat(t.slice(w+1)),0),{scroll:!1,origin:"*mouse"}),E=v.sel):Pa(v,w,g,W):(Wa(v,new pa([g],w=0),W),E=v.sel);var A=y;var d=l.wrapper.getBoundingClientRect(),_=0;function n(e){h.state.selectingText=!1,_=1/0,e&&(ge(e),l.input.focus()),pe(l.wrapper.ownerDocument,"mousemove",a),pe(l.wrapper.ownerDocument,"mouseup",r),v.history.lastSelOrigin=null}var a=Un(h,function(e){0!==e.buttons&&ke(e)?function e(t){var i=++_,n=an(h,t,!0,"rectangle"==b.unit);if(n)if(0!=tt(n,A)){h.curOp.focus=M(),function(e){if(0!=tt(A,e))if(A=e,"rectangle"==b.unit){for(var t=[],i=h.options.tabSize,n=H(Ue(v,y.line).text,y.ch,i),a=H(Ue(v,e.line).text,e.ch,i),r=Math.min(n,a),l=Math.max(n,a),d=Math.min(y.line,e.line),_=Math.min(h.lastLine(),Math.max(y.line,e.line));d<=_;d++){var o=Ue(v,d).text,s=U(o,r,i);r==l?t.push(new fa(et(d,s),et(d,s))):o.length>s&&t.push(new fa(et(d,s),et(d,U(o,l,i))))}t.length||t.push(new fa(y,y)),Wa(v,ha(h,E.ranges.slice(0,w).concat(t),w),{origin:"*mouse",scroll:!1}),h.scrollIntoView(e)}else{var m,u=g,c=ll(h,e,b.unit),p=u.anchor;p=0<tt(c.anchor,p)?(m=c.head,rt(u.from(),c.anchor)):(m=c.anchor,at(u.to(),c.head));var f=E.ranges.slice(0);f[w]=function(e,t){var i=t.anchor,n=t.head,a=Ue(e.doc,i.line);if(0==tt(i,n)&&i.sticky==n.sticky)return t;var r=se(a);if(!r)return t;var l=_e(r,i.ch,i.sticky),d=r[l];if(d.from!=i.ch&&d.to!=i.ch)return t;var _,o=l+(d.from==i.ch==(1!=d.level)?0:1);if(0==o||o==r.length)return t;if(n.line!=i.line)_=0<(n.line-i.line)*("ltr"==e.doc.direction?1:-1);else{var s=_e(r,n.ch,n.sticky),m=s-l||(n.ch-i.ch)*(1==d.level?-1:1);_=s==o-1||s==o?m<0:0<m}var u=r[o+(_?-1:0)],c=_==(1==u.level),p=c?u.from:u.to,f=c?"after":"before";return i.ch==p&&i.sticky==f?t:new fa(new et(i.line,p,f),n)}(h,new fa(dt(v,p),m)),Wa(v,ha(h,f,w),W)}}(n);var a=An(l,v);(n.line>=a.to||n.line<a.from)&&setTimeout(Un(h,function(){_==i&&e(t)}),150)}else{var r=t.clientY<d.top?-20:t.clientY>d.bottom?20:0;r&&setTimeout(Un(h,function(){_==i&&(l.scroller.scrollTop+=r,e(t))}),50)}}(e):n(e)}),r=Un(h,n);h.state.selectingText=r,ue(l.wrapper.ownerDocument,"mousemove",a),ue(l.wrapper.ownerDocument,"mouseup",r)}(e,n,t,p)}(_,s,u,e):xe(e)==o.scroller&&ge(e):2==m?(s&&Da(_.doc,s),setTimeout(function(){return o.input.focus()},20)):3==m&&(f?_.display.input.onContextMenu(e):bn(_)))}}function ll(e,t,i){if("char"==i)return new fa(t,t);if("word"==i)return e.findWordAt(t);if("line"==i)return new fa(et(t.line,0),dt(e.doc,et(t.line+1,0)));var n=i(e,t);return new fa(n.from,n.to)}function dl(e,t,i,n){var a,r;if(t.touches)a=t.touches[0].clientX,r=t.touches[0].clientY;else try{a=t.clientX,r=t.clientY}catch(e){return!1}if(a>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&ge(t);var l=e.display,d=l.lineDiv.getBoundingClientRect();if(r>d.bottom||!be(e,i))return Ee(t);r-=d.top-l.viewOffset;for(var _=0;_<e.display.gutterSpecs.length;++_){var o=l.gutters.childNodes[_];if(o&&o.getBoundingClientRect().right>=a)return fe(e,i,e,Xe(e.doc,r),e.display.gutterSpecs[_].className,t),Ee(t)}}function _l(e,t){return dl(e,t,"gutterClick",!0)}function ol(e,t){var i,n;bi(e.display,t)||(n=t,be(i=e,"gutterContextMenu")&&dl(i,n,"gutterContextMenu",!1))||he(e,t,"contextmenu")||f||e.display.input.onContextMenu(t)}function sl(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Si(e)}al.prototype.compare=function(e,t,i){return this.time+400>e&&0==tt(t,this.pos)&&i==this.button};var ml={toString:function(){return"CodeMirror.Init"}},ul={},cl={};function pl(e,t,i){if(!t!=!(i&&i!=ml)){var n=e.display.dragFunctions,a=t?ue:pe;a(e.display.scroller,"dragstart",n.start),a(e.display.scroller,"dragenter",n.enter),a(e.display.scroller,"dragover",n.over),a(e.display.scroller,"dragleave",n.leave),a(e.display.scroller,"drop",n.drop)}}function fl(e){e.options.lineWrapping?(L(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(j(e.display.wrapper,"CodeMirror-wrap"),Kt(e)),nn(e),ln(e),Si(e),setTimeout(function(){return Sn(e)},100)}function hl(e,t){var i=this;if(!(this instanceof hl))return new hl(e,t);this.options=t=t?N(t):{},N(ul,t,!1);var n=t.value;"string"==typeof n?n=new wr(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var a=new hl.inputStyles[t.inputStyle](this),r=this.display=new _a(e,n,a,t);for(var l in sl(r.wrapper.CodeMirror=this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Dn(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new D,keySeq:null,specialChars:null},t.autofocus&&!m&&r.input.focus(),x&&w<11&&setTimeout(function(){return i.display.input.reset(!0)},20),function(r){var a=r.display;ue(a.scroller,"mousedown",Un(r,rl)),ue(a.scroller,"dblclick",x&&w<11?Un(r,function(e){if(!he(r,e)){var t=an(r,e);if(t&&!_l(r,e)&&!bi(r.display,e)){ge(e);var i=r.findWordAt(t);Da(r.doc,i.anchor,i.head)}}}):function(e){return he(r,e)||ge(e)}),ue(a.scroller,"contextmenu",function(e){return ol(r,e)}),ue(a.input.getField(),"contextmenu",function(e){a.scroller.contains(e.target)||ol(r,e)});var i,n={end:0};function l(){a.activeTouch&&(i=setTimeout(function(){return a.activeTouch=null},1e3),(n=a.activeTouch).end=+new Date)}function d(e,t){if(null==t.left)return!0;var i=t.left-e.left,n=t.top-e.top;return 400<i*i+n*n}ue(a.scroller,"touchstart",function(e){if(!he(r,e)&&!function(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(e)&&!_l(r,e)){a.input.ensurePolled(),clearTimeout(i);var t=+new Date;a.activeTouch={start:t,moved:!1,prev:t-n.end<=300?n:null},1==e.touches.length&&(a.activeTouch.left=e.touches[0].pageX,a.activeTouch.top=e.touches[0].pageY)}}),ue(a.scroller,"touchmove",function(){a.activeTouch&&(a.activeTouch.moved=!0)}),ue(a.scroller,"touchend",function(e){var t=a.activeTouch;if(t&&!bi(a,e)&&null!=t.left&&!t.moved&&new Date-t.start<300){var i,n=r.coordsChar(a.activeTouch,"page");i=!t.prev||d(t,t.prev)?new fa(n,n):!t.prev.prev||d(t,t.prev.prev)?r.findWordAt(n):new fa(et(n.line,0),dt(r.doc,et(n.line+1,0))),r.setSelection(i.anchor,i.head),r.focus(),ge(e)}l()}),ue(a.scroller,"touchcancel",l),ue(a.scroller,"scroll",function(){a.scroller.clientHeight&&(Qn(r,a.scroller.scrollTop),Mn(r,a.scroller.scrollLeft,!0),fe(r,"scroll",r))}),ue(a.scroller,"mousewheel",function(e){return ca(r,e)}),ue(a.scroller,"DOMMouseScroll",function(e){return ca(r,e)}),ue(a.wrapper,"scroll",function(){return a.wrapper.scrollTop=a.wrapper.scrollLeft=0}),a.dragFunctions={enter:function(e){he(r,e)||Ae(e)},over:function(a){he(r,a)||(function(e,t){var i=an(e,a);if(i){var n=document.createDocumentFragment();cn(e,i,n),e.display.dragCursor||(e.display.dragCursor=Q("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),I(e.display.dragCursor,n)}}(r),Ae(a))},start:function(e){return function(e,t){if(x&&(!e.state.draggingText||+new Date-Er<100))Ae(t);else if(!he(e,t)&&!bi(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!b)){var i=Q("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",y&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),y&&i.parentNode.removeChild(i)}}(r,e)},drop:Un(r,Ar),leave:function(e){he(r,e)||xr(r)}};var e=a.input.getField();ue(e,"keyup",function(e){return el.call(r,e)}),ue(e,"keydown",Un(r,Jr)),ue(e,"keypress",Un(r,tl)),ue(e,"focus",function(e){return vn(r,e)}),ue(e,"blur",function(e){return gn(r,e)})}(this),function(){var e;jr||(ue(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,kr(Cr)},100))}),ue(window,"blur",function(){return kr(gn)}),jr=!0)}(),Pn(this),this.curOp.forceUpdate=!0,Ca(this,n),t.autofocus&&!m||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&vn(i)},20):gn(this),cl)cl.hasOwnProperty(l)&&cl[l](this,t[l],ml);aa(this),t.finishInit&&t.finishInit(this);for(var d=0;d<yl.length;++d)yl[d](this);Fn(this),v&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(r.lineDiv).textRendering&&(r.lineDiv.style.textRendering="auto")}hl.defaults=ul,hl.optionHandlers=cl;var yl=[];function bl(e,t,i,n){var a,r=e.doc;null==i&&(i="add"),"smart"==i&&(r.mode.indent?a=ct(e,t).state:i="prev");var l=e.options.tabSize,d=Ue(r,t),_=H(d.text,null,l);d.stateAfter&&(d.stateAfter=null);var o,s=d.text.match(/^\s*/)[0];if(n||/\S/.test(d.text)){if("smart"==i&&((o=r.mode.indent(a,d.text.slice(s.length),d.text))==F||150<o)){if(!n)return;i="prev"}}else o=0,i="not";"prev"==i?o=t>r.first?H(Ue(r,t-1).text,null,l):0:"add"==i?o=_+e.options.indentUnit:"subtract"==i?o=_-e.options.indentUnit:"number"==typeof i&&(o=_+i),o=Math.max(0,o);var m="",u=0;if(e.options.indentWithTabs)for(var c=Math.floor(o/l);c;--c)u+=l,m+="\t";if(u<o&&(m+=$(o-u)),m!=s)return rr(r,m,et(t,0),et(t,s.length),"+input"),!(d.stateAfter=null);for(var p=0;p<r.sel.ranges.length;p++){var f=r.sel.ranges[p];if(f.head.line==t&&f.head.ch<s.length){var h=et(t,s.length);Pa(r,p,new fa(h,h));break}}}hl.defineInitHook=function(e){return yl.push(e)};var vl=null;function gl(e){vl=e}function wl(e,t,i,n,a){var r=e.doc;e.display.shift=!1,n||(n=r.sel);var l=+new Date-200,d="paste"==a||e.state.pasteIncoming>l,_=Me(t),o=null;if(d&&1<n.ranges.length)if(vl&&vl.text.join("\n")==t){if(n.ranges.length%vl.text.length==0){o=[];for(var s=0;s<vl.text.length;s++)o.push(r.splitLines(vl.text[s]))}}else _.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(o=Y(_,function(e){return[e]}));for(var m=e.curOp.updateInput,u=n.ranges.length-1;0<=u;u--){var c=n.ranges[u],p=c.from(),f=c.to();c.empty()&&(i&&0<i?p=et(p.line,p.ch-i):e.state.overwrite&&!d?f=et(f.line,Math.min(Ue(r,f.line).text.length,f.ch+G(_).length)):d&&vl&&vl.lineWise&&vl.text.join("\n")==_.join("\n")&&(p=f=et(p.line,0)));var h={from:p,to:f,text:o?o[u%o.length]:_,origin:a||(d?"paste":e.state.cutIncoming>l?"cut":"+input")};er(e.doc,h),li(e,"inputRead",e,h)}t&&!d&&Al(e,t),jn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=m),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function El(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Kn(t,function(){return wl(t,i,0,null,"paste")}),!0}function Al(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var i=e.doc.sel,n=i.ranges.length-1;0<=n;n--){var a=i.ranges[n];if(!(100<a.head.ch||n&&i.ranges[n-1].head.line==a.head.line)){var r=e.getModeAt(a.head),l=!1;if(r.electricChars){for(var d=0;d<r.electricChars.length;d++)if(-1<t.indexOf(r.electricChars.charAt(d))){l=bl(e,a.head.line,"smart");break}}else r.electricInput&&r.electricInput.test(Ue(e.doc,a.head.line).text.slice(0,a.head.ch))&&(l=bl(e,a.head.line,"smart"));l&&li(e,"electricInput",e,a.head.line)}}}function xl(e){for(var t=[],i=[],n=0;n<e.doc.sel.ranges.length;n++){var a=e.doc.sel.ranges[n].head.line,r={anchor:et(a,0),head:et(a+1,0)};i.push(r),t.push(e.getRange(r.anchor,r.head))}return{text:t,ranges:i}}function kl(e,t,i,n){e.setAttribute("autocorrect",i?"":"off"),e.setAttribute("autocapitalize",n?"":"off"),e.setAttribute("spellcheck",!!t)}function jl(){var e=Q("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),t=Q("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return v?e.style.width="1000px":e.setAttribute("wrap","off"),o&&(e.style.border="1px solid black"),kl(e),t}function Cl(r,l,d,_,o){var e=l,t=d,s=Ue(r,l.line),m=o&&"rtl"==r.direction?-d:d;function i(e){var t,i;if("codepoint"==_){var n=s.text.charCodeAt(l.ch+(0<d?0:-1));if(isNaN(n))t=null;else{var a=0<d?55296<=n&&n<56320:56320<=n&&n<57343;t=new et(l.line,Math.max(0,Math.min(s.text.length,l.ch+d*(a?2:1))),-d)}}else t=o?function(t,i,d,e){var _=se(i,t.doc.direction);if(!_)return Fr(i,d,e);d.ch>=i.text.length?(d.ch=i.text.length,d.sticky="before"):d.ch<=0&&(d.ch=0,d.sticky="after");var n=_e(_,d.ch,d.sticky),a=_[n];if("ltr"==t.doc.direction&&a.level%2==0&&(0<e?a.to>d.ch:a.from<d.ch))return Fr(i,d,e);var r,o=function(e,t){return Pr(i,e instanceof et?e.ch:e,t)},l=function(e){return t.options.lineWrapping?(r=r||Ii(t,i),$i(t,i,r,e)):{begin:0,end:i.text.length}},s=l("before"==d.sticky?o(d,-1):d.ch);if("rtl"==t.doc.direction||1==a.level){var m=1==a.level==e<0,u=o(d,m?1:-1);if(null!=u&&(m?u<=a.to&&u<=s.end:u>=a.from&&u>=s.begin)){var c=m?"before":"after";return new et(d.line,u,c)}}var p=function(e,t,i){for(var n=function(e,t){return t?new et(d.line,o(e,1),"before"):new et(d.line,e,"after")};0<=e&&e<_.length;e+=t){var a=_[e],r=0<t==(1!=a.level),l=r?i.begin:o(i.end,-1);if(a.from<=l&&l<a.to)return n(l,r);if(l=r?a.from:o(a.to,-1),i.begin<=l&&l<i.end)return n(l,r)}},f=p(n+e,e,s);if(f)return f;var h=0<e?s.end:o(s.begin,-1);return null==h||0<e&&h==i.text.length||!(f=p(0<e?0:_.length-1,e,l(h)))?null:f}(r.cm,s,l,d):Fr(s,l,d);if(null==t){if(e||(i=l.line+m)<r.first||i>=r.first+r.size||(l=new et(i,l.ch,l.sticky),!(s=Ue(r,i))))return!1;l=Rr(o,r.cm,s,l.line,m)}else l=t;return!0}if("char"==_||"codepoint"==_)i();else if("column"==_)i(!0);else if("word"==_||"group"==_)for(var n=null,a="group"==_,u=r.cm&&r.cm.getHelper(l,"wordChars"),c=!0;!(d<0)||i(!c);c=!1){var p=s.text.charAt(l.ch)||"\n",f=te(p,u)?"w":a&&"\n"==p?"n":!a||/\s/.test(p)?null:"p";if(!a||c||f||(f="s"),n&&n!=f){d<0&&(d=1,i(),l.sticky="after");break}if(f&&(n=f),0<d&&!i(!c))break}var h=Ya(r,l,e,t,!0);return it(e,h)&&(h.hitSide=!0),h}function Il(e,t,i,n){var a,r,l=e.doc,d=t.left;if("page"==n){var _=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),o=Math.max(_-.5*Xi(e.display),3);a=(0<i?t.bottom:t.top)+i*o}else"line"==n&&(a=0<i?t.bottom+3:t.top-3);for(;(r=Ui(e,d,a)).outside;){if(i<0?a<=0:a>=l.height){r.hitSide=!0;break}a+=5*i}return r}var Bl=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new D,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Ql(e,t){var i=Ci(e,t.line);if(!i||i.hidden)return null;var n=Ue(e.doc,t.line),a=ki(i,n,t.line),r=se(n,e.doc.direction),l="left";r&&(l=_e(r,t.ch)%2?"right":"left");var d=Mi(a.map,t.ch,l);return d.offset="right"==d.collapse?d.end:d.start,d}function Tl(e,t){return t&&(e.bad=!0),e}function Ml(e,t,i){var n;if(t==e.display.lineDiv){if(!(n=e.display.lineDiv.childNodes[i]))return Tl(e.clipPos(et(e.display.viewTo-1)),!0);t=null,i=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var a=0;a<e.display.view.length;a++){var r=e.display.view[a];if(r.node==n)return Ll(r,t,i)}}function Ll(o,e,t){var i=o.text.firstChild,n=!1;if(!e||!T(i,e))return Tl(et(Ye(o.line),0),!0);if(e==i&&(n=!0,e=i.childNodes[t],t=0,!e)){var a=o.rest?G(o.rest):o.line;return Tl(et(Ye(a),a.text.length),n)}var r=3==e.nodeType?e:null,l=e;for(r||1!=e.childNodes.length||3!=e.firstChild.nodeType||(r=e.firstChild,t&&(t=r.nodeValue.length));l.parentNode!=i;)l=l.parentNode;var s=o.measure,m=s.maps;function d(e,t,i){for(var n=-1;n<(m?m.length:0);n++)for(var a=n<0?s.map:m[n],r=0;r<a.length;r+=3){var l=a[r+2];if(l==e||l==t){var d=Ye(n<0?o.line:o.rest[n]),_=a[r]+i;return(i<0||l!=e)&&(_=a[r+(i?1:0)]),et(d,_)}}}var _=d(r,l,t);if(_)return Tl(_,n);for(var u=l.nextSibling,c=r?r.nodeValue.length-t:0;u;u=u.nextSibling){if(_=d(u,u.firstChild,0))return Tl(et(_.line,_.ch-c),n);c+=u.textContent.length}for(var p=l.previousSibling,f=t;p;p=p.previousSibling){if(_=d(p,p.firstChild,-1))return Tl(et(_.line,_.ch+f),n);f+=p.textContent.length}}Bl.prototype.init=function(e){var t=this,l=this,d=l.cm,_=l.div=e.lineDiv;function o(e){for(var t=e.target;t;t=t.parentNode){if(t==_)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(t.className))break}return!1}function i(e){if(o(e)&&!he(d,e)){if(d.somethingSelected())gl({lineWise:!1,text:d.getSelections()}),"cut"==e.type&&d.replaceSelection("",null,"cut");else{if(!d.options.lineWiseCopyCut)return;var t=xl(d);gl({lineWise:!0,text:t.text}),"cut"==e.type&&d.operation(function(){d.setSelections(t.ranges,0,R),d.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var i=vl.text.join("\n");if(e.clipboardData.setData("Text",i),e.clipboardData.getData("Text")==i)return void e.preventDefault()}var n=jl(),a=n.firstChild;d.display.lineSpace.insertBefore(n,d.display.lineSpace.firstChild),a.value=vl.text.join("\n");var r=M();q(a),setTimeout(function(){d.display.lineSpace.removeChild(n),r.focus(),r==_&&l.showPrimarySelection()},50)}}_.contentEditable=!0,kl(_,d.options.spellcheck,d.options.autocorrect,d.options.autocapitalize),ue(_,"paste",function(e){!o(e)||he(d,e)||El(e,d)||w<=11&&setTimeout(Un(d,function(){return t.updateFromDOM()}),20)}),ue(_,"compositionstart",function(e){t.composing={data:e.data,done:!1}}),ue(_,"compositionupdate",function(e){t.composing||(t.composing={data:e.data,done:!1})}),ue(_,"compositionend",function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ue(_,"touchstart",function(){return l.forceCompositionEnd()}),ue(_,"input",function(){t.composing||t.readFromDOMSoon()}),ue(_,"copy",i),ue(_,"cut",i)},Bl.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Bl.prototype.prepareSelection=function(){var e=un(this.cm,!1);return e.focus=M()==this.div,e},Bl.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Bl.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Bl.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),n=i.from(),a=i.to();if(t.display.viewTo==t.display.viewFrom||n.line>=t.display.viewTo||a.line<t.display.viewFrom)e.removeAllRanges();else{var r=Ml(t,e.anchorNode,e.anchorOffset),l=Ml(t,e.focusNode,e.focusOffset);if(!r||r.bad||!l||l.bad||0!=tt(rt(r,l),n)||0!=tt(at(r,l),a)){var d=t.display.view,_=n.line>=t.display.viewFrom&&Ql(t,n)||{node:d[0].measure.map[2],offset:0},o=a.line<t.display.viewTo&&Ql(t,a);if(!o){var s=d[d.length-1].measure,m=s.maps?s.maps[s.maps.length-1]:s.map;o={node:m[m.length-1],offset:m[m.length-2]-m[m.length-3]}}if(_&&o){var u,c=e.rangeCount&&e.getRangeAt(0);try{u=k(_.node,_.offset,o.offset,o.node)}catch(e){}u&&(!h&&t.state.focused?(e.collapse(_.node,_.offset),u.collapsed||(e.removeAllRanges(),e.addRange(u))):(e.removeAllRanges(),e.addRange(u)),c&&null==e.anchorNode?e.addRange(c):h&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},Bl.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},Bl.prototype.showMultipleSelections=function(e){I(this.cm.display.cursorDiv,e.cursors),I(this.cm.display.selectionDiv,e.selection)},Bl.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Bl.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return T(this.div,t)},Bl.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&M()==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())},Bl.prototype.blur=function(){this.div.blur()},Bl.prototype.getField=function(){return this.div},Bl.prototype.supportsTouch=function(){return!0},Bl.prototype.receivedFocus=function(){var e=this,t=this;this.selectionInEditor()?setTimeout(function(){return e.pollSelection()},20):Kn(this.cm,function(){return t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))})},Bl.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Bl.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var i=this.getSelection(),e=this.cm;if(s&&l&&this.cm.display.gutterSpecs.length&&function(e){for(var t=i.anchorNode;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}())return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var t=Ml(e,i.anchorNode,i.anchorOffset),n=Ml(e,i.focusNode,i.focusOffset);t&&n&&Kn(e,function(){Wa(e.doc,ya(t,n),R),(t.bad||n.bad)&&(e.curOp.selectionChanged=!0)})}}},Bl.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e,t,i,n=this.cm,a=n.display,r=n.doc.sel.primary(),l=r.from(),d=r.to();if(0==l.ch&&l.line>n.firstLine()&&(l=et(l.line-1,Ue(n.doc,l.line-1).length)),d.ch==Ue(n.doc,d.line).text.length&&d.line<n.lastLine()&&(d=et(d.line+1,0)),l.line<a.viewFrom||d.line>a.viewTo-1)return!1;i=l.line==a.viewFrom||0==(e=rn(n,l.line))?(t=Ye(a.view[0].line),a.view[0].node):(t=Ye(a.view[e].line),a.view[e-1].node.nextSibling);var _,o,s=rn(n,d.line);if(o=s==a.view.length-1?(_=a.viewTo-1,a.lineDiv.lastChild):(_=Ye(a.view[s+1].line)-1,a.view[s+1].node.previousSibling),!i)return!1;for(var m=n.doc.splitLines(function(_,e,t,o,s){var i="",m=!1,u=_.doc.lineSeparator(),c=!1;function p(){m&&(i+=u,c&&(i+=u),m=c=!1)}function f(e){e&&(p(),i+=e)}function h(e){if(1==e.nodeType){var t=e.getAttribute("cm-text");if(t)return void f(t);var i,n=e.getAttribute("cm-marker");if(n){var a=_.findMarks(et(o,0),et(s+1,0),(d=+n,function(e){return e.id==d}));return void(a.length&&(i=a[0].find(0))&&f(Ve(_.doc,i.from,i.to).join(u)))}if("false"==e.getAttribute("contenteditable"))return;var r=/^(pre|div|p|li|table|br)$/i.test(e.nodeName);if(!/^br$/i.test(e.nodeName)&&0==e.textContent.length)return;r&&p();for(var l=0;l<e.childNodes.length;l++)h(e.childNodes[l]);/^(pre|p)$/i.test(e.nodeName)&&(c=!0),r&&(m=!0)}else 3==e.nodeType&&f(e.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "));var d}for(;h(e),e!=t;)e=e.nextSibling,c=!1;return i}(n,i,o,t,_)),u=Ve(n.doc,et(t,0),et(_,Ue(n.doc,_).text.length));1<m.length&&1<u.length;)if(G(m)==G(u))m.pop(),u.pop(),_--;else{if(m[0]!=u[0])break;m.shift(),u.shift(),t++}for(var c=0,p=0,f=m[0],h=u[0],y=Math.min(f.length,h.length);c<y&&f.charCodeAt(c)==h.charCodeAt(c);)++c;for(var b=G(m),v=G(u),g=Math.min(b.length-(1==m.length?c:0),v.length-(1==u.length?c:0));p<g&&b.charCodeAt(b.length-p-1)==v.charCodeAt(v.length-p-1);)++p;if(1==m.length&&1==u.length&&t==l.line)for(;c&&c>l.ch&&b.charCodeAt(b.length-p-1)==v.charCodeAt(v.length-p-1);)c--,p++;m[m.length-1]=b.slice(0,b.length-p).replace(/^\u200b+/,""),m[0]=m[0].slice(c).replace(/\u200b+$/,"");var w=et(t,c),E=et(_,u.length?G(u).length-p:0);return 1<m.length||m[0]||tt(w,E)?(rr(n.doc,m,w,E,"+input"),!0):void 0},Bl.prototype.ensurePolled=function(){this.forceCompositionEnd()},Bl.prototype.reset=function(){this.forceCompositionEnd()},Bl.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Bl.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()},80))},Bl.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Kn(this.cm,function(){return ln(e.cm)})},Bl.prototype.setUneditable=function(e){e.contentEditable="false"},Bl.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Un(this.cm,wl)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Bl.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Bl.prototype.onContextMenu=function(){},Bl.prototype.resetPosition=function(){},Bl.prototype.needsContentAttribute=!0;var zl,ql,Sl,Nl=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new D,this.hasSelection=!1,this.composing=null};Nl.prototype.init=function(i){var e=this,n=this,a=this.cm;this.createField(i);var r=this.textarea;function t(e){if(!he(a,e)){if(a.somethingSelected())gl({lineWise:!1,text:a.getSelections()});else{if(!a.options.lineWiseCopyCut)return;var t=xl(a);gl({lineWise:!0,text:t.text}),"cut"==e.type?a.setSelections(t.ranges,null,R):(n.prevInput="",r.value=t.text.join("\n"),q(r))}"cut"==e.type&&(a.state.cutIncoming=+new Date)}}i.wrapper.insertBefore(this.wrapper,i.wrapper.firstChild),o&&(r.style.width="0px"),ue(r,"input",function(){x&&9<=w&&e.hasSelection&&(e.hasSelection=null),n.poll()}),ue(r,"paste",function(e){he(a,e)||El(e,a)||(a.state.pasteIncoming=+new Date,n.fastPoll())}),ue(r,"cut",t),ue(r,"copy",t),ue(i.scroller,"paste",function(e){if(!bi(i,e)&&!he(a,e)){if(!r.dispatchEvent)return a.state.pasteIncoming=+new Date,void n.focus();var t=new Event("paste");t.clipboardData=e.clipboardData,r.dispatchEvent(t)}}),ue(i.lineSpace,"selectstart",function(e){bi(i,e)||ge(e)}),ue(r,"compositionstart",function(){var e=a.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:a.markText(e,a.getCursor("to"),{className:"CodeMirror-composing"})}}),ue(r,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Nl.prototype.createField=function(e){this.wrapper=jl(),this.textarea=this.wrapper.firstChild},Nl.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Nl.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,n=un(e);if(e.options.moveInputWithCursor){var a=Ri(e,i.sel.primary().head,"div"),r=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,a.top+l.top-r.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,a.left+l.left-r.left))}return n},Nl.prototype.showSelection=function(e){var t=this.cm.display;I(t.cursorDiv,e.cursors),I(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Nl.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&q(this.textarea),x&&9<=w&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",x&&9<=w&&(this.hasSelection=null))}},Nl.prototype.getField=function(){return this.textarea},Nl.prototype.supportsTouch=function(){return!1},Nl.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!m||M()!=this.textarea))try{this.textarea.focus()}catch(e){}},Nl.prototype.blur=function(){this.textarea.blur()},Nl.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Nl.prototype.receivedFocus=function(){this.slowPoll()},Nl.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Nl.prototype.fastPoll=function(){var t=!1,i=this;i.pollingFast=!0,i.polling.set(20,function e(){i.poll()||t?(i.pollingFast=!1,i.slowPoll()):(t=!0,i.polling.set(60,e))})},Nl.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||Le(i)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var a=i.value;if(a==n&&!t.somethingSelected())return!1;if(x&&9<=w&&this.hasSelection===a||g&&/[\uf700-\uf7ff]/.test(a))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var r=a.charCodeAt(0);if(8203!=r||n||(n="​"),8666==r)return this.reset(),this.cm.execCommand("undo")}for(var l=0,d=Math.min(n.length,a.length);l<d&&n.charCodeAt(l)==a.charCodeAt(l);)++l;return Kn(t,function(){wl(t,a.slice(l),n.length-l,null,e.composing?"*compose":null),1e3<a.length||-1<a.indexOf("\n")?i.value=e.prevInput="":e.prevInput=a,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Nl.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Nl.prototype.onKeyPress=function(){x&&9<=w&&(this.hasSelection=null),this.fastPoll()},Nl.prototype.onContextMenu=function(e){var i=this,n=i.cm,a=n.display,r=i.textarea;i.contextMenuPending&&i.contextMenuPending();var t=an(n,e),l=a.scroller.scrollTop;if(t&&!y){n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(t)&&Un(n,Wa)(n.doc,ya(t),R);var d,_=r.style.cssText,o=i.wrapper.style.cssText,s=i.wrapper.offsetParent.getBoundingClientRect();if(i.wrapper.style.cssText="position: static",r.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-s.top-5)+"px; left: "+(e.clientX-s.left-5)+"px;\n z-index: 1000; background: "+(x?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",v&&(d=window.scrollY),a.input.focus(),v&&window.scrollTo(null,d),a.input.reset(),n.somethingSelected()||(r.value=i.prevInput=" "),i.contextMenuPending=c,a.selForContextMenu=n.doc.sel,clearTimeout(a.detectingSelectAll),x&&9<=w&&u(),f){Ae(e);var m=function(){pe(window,"mouseup",m),setTimeout(c,20)};ue(window,"mouseup",m)}else setTimeout(c,50)}function u(){if(null!=r.selectionStart){var e=n.somethingSelected(),t="​"+(e?r.value:"");r.value="⇚",r.value=t,i.prevInput=e?"":"​",r.selectionStart=1,r.selectionEnd=t.length,a.selForContextMenu=n.doc.sel}}function c(){if(i.contextMenuPending==c&&(i.contextMenuPending=!1,i.wrapper.style.cssText=o,r.style.cssText=_,x&&w<9&&a.scrollbars.setScrollTop(a.scroller.scrollTop=l),null!=r.selectionStart)){(!x||x&&w<9)&&u();var e=0,t=function(){a.selForContextMenu==n.doc.sel&&0==r.selectionStart&&0<r.selectionEnd&&"​"==i.prevInput?Un(n,Za)(n):e++<10?a.detectingSelectAll=setTimeout(t,500):(a.selForContextMenu=null,a.input.reset())};a.detectingSelectAll=setTimeout(t,200)}}},Nl.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e,this.textarea.readOnly=!!e},Nl.prototype.setUneditable=function(){},Nl.prototype.needsContentAttribute=!1,function(a){var r=a.optionHandlers;function e(e,t,n,i){a.defaults[e]=t,n&&(r[e]=i?function(e,t,i){i!=ml&&n(e,t,i)}:n)}a.defineOption=e,a.Init=ml,e("value","",function(e,t){return e.setValue(t)},!0),e("mode",null,function(e,t){e.doc.modeOption=t,Ea(e)},!0),e("indentUnit",2,Ea,!0),e("indentWithTabs",!1),e("smartIndent",!0),e("tabSize",4,function(e){Aa(e),Si(e),ln(e)},!0),e("lineSeparator",null,function(e,n){if(e.doc.lineSep=n){var a=[],r=e.doc.first;e.doc.iter(function(e){for(var t=0;;){var i=e.text.indexOf(n,t);if(-1==i)break;t=i+n.length,a.push(et(r,i))}r++});for(var t=a.length-1;0<=t;t--)rr(e.doc,n,a[t],et(a[t].line,a[t].ch+n.length))}}),e("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(e,t,i){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),i!=ml&&e.refresh()}),e("specialCharPlaceholder",Xt,function(e){return e.refresh()},!0),e("electricChars",!0),e("inputStyle",m?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),e("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),e("autocorrect",!1,function(e,t){return e.getInputField().autocorrect=t},!0),e("autocapitalize",!1,function(e,t){return e.getInputField().autocapitalize=t},!0),e("rtlMoveVisually",!u),e("wholeLineUpdateBefore",!0),e("theme","default",function(e){sl(e),da(e)},!0),e("keyMap","default",function(e,t,i){var n=Dr(t),a=i!=ml&&Dr(i);a&&a.detach&&a.detach(e,n),n.attach&&n.attach(e,a||null)}),e("extraKeys",null),e("configureMouse",null),e("lineWrapping",!1,fl,!0),e("gutters",[],function(e,t){e.display.gutterSpecs=ra(t,e.options.lineNumbers),da(e)},!0),e("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?en(e.display)+"px":"0",e.refresh()},!0),e("coverGutterNextToScrollbar",!1,function(e){return Sn(e)},!0),e("scrollbarStyle","native",function(e){Dn(e),Sn(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),e("lineNumbers",!1,function(e,t){e.display.gutterSpecs=ra(e.options.gutters,t),da(e)},!0),e("firstLineNumber",1,da,!0),e("lineNumberFormatter",function(e){return e},da,!0),e("showCursorWhenSelecting",!1,mn,!0),e("resetSelectionOnContextMenu",!0),e("lineWiseCopyCut",!0),e("pasteLinesPerSelection",!0),e("selectionsMayTouch",!1),e("readOnly",!1,function(e,t){"nocursor"==t&&(gn(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),e("screenReaderLabel",null,function(e,t){t=""===t?null:t,e.display.input.screenReaderLabelChanged(t)}),e("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),e("dragDrop",!0,pl),e("allowDropFileTypes",null),e("cursorBlinkRate",530),e("cursorScrollMargin",0),e("cursorHeight",1,mn,!0),e("singleCursorHeightPerLine",!0,mn,!0),e("workTime",100),e("workDelay",100),e("flattenSpans",!0,Aa,!0),e("addModeClass",!1,Aa,!0),e("pollInterval",100),e("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),e("historyEventDelay",1250),e("viewportMargin",10,function(e){return e.refresh()},!0),e("maxHighlightLength",1e4,Aa,!0),e("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),e("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),e("autofocus",null),e("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0),e("phrases",null)}(hl),ql=(zl=hl).optionHandlers,Sl=zl.helpers={},zl.prototype={constructor:zl,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var i=this.options,n=i[e];i[e]==t&&"mode"!=e||(i[e]=t,ql.hasOwnProperty(e)&&Un(this,ql[e])(this,t,n),fe(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Dr(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,i=0;i<t.length;++i)if(t[i]==e||t[i].name==e)return t.splice(i,1),!0},addOverlay:Vn(function(e,t){var i=e.token?e:zl.getMode(this.options,e);if(i.startState)throw new Error("Overlays may not be stateful.");!function(e,t,i){for(var n=0,a=i(t);n<e.length&&i(e[n])<=a;)n++;e.splice(n,0,t)}(this.state.overlays,{mode:i,modeSpec:e,opaque:t&&t.opaque,priority:t&&t.priority||0},function(e){return e.priority}),this.state.modeGen++,ln(this)}),removeOverlay:Vn(function(e){for(var t=this.state.overlays,i=0;i<t.length;++i){var n=t[i].modeSpec;if(n==e||"string"==typeof e&&n.name==e)return t.splice(i,1),this.state.modeGen++,void ln(this)}}),indentLine:Vn(function(e,t,i){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),Ze(this.doc,e)&&bl(this,e,t,i)}),indentSelection:Vn(function(e){for(var t=this.doc.sel.ranges,i=-1,n=0;n<t.length;n++){var a=t[n];if(a.empty())a.head.line>i&&(bl(this,a.head.line,e,!0),i=a.head.line,n==this.doc.sel.primIndex&&jn(this));else{var r=a.from(),l=a.to(),d=Math.max(i,r.line);i=Math.min(this.lastLine(),l.line-(l.ch?0:1))+1;for(var _=d;_<i;++_)bl(this,_,e);var o=this.doc.sel.ranges;0==r.ch&&t.length==o.length&&0<o[n].from().ch&&Pa(this.doc,n,new fa(r,o[n].to()),R)}}}),getTokenAt:function(e,t){return bt(this,e,t)},getLineTokens:function(e,t){return bt(this,et(e),t,!0)},getTokenTypeAt:function(e){e=dt(this.doc,e);var t,i=ut(this,Ue(this.doc,e.line)),n=0,a=(i.length-1)/2,r=e.ch;if(0==r)t=i[2];else for(;;){var l=n+a>>1;if((l?i[2*l-1]:0)>=r)a=l;else{if(!(i[2*l+1]<r)){t=i[2*l+2];break}n=l+1}}var d=t?t.indexOf("overlay "):-1;return d<0?t:0==d?null:t.slice(0,d-1)},getModeAt:function(e){var t=this.doc.mode;return t.innerMode?zl.innerMode(t,this.getTokenAt(e).state).mode:t},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var i=[];if(!Sl.hasOwnProperty(t))return i;var n=Sl[t],a=this.getModeAt(e);if("string"==typeof a[t])n[a[t]]&&i.push(n[a[t]]);else if(a[t])for(var r=0;r<a[t].length;r++){var l=n[a[t][r]];l&&i.push(l)}else a.helperType&&n[a.helperType]?i.push(n[a.helperType]):n[a.name]&&i.push(n[a.name]);for(var d=0;d<n._global.length;d++){var _=n._global[d];_.pred(a,this)&&-1==O(i,_.val)&&i.push(_.val)}return i},getStateAfter:function(e,t){var i=this.doc;return ct(this,(e=lt(i,null==e?i.first+i.size-1:e))+1,t).state},cursorCoords:function(e,t){var i=this.doc.sel.primary();return Ri(this,null==e?i.head:"object"==typeof e?dt(this.doc,e):e?i.from():i.to(),t||"page")},charCoords:function(e,t){return Fi(this,dt(this.doc,e),t||"page")},coordsChar:function(e,t){return Ui(this,(e=Pi(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=Pi(this,{top:e,left:0},t||"page").top,Xe(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,i){var n,a=!1;if("number"==typeof e){var r=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:r<e&&(e=r,a=!0),n=Ue(this.doc,e)}else n=e;return Oi(this,n,{top:0,left:0},t||"page",i||a).top+(a?this.doc.height-Rt(n):0)},defaultTextHeight:function(){return Xi(this.display)},defaultCharWidth:function(){return Zi(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,i,n,a){var r,l=this.display,d=(e=Ri(this,dt(this.doc,e))).bottom,_=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),l.sizer.appendChild(t),"over"==n)d=e.top;else if("above"==n||"near"==n){var o=Math.max(l.wrapper.clientHeight,this.doc.height),s=Math.max(l.sizer.clientWidth,l.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>o)&&e.top>t.offsetHeight?d=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=o&&(d=e.bottom),_+t.offsetWidth>s&&(_=s-t.offsetWidth)}t.style.top=d+"px",t.style.left=t.style.right="","right"==a?(_=l.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==a?_=0:"middle"==a&&(_=(l.sizer.clientWidth-t.offsetWidth)/2),t.style.left=_+"px"),i&&(null!=(r=xn(this,{left:_,top:d,right:_+t.offsetWidth,bottom:d+t.offsetHeight})).scrollTop&&Qn(this,r.scrollTop),null!=r.scrollLeft&&Mn(this,r.scrollLeft))},triggerOnKeyDown:Vn(Jr),triggerOnKeyPress:Vn(tl),triggerOnKeyUp:el,triggerOnMouseDown:Vn(rl),execCommand:function(e){if(Wr.hasOwnProperty(e))return Wr[e].call(null,this)},triggerElectric:Vn(function(e){Al(this,e)}),findPosH:function(e,t,i,n){var a=1;t<0&&(a=-1,t=-t);for(var r=dt(this.doc,e),l=0;l<t&&!(r=Cl(this.doc,r,a,i,n)).hitSide;++l);return r},moveH:Vn(function(t,i){var n=this;this.extendSelectionsBy(function(e){return n.display.shift||n.doc.extend||e.empty()?Cl(n.doc,e.head,t,i,n.options.rtlMoveVisually):t<0?e.from():e.to()},K)}),deleteH:Vn(function(i,n){var e=this.doc.sel,a=this.doc;e.somethingSelected()?a.replaceSelection("",null,"+delete"):Or(this,function(e){var t=Cl(a,e.head,i,n,!1);return i<0?{from:t,to:e.head}:{from:e.head,to:t}})}),findPosV:function(e,t,i,n){var a=1,r=n;t<0&&(a=-1,t=-t);for(var l=dt(this.doc,e),d=0;d<t;++d){var _=Ri(this,l,"div");if(null==r?r=_.left:_.left=r,(l=Il(this,_,a,i)).hitSide)break}return l},moveV:Vn(function(n,a){var r=this,l=this.doc,d=[],_=!this.display.shift&&!l.extend&&l.sel.somethingSelected();if(l.extendSelectionsBy(function(e){if(_)return n<0?e.from():e.to();var t=Ri(r,e.head,"div");null!=e.goalColumn&&(t.left=e.goalColumn),d.push(t.left);var i=Il(r,t,n,a);return"page"==a&&e==l.sel.primary()&&kn(r,Fi(r,i,"div").top-t.top),i},K),d.length)for(var e=0;e<l.sel.ranges.length;e++)l.sel.ranges[e].goalColumn=d[e]}),findWordAt:function(e){var t=Ue(this.doc,e.line).text,i=e.ch,n=e.ch;if(t){var a=this.getHelper(e,"wordChars");"before"!=e.sticky&&n!=t.length||!i?++n:--i;for(var r=t.charAt(i),l=te(r,a)?function(e){return te(e,a)}:/\s/.test(r)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!te(e)};0<i&&l(t.charAt(i-1));)--i;for(;n<t.length&&l(t.charAt(n));)++n}return new fa(et(e.line,i),et(e.line,n))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?L(this.display.cursorDiv,"CodeMirror-overwrite"):j(this.display.cursorDiv,"CodeMirror-overwrite"),fe(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==M()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:Vn(function(e,t){Cn(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Ei(this)-this.display.barHeight,width:e.scrollWidth-Ei(this)-this.display.barWidth,clientHeight:xi(this),clientWidth:Ai(this)}},scrollIntoView:Vn(function(e,t){var i,n;null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:et(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line?(n=e,In(i=this),i.curOp.scrollToPos=n):Bn(this,e.from,e.to,e.margin)}),setSize:Vn(function(e,t){var i=this,n=function(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e};null!=e&&(this.display.wrapper.style.width=n(e)),null!=t&&(this.display.wrapper.style.height=n(t)),this.options.lineWrapping&&qi(this);var a=this.display.viewFrom;this.doc.iter(a,this.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){dn(i,a,"widget");break}++a}),this.curOp.forceUpdate=!0,fe(this,"refresh",this)}),operation:function(e){return Kn(this,e)},startOperation:function(){return Pn(this)},endOperation:function(){return Fn(this)},refresh:Vn(function(){var e=this.display.cachedTextHeight;ln(this),this.curOp.forceUpdate=!0,Si(this),Cn(this,this.doc.scrollLeft,this.doc.scrollTop),ta(this.display),(null==e||.5<Math.abs(e-Xi(this.display))||this.options.lineWrapping)&&nn(this),fe(this,"refresh",this)}),swapDoc:Vn(function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),Ca(this,e),Si(this),this.display.input.reset(),Cn(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,li(this,"swapDoc",this,t),t}),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ve(zl),zl.registerHelper=function(e,t,i){Sl.hasOwnProperty(e)||(Sl[e]=zl[e]={_global:[]}),Sl[e][t]=i},zl.registerGlobalHelper=function(e,t,i,n){zl.registerHelper(e,t,n),Sl[e]._global.push({pred:i,val:n})};var Hl,Dl="iter insert remove copy getEditor constructor".split(" ");for(var Ol in wr.prototype)wr.prototype.hasOwnProperty(Ol)&&O(Dl,Ol)<0&&(hl.prototype[Ol]=function(e){return function(){return e.apply(this.doc,arguments)}}(wr.prototype[Ol]));return ve(wr),hl.inputStyles={textarea:Nl,contenteditable:Bl},hl.defineMode=function(e){hl.defaults.mode||"null"==e||(hl.defaults.mode=e),function(e,t){2<arguments.length&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Se[e]=t}.apply(this,arguments)},hl.defineMIME=function(e,t){Ne[e]=t},hl.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),hl.defineMIME("text/plain","null"),hl.defineExtension=function(e,t){hl.prototype[e]=t},hl.defineDocExtension=function(e,t){wr.prototype[e]=t},hl.fromTextArea=function(t,i){if((i=i?N(i):{}).value=t.value,!i.tabindex&&t.tabIndex&&(i.tabindex=t.tabIndex),!i.placeholder&&t.placeholder&&(i.placeholder=t.placeholder),null==i.autofocus){var e=M();i.autofocus=e==t||null!=t.getAttribute("autofocus")&&e==document.body}function n(){t.value=d.getValue()}var a;if(t.form&&(ue(t.form,"submit",n),!i.leaveSubmitMethodAlone)){var r=t.form;a=r.submit;try{var l=r.submit=function(){n(),r.submit=a,r.submit(),r.submit=l}}catch(t){}}i.finishInit=function(e){e.save=n,e.getTextArea=function(){return t},e.toTextArea=function(){e.toTextArea=isNaN,n(),t.parentNode.removeChild(e.getWrapperElement()),t.style.display="",t.form&&(pe(t.form,"submit",n),i.leaveSubmitMethodAlone||"function"!=typeof t.form.submit||(t.form.submit=a))}},t.style.display="none";var d=hl(function(e){return t.parentNode.insertBefore(e,t.nextSibling)},i);return d},(Hl=hl).off=pe,Hl.on=ue,Hl.wheelEventPixels=ua,Hl.Doc=wr,Hl.splitLines=Me,Hl.countColumn=H,Hl.findColumn=U,Hl.isWordChar=ee,Hl.Pass=F,Hl.signal=fe,Hl.Line=Ut,Hl.changeEnd=ba,Hl.scrollbarModel=Hn,Hl.Pos=et,Hl.cmpPos=tt,Hl.modes=Se,Hl.mimeModes=Ne,Hl.resolveMode=He,Hl.getMode=De,Hl.modeExtensions=Oe,Hl.extendMode=Pe,Hl.copyState=Fe,Hl.startState=We,Hl.innerMode=Re,Hl.commands=Wr,Hl.keyMap=Mr,Hl.keyName=Hr,Hl.isModifierKey=Sr,Hl.lookupKey=qr,Hl.normalizeKeyMap=zr,Hl.StringStream=Ke,Hl.SharedTextMarker=yr,Hl.TextMarker=fr,Hl.LineWidget=ur,Hl.e_preventDefault=ge,Hl.e_stopPropagation=we,Hl.e_stop=Ae,Hl.addClass=L,Hl.contains=T,Hl.rmClass=j,Hl.keyNames=Ir,hl.version="5.63.3",hl}),CodeMirror.modeExtensions||(CodeMirror.modeExtensions={}),CodeMirror.defineExtension("getModeExt",function(){var e=CodeMirror.resolveMode(this.getOption("mode")).name,t=CodeMirror.modeExtensions[e];if(!t)throw new Error("No extensions found for mode "+e);return t}),CodeMirror.defineExtension("getModeExtAtPos",function(e){var t=this.getTokenAt(e);return t&&t.state&&t.state.mode?CodeMirror.modeExtensions["html"==t.state.mode?"htmlmixed":t.state.mode]:this.getModeExt()}),CodeMirror.defineExtension("commentRange",function(e,t,i){var n=this.getModeExtAtPos(this.getCursor());if(e){this.getRange(t,i);this.replaceRange(n.commentStart+this.getRange(t,i)+n.commentEnd,t,i),t.line==i.line&&t.ch==i.ch&&this.setCursor(t.line,t.ch+n.commentStart.length)}else{var a=this.getRange(t,i),r=a.indexOf(n.commentStart),l=a.lastIndexOf(n.commentEnd);-1<r&&-1<l&&r<l&&(a=a.substr(0,r)+a.substring(r+n.commentStart.length,l)+a.substr(l+n.commentEnd.length)),this.replaceRange(a,t,i)}}),CodeMirror.defineExtension("autoIndentRange",function(t,i){var n=this;this.operation(function(){for(var e=t.line;e<=i.line;e++)n.indentLine(e,"smart")})}),CodeMirror.defineExtension("autoFormatRange",function(n,a){var r=this.indexFromPos(n),e=this.indexFromPos(a),l=this.getModeExt().autoFormatLineBreaks(this.getValue(),r,e),d=this;this.operation(function(){d.replaceRange(l,n,a);for(var e=d.posFromIndex(r).line,t=d.posFromIndex(r+l.length).line,i=e;i<=t;i++)d.indentLine(i,"smart")})}),CodeMirror.modeExtensions.css={commentStart:"/*",commentEnd:"*/",wordWrapChars:[";","\\{","\\}"],autoFormatLineBreaks:function(e,t,i){return(e=e.substring(t,i)).replace(new RegExp("(;|\\{|\\})([^\r\n])","g"),"$1\n$2")}},CodeMirror.modeExtensions.javascript={commentStart:"/*",commentEnd:"*/",wordWrapChars:[";","\\{","\\}"],getNonBreakableBlocks:function(e){for(var t=[new RegExp("for\\s*?\\(([\\s\\S]*?)\\)"),new RegExp("'([\\s\\S]*?)('|$)"),new RegExp('"([\\s\\S]*?)("|$)'),new RegExp("//.*([\r\n]|$)")],i=new Array,n=0;n<t.length;n++)for(var a=0;a<e.length;){var r=e.substr(a).match(t[n]);if(null==r)break;i.push({start:a+r.index,end:a+r.index+r[0].length}),a+=r.index+Math.max(1,r[0].length)}return i.sort(function(e,t){return e.start-t.start}),i},autoFormatLineBreaks:function(e,t,i){e=e.substring(t,i);var n=0,a=new RegExp("(;|\\{|\\})([^\r\n])","g"),r=this.getNonBreakableBlocks(e);if(null==r)return e.replace(a,"$1\n$2");for(var l="",d=0;d<r.length;d++)r[d].start>n&&(l+=e.substring(n,r[d].start).replace(a,"$1\n$2"),n=r[d].start),r[d].start<=n&&r[d].end>=n&&(l+=e.substring(n,r[d].end),n=r[d].end);return n<e.length-1&&(l+=e.substr(n).replace(a,"$1\n$2")),l}},CodeMirror.modeExtensions.xml={commentStart:"\x3c!--",commentEnd:"--\x3e",wordWrapChars:[">"],autoFormatLineBreaks:function(e,t,i){for(var n=(e=e.substring(t,i)).split("\n"),a=new RegExp("(^\\s*?<|^[^<]*?)(.+)(>\\s*?$|[^>]*?$)"),r=new RegExp("<","g"),l=new RegExp("(>)([^\r\n])","g"),d=0;d<n.length;d++){var _=n[d].match(a);null!=_&&3<_.length&&(n[d]=_[1]+_[2].replace(r,"\n$&").replace(l,"$1\n$2")+_[3])}return n.join("\n")}},CodeMirror.modeExtensions.htmlmixed={commentStart:"\x3c!--",commentEnd:"--\x3e",wordWrapChars:[">",";","\\{","\\}"],getModeInfos:function(e,t){var i=new Array;i[0]={pos:0,modeExt:CodeMirror.modeExtensions.xml,modeName:"xml"};var n=new Array;n[0]={regex:new RegExp("<style[^>]*>([\\s\\S]*?)(</style[^>]*>|$)","i"),modeExt:CodeMirror.modeExtensions.css,modeName:"css"},n[1]={regex:new RegExp("<script[^>]*>([\\s\\S]*?)(</script[^>]*>|$)","i"),modeExt:CodeMirror.modeExtensions.javascript,modeName:"javascript"};for(var a=void 0!==t?t:e.length-1,r=0;r<n.length;r++)for(var l=0;l<=a;){var d=e.substr(l).match(n[r].regex);if(null==d)break;if(1<d.length&&0<d[1].length){var _=l+d.index+d[0].indexOf(d[1]);i.push({pos:_,modeExt:n[r].modeExt,modeName:n[r].modeName}),i.push({pos:_+d[1].length,modeExt:i[0].modeExt,modeName:i[0].modeName}),l+=d.index+d[0].length}else l+=d.index+Math.max(d[0].length,1)}return i.sort(function(e,t){return e.pos-t.pos}),i},autoFormatLineBreaks:function(e,t,i){var n=this.getModeInfos(e),a=new RegExp("^\\s*?\n"),r=new RegExp("\n\\s*?$"),l="";if(1<n.length)for(var d=1;d<=n.length;d++){var _=n[d-1].pos,o=d<n.length?n[d].pos:i;if(i<=_)break;if(_<t){if(o<=t)continue;_=t}i<o&&(o=i);var s=e.substring(_,o);"xml"!=n[d-1].modeName&&(!a.test(s)&&0<_&&(s="\n"+s),!r.test(s)&&o<e.length-1&&(s+="\n")),l+=n[d-1].modeExt.autoFormatLineBreaks(s)}else l=n[0].modeExt.autoFormatLineBreaks(e.substring(t,i));return l}},function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(Q){"use strict";function T(e,t,i,n,a,r){this.indented=e,this.column=t,this.type=i,this.info=n,this.align=a,this.prev=r}function M(e,t,i,n){var a=e.indented;return e.context&&"statement"==e.context.type&&"statement"!=i&&(a=e.context.indented),e.context=new T(a,t,i,n,null,e.context)}function L(e){var t=e.context.type;return")"!=t&&"]"!=t&&"}"!=t||(e.indented=e.context.indented),e.context=e.context.prev}function z(e,t,i){return"variable"==t.prevToken||"type"==t.prevToken||!!/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(e.string.slice(0,i))||!(!t.typeAtEndOfLine||e.column()!=e.indentation())||void 0}function q(e){for(;;){if(!e||"top"==e.type)return!0;if("}"==e.type&&"namespace"!=e.prev.info)return!1;e=e.prev}}function e(e){for(var t={},i=e.split(" "),n=0;n<i.length;++n)t[i[n]]=!0;return t}function S(e,t){return"function"==typeof e?e(t):e.propertyIsEnumerable(t)}Q.defineMode("clike",function(e,d){var l,_,o=e.indentUnit,s=d.statementIndentUnit||o,m=d.dontAlignCalls,u=d.keywords||{},c=d.types||{},p=d.builtin||{},f=d.blockKeywords||{},h=d.defKeywords||{},y=d.atoms||{},b=d.hooks||{},v=d.multiLineStrings,r=!1!==d.indentStatements,t=!1!==d.indentSwitch,g=d.namespaceSeparator,w=d.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,E=d.numberStart||/[\d\.]/,A=d.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,x=d.isOperatorChar||/[+\-*&%=<>!?|\/]/,k=d.isIdentifierChar||/[\w\$_\xa1-\uffff]/,j=d.isReservedIdentifier||!1;function C(e,t){var r,i=e.next();if(b[i]){var n=b[i](e,t);if(!1!==n)return n}if('"'==i||"'"==i)return t.tokenize=(r=i,function(e,t){for(var i,n=!1,a=!1;null!=(i=e.next());){if(i==r&&!n){a=!0;break}n=!n&&"\\"==i}return(a||!n&&!v)&&(t.tokenize=null),"string"}),t.tokenize(e,t);if(E.test(i)){if(e.backUp(1),e.match(A))return"number";e.next()}if(w.test(i))return l=i,null;if("/"==i){if(e.eat("*"))return(t.tokenize=I)(e,t);if(e.eat("/"))return e.skipToEnd(),"comment"}if(x.test(i)){for(;!e.match(/^\/[\/*]/,!1)&&e.eat(x););return"operator"}if(e.eatWhile(k),g)for(;e.match(g);)e.eatWhile(k);var a=e.current();return S(u,a)?(S(f,a)&&(l="newstatement"),S(h,a)&&(_=!0),"keyword"):S(c,a)?"type":S(p,a)||j&&j(a)?(S(f,a)&&(l="newstatement"),"builtin"):S(y,a)?"atom":"variable"}function I(e,t){for(var i,n=!1;i=e.next();){if("/"==i&&n){t.tokenize=null;break}n="*"==i}return"comment"}function B(e,t){d.typeFirstDefinitions&&e.eol()&&q(t.context)&&(t.typeAtEndOfLine=z(e,t,e.pos))}return{startState:function(e){return{tokenize:null,context:new T((e||0)-o,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(e,t){var i=t.context;if(e.sol()&&(null==i.align&&(i.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return B(e,t),null;l=_=null;var n=(t.tokenize||C)(e,t);if("comment"==n||"meta"==n)return n;if(null==i.align&&(i.align=!0),";"==l||":"==l||","==l&&e.match(/^\s*(?:\/\/.*)?$/,!1))for(;"statement"==t.context.type;)L(t);else if("{"==l)M(t,e.column(),"}");else if("["==l)M(t,e.column(),"]");else if("("==l)M(t,e.column(),")");else if("}"==l){for(;"statement"==i.type;)i=L(t);for("}"==i.type&&(i=L(t));"statement"==i.type;)i=L(t)}else l==i.type?L(t):r&&(("}"==i.type||"top"==i.type)&&";"!=l||"statement"==i.type&&"newstatement"==l)&&M(t,e.column(),"statement",e.current());if("variable"==n&&("def"==t.prevToken||d.typeFirstDefinitions&&z(e,t,e.start)&&q(t.context)&&e.match(/^\s*\(/,!1))&&(n="def"),b.token){var a=b.token(e,t,n);void 0!==a&&(n=a)}return"def"==n&&!1===d.styleDefs&&(n="variable"),t.startOfLine=!1,t.prevToken=_?"def":n||l,B(e,t),n},indent:function(e,t){if(e.tokenize!=C&&null!=e.tokenize||e.typeAtEndOfLine)return Q.Pass;var i=e.context,n=t&&t.charAt(0),a=n==i.type;if("statement"==i.type&&"}"==n&&(i=i.prev),d.dontIndentStatements)for(;"statement"==i.type&&d.dontIndentStatements.test(i.info);)i=i.prev;if(b.indent){var r=b.indent(e,i,t,o);if("number"==typeof r)return r}var l=i.prev&&"switch"==i.prev.info;if(d.allmanIndentation&&/[{(]/.test(n)){for(;"top"!=i.type&&"}"!=i.type;)i=i.prev;return i.indented}return"statement"==i.type?i.indented+("{"==n?0:s):!i.align||m&&")"==i.type?")"!=i.type||a?i.indented+(a?0:o)+(a||!l||/^(?:case|default)\b/.test(t)?0:o):i.indented+s:i.column+(a?0:1)},electricInput:t?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:"//",fold:"brace"}});var t="auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile inline restrict asm fortran",i="alignas alignof and and_eq audit axiom bitand bitor catch class compl concept constexpr const_cast decltype delete dynamic_cast explicit export final friend import module mutable namespace new noexcept not not_eq operator or or_eq override private protected public reinterpret_cast requires static_assert static_cast template this thread_local throw try typeid typename using virtual xor xor_eq",n="bycopy byref in inout oneway out self super atomic nonatomic retain copy readwrite readonly strong weak assign typeof nullable nonnull null_resettable _cmd @interface @implementation @end @protocol @encode @property @synthesize @dynamic @class @public @package @private @protected @required @optional @try @catch @finally @import @selector @encode @defs @synchronized @autoreleasepool @compatibility_alias @available",a="FOUNDATION_EXPORT FOUNDATION_EXTERN NS_INLINE NS_FORMAT_FUNCTION NS_RETURNS_RETAINEDNS_ERROR_ENUM NS_RETURNS_NOT_RETAINED NS_RETURNS_INNER_POINTER NS_DESIGNATED_INITIALIZER NS_ENUM NS_OPTIONS NS_REQUIRES_NIL_TERMINATION NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END NS_SWIFT_NAME NS_REFINED_FOR_SWIFT",r=e("int long char short double float unsigned signed void bool"),l=e("SEL instancetype id Class Protocol BOOL");function d(e){return S(r,e)||/.+_t$/.test(e)}function _(e){return d(e)||S(l,e)}var o="case do else for if switch while struct enum union";function s(e,t){if(!t.startOfLine)return!1;for(var i,n=null;i=e.peek();){if("\\"==i&&e.match(/^.$/)){n=s;break}if("/"==i&&e.match(/^\/[\/\*]/,!1))break;e.next()}return t.tokenize=n,"meta"}function m(e,t){return"type"==t.prevToken&&"type"}function u(e){return!(!e||e.length<2||"_"!=e[0]||"_"!=e[1]&&e[1]===e[1].toLowerCase())}function c(e){return e.eatWhile(/[\w\.']/),"number"}function p(e,t){if(e.backUp(1),e.match(/^(?:R|u8R|uR|UR|LR)/)){var i=e.match(/^"([^\s\\()]{0,16})\(/);return!!i&&(t.cpp11RawStringDelim=i[1],(t.tokenize=y)(e,t))}return e.match(/^(?:u8|u|U|L)/)?!!e.match(/^["']/,!1)&&"string":(e.next(),!1)}function f(e){var t=/(\w+)::~?(\w+)$/.exec(e);return t&&t[1]==t[2]}function h(e,t){for(var i;null!=(i=e.next());)if('"'==i&&!e.eat('"')){t.tokenize=null;break}return"string"}function y(e,t){var i=t.cpp11RawStringDelim.replace(/[^\w\s]/g,"\\$&");return e.match(new RegExp(".*?\\)"+i+'"'))?t.tokenize=null:e.skipToEnd(),"string"}function b(e,t){"string"==typeof e&&(e=[e]);var i=[];function n(e){if(e)for(var t in e)e.hasOwnProperty(t)&&i.push(t)}n(t.keywords),n(t.types),n(t.builtin),n(t.atoms),i.length&&(t.helperType=e[0],Q.registerHelper("hintWords",e[0],i));for(var a=0;a<e.length;++a)Q.defineMIME(e[a],t)}function v(e,t){for(var i=!1;!e.eol();){if(!i&&e.match('"""')){t.tokenize=null;break}i="\\"==e.next()&&!i}return"string"}function g(n){return function(e,t){for(var i;i=e.next();){if("*"==i&&e.eat("/")){if(1!=n)return t.tokenize=g(n-1),t.tokenize(e,t);t.tokenize=null;break}if("/"==i&&e.eat("*"))return t.tokenize=g(n+1),t.tokenize(e,t)}return"comment"}}b(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:e(t),types:d,blockKeywords:e(o),defKeywords:e("struct enum union"),typeFirstDefinitions:!0,atoms:e("NULL true false"),isReservedIdentifier:u,hooks:{"#":s,"*":m},modeProps:{fold:["brace","include"]}}),b(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:e(t+" "+i),types:d,blockKeywords:e(o+" class try catch"),defKeywords:e("struct enum union class namespace"),typeFirstDefinitions:!0,atoms:e("true false NULL nullptr"),dontIndentStatements:/^template$/,isIdentifierChar:/[\w\$_~\xa1-\uffff]/,isReservedIdentifier:u,hooks:{"#":s,"*":m,u:p,U:p,L:p,R:p,0:c,1:c,2:c,3:c,4:c,5:c,6:c,7:c,8:c,9:c,token:function(e,t,i){if("variable"==i&&"("==e.peek()&&(";"==t.prevToken||null==t.prevToken||"}"==t.prevToken)&&f(e.current()))return"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),b("text/x-java",{name:"clike",keywords:e("abstract assert break case catch class const continue default do else enum extends final finally for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while @interface"),types:e("var byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:e("catch class do else finally for if switch try while"),defKeywords:e("class interface enum @interface"),typeFirstDefinitions:!0,atoms:e("true false null"),number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,hooks:{"@":function(e){return!e.match("interface",!1)&&(e.eatWhile(/[\w\$_]/),"meta")}},modeProps:{fold:["brace","import"]}}),b("text/x-csharp",{name:"clike",keywords:e("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:e("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:e("catch class do else finally for foreach if struct switch try while"),defKeywords:e("class interface namespace struct var"),typeFirstDefinitions:!0,atoms:e("true false null"),hooks:{"@":function(e,t){return e.eat('"')?(t.tokenize=h)(e,t):(e.eatWhile(/[\w\$_]/),"meta")}}}),b("text/x-scala",{name:"clike",keywords:e("abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble"),types:e("AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:e("catch class enum do else finally for forSome if match switch try while"),defKeywords:e("class enum def object package trait type val var"),atoms:e("true false null"),indentStatements:!1,indentSwitch:!1,isOperatorChar:/[+\-*&%=<>!?|\/#:@]/,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return!!e.match('""')&&(t.tokenize=v,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},"=":function(e,t){var i=t.context;return!("}"!=i.type||!i.align||!e.eat(">"))&&(t.context=new T(i.indented,i.column,i.type,i.info,null,i.prev),"operator")},"/":function(e,t){return!!e.eat("*")&&(t.tokenize=g(1),t.tokenize(e,t))}},modeProps:{closeBrackets:{pairs:'()[]{}""',triples:'"'}}}),b("text/x-kotlin",{name:"clike",keywords:e("package as typealias class interface this super val operator var fun for is in This throw return annotation break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix suspend actual expect setparam value"),types:e("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void Annotation Any BooleanArray ByteArray Char CharArray DeprecationLevel DoubleArray Enum FloatArray Function Int IntArray Lazy LazyThreadSafetyMode LongArray Nothing ShortArray Unit"),intendSwitch:!1,indentStatements:!1,multiLineStrings:!0,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+(\.\d+)?|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,blockKeywords:e("catch class do else finally for if where try while enum"),defKeywords:e("class val var object interface fun"),atoms:e("true false null this"),hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},"*":function(e,t){return"."==t.prevToken?"variable":"operator"},'"':function(e,t){var r;return t.tokenize=(r=e.match('""'),function(e,t){for(var i,n=!1,a=!1;!e.eol();){if(!r&&!n&&e.match('"')){a=!0;break}if(r&&e.match('"""')){a=!0;break}i=e.next(),!n&&"$"==i&&e.match("{")&&e.skipTo("}"),n=!n&&"\\"==i&&!r}return!a&&r||(t.tokenize=null),"string"}),t.tokenize(e,t)},"/":function(e,t){return!!e.eat("*")&&(t.tokenize=g(1),t.tokenize(e,t))},indent:function(e,t,i,n){var a=i&&i.charAt(0);return"}"!=e.prevToken&&")"!=e.prevToken||""!=i?"operator"==e.prevToken&&"}"!=i&&"}"!=e.context.type||"variable"==e.prevToken&&"."==a||("}"==e.prevToken||")"==e.prevToken)&&"."==a?2*n+t.indented:t.align&&"}"==t.type?t.indented+(e.context.type==(i||"").charAt(0)?0:n):void 0:e.indented}},modeProps:{closeBrackets:{triples:'"'}}}),b(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:e("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:e("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:e("for while do if else struct"),builtin:e("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:e("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TextureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":s},modeProps:{fold:["brace","include"]}}),b("text/x-nesc",{name:"clike",keywords:e(t+" as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:d,blockKeywords:e(o),atoms:e("null true false"),hooks:{"#":s},modeProps:{fold:["brace","include"]}}),b("text/x-objectivec",{name:"clike",keywords:e(t+" "+n),types:_,builtin:e(a),blockKeywords:e(o+" @synthesize @try @catch @finally @autoreleasepool @synchronized"),defKeywords:e("struct enum union @interface @implementation @protocol @class"),dontIndentStatements:/^@.*$/,typeFirstDefinitions:!0,atoms:e("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:u,hooks:{"#":s,"*":m},modeProps:{fold:["brace","include"]}}),b("text/x-objectivec++",{name:"clike",keywords:e(t+" "+n+" "+i),types:_,builtin:e(a),blockKeywords:e(o+" @synthesize @try @catch @finally @autoreleasepool @synchronized class try catch"),defKeywords:e("struct enum union @interface @implementation @protocol @class class namespace"),dontIndentStatements:/^@.*$|^template$/,typeFirstDefinitions:!0,atoms:e("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:u,hooks:{"#":s,"*":m,u:p,U:p,L:p,R:p,0:c,1:c,2:c,3:c,4:c,5:c,6:c,7:c,8:c,9:c,token:function(e,t,i){if("variable"==i&&"("==e.peek()&&(";"==t.prevToken||null==t.prevToken||"}"==t.prevToken)&&f(e.current()))return"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),b("text/x-squirrel",{name:"clike",keywords:e("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:d,blockKeywords:e("case catch class else for foreach if switch try while"),defKeywords:e("function local class"),typeFirstDefinitions:!0,atoms:e("true false null"),hooks:{"#":s},modeProps:{fold:["brace","include"]}});var w=null;b("text/x-ceylon",{name:"clike",keywords:e("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(e){var t=e.charAt(0);return t===t.toUpperCase()&&t!==t.toLowerCase()},blockKeywords:e("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:e("class dynamic function interface module object package value"),builtin:e("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:e("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return t.tokenize=function r(l){return function(e,t){for(var i,n=!1,a=!1;!e.eol();){if(!n&&e.match('"')&&("single"==l||e.match('""'))){a=!0;break}if(!n&&e.match("``")){w=r(l),a=!0;break}i=e.next(),n="single"==l&&!n&&"\\"==i}return a&&(t.tokenize=null),"string"}}(e.match('""')?"triple":"single"),t.tokenize(e,t)},"`":function(e,t){return!(!w||!e.match("`"))&&(t.tokenize=w,w=null,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(e,t,i){if(("variable"==i||"type"==i)&&"."==t.prevToken)return"variable-2"}},modeProps:{fold:["brace","import"],closeBrackets:{triples:'"'}}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(T){"use strict";function e(e){for(var t={},i=0;i<e.length;++i)t[e[i].toLowerCase()]=!0;return t}T.defineMode("css",function(e,t){var i=t.inline;t.propertyKeywords||(t=T.resolveMode("text/css"));var n,a,r=e.indentUnit,l=t.tokenHooks,d=t.documentTypes||{},_=t.mediaTypes||{},o=t.mediaFeatures||{},s=t.mediaValueKeywords||{},m=t.propertyKeywords||{},u=t.nonStandardPropertyKeywords||{},c=t.fontProperties||{},p=t.counterDescriptors||{},f=t.colorKeywords||{},h=t.valueKeywords||{},y=t.allowNested,b=t.lineComment,v=!0===t.supportsAtComponent,g=!1!==e.highlightNonStandardPropertyKeywords;function w(e,t){return n=t,e}function E(a){return function(e,t){for(var i,n=!1;null!=(i=e.next());){if(i==a&&!n){")"==a&&e.backUp(1);break}n=!n&&"\\"==i}return(i==a||!n&&")"!=a)&&(t.tokenize=null),w("string","string")}}function A(e,t){return e.next(),e.match(/^\s*[\"\')]/,!1)?t.tokenize=null:t.tokenize=E(")"),w(null,"(")}function x(e,t,i){this.type=e,this.indent=t,this.prev=i}function k(e,t,i,n){return e.context=new x(i,t.indentation()+(!1===n?0:r),e.context),i}function j(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function C(e,t,i){return Q[i.context.type](e,t,i)}function I(e,t,i,n){for(var a=n||1;0<a;a--)i.context=i.context.prev;return C(e,t,i)}function B(e){var t=e.current().toLowerCase();a=h.hasOwnProperty(t)?"atom":f.hasOwnProperty(t)?"keyword":"variable"}var Q={top:function(e,t,i){if("{"==e)return k(i,t,"block");if("}"==e&&i.context.prev)return j(i);if(v&&/@component/i.test(e))return k(i,t,"atComponentBlock");if(/^@(-moz-)?document$/i.test(e))return k(i,t,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/i.test(e))return k(i,t,"atBlock");if(/^@(font-face|counter-style)/i.test(e))return i.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return k(i,t,"at");if("hash"==e)a="builtin";else if("word"==e)a="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return k(i,t,"interpolation");if(":"==e)return"pseudo";if(y&&"("==e)return k(i,t,"parens")}return i.context.type},block:function(e,t,i){if("word"!=e)return"meta"==e?"block":y||"hash"!=e&&"qualifier"!=e?Q.top(e,t,i):(a="error","block");var n=t.current().toLowerCase();return m.hasOwnProperty(n)?(a="property","maybeprop"):u.hasOwnProperty(n)?(a=g?"string-2":"property","maybeprop"):y?(a=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(a+=" error","maybeprop")},maybeprop:function(e,t,i){return":"==e?k(i,t,"prop"):C(e,t,i)},prop:function(e,t,i){if(";"==e)return j(i);if("{"==e&&y)return k(i,t,"propBlock");if("}"==e||"{"==e)return I(e,t,i);if("("==e)return k(i,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(t.current())){if("word"==e)B(t);else if("interpolation"==e)return k(i,t,"interpolation")}else a+=" error";return"prop"},propBlock:function(e,t,i){return"}"==e?j(i):"word"==e?(a="property","maybeprop"):i.context.type},parens:function(e,t,i){return"{"==e||"}"==e?I(e,t,i):")"==e?j(i):"("==e?k(i,t,"parens"):"interpolation"==e?k(i,t,"interpolation"):("word"==e&&B(t),"parens")},pseudo:function(e,t,i){return"meta"==e?"pseudo":"word"==e?(a="variable-3",i.context.type):C(e,t,i)},documentTypes:function(e,t,i){return"word"==e&&d.hasOwnProperty(t.current())?(a="tag",i.context.type):Q.atBlock(e,t,i)},atBlock:function(e,t,i){if("("==e)return k(i,t,"atBlock_parens");if("}"==e||";"==e)return I(e,t,i);if("{"==e)return j(i)&&k(i,t,y?"block":"top");if("interpolation"==e)return k(i,t,"interpolation");if("word"==e){var n=t.current().toLowerCase();a="only"==n||"not"==n||"and"==n||"or"==n?"keyword":_.hasOwnProperty(n)?"attribute":o.hasOwnProperty(n)?"property":s.hasOwnProperty(n)?"keyword":m.hasOwnProperty(n)?"property":u.hasOwnProperty(n)?g?"string-2":"property":h.hasOwnProperty(n)?"atom":f.hasOwnProperty(n)?"keyword":"error"}return i.context.type},atComponentBlock:function(e,t,i){return"}"==e?I(e,t,i):"{"==e?j(i)&&k(i,t,y?"block":"top",!1):("word"==e&&(a="error"),i.context.type)},atBlock_parens:function(e,t,i){return")"==e?j(i):"{"==e||"}"==e?I(e,t,i,2):Q.atBlock(e,t,i)},restricted_atBlock_before:function(e,t,i){return"{"==e?k(i,t,"restricted_atBlock"):"word"==e&&"@counter-style"==i.stateArg?(a="variable","restricted_atBlock_before"):C(e,t,i)},restricted_atBlock:function(e,t,i){return"}"==e?(i.stateArg=null,j(i)):"word"==e?(a="@font-face"==i.stateArg&&!c.hasOwnProperty(t.current().toLowerCase())||"@counter-style"==i.stateArg&&!p.hasOwnProperty(t.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},keyframes:function(e,t,i){return"word"==e?(a="variable","keyframes"):"{"==e?k(i,t,"top"):C(e,t,i)},at:function(e,t,i){return";"==e?j(i):"{"==e||"}"==e?I(e,t,i):("word"==e?a="tag":"hash"==e&&(a="builtin"),"at")},interpolation:function(e,t,i){return"}"==e?j(i):"{"==e||";"==e?I(e,t,i):("word"==e?a="variable":"variable"!=e&&"("!=e&&")"!=e&&(a="error"),"interpolation")}};return{startState:function(e){return{tokenize:null,state:i?"block":"top",stateArg:null,context:new x(i?"block":"top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var i=(t.tokenize||function(e,t){var i=e.next();if(l[i]){var n=l[i](e,t);if(!1!==n)return n}return"@"==i?(e.eatWhile(/[\w\\\-]/),w("def",e.current())):"="==i||("~"==i||"|"==i)&&e.eat("=")?w(null,"compare"):'"'==i||"'"==i?(t.tokenize=E(i),t.tokenize(e,t)):"#"==i?(e.eatWhile(/[\w\\\-]/),w("atom","hash")):"!"==i?(e.match(/^\s*\w*/),w("keyword","important")):/\d/.test(i)||"."==i&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),w("number","unit")):"-"!==i?/[,+>*\/]/.test(i)?w(null,"select-op"):"."==i&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?w("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(i)?w(null,i):e.match(/^[\w-.]+(?=\()/)?(/^(url(-prefix)?|domain|regexp)$/i.test(e.current())&&(t.tokenize=A),w("variable callee","variable")):/[\w\\\-]/.test(i)?(e.eatWhile(/[\w\\\-]/),w("property","word")):w(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),w("number","unit")):e.match(/^-[\w\\\-]*/)?(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?w("variable-2","variable-definition"):w("variable-2","variable")):e.match(/^\w+-/)?w("meta","meta"):void 0})(e,t);return i&&"object"==typeof i&&(n=i[1],i=i[0]),a=i,"comment"!=n&&(t.state=Q[t.state](n,e,t)),a},indent:function(e,t){var i=e.context,n=t&&t.charAt(0),a=i.indent;return"prop"!=i.type||"}"!=n&&")"!=n||(i=i.prev),i.prev&&("}"!=n||"block"!=i.type&&"top"!=i.type&&"interpolation"!=i.type&&"restricted_atBlock"!=i.type?(")"!=n||"parens"!=i.type&&"atBlock_parens"!=i.type)&&("{"!=n||"at"!=i.type&&"atBlock"!=i.type)||(a=Math.max(0,i.indent-r)):a=(i=i.prev).indent),a},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:b,fold:"brace"}});var t=["domain","regexp","url","url-prefix"],i=e(t),n=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],a=e(n),r=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","orientation","device-pixel-ratio","min-device-pixel-ratio","max-device-pixel-ratio","pointer","any-pointer","hover","any-hover","prefers-color-scheme"],l=e(r),d=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive","dark","light"],_=e(d),o=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","all","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","binding","bleed","block-size","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-content","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-gap","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-gap","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","inset","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","left","letter-spacing","line-break","line-height","line-height-step","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","place-content","place-items","place-self","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotate","rotation","rotation-point","row-gap","ruby-align","ruby-overhang","ruby-position","ruby-span","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-type","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-orientation","text-outline","text-overflow","text-rendering","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","touch-action","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-select","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","paint-order","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],s=e(o),m=["accent-color","aspect-ratio","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","content-visibility","margin-block","margin-block-end","margin-block-start","margin-inline","margin-inline-end","margin-inline-start","overflow-anchor","overscroll-behavior","padding-block","padding-block-end","padding-block-start","padding-inline","padding-inline-end","padding-inline-start","scroll-snap-stop","scrollbar-3d-light-color","scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-track-color","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","shape-inside","zoom"],u=e(m),c=e(["font-display","font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"]),p=e(["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"]),f=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],h=e(f),y=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","blur","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","brightness","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","contrast","copy","counter","counters","cover","crop","cross","crosshair","cubic-bezier","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","drop-shadow","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","grayscale","graytext","grid","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","hue-rotate","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","manipulation","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","multiple_mask_images","multiply","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","opacity","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturate","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","self-start","self-end","semi-condensed","semi-expanded","separate","sepia","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","square-button","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"],b=e(y),v=t.concat(n).concat(r).concat(d).concat(o).concat(m).concat(f).concat(y);function g(e,t){for(var i,n=!1;null!=(i=e.next());){if(n&&"/"==i){t.tokenize=null;break}n="*"==i}return["comment","comment"]}T.registerHelper("hintWords","css",v),T.defineMIME("text/css",{documentTypes:i,mediaTypes:a,mediaFeatures:l,mediaValueKeywords:_,propertyKeywords:s,nonStandardPropertyKeywords:u,fontProperties:c,counterDescriptors:p,colorKeywords:h,valueKeywords:b,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=g)(e,t)}},name:"css"}),T.defineMIME("text/x-scss",{mediaTypes:a,mediaFeatures:l,mediaValueKeywords:_,propertyKeywords:s,nonStandardPropertyKeywords:u,colorKeywords:h,valueKeywords:b,fontProperties:c,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=g)(e,t):["operator","operator"]},":":function(e){return!!e.match(/^\s*\{/,!1)&&[null,null]},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return!!e.eat("{")&&[null,"interpolation"]}},name:"css",helperType:"scss"}),T.defineMIME("text/x-less",{mediaTypes:a,mediaFeatures:l,mediaValueKeywords:_,propertyKeywords:s,nonStandardPropertyKeywords:u,colorKeywords:h,valueKeywords:b,fontProperties:c,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=g)(e,t):["operator","operator"]},"@":function(e){return e.eat("{")?[null,"interpolation"]:!e.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/i,!1)&&(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),T.defineMIME("text/x-gss",{documentTypes:i,mediaTypes:a,mediaFeatures:l,propertyKeywords:s,nonStandardPropertyKeywords:u,fontProperties:c,counterDescriptors:p,colorKeywords:h,valueKeywords:b,supportsAtComponent:!0,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=g)(e,t)}},name:"css",helperType:"gss"})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(Je){"use strict";Je.defineMode("javascript",function(e,m){var n,a,u=e.indentUnit,c=m.statementIndent,l=m.jsonld,d=m.json||l,r=!1!==m.trackScope,o=m.typescript,s=m.wordCharacters||/[\w$\xa1-\uffff]/,_=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),i=e("keyword b"),n=e("keyword c"),a=e("keyword d"),r=e("operator"),l={type:"atom",style:"atom"};return{if:e("if"),while:t,with:t,else:i,do:i,try:i,finally:i,return:a,break:a,continue:a,new:e("new"),delete:n,void:n,throw:n,debugger:e("debugger"),var:e("var"),const:e("var"),let:e("var"),function:e("function"),catch:e("catch"),for:e("for"),switch:e("switch"),case:e("case"),default:e("default"),in:r,typeof:r,instanceof:r,true:l,false:l,null:l,undefined:l,NaN:l,Infinity:l,this:e("this"),class:e("class"),super:e("atom"),yield:n,export:e("export"),import:e("import"),extends:n,await:n}}(),p=/[+\-*&%=<>!?|~^@]/,f=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function h(e,t,i){return n=e,a=i,t}function y(e,t){var a,i=e.next();if('"'==i||"'"==i)return t.tokenize=(a=i,function(e,t){var i,n=!1;if(l&&"@"==e.peek()&&e.match(f))return t.tokenize=y,h("jsonld-keyword","meta");for(;null!=(i=e.next())&&(i!=a||n);)n=!n&&"\\"==i;return n||(t.tokenize=y),h("string","string")}),t.tokenize(e,t);if("."==i&&e.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return h("number","number");if("."==i&&e.match(".."))return h("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(i))return h(i);if("="==i&&e.eat(">"))return h("=>","operator");if("0"==i&&e.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return h("number","number");if(/\d/.test(i))return e.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),h("number","number");if("/"==i)return e.eat("*")?(t.tokenize=b)(e,t):e.eat("/")?(e.skipToEnd(),h("comment","comment")):Ze(e,t,1)?(function(e){for(var t,i=!1,n=!1;null!=(t=e.next());){if(!i){if("/"==t&&!n)return;"["==t?n=!0:n&&"]"==t&&(n=!1)}i=!i&&"\\"==t}}(e),e.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),h("regexp","string-2")):(e.eat("="),h("operator","operator",e.current()));if("`"==i)return(t.tokenize=v)(e,t);if("#"==i&&"!"==e.peek())return e.skipToEnd(),h("meta","meta");if("#"==i&&e.eatWhile(s))return h("variable","property");if("<"==i&&e.match("!--")||"-"==i&&e.match("->")&&!/\S/.test(e.string.slice(0,e.start)))return e.skipToEnd(),h("comment","comment");if(p.test(i))return">"==i&&t.lexical&&">"==t.lexical.type||(e.eat("=")?"!"!=i&&"="!=i||e.eat("="):/[<>*+\-|&?]/.test(i)&&(e.eat(i),">"==i&&e.eat(i))),"?"==i&&e.eat(".")?h("."):h("operator","operator",e.current());if(s.test(i)){e.eatWhile(s);var n=e.current();if("."!=t.lastType){if(_.propertyIsEnumerable(n)){var r=_[n];return h(r.type,r.style,n)}if("async"==n&&e.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return h("async","keyword",n)}return h("variable","variable",n)}}function b(e,t){for(var i,n=!1;i=e.next();){if("/"==i&&n){t.tokenize=y;break}n="*"==i}return h("comment","comment")}function v(e,t){for(var i,n=!1;null!=(i=e.next());){if(!n&&("`"==i||"$"==i&&e.eat("{"))){t.tokenize=y;break}n=!n&&"\\"==i}return h("quasi","string-2",e.current())}var g="([{}])";function w(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var i=e.string.indexOf("=>",e.start);if(!(i<0)){if(o){var n=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(e.string.slice(e.start,i));n&&(i=n.index)}for(var a=0,r=!1,l=i-1;0<=l;--l){var d=e.string.charAt(l),_=g.indexOf(d);if(0<=_&&_<3){if(!a){++l;break}if(0==--a){"("==d&&(r=!0);break}}else if(3<=_&&_<6)++a;else if(s.test(d))r=!0;else if(/["'\/`]/.test(d))for(;;--l){if(0==l)return;if(e.string.charAt(l-1)==d&&"\\"!=e.string.charAt(l-2)){l--;break}}else if(r&&!a){++l;break}}r&&!a&&(t.fatArrowAt=l)}}var E={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function A(e,t,i,n,a,r){this.indented=e,this.column=t,this.type=i,this.prev=a,this.info=r,null!=n&&(this.align=n)}function x(e,t){if(!r)return!1;for(var i=e.localVars;i;i=i.next)if(i.name==t)return!0;for(var n=e.context;n;n=n.prev)for(i=n.vars;i;i=i.next)if(i.name==t)return!0}function k(e,t,i,n,a){var r=e.cc;for(j.state=e,j.stream=a,j.marked=null,j.cc=r,j.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;)if((r.length?r.pop():d?P:D)(i,n)){for(;r.length&&r[r.length-1].lex;)r.pop()();return j.marked?j.marked:"variable"==i&&x(e,n)?"variable-2":t}}var j={state:null,column:null,marked:null,cc:null};function C(){for(var e=arguments.length-1;0<=e;e--)j.cc.push(arguments[e])}function I(){return C.apply(null,arguments),!0}function B(e,t){for(var i=t;i;i=i.next)if(i.name==e)return!0;return!1}function i(e){var t=j.state;if(j.marked="def",r){if(t.context)if("var"==t.lexical.info&&t.context&&t.context.block){var i=function e(t,i){if(i){if(i.block){var n=e(t,i.prev);return n?n==i.prev?i:new T(n,i.vars,!0):null}return B(t,i.vars)?i:new T(i.prev,new M(t,i.vars),!1)}return null}(e,t.context);if(null!=i)return void(t.context=i)}else if(!B(e,t.localVars))return void(t.localVars=new M(e,t.localVars));m.globalVars&&!B(e,t.globalVars)&&(t.globalVars=new M(e,t.globalVars))}}function Q(e){return"public"==e||"private"==e||"protected"==e||"abstract"==e||"readonly"==e}function T(e,t,i){this.prev=e,this.vars=t,this.block=i}function M(e,t){this.name=e,this.next=t}var t=new M("this",new M("arguments",null));function L(){j.state.context=new T(j.state.context,j.state.localVars,!1),j.state.localVars=t}function z(){j.state.context=new T(j.state.context,j.state.localVars,!0),j.state.localVars=null}function q(){j.state.localVars=j.state.context.vars,j.state.context=j.state.context.prev}function S(n,a){var e=function(){var e=j.state,t=e.indented;if("stat"==e.lexical.type)t=e.lexical.indented;else for(var i=e.lexical;i&&")"==i.type&&i.align;i=i.prev)t=i.indented;e.lexical=new A(t,j.stream.column(),n,null,e.lexical,a)};return e.lex=!0,e}function N(){var e=j.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function H(i){return function e(t){return t==i?I():";"==i||"}"==t||")"==t||"]"==t?C():I(e)}}function D(e,t){return"var"==e?I(S("vardef",t),Ae,H(";"),N):"keyword a"==e?I(S("form"),R,D,N):"keyword b"==e?I(S("form"),D,N):"keyword d"==e?j.stream.match(/^\s*$/,!1)?I():I(S("stat"),K,H(";"),N):"debugger"==e?I(H(";")):"{"==e?I(S("}"),z,de,N,q):";"==e?I():"if"==e?("else"==j.state.lexical.info&&j.state.cc[j.state.cc.length-1]==N&&j.state.cc.pop()(),I(S("form"),R,D,N,Be)):"function"==e?I(Le):"for"==e?I(S("form"),z,Qe,D,q,N):"class"==e||o&&"interface"==t?(j.marked="keyword",I(S("form","class"==e?e:t),He,N)):"variable"==e?o&&"declare"==t?(j.marked="keyword",I(D)):o&&("module"==t||"enum"==t||"type"==t)&&j.stream.match(/^\s*\w/,!1)?(j.marked="keyword","enum"==t?I(Ye):"type"==t?I(qe,H("operator"),ue,H(";")):I(S("form"),xe,H("{"),S("}"),de,N,N)):o&&"namespace"==t?(j.marked="keyword",I(S("form"),P,D,N)):o&&"abstract"==t?(j.marked="keyword",I(D)):I(S("stat"),ee):"switch"==e?I(S("form"),R,H("{"),S("}","switch"),z,de,N,N,q):"case"==e?I(P,H(":")):"default"==e?I(H(":")):"catch"==e?I(S("form"),L,O,D,N,q):"export"==e?I(S("stat"),Fe,N):"import"==e?I(S("stat"),We,N):"async"==e?I(D):"@"==t?I(P,D):C(S("stat"),P,H(";"),N)}function O(e){if("("==e)return I(Se,H(")"))}function P(e,t){return W(e,t,!1)}function F(e,t){return W(e,t,!0)}function R(e){return"("!=e?C():I(S(")"),K,H(")"),N)}function W(e,t,i){if(j.state.fatArrowAt==j.stream.start){var n=i?X:Y;if("("==e)return I(L,S(")"),re(Se,")"),N,H("=>"),n,q);if("variable"==e)return C(L,xe,H("=>"),n,q)}var a,r=i?V:U;return E.hasOwnProperty(e)?I(r):"function"==e?I(Le,r):"class"==e||o&&"interface"==t?(j.marked="keyword",I(S("form"),Ne,N)):"keyword c"==e||"async"==e?I(i?F:P):"("==e?I(S(")"),K,H(")"),N,r):"operator"==e||"spread"==e?I(i?F:P):"["==e?I(S("]"),Ge,N,r):"{"==e?le(ie,"}",null,r):"quasi"==e?C($,r):"new"==e?I((a=i,function(e){return"."==e?I(a?J:Z):"variable"==e&&o?I(ge,a?V:U):C(a?F:P)})):I()}function K(e){return e.match(/[;\}\)\],]/)?C():C(P)}function U(e,t){return","==e?I(K):V(e,t,!1)}function V(e,t,i){var n=0==i?U:V,a=0==i?P:F;return"=>"==e?I(L,i?X:Y,q):"operator"==e?/\+\+|--/.test(t)||o&&"!"==t?I(n):o&&"<"==t&&j.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?I(S(">"),re(ue,">"),N,n):"?"==t?I(P,H(":"),a):I(a):"quasi"==e?C($,n):";"!=e?"("==e?le(F,")","call",n):"."==e?I(te,n):"["==e?I(S("]"),K,H("]"),N,n):o&&"as"==t?(j.marked="keyword",I(ue,n)):"regexp"==e?(j.state.lastType=j.marked="operator",j.stream.backUp(j.stream.pos-j.stream.start-1),I(a)):void 0:void 0}function $(e,t){return"quasi"!=e?C():"${"!=t.slice(t.length-2)?I($):I(K,G)}function G(e){if("}"==e)return j.marked="string-2",j.state.tokenize=v,I($)}function Y(e){return w(j.stream,j.state),C("{"==e?D:P)}function X(e){return w(j.stream,j.state),C("{"==e?D:F)}function Z(e,t){if("target"==t)return j.marked="keyword",I(U)}function J(e,t){if("target"==t)return j.marked="keyword",I(V)}function ee(e){return":"==e?I(N,D):C(U,H(";"),N)}function te(e){if("variable"==e)return j.marked="property",I()}function ie(e,t){return"async"==e?(j.marked="property",I(ie)):"variable"==e||"keyword"==j.style?(j.marked="property","get"==t||"set"==t?I(ne):(o&&j.state.fatArrowAt==j.stream.start&&(i=j.stream.match(/^\s*:\s*/,!1))&&(j.state.fatArrowAt=j.stream.pos+i[0].length),I(ae))):"number"==e||"string"==e?(j.marked=l?"property":j.style+" property",I(ae)):"jsonld-keyword"==e?I(ae):o&&Q(t)?(j.marked="keyword",I(ie)):"["==e?I(P,_e,H("]"),ae):"spread"==e?I(F,ae):"*"==t?(j.marked="keyword",I(ie)):":"==e?C(ae):void 0;var i}function ne(e){return"variable"!=e?C(ae):(j.marked="property",I(Le))}function ae(e){return":"==e?I(F):"("==e?C(Le):void 0}function re(n,a,r){function l(e,t){if(r?-1<r.indexOf(e):","==e){var i=j.state.lexical;return"call"==i.info&&(i.pos=(i.pos||0)+1),I(function(e,t){return e==a||t==a?C():C(n)},l)}return e==a||t==a?I():r&&-1<r.indexOf(";")?C(n):I(H(a))}return function(e,t){return e==a||t==a?I():C(n,l)}}function le(e,t,i){for(var n=3;n<arguments.length;n++)j.cc.push(arguments[n]);return I(S(t,i),re(e,t),N)}function de(e){return"}"==e?I():C(D,de)}function _e(e,t){if(o){if(":"==e)return I(ue);if("?"==t)return I(_e)}}function oe(e,t){if(o&&(":"==e||"in"==t))return I(ue)}function se(e){if(o&&":"==e)return j.stream.match(/^\s*\w+\s+is\b/,!1)?I(P,me,ue):I(ue)}function me(e,t){if("is"==t)return j.marked="keyword",I()}function ue(e,t){return"keyof"==t||"typeof"==t||"infer"==t||"readonly"==t?(j.marked="keyword",I("typeof"==t?F:ue)):"variable"==e||"void"==t?(j.marked="type",I(ve)):"|"==t||"&"==t?I(ue):"string"==e||"number"==e||"atom"==e?I(ve):"["==e?I(S("]"),re(ue,"]",","),N,ve):"{"==e?I(S("}"),pe,N,ve):"("==e?I(re(be,")"),ce,ve):"<"==e?I(re(ue,">"),ue):"quasi"==e?C(he,ve):void 0}function ce(e){if("=>"==e)return I(ue)}function pe(e){return e.match(/[\}\)\]]/)?I():","==e||";"==e?I(pe):C(fe,pe)}function fe(e,t){return"variable"==e||"keyword"==j.style?(j.marked="property",I(fe)):"?"==t||"number"==e||"string"==e?I(fe):":"==e?I(ue):"["==e?I(H("variable"),oe,H("]"),fe):"("==e?C(ze,fe):e.match(/[;\}\)\],]/)?void 0:I()}function he(e,t){return"quasi"!=e?C():"${"!=t.slice(t.length-2)?I(he):I(ue,ye)}function ye(e){if("}"==e)return j.marked="string-2",j.state.tokenize=v,I(he)}function be(e,t){return"variable"==e&&j.stream.match(/^\s*[?:]/,!1)||"?"==t?I(be):":"==e?I(ue):"spread"==e?I(be):C(ue)}function ve(e,t){return"<"==t?I(S(">"),re(ue,">"),N,ve):"|"==t||"."==e||"&"==t?I(ue):"["==e?I(ue,H("]"),ve):"extends"==t||"implements"==t?(j.marked="keyword",I(ue)):"?"==t?I(ue,H(":"),ue):void 0}function ge(e,t){if("<"==t)return I(S(">"),re(ue,">"),N,ve)}function we(){return C(ue,Ee)}function Ee(e,t){if("="==t)return I(ue)}function Ae(e,t){return"enum"==t?(j.marked="keyword",I(Ye)):C(xe,_e,Ce,Ie)}function xe(e,t){return o&&Q(t)?(j.marked="keyword",I(xe)):"variable"==e?(i(t),I()):"spread"==e?I(xe):"["==e?le(je,"]"):"{"==e?le(ke,"}"):void 0}function ke(e,t){return"variable"!=e||j.stream.match(/^\s*:/,!1)?("variable"==e&&(j.marked="property"),"spread"==e?I(xe):"}"==e?C():"["==e?I(P,H("]"),H(":"),ke):I(H(":"),xe,Ce)):(i(t),I(Ce))}function je(){return C(xe,Ce)}function Ce(e,t){if("="==t)return I(F)}function Ie(e){if(","==e)return I(Ae)}function Be(e,t){if("keyword b"==e&&"else"==t)return I(S("form","else"),D,N)}function Qe(e,t){return"await"==t?I(Qe):"("==e?I(S(")"),Te,N):void 0}function Te(e){return"var"==e?I(Ae,Me):"variable"==e?I(Me):C(Me)}function Me(e,t){return")"==e?I():";"==e?I(Me):"in"==t||"of"==t?(j.marked="keyword",I(P,Me)):C(P,Me)}function Le(e,t){return"*"==t?(j.mark