Admin Menu Editor - Version 1.9.4

Version Description

  • Fixed another warning about get_magic_quotes_gpc() being deprecated in PHP 7.4. This instance was missed in the previous patch.
  • Added a workaround for an issue with MailPoet 3 where some menu settings didn't work on MailPoet's admin pages.
  • Added a workaround for an issue with Extended Widget Options where the "getting started" page that's added by that plugin showed up in the menu editor even though it was supposed to be hidden.
  • Reduced the amount of space used by plugin visibility settings. This change will take effect the next time you save the settings.
  • Extended the "compress menu configuration data" feature to use ZLIB compression in addition to menu data restructuring. This greatly decreases the amount of data stored in the database, but increases decompression overhead.
Download this release

Release Info

Developer whiteshadow
Plugin Icon 128x128 Admin Menu Editor
Version 1.9.4
Comparing to
See all releases

Code changes from version 1.9.3 to 1.9.4

ajax-wrapper/AjaxWrapper.php CHANGED
@@ -448,7 +448,11 @@ if (!class_exists('Ajaw_v1_Action', false)):
448
  $this->get = $_GET;
449
  $this->request = $_REQUEST;
450
 
451
- if ( function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc() ) {
 
 
 
 
452
  $this->post = stripslashes_deep($this->post);
453
  $this->get = stripslashes_deep($this->get);
454
  }
448
  $this->get = $_GET;
449
  $this->request = $_REQUEST;
450
 
451
+ if (
452
+ version_compare(phpversion(), '7.4.0alpha1', '<')
453
+ && function_exists('get_magic_quotes_gpc')
454
+ && get_magic_quotes_gpc()
455
+ ) {
456
  $this->post = stripslashes_deep($this->post);
457
  $this->get = stripslashes_deep($this->get);
458
  }
ajax-wrapper/README.md CHANGED
@@ -1,23 +1,74 @@
1
  # AJAX Action Wrapper
2
 
3
- **Warning: Work in progress.** Not intended for public consumption. There is no documentation.
4
 
5
- This helper library makes it easier to handle AJAX requests in WordPress plugins.
 
 
 
 
 
 
 
 
 
 
6
 
7
- ### Goals
 
 
 
 
 
 
 
 
 
 
 
 
8
  - Automate common, boring stuff.
9
- - [x] Automatically pass the `admin-ajax.php` URL and nonce to JS.
10
- - [x] Define required parameters.
11
- - [x] Define optional parameters with default values.
12
- - [x] Automatically remove "magic quotes" that WordPress adds to `$_GET`, `$_POST` and `$_REQUEST`.
13
- - [x] Encode return values as JSON.
 
 
 
 
 
 
14
  - Security should be the default.
15
- - [x] Generate and verify nonces. Nonce verification is on by default, but can be disabled.
16
- - [x] Check capabilities.
17
- - [x] Verify that all required parameters are set.
18
- - [x] Validate parameter values.
19
- - [x] Set the required HTTP method.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  - Resilience.
21
- - [ ] Lenient response parsing to work around bugs in other plugins. For example, deal with extraneous whitespace and PHP notices in AJAX responses.
22
- - [ ] Multiple versions of the library can coexist on the same site.
 
 
23
 
 
1
  # AJAX Action Wrapper
2
 
3
+ This helper library makes it easier to handle AJAX requests in WordPress plugins. Mainly for personal use.
4
 
5
+ ### Example
6
+ Define action:
7
+ ```php
8
+ $exampleAction = ajaw_v1_CreateAction('ws_do_something')
9
+ ->handler(array($this, 'myAjaxCallback'))
10
+ ->requiredCap('manage_options')
11
+ ->method('post')
12
+ ->requiredParam('foo')
13
+ ->optionalParam('bar', 'default value')
14
+ ->register();
15
+ ```
16
 
17
+ Call from JavaScript:
18
+ ```javascript
19
+ AjawV1.getAction('ws_do_something').post(
20
+ {
21
+ 'foo': '...'
22
+ },
23
+ function(response) {
24
+ console.log(response);
25
+ }
26
+ );
27
+ ```
28
+
29
+ ### Features
30
  - Automate common, boring stuff.
31
+ - [x] Automatically pass the `admin-ajax.php` URL and nonce to JS.
32
+ - [x] Define required parameters.
33
+ ```php
34
+ $builder->requiredParam('foo', 'int')
35
+ ```
36
+ - [x] Define optional parameters with default values.
37
+ ```php
38
+ $builder->optionalParam('meaningOfLife', 42, 'int')
39
+ ```
40
+ - [x] Automatically remove "magic quotes" that WordPress adds to `$_GET`, `$_POST` and `$_REQUEST`.
41
+ - [x] Encode return values as JSON.
42
  - Security should be the default.
43
+ - [x] Generate and verify nonces. Nonce verification is on by default, but can be disabled.
44
+ ```php
45
+ $builder->withoutNonce()
46
+ ```
47
+ - [x] Check capabilities.
48
+ ```php
49
+ $builder->requiredCap('manage_options');
50
+ ```
51
+ - [x] Verify that all required parameters are set.
52
+ - [x] Validate parameter values.
53
+ ```php
54
+ $builder->optionalParam('things', 1, 'int', function($value) {
55
+ if ($value > 10) {
56
+ return new WP_Error(
57
+ 'excessive_things',
58
+ 'Too many things!',
59
+ 400 //HTTP status code.
60
+ );
61
+ }
62
+ })
63
+ ```
64
+ - [x] Set the required HTTP method.
65
+ ```php
66
+ $builder->method('post')
67
+ ```
68
  - Resilience.
69
+ - [ ] Lenient response parsing to work around bugs in other plugins. For example, deal with extraneous whitespace and PHP notices in AJAX responses.
70
+ - [x] Multiple versions of the library can coexist on the same site.
71
+
72
+ ### Why not use the REST API instead?
73
 
74
+ Backwards compatibility. In theory, this library should be compatible with WP 4.1+.
ajax-wrapper/ajax-action-wrapper.d.ts CHANGED
@@ -2,8 +2,8 @@
2
 
3
  declare namespace AjawV1 {
4
  interface RequestParams { [name: string]: any }
5
- interface SuccessCallback { (data, textStatus: string, jqXHR): string }
6
- interface ErrorCallback { (data, textStatus: string, jqXHR, errorThrown): string }
7
 
8
  class AjawAjaxAction {
9
  get(params?: RequestParams, success?: SuccessCallback, error?: ErrorCallback): void;
2
 
3
  declare namespace AjawV1 {
4
  interface RequestParams { [name: string]: any }
5
+ interface SuccessCallback { (data, textStatus: string, jqXHR): void }
6
+ interface ErrorCallback { (data, textStatus: string, jqXHR, errorThrown): void }
7
 
8
  class AjawAjaxAction {
9
  get(params?: RequestParams, success?: SuccessCallback, error?: ErrorCallback): void;
css/_boxes.scss CHANGED
@@ -1,11 +1,12 @@
1
  $amePostboxBorderColor: #ccd0d4; //Was #e5e5e5 before WP 5.3.
 
2
 
3
  @mixin ame-emulated-postbox($toggleWidth: 36px, $horizontalPadding: 12px) {
4
  $borderColor: $amePostboxBorderColor;
5
  $headerBackground: #fff;
6
 
7
  position: relative;
8
- box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
9
  background: $headerBackground;
10
 
11
  margin-bottom: 20px;
1
  $amePostboxBorderColor: #ccd0d4; //Was #e5e5e5 before WP 5.3.
2
+ $amePostboxShadow: 0 1px 1px rgba(0, 0, 0, 0.04);
3
 
4
  @mixin ame-emulated-postbox($toggleWidth: 36px, $horizontalPadding: 12px) {
5
  $borderColor: $amePostboxBorderColor;
6
  $headerBackground: #fff;
7
 
8
  position: relative;
9
+ box-shadow: $amePostboxShadow;
10
  background: $headerBackground;
11
 
12
  margin-bottom: 20px;
images/reset-permissions.png CHANGED
Binary file
includes/ame-utils.php CHANGED
@@ -15,20 +15,20 @@ class ameUtils {
15
  * @return mixed
16
  */
17
  public static function get($array, $path, $default = null, $separator = '.') {
18
- if (is_string($path)) {
19
  $path = explode($separator, $path);
20
  }
21
- if (empty($path)) {
22
  return $default;
23
  }
24
 
25
  //Follow the $path into $input as far as possible.
26
  $currentValue = $array;
27
  $pathExists = true;
28
- foreach($path as $node) {
29
- if (is_array($currentValue) && array_key_exists($node, $currentValue)) {
30
  $currentValue = $currentValue[$node];
31
- } else if (is_object($currentValue) && property_exists($currentValue, $node)) {
32
  $currentValue = $currentValue->$node;
33
  } else {
34
  $pathExists = false;
@@ -36,7 +36,7 @@ class ameUtils {
36
  }
37
  }
38
 
39
- if ($pathExists) {
40
  return $currentValue;
41
  }
42
  return $default;
@@ -59,9 +59,91 @@ class ameUtils {
59
  $fileName = ltrim($fileName, '/');
60
 
61
  $segments = explode('/', $fileName, 2);
62
- if ((count($segments) > 1) && ($segments[0] !== '')) {
63
  return $segments[0];
64
  }
65
  return null;
66
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  }
15
  * @return mixed
16
  */
17
  public static function get($array, $path, $default = null, $separator = '.') {
18
+ if ( is_string($path) ) {
19
  $path = explode($separator, $path);
20
  }
21
+ if ( empty($path) ) {
22
  return $default;
23
  }
24
 
25
  //Follow the $path into $input as far as possible.
26
  $currentValue = $array;
27
  $pathExists = true;
28
+ foreach ($path as $node) {
29
+ if ( is_array($currentValue) && array_key_exists($node, $currentValue) ) {
30
  $currentValue = $currentValue[$node];
31
+ } else if ( is_object($currentValue) && property_exists($currentValue, $node) ) {
32
  $currentValue = $currentValue->$node;
33
  } else {
34
  $pathExists = false;
36
  }
37
  }
38
 
39
+ if ( $pathExists ) {
40
  return $currentValue;
41
  }
42
  return $default;
59
  $fileName = ltrim($fileName, '/');
60
 
61
  $segments = explode('/', $fileName, 2);
62
+ if ( (count($segments) > 1) && ($segments[0] !== '') ) {
63
  return $segments[0];
64
  }
65
  return null;
66
  }
67
+ }
68
+
69
+ class ameFileLock {
70
+ protected $fileName;
71
+ protected $handle = null;
72
+
73
+ public function __construct($fileName) {
74
+ $this->fileName = $fileName;
75
+ }
76
+
77
+ public function acquire($timeout = null) {
78
+ if ( $this->handle !== null ) {
79
+ throw new RuntimeException('Cannot acquire a lock that is already held.');
80
+ }
81
+ if ( !function_exists('flock') ) {
82
+ return false;
83
+ }
84
+
85
+ $this->handle = @fopen(__FILE__, 'r');
86
+ if ( !$this->handle ) {
87
+ $this->handle = null;
88
+ return false;
89
+ }
90
+
91
+ $success = @flock($this->handle, LOCK_EX | LOCK_NB, $wouldBlock);
92
+
93
+ if ( !$success && $wouldBlock && ($timeout !== null) ) {
94
+ $timeout = max(min($timeout, 0.1), 600);
95
+ $endTime = microtime(true) + $timeout;
96
+ //Wait for a short, random time and try again.
97
+ do {
98
+ $canWaitMore = $this->waitRandom($endTime);
99
+ $success = @flock($this->handle, LOCK_EX | LOCK_NB, $wouldBlock);
100
+ } while (!$success && $wouldBlock && $canWaitMore);
101
+ }
102
+
103
+ if ( !$success ) {
104
+ fclose($this->handle);
105
+ $this->handle = null;
106
+ return false;
107
+ }
108
+ return true;
109
+ }
110
+
111
+ public function release() {
112
+ if ( $this->handle !== null ) {
113
+ @flock($this->handle, LOCK_UN);
114
+ fclose($this->handle);
115
+ $this->handle = null;
116
+ }
117
+ }
118
+
119
+ /**
120
+ * Wait for a random interval without going over $endTime.
121
+ *
122
+ * @param float|int $endTime Unix timestamp.
123
+ * @return bool TRUE if there's still time until $endTime, FALSE otherwise.
124
+ */
125
+ protected function waitRandom($endTime) {
126
+ $now = microtime(true);
127
+ if ( $now >= $endTime ) {
128
+ return false;
129
+ }
130
+
131
+ $delayMs = rand(80, 300);
132
+ $remainingTimeMs = ($endTime - $now) * 1000;
133
+ if ( $delayMs < $remainingTimeMs ) {
134
+ usleep($delayMs * 1000);
135
+ return true;
136
+ } else {
137
+ usleep($remainingTimeMs * 1000);
138
+ return false;
139
+ }
140
+ }
141
+
142
+ public static function create($fileName) {
143
+ return new self($fileName);
144
+ }
145
+
146
+ public function __destruct() {
147
+ $this->release();
148
+ }
149
  }
includes/editor-page.php CHANGED
@@ -27,6 +27,7 @@ $icons = array(
27
  foreach($icons as $name => $url) {
28
  $icons[$name] = $images_url . $url;
29
  }
 
30
 
31
  $hide_button_extra_tooltip = 'When "All" is selected, this will hide the menu from everyone except the current user'
32
  . ($is_multisite ? ' and Super Admin' : '') . '.';
@@ -144,18 +145,7 @@ function ame_output_sort_buttons($icons) {
144
  }
145
  ?>
146
 
147
- <?php if ( $is_pro_version ): ?>
148
- <div class="ws_separator">&nbsp;</div>
149
-
150
- <a id='ws_toggle_all_menus' class='ws_button' href='javascript:void(0)'
151
- title='Toggle all menus for the selected role'><img src='<?php echo $icons['toggle-all']; ?>' alt="Toggle all" /></a>
152
-
153
- <a id='ws_copy_role_permissions' class='ws_button' href='javascript:void(0)'
154
- title='Copy all menu permissions from one role to another'><img src='<?php echo $icons['copy-permissions']; ?>' alt="Copy permissions" /></a>
155
-
156
- <div class="ws_separator">&nbsp;</div>
157
- <?php endif; ?>
158
-
159
  <div class="clear"></div>
160
  </div>
161
  </div>
27
  foreach($icons as $name => $url) {
28
  $icons[$name] = $images_url . $url;
29
  }
30
+ $icons = apply_filters('admin_menu_editor-toolbar_icons', $icons, $images_url);
31
 
32
  $hide_button_extra_tooltip = 'When "All" is selected, this will hide the menu from everyone except the current user'
33
  . ($is_multisite ? ' and Super Admin' : '') . '.';
145
  }
146
  ?>
147
 
148
+ <?php do_action('admin_menu_editor-toolbar_row_2', $icons); ?>
 
 
 
 
 
 
 
 
 
 
 
149
  <div class="clear"></div>
150
  </div>
151
  </div>
includes/menu-editor-core.php CHANGED
@@ -245,6 +245,8 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
245
  'admin.php?page=WPCW_showPage_UserCourseAccess' => true,
246
  'admin.php?page=WPCW_showPage_UserProgess' => true,
247
  'admin.php?page=WPCW_showPage_UserProgess_quizAnswers' => true,
 
 
248
  );
249
 
250
  //AJAXify screen options
@@ -322,6 +324,7 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
322
  $this->import_settings();
323
  $should_save_options = true;
324
  }
 
325
 
326
  //Track first install time.
327
  if ( !isset($this->options['first_install_time']) ) {
@@ -353,6 +356,9 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
353
  add_action('admin_notices', array($this, 'display_security_log'));
354
  }
355
 
 
 
 
356
  if ( did_action('plugins_loaded') ) {
357
  $this->load_modules();
358
  } else {
@@ -840,7 +846,7 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
840
  }
841
 
842
  //Any capability that's assigned to a role probably isn't a meta capability.
843
- $allRealCaps = ameRoleUtils::get_all_capabilities();
844
  //Similarly, capabilities that are directly assigned to users are probably real.
845
  foreach($users as $user) {
846
  $allRealCaps = array_merge($allRealCaps, $user['capabilities']);
@@ -2569,7 +2575,7 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
2569
  $editor_data['custom_menu_js'] = ameMenu::to_json($custom_menu);
2570
 
2571
  //Create a list of all known capabilities and roles. Used for the drop-down list on the access field.
2572
- $all_capabilities = ameRoleUtils::get_all_capabilities();
2573
  //"level_X" capabilities are deprecated so we don't want people using them.
2574
  //This would look better with array_filter() and an anonymous function as a callback.
2575
  for($level = 0; $level <= 10; $level++){
@@ -3851,6 +3857,29 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
3851
  }
3852
  }
3853
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3854
  /**
3855
  * As of WP 3.5, the Links Manager is hidden by default. It's only visible if the user has existing links
3856
  * or they choose to enable it by installing the Links Manager plugin.
245
  'admin.php?page=WPCW_showPage_UserCourseAccess' => true,
246
  'admin.php?page=WPCW_showPage_UserProgess' => true,
247
  'admin.php?page=WPCW_showPage_UserProgess_quizAnswers' => true,
248
+ //Extended Widget Options
249
+ 'index.php?page=extended-widget-opts-getting-started' => true,
250
  );
251
 
252
  //AJAXify screen options
324
  $this->import_settings();
325
  $should_save_options = true;
326
  }
327
+ $this->zlib_compression = $this->options['compress_custom_menu'];
328
 
329
  //Track first install time.
330
  if ( !isset($this->options['first_install_time']) ) {
356
  add_action('admin_notices', array($this, 'display_security_log'));
357
  }
358
 
359
+ //Compatibility fix for MailPoet 3.
360
+ $this->apply_mailpoet_compat_fix();
361
+
362
  if ( did_action('plugins_loaded') ) {
363
  $this->load_modules();
364
  } else {
846
  }
847
 
848
  //Any capability that's assigned to a role probably isn't a meta capability.
849
+ $allRealCaps = ameRoleUtils::get_all_capabilities(true);
850
  //Similarly, capabilities that are directly assigned to users are probably real.
851
  foreach($users as $user) {
852
  $allRealCaps = array_merge($allRealCaps, $user['capabilities']);
2575
  $editor_data['custom_menu_js'] = ameMenu::to_json($custom_menu);
2576
 
2577
  //Create a list of all known capabilities and roles. Used for the drop-down list on the access field.
2578
+ $all_capabilities = ameRoleUtils::get_all_capabilities(is_multisite());
2579
  //"level_X" capabilities are deprecated so we don't want people using them.
2580
  //This would look better with array_filter() and an anonymous function as a callback.
2581
  for($level = 0; $level <= 10; $level++){
3857
  }
3858
  }
3859
 
3860
+ /**
3861
+ * Compatibility fix for MailPoet 3. Last tested with MailPoet 3.44.0.
3862
+ *
3863
+ * MailPoet deliberately removes all third-party stylesheets from its admin pages.
3864
+ * As a result, some AME features that use stylesheets - like custom menu icons and admin
3865
+ * menu colors - don't work on those pages. Let's fix that by whitelisting our styles.
3866
+ */
3867
+ private function apply_mailpoet_compat_fix() {
3868
+ add_filter('mailpoet_conflict_resolver_whitelist_style', array($this, '_whitelist_ame_styles_for_mailpoet'));
3869
+ }
3870
+
3871
+ /**
3872
+ * @internal
3873
+ * @param array $styles
3874
+ * @return array
3875
+ */
3876
+ public function _whitelist_ame_styles_for_mailpoet($styles) {
3877
+ $styles[] = 'ame_output_menu_color_css';
3878
+ $styles[] = 'font-awesome\.css';
3879
+ $styles[] = 'force-dashicons\.css';
3880
+ return $styles;
3881
+ }
3882
+
3883
  /**
3884
  * As of WP 3.5, the Links Manager is hidden by default. It's only visible if the user has existing links
3885
  * or they choose to enable it by installing the Links Manager plugin.
includes/role-utils.php CHANGED
@@ -6,11 +6,19 @@ class ameRoleUtils {
6
  * @param bool $include_multisite_caps
7
  * @return array Associative array with capability names as keys
8
  */
9
- public static function get_all_capabilities($include_multisite_caps = true){
 
 
 
 
10
  //Cache the results.
11
- static $capabilities = null;
12
- if ( isset($capabilities) ) {
13
- return $capabilities;
 
 
 
 
14
  }
15
 
16
  $wp_roles = self::get_roles();
@@ -22,6 +30,7 @@ class ameRoleUtils {
22
  $capabilities = array_merge($capabilities, $role['capabilities']);
23
  }
24
  }
 
25
 
26
  //Add multisite-specific capabilities (not listed in any roles in WP 3.0)
27
  if ($include_multisite_caps) {
@@ -34,6 +43,7 @@ class ameRoleUtils {
34
  'manage_network_plugins' => 1,
35
  );
36
  $capabilities = array_merge($capabilities, $multisite_caps);
 
37
  }
38
 
39
  return $capabilities;
6
  * @param bool $include_multisite_caps
7
  * @return array Associative array with capability names as keys
8
  */
9
+ public static function get_all_capabilities($include_multisite_caps = null){
10
+ if ( $include_multisite_caps === null ) {
11
+ $include_multisite_caps = is_multisite();
12
+ }
13
+
14
  //Cache the results.
15
+ static $regular_cache = null, $multisite_cache = null;
16
+ if ( $include_multisite_caps ) {
17
+ if ( isset($multisite_cache) ) {
18
+ return $multisite_cache;
19
+ }
20
+ } else if ( isset($regular_cache) ) {
21
+ return $regular_cache;
22
  }
23
 
24
  $wp_roles = self::get_roles();
30
  $capabilities = array_merge($capabilities, $role['capabilities']);
31
  }
32
  }
33
+ $regular_cache = $capabilities;
34
 
35
  //Add multisite-specific capabilities (not listed in any roles in WP 3.0)
36
  if ($include_multisite_caps) {
43
  'manage_network_plugins' => 1,
44
  );
45
  $capabilities = array_merge($capabilities, $multisite_caps);
46
+ $multisite_cache = $capabilities;
47
  }
48
 
49
  return $capabilities;
includes/shadow_plugin_framework.php CHANGED
@@ -22,7 +22,8 @@ class MenuEd_ShadowPluginFramework {
22
  public $option_name = ''; //should be set or overridden by the plugin
23
  protected $defaults = array(); //should be set or overridden by the plugin
24
  protected $sitewide_options = false; //WPMU only : save the setting in a site-wide option
25
- protected $serialize_with_json = false; //Use the JSON format for option storage
 
26
 
27
  public $plugin_file = ''; //Filename of the plugin.
28
  public $plugin_basename = ''; //Basename of the plugin, as returned by plugin_basename().
@@ -120,7 +121,18 @@ class MenuEd_ShadowPluginFramework {
120
  } else {
121
  $this->options = get_option($option_name);
122
  }
123
-
 
 
 
 
 
 
 
 
 
 
 
124
  if ( $this->serialize_with_json || is_string($this->options) ){
125
  $this->options = $this->json_decode($this->options, true);
126
  }
@@ -146,7 +158,12 @@ class MenuEd_ShadowPluginFramework {
146
  if ( $this->serialize_with_json ){
147
  $stored_options = $this->json_encode($stored_options);
148
  }
149
-
 
 
 
 
 
150
  if ( $this->sitewide_options && is_multisite() ) {
151
  return self::atomic_update_site_option($this->option_name, $stored_options);
152
  } else {
22
  public $option_name = ''; //should be set or overridden by the plugin
23
  protected $defaults = array(); //should be set or overridden by the plugin
24
  protected $sitewide_options = false; //WPMU only : save the setting in a site-wide option
25
+ protected $serialize_with_json = false; //Use the JSON format for option storage
26
+ protected $zlib_compression = false;
27
 
28
  public $plugin_file = ''; //Filename of the plugin.
29
  public $plugin_basename = ''; //Basename of the plugin, as returned by plugin_basename().
121
  } else {
122
  $this->options = get_option($option_name);
123
  }
124
+
125
+ $prefix = 'gzcompress:';
126
+ if (
127
+ is_string($this->options)
128
+ && (substr($this->options, 0, strlen($prefix)) === $prefix)
129
+ && function_exists('gzuncompress')
130
+ ) {
131
+ //TODO: Maybe this would be faster if we stored the flag separately?
132
+ /** @noinspection PhpComposerExtensionStubsInspection */
133
+ $this->options = unserialize(gzuncompress(base64_decode(substr($this->options, strlen($prefix)))));
134
+ }
135
+
136
  if ( $this->serialize_with_json || is_string($this->options) ){
137
  $this->options = $this->json_decode($this->options, true);
138
  }
158
  if ( $this->serialize_with_json ){
159
  $stored_options = $this->json_encode($stored_options);
160
  }
161
+
162
+ if ( $this->zlib_compression && function_exists('gzcompress') ) {
163
+ /** @noinspection PhpComposerExtensionStubsInspection */
164
+ $stored_options = 'gzcompress:' . base64_encode(gzcompress(serialize($stored_options)));
165
+ }
166
+
167
  if ( $this->sitewide_options && is_multisite() ) {
168
  return self::atomic_update_site_option($this->option_name, $stored_options);
169
  } else {
js/actor-manager.js CHANGED
@@ -1,4 +1,5 @@
1
  /// <reference path="lodash-3.10.d.ts" />
 
2
  /// <reference path="common.d.ts" />
3
  var __extends = (this && this.__extends) || (function () {
4
  var extendStatics = function (d, b) {
@@ -42,7 +43,7 @@ var AmeBaseActor = /** @class */ (function () {
42
  return null;
43
  };
44
  AmeBaseActor.getActorSpecificity = function (actorId) {
45
- var actorType = actorId.substring(0, actorId.indexOf(':')), specificity = 0;
46
  switch (actorType) {
47
  case 'role':
48
  specificity = 1;
@@ -357,6 +358,18 @@ var AmeActorManager = /** @class */ (function () {
357
  delete context[actor][capability];
358
  }
359
  };
 
 
 
 
 
 
 
 
 
 
 
 
360
  /**
361
  * Remove redundant granted capabilities.
362
  *
1
  /// <reference path="lodash-3.10.d.ts" />
2
+ /// <reference path="knockout.d.ts" />
3
  /// <reference path="common.d.ts" />
4
  var __extends = (this && this.__extends) || (function () {
5
  var extendStatics = function (d, b) {
43
  return null;
44
  };
45
  AmeBaseActor.getActorSpecificity = function (actorId) {
46
+ var actorType = actorId.substring(0, actorId.indexOf(':')), specificity;
47
  switch (actorType) {
48
  case 'role':
49
  specificity = 1;
358
  delete context[actor][capability];
359
  }
360
  };
361
+ /**
362
+ * Reset all capabilities granted to an actor.
363
+ * @param actor
364
+ * @return boolean TRUE if anything was reset or FALSE if the actor didn't have any granted capabilities.
365
+ */
366
+ AmeActorManager.prototype.resetActorCaps = function (actor) {
367
+ if (AmeActorManager._.has(this.grantedCapabilities, actor)) {
368
+ delete this.grantedCapabilities[actor];
369
+ return true;
370
+ }
371
+ return false;
372
+ };
373
  /**
374
  * Remove redundant granted capabilities.
375
  *
js/actor-manager.ts CHANGED
@@ -1,4 +1,5 @@
1
  /// <reference path="lodash-3.10.d.ts" />
 
2
  /// <reference path="common.d.ts" />
3
 
4
  declare let wsAmeActorData: any;
@@ -58,7 +59,7 @@ abstract class AmeBaseActor implements IAmeActor {
58
 
59
  static getActorSpecificity(actorId: string) {
60
  let actorType = actorId.substring(0, actorId.indexOf(':')),
61
- specificity = 0;
62
  switch (actorType) {
63
  case 'role':
64
  specificity = 1;
@@ -476,6 +477,19 @@ class AmeActorManager implements AmeActorManagerInterface {
476
  }
477
  }
478
 
 
 
 
 
 
 
 
 
 
 
 
 
 
479
  /**
480
  * Remove redundant granted capabilities.
481
  *
1
  /// <reference path="lodash-3.10.d.ts" />
2
+ /// <reference path="knockout.d.ts" />
3
  /// <reference path="common.d.ts" />
4
 
5
  declare let wsAmeActorData: any;
59
 
60
  static getActorSpecificity(actorId: string) {
61
  let actorType = actorId.substring(0, actorId.indexOf(':')),
62
+ specificity;
63
  switch (actorType) {
64
  case 'role':
65
  specificity = 1;
477
  }
478
  }
479
 
480
+ /**
481
+ * Reset all capabilities granted to an actor.
482
+ * @param actor
483
+ * @return boolean TRUE if anything was reset or FALSE if the actor didn't have any granted capabilities.
484
+ */
485
+ resetActorCaps(actor: string): boolean {
486
+ if (AmeActorManager._.has(this.grantedCapabilities, actor)) {
487
+ delete this.grantedCapabilities[actor];
488
+ return true;
489
+ }
490
+ return false;
491
+ }
492
+
493
  /**
494
  * Remove redundant granted capabilities.
495
  *
js/common.d.ts CHANGED
@@ -1,3 +1,6 @@
1
  interface AmeDictionary<T> {
2
  [mapKey: string] : T;
3
- }
 
 
 
1
  interface AmeDictionary<T> {
2
  [mapKey: string] : T;
3
+ }
4
+
5
+ // noinspection JSUnusedGlobalSymbols
6
+ type KeysMatchingType<T, V> = { [K in keyof T]: T[K] extends V ? K : never }[keyof T];
js/knockout.d.ts CHANGED
@@ -1,631 +1,1064 @@
1
- // Type definitions for Knockout v3.2.0
2
- // Project: http://knockoutjs.com
3
- // Definitions by: Boris Yankov <https://github.com/borisyankov/>, Igor Oleinikov <https://github.com/Igorbek/>, Clément Bourgeois <https://github.com/moonpyk/>
4
- // Definitions: https://github.com/borisyankov/DefinitelyTyped
5
-
6
-
7
- interface KnockoutSubscribableFunctions<T> {
8
- [key: string]: KnockoutBindingHandler;
9
-
10
- notifySubscribers(valueToWrite?: T, event?: string): void;
11
- }
12
-
13
- interface KnockoutComputedFunctions<T> {
14
- [key: string]: KnockoutBindingHandler;
15
- }
16
-
17
- interface KnockoutObservableFunctions<T> {
18
- [key: string]: KnockoutBindingHandler;
19
-
20
- equalityComparer(a: any, b: any): boolean;
21
- }
22
-
23
- interface KnockoutObservableArrayFunctions<T> {
24
- // General Array functions
25
- indexOf(searchElement: T, fromIndex?: number): number;
26
- slice(start: number, end?: number): T[];
27
- splice(start: number): T[];
28
- splice(start: number, deleteCount: number, ...items: T[]): T[];
29
- pop(): T;
30
- push(...items: T[]): void;
31
- shift(): T;
32
- unshift(...items: T[]): number;
33
- reverse(): KnockoutObservableArray<T>;
34
- sort(): KnockoutObservableArray<T>;
35
- sort(compareFunction: (left: T, right: T) => number): KnockoutObservableArray<T>;
36
-
37
- // Ko specific
38
- [key: string]: KnockoutBindingHandler;
39
-
40
- replace(oldItem: T, newItem: T): void;
41
-
42
- remove(item: T): T[];
43
- remove(removeFunction: (item: T) => boolean): T[];
44
- removeAll(items: T[]): T[];
45
- removeAll(): T[];
46
-
47
- destroy(item: T): void;
48
- destroy(destroyFunction: (item: T) => boolean): void;
49
- destroyAll(items: T[]): void;
50
- destroyAll(): void;
51
- }
52
-
53
- interface KnockoutSubscribableStatic {
54
- fn: KnockoutSubscribableFunctions<any>;
55
-
56
- new <T>(): KnockoutSubscribable<T>;
57
- }
58
-
59
- interface KnockoutSubscription {
60
- dispose(): void;
61
- }
62
-
63
- interface KnockoutSubscribable<T> extends KnockoutSubscribableFunctions<T> {
64
- subscribe(callback: (newValue: T) => void, target?: any, event?: string): KnockoutSubscription;
65
- subscribe<TEvent>(callback: (newValue: TEvent) => void, target: any, event: string): KnockoutSubscription;
66
- extend(requestedExtenders: { [key: string]: any; }): KnockoutSubscribable<T>;
67
- getSubscriptionsCount(): number;
68
- }
69
-
70
- interface KnockoutComputedStatic {
71
- fn: KnockoutComputedFunctions<any>;
72
-
73
- <T>(): KnockoutComputed<T>;
74
- <T>(func: () => T, context?: any, options?: any): KnockoutComputed<T>;
75
- <T>(def: KnockoutComputedDefine<T>, context?: any): KnockoutComputed<T>;
76
- }
77
-
78
- interface KnockoutComputed<T> extends KnockoutObservable<T>, KnockoutComputedFunctions<T> {
79
- fn: KnockoutComputedFunctions<any>;
80
-
81
- dispose(): void;
82
- isActive(): boolean;
83
- getDependenciesCount(): number;
84
- extend(requestedExtenders: { [key: string]: any; }): KnockoutComputed<T>;
85
- }
86
-
87
- interface KnockoutObservableArrayStatic {
88
- fn: KnockoutObservableArrayFunctions<any>;
89
-
90
- <T>(value?: T[]): KnockoutObservableArray<T>;
91
- }
92
-
93
- interface KnockoutObservableArray<T> extends KnockoutObservable<T[]>, KnockoutObservableArrayFunctions<T> {
94
- extend(requestedExtenders: { [key: string]: any; }): KnockoutObservableArray<T>;
95
- }
96
-
97
- interface KnockoutObservableStatic {
98
- fn: KnockoutObservableFunctions<any>;
99
-
100
- <T>(value?: T): KnockoutObservable<T>;
101
- }
102
-
103
- interface KnockoutObservable<T> extends KnockoutSubscribable<T>, KnockoutObservableFunctions<T> {
104
- (): T;
105
- (value: T): void;
106
-
107
- peek(): T;
108
- valueHasMutated?:{(): void;};
109
- valueWillMutate?:{(): void;};
110
- extend(requestedExtenders: { [key: string]: any; }): KnockoutObservable<T>;
111
- }
112
-
113
- interface KnockoutComputedDefine<T> {
114
- read(): T;
115
- write? (value: T): void;
116
- disposeWhenNodeIsRemoved?: Node;
117
- disposeWhen? (): boolean;
118
- owner?: any;
119
- deferEvaluation?: boolean;
120
- pure?: boolean;
121
- }
122
-
123
- interface KnockoutBindingContext {
124
- $parent: any;
125
- $parents: any[];
126
- $root: any;
127
- $data: any;
128
- $rawData: any | KnockoutObservable<any>;
129
- $index?: KnockoutObservable<number>;
130
- $parentContext?: KnockoutBindingContext;
131
- $component: any;
132
- $componentTemplateNodes: Node[];
133
-
134
- extend(properties: any): any;
135
- createChildContext(dataItemOrAccessor: any, dataItemAlias?: any, extendCallback?: Function): any;
136
- }
137
-
138
- interface KnockoutAllBindingsAccessor {
139
- (): any;
140
- get(name: string): any;
141
- has(name: string): boolean;
142
- }
143
-
144
- interface KnockoutBindingHandler {
145
- after?: Array<string>;
146
- init?: (element: any, valueAccessor: () => any, allBindingsAccessor?: KnockoutAllBindingsAccessor, viewModel?: any, bindingContext?: KnockoutBindingContext) => void | { controlsDescendantBindings: boolean; };
147
- update?: (element: any, valueAccessor: () => any, allBindingsAccessor?: KnockoutAllBindingsAccessor, viewModel?: any, bindingContext?: KnockoutBindingContext) => void;
148
- options?: any;
149
- preprocess?: (value: string, name: string, addBindingCallback?: (name: string, value: string) => void) => string;
150
- }
151
-
152
- interface KnockoutBindingHandlers {
153
- [bindingHandler: string]: KnockoutBindingHandler;
154
-
155
- // Controlling text and appearance
156
- visible: KnockoutBindingHandler;
157
- text: KnockoutBindingHandler;
158
- html: KnockoutBindingHandler;
159
- css: KnockoutBindingHandler;
160
- style: KnockoutBindingHandler;
161
- attr: KnockoutBindingHandler;
162
-
163
- // Control Flow
164
- foreach: KnockoutBindingHandler;
165
- if: KnockoutBindingHandler;
166
- ifnot: KnockoutBindingHandler;
167
- with: KnockoutBindingHandler;
168
-
169
- // Working with form fields
170
- click: KnockoutBindingHandler;
171
- event: KnockoutBindingHandler;
172
- submit: KnockoutBindingHandler;
173
- enable: KnockoutBindingHandler;
174
- disable: KnockoutBindingHandler;
175
- value: KnockoutBindingHandler;
176
- textInput: KnockoutBindingHandler;
177
- hasfocus: KnockoutBindingHandler;
178
- checked: KnockoutBindingHandler;
179
- options: KnockoutBindingHandler;
180
- selectedOptions: KnockoutBindingHandler;
181
- uniqueName: KnockoutBindingHandler;
182
-
183
- // Rendering templates
184
- template: KnockoutBindingHandler;
185
-
186
- // Components (new for v3.2)
187
- component: KnockoutBindingHandler;
188
- }
189
-
190
- interface KnockoutMemoization {
191
- memoize(callback: () => string): string;
192
- unmemoize(memoId: string, callbackParams: any[]): boolean;
193
- unmemoizeDomNodeAndDescendants(domNode: any, extraCallbackParamsArray: any[]): boolean;
194
- parseMemoText(memoText: string): string;
195
- }
196
-
197
- interface KnockoutVirtualElement {}
198
-
199
- interface KnockoutVirtualElements {
200
- allowedBindings: { [bindingName: string]: boolean; };
201
- emptyNode(node: KnockoutVirtualElement ): void;
202
- firstChild(node: KnockoutVirtualElement ): KnockoutVirtualElement;
203
- insertAfter( container: KnockoutVirtualElement, nodeToInsert: Node, insertAfter: Node ): void;
204
- nextSibling(node: KnockoutVirtualElement): Node;
205
- prepend(node: KnockoutVirtualElement, toInsert: Node ): void;
206
- setDomNodeChildren(node: KnockoutVirtualElement, newChildren: { length: number;[index: number]: Node; } ): void;
207
- childNodes(node: KnockoutVirtualElement ): Node[];
208
- }
209
-
210
- interface KnockoutExtenders {
211
- throttle(target: any, timeout: number): KnockoutComputed<any>;
212
- notify(target: any, notifyWhen: string): any;
213
-
214
- rateLimit(target: any, timeout: number): any;
215
- rateLimit(target: any, options: { timeout: number; method?: string; }): any;
216
-
217
- trackArrayChanges(target: any): any;
218
- }
219
-
220
- //
221
- // NOTE TO MAINTAINERS AND CONTRIBUTORS : pay attention to only include symbols that are
222
- // publicly exported in the minified version of ko, without that you can give the false
223
- // impression that some functions will be available in production builds.
224
- //
225
- interface KnockoutUtils {
226
- //////////////////////////////////
227
- // utils.domData.js
228
- //////////////////////////////////
229
-
230
- domData: {
231
- get (node: Element, key: string): any;
232
-
233
- set (node: Element, key: string, value: any): void;
234
-
235
- getAll(node: Element, createIfNotFound: boolean): any;
236
-
237
- clear(node: Element): boolean;
238
- };
239
-
240
- //////////////////////////////////
241
- // utils.domNodeDisposal.js
242
- //////////////////////////////////
243
-
244
- domNodeDisposal: {
245
- addDisposeCallback(node: Element, callback: Function): void;
246
-
247
- removeDisposeCallback(node: Element, callback: Function): void;
248
-
249
- cleanNode(node: Node): Element;
250
-
251
- removeNode(node: Node): void;
252
- };
253
-
254
- addOrRemoveItem<T>(array: T[] | KnockoutObservable<T>, value: T, included: T): void;
255
-
256
- arrayFilter<T>(array: T[], predicate: (item: T) => boolean): T[];
257
-
258
- arrayFirst<T>(array: T[], predicate: (item: T) => boolean, predicateOwner?: any): T;
259
-
260
- arrayForEach<T>(array: T[], action: (item: T, index: number) => void): void;
261
-
262
- arrayGetDistinctValues<T>(array: T[]): T[];
263
-
264
- arrayIndexOf<T>(array: T[], item: T): number;
265
-
266
- arrayMap<T, U>(array: T[], mapping: (item: T) => U): U[];
267
-
268
- arrayPushAll<T>(array: T[] | KnockoutObservableArray<T>, valuesToPush: T[]): T[];
269
-
270
- arrayRemoveItem(array: any[], itemToRemove: any): void;
271
-
272
- compareArrays<T>(a: T[], b: T[]): Array<KnockoutArrayChange<T>>;
273
-
274
- extend(target: Object, source: Object): Object;
275
-
276
- fieldsIncludedWithJsonPost: any[];
277
-
278
- getFormFields(form: any, fieldName: string): any[];
279
-
280
- objectForEach(obj: any, action: (key: any, value: any) => void): void;
281
-
282
- parseHtmlFragment(html: string): any[];
283
-
284
- parseJson(jsonString: string): any;
285
-
286
- postJson(urlOrForm: any, data: any, options: any): void;
287
-
288
- peekObservable<T>(value: KnockoutObservable<T>): T;
289
-
290
- range(min: any, max: any): any;
291
-
292
- registerEventHandler(element: any, eventType: any, handler: Function): void;
293
-
294
- setHtml(node: Element, html: () => string): void;
295
-
296
- setHtml(node: Element, html: string): void;
297
-
298
- setTextContent(element: any, textContent: string | KnockoutObservable<string>): void;
299
-
300
- stringifyJson(data: any, replacer?: Function, space?: string): string;
301
-
302
- toggleDomNodeCssClass(node: any, className: string, shouldHaveClass: boolean): void;
303
-
304
- triggerEvent(element: any, eventType: any): void;
305
-
306
- unwrapObservable<T>(value: KnockoutObservable<T> | T): T;
307
-
308
- // NOT PART OF THE MINIFIED API SURFACE (ONLY IN knockout-{version}.debug.js) https://github.com/SteveSanderson/knockout/issues/670
309
- // forceRefresh(node: any): void;
310
- // ieVersion: number;
311
- // isIe6: boolean;
312
- // isIe7: boolean;
313
- // jQueryHtmlParse(html: string): any[];
314
- // makeArray(arrayLikeObject: any): any[];
315
- // moveCleanedNodesToContainerElement(nodes: any[]): HTMLElement;
316
- // replaceDomNodes(nodeToReplaceOrNodeArray: any, newNodesArray: any[]): void;
317
- // setDomNodeChildren(domNode: any, childNodes: any[]): void;
318
- // setElementName(element: any, name: string): void;
319
- // setOptionNodeSelectionState(optionNode: any, isSelected: boolean): void;
320
- // simpleHtmlParse(html: string): any[];
321
- // stringStartsWith(str: string, startsWith: string): boolean;
322
- // stringTokenize(str: string, delimiter: string): string[];
323
- // stringTrim(str: string): string;
324
- // tagNameLower(element: any): string;
325
- }
326
-
327
- interface KnockoutArrayChange<T> {
328
- status: string;
329
- value: T;
330
- index: number;
331
- moved?: number;
332
- }
333
-
334
- //////////////////////////////////
335
- // templateSources.js
336
- //////////////////////////////////
337
-
338
- interface KnockoutTemplateSourcesDomElement {
339
- text(): any;
340
- text(value: any): void;
341
-
342
- data(key: string): any;
343
- data(key: string, value: any): any;
344
- }
345
-
346
- interface KnockoutTemplateAnonymous extends KnockoutTemplateSourcesDomElement {
347
- nodes(): any;
348
- nodes(value: any): void;
349
- }
350
-
351
- interface KnockoutTemplateSources {
352
-
353
- domElement: {
354
- prototype: KnockoutTemplateSourcesDomElement
355
- new (element: Element): KnockoutTemplateSourcesDomElement
356
- };
357
-
358
- anonymousTemplate: {
359
- prototype: KnockoutTemplateAnonymous;
360
- new (element: Element): KnockoutTemplateAnonymous;
361
- };
362
- }
363
-
364
- //////////////////////////////////
365
- // nativeTemplateEngine.js
366
- //////////////////////////////////
367
-
368
- interface KnockoutNativeTemplateEngine {
369
-
370
- renderTemplateSource(templateSource: Object, bindingContext?: KnockoutBindingContext, options?: Object): any[];
371
- }
372
-
373
- //////////////////////////////////
374
- // templateEngine.js
375
- //////////////////////////////////
376
-
377
- interface KnockoutTemplateEngine extends KnockoutNativeTemplateEngine {
378
-
379
- createJavaScriptEvaluatorBlock(script: string): string;
380
-
381
- makeTemplateSource(template: any, templateDocument?: Document): any;
382
-
383
- renderTemplate(template: any, bindingContext: KnockoutBindingContext, options: Object, templateDocument: Document): any;
384
-
385
- isTemplateRewritten(template: any, templateDocument: Document): boolean;
386
-
387
- rewriteTemplate(template: any, rewriterCallback: Function, templateDocument: Document): void;
388
- }
389
-
390
- /////////////////////////////////
391
-
392
- interface KnockoutStatic {
393
- utils: KnockoutUtils;
394
- memoization: KnockoutMemoization;
395
-
396
- bindingHandlers: KnockoutBindingHandlers;
397
- getBindingHandler(handler: string): KnockoutBindingHandler;
398
-
399
- virtualElements: KnockoutVirtualElements;
400
- extenders: KnockoutExtenders;
401
-
402
- applyBindings(viewModelOrBindingContext?: any, rootNode?: any): void;
403
- applyBindingsToDescendants(viewModelOrBindingContext: any, rootNode: any): void;
404
- applyBindingAccessorsToNode(node: Node, bindings: (bindingContext: KnockoutBindingContext, node: Node) => {}, bindingContext: KnockoutBindingContext): void;
405
- applyBindingAccessorsToNode(node: Node, bindings: {}, bindingContext: KnockoutBindingContext): void;
406
- applyBindingAccessorsToNode(node: Node, bindings: (bindingContext: KnockoutBindingContext, node: Node) => {}, viewModel: any): void;
407
- applyBindingAccessorsToNode(node: Node, bindings: {}, viewModel: any): void;
408
- applyBindingsToNode(node: Node, bindings: any, viewModelOrBindingContext?: any): any;
409
-
410
- subscribable: KnockoutSubscribableStatic;
411
- observable: KnockoutObservableStatic;
412
-
413
- computed: KnockoutComputedStatic;
414
- pureComputed<T>(evaluatorFunction: () => T, context?: any): KnockoutComputed<T>;
415
- pureComputed<T>(options: KnockoutComputedDefine<T>, context?: any): KnockoutComputed<T>;
416
-
417
- observableArray: KnockoutObservableArrayStatic;
418
-
419
- contextFor(node: any): any;
420
- isSubscribable(instance: any): boolean;
421
- toJSON(viewModel: any, replacer?: Function, space?: any): string;
422
- toJS(viewModel: any): any;
423
- isObservable(instance: any): boolean;
424
- isWriteableObservable(instance: any): boolean;
425
- isComputed(instance: any): boolean;
426
- dataFor(node: any): any;
427
- removeNode(node: Element): void;
428
- cleanNode(node: Element): Element;
429
- renderTemplate(template: Function, viewModel: any, options?: any, target?: any, renderMode?: any): any;
430
- renderTemplate(template: string, viewModel: any, options?: any, target?: any, renderMode?: any): any;
431
- unwrap<T>(value: KnockoutObservable<T> | T): T;
432
-
433
- computedContext: KnockoutComputedContext;
434
-
435
- //////////////////////////////////
436
- // templateSources.js
437
- //////////////////////////////////
438
-
439
- templateSources: KnockoutTemplateSources;
440
-
441
- //////////////////////////////////
442
- // templateEngine.js
443
- //////////////////////////////////
444
-
445
- templateEngine: {
446
-
447
- prototype: KnockoutTemplateEngine;
448
-
449
- new (): KnockoutTemplateEngine;
450
- };
451
-
452
- //////////////////////////////////
453
- // templateRewriting.js
454
- //////////////////////////////////
455
-
456
- templateRewriting: {
457
-
458
- ensureTemplateIsRewritten(template: Node, templateEngine: KnockoutTemplateEngine, templateDocument: Document): any;
459
- ensureTemplateIsRewritten(template: string, templateEngine: KnockoutTemplateEngine, templateDocument: Document): any;
460
-
461
- memoizeBindingAttributeSyntax(htmlString: string, templateEngine: KnockoutTemplateEngine): any;
462
-
463
- applyMemoizedBindingsToNextSibling(bindings: any, nodeName: string): string;
464
- };
465
-
466
- //////////////////////////////////
467
- // nativeTemplateEngine.js
468
- //////////////////////////////////
469
-
470
- nativeTemplateEngine: {
471
-
472
- prototype: KnockoutNativeTemplateEngine;
473
-
474
- new (): KnockoutNativeTemplateEngine;
475
-
476
- instance: KnockoutNativeTemplateEngine;
477
- };
478
-
479
- //////////////////////////////////
480
- // jqueryTmplTemplateEngine.js
481
- //////////////////////////////////
482
-
483
- jqueryTmplTemplateEngine: {
484
-
485
- prototype: KnockoutTemplateEngine;
486
-
487
- renderTemplateSource(templateSource: Object, bindingContext: KnockoutBindingContext, options: Object): Node[];
488
-
489
- createJavaScriptEvaluatorBlock(script: string): string;
490
-
491
- addTemplate(templateName: string, templateMarkup: string): void;
492
- };
493
-
494
- //////////////////////////////////
495
- // templating.js
496
- //////////////////////////////////
497
-
498
- setTemplateEngine(templateEngine: KnockoutNativeTemplateEngine): void;
499
-
500
- renderTemplate(template: Function, dataOrBindingContext: KnockoutBindingContext, options: Object, targetNodeOrNodeArray: Node, renderMode: string): any;
501
- renderTemplate(template: any, dataOrBindingContext: KnockoutBindingContext, options: Object, targetNodeOrNodeArray: Node, renderMode: string): any;
502
- renderTemplate(template: Function, dataOrBindingContext: any, options: Object, targetNodeOrNodeArray: Node, renderMode: string): any;
503
- renderTemplate(template: any, dataOrBindingContext: any, options: Object, targetNodeOrNodeArray: Node, renderMode: string): any;
504
- renderTemplate(template: Function, dataOrBindingContext: KnockoutBindingContext, options: Object, targetNodeOrNodeArray: Node[], renderMode: string): any;
505
- renderTemplate(template: any, dataOrBindingContext: KnockoutBindingContext, options: Object, targetNodeOrNodeArray: Node[], renderMode: string): any;
506
- renderTemplate(template: Function, dataOrBindingContext: any, options: Object, targetNodeOrNodeArray: Node[], renderMode: string): any;
507
- renderTemplate(template: any, dataOrBindingContext: any, options: Object, targetNodeOrNodeArray: Node[], renderMode: string): any;
508
-
509
- renderTemplateForEach(template: Function, arrayOrObservableArray: any[], options: Object, targetNode: Node, parentBindingContext: KnockoutBindingContext): any;
510
- renderTemplateForEach(template: any, arrayOrObservableArray: any[], options: Object, targetNode: Node, parentBindingContext: KnockoutBindingContext): any;
511
- renderTemplateForEach(template: Function, arrayOrObservableArray: KnockoutObservable<any>, options: Object, targetNode: Node, parentBindingContext: KnockoutBindingContext): any;
512
- renderTemplateForEach(template: any, arrayOrObservableArray: KnockoutObservable<any>, options: Object, targetNode: Node, parentBindingContext: KnockoutBindingContext): any;
513
-
514
- expressionRewriting: {
515
- bindingRewriteValidators: any;
516
- parseObjectLiteral: { (objectLiteralString: string): any[] }
517
- };
518
-
519
- /////////////////////////////////
520
-
521
- bindingProvider: {
522
- instance: KnockoutBindingProvider;
523
- new (): KnockoutBindingProvider;
524
- }
525
-
526
- /////////////////////////////////
527
- // selectExtensions.js
528
- /////////////////////////////////
529
-
530
- selectExtensions: {
531
-
532
- readValue(element: HTMLElement): any;
533
-
534
- writeValue(element: HTMLElement, value: any): void;
535
- };
536
-
537
- components: KnockoutComponents;
538
- }
539
-
540
- interface KnockoutBindingProvider {
541
- nodeHasBindings(node: Node): boolean;
542
- getBindings(node: Node, bindingContext: KnockoutBindingContext): {};
543
- getBindingAccessors?(node: Node, bindingContext: KnockoutBindingContext): { [key: string]: string; };
544
- }
545
-
546
- interface KnockoutComputedContext {
547
- getDependenciesCount(): number;
548
- isInitial: () => boolean;
549
- isSleeping: boolean;
550
- }
551
-
552
- //
553
- // refactored types into a namespace to reduce global pollution
554
- // and used Union Types to simplify overloads (requires TypeScript 1.4)
555
- //
556
- declare module KnockoutComponentTypes {
557
-
558
- interface Config {
559
- viewModel?: ViewModelFunction | ViewModelSharedInstance | ViewModelFactoryFunction | AMDModule;
560
- template: string | Node[]| DocumentFragment | TemplateElement | AMDModule;
561
- synchronous?: boolean;
562
- }
563
-
564
- interface ComponentConfig {
565
- viewModel?: ViewModelFunction | ViewModelSharedInstance | ViewModelFactoryFunction | AMDModule;
566
- template: any;
567
- createViewModel?: any;
568
- }
569
-
570
- interface EmptyConfig {
571
- }
572
-
573
- // common AMD type
574
- interface AMDModule {
575
- require: string;
576
- }
577
-
578
- // viewmodel types
579
- interface ViewModelFunction {
580
- (params?: any): any;
581
- }
582
-
583
- interface ViewModelSharedInstance {
584
- instance: any;
585
- }
586
-
587
- interface ViewModelFactoryFunction {
588
- createViewModel: (params?: any, componentInfo?: ComponentInfo) => any;
589
- }
590
-
591
- interface ComponentInfo {
592
- element: Node;
593
- templateNodes: Node[];
594
- }
595
-
596
- interface TemplateElement {
597
- element: string | Node;
598
- }
599
-
600
- interface Loader {
601
- getConfig? (componentName: string, callback: (result: ComponentConfig) => void): void;
602
- loadComponent? (componentName: string, config: ComponentConfig, callback: (result: Definition) => void): void;
603
- loadTemplate? (componentName: string, templateConfig: any, callback: (result: Node[]) => void): void;
604
- loadViewModel? (componentName: string, viewModelConfig: any, callback: (result: any) => void): void;
605
- suppressLoaderExceptions?: boolean;
606
- }
607
-
608
- interface Definition {
609
- template: Node[];
610
- createViewModel? (params: any, options: { element: Node; }): any;
611
- }
612
- }
613
-
614
- interface KnockoutComponents {
615
- // overloads for register method:
616
- register(componentName: string, config: KnockoutComponentTypes.Config | KnockoutComponentTypes.EmptyConfig): void;
617
-
618
- isRegistered(componentName: string): boolean;
619
- unregister(componentName: string): void;
620
- get(componentName: string, callback: (definition: KnockoutComponentTypes.Definition) => void): void;
621
- clearCachedDefinition(componentName: string): void
622
- defaultLoader: KnockoutComponentTypes.Loader;
623
- loaders: KnockoutComponentTypes.Loader[];
624
- getComponentNameForNode(node: Node): string;
625
- }
626
-
627
- declare var ko: KnockoutStatic;
628
-
629
- declare module "knockout" {
630
- export = ko;
631
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Type definitions for Knockout v3.4.0
2
+ // Project: http://knockoutjs.com
3
+ // Definitions by: Boris Yankov <https://github.com/borisyankov>,
4
+ // Igor Oleinikov <https://github.com/Igorbek>,
5
+ // Clément Bourgeois <https://github.com/moonpyk>,
6
+ // Matt Brooks <https://github.com/EnableSoftware>,
7
+ // Benjamin Eckardt <https://github.com/BenjaminEckardt>,
8
+ // Mathias Lorenzen <https://github.com/ffMathy>,
9
+ // Leonardo Lombardi <https://github.com/ltlombardi>
10
+ // Retsam <https://github.com/Retsam>
11
+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
12
+ // TypeScript Version: 2.3
13
+
14
+ interface KnockoutSubscribableFunctions<T> {
15
+ /**
16
+ * Notify subscribers of knockout "change" event. This doesn't actually change the observable value.
17
+ * @param eventValue A value to be sent with the event.
18
+ * @param event The knockout event.
19
+ */
20
+ notifySubscribers(eventValue?: T, event?: "change"): void;
21
+ /**
22
+ * Notify subscribers of a knockout or user defined event.
23
+ * @param eventValue A value to be sent with the event.
24
+ * @param event The knockout or user defined event name.
25
+ */
26
+ notifySubscribers<U>(eventValue: U, event: string): void;
27
+ }
28
+
29
+ interface KnockoutComputedFunctions<T> {
30
+ }
31
+
32
+ interface KnockoutObservableFunctions<T> {
33
+ /**
34
+ * Used by knockout to decide if value of observable has changed and should notify subscribers. Returns true if instances are primitives, and false if are objects.
35
+ * If your observable holds an object, this can be overwritten to return equality based on your needs.
36
+ * @param a previous value.
37
+ * @param b next value.
38
+ */
39
+ equalityComparer(a: T, b: T): boolean;
40
+ }
41
+
42
+ // The functions of observable arrays that don't mutate the array
43
+ interface KnockoutReadonlyObservableArrayFunctions<T> {
44
+ /**
45
+ * Returns the index of the first occurrence of a value in an array.
46
+ * @param searchElement The value to locate in the array.
47
+ * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.
48
+ */
49
+ indexOf(searchElement: T, fromIndex?: number): number;
50
+ /**
51
+ * Returns a section of an array.
52
+ * @param start The beginning of the specified portion of the array.
53
+ * @param end The end of the specified portion of the array.
54
+ */
55
+ slice(start: number, end?: number): T[];
56
+ }
57
+ // The functions of observable arrays that mutate the array
58
+ interface KnockoutObservableArrayFunctions<T> extends KnockoutReadonlyObservableArrayFunctions<T> {
59
+ /**
60
+ * Removes and returns all the remaining elements starting from a given index.
61
+ * @param start The zero-based location in the array from which to start removing elements.
62
+ */
63
+ splice(start: number): T[];
64
+ /**
65
+ * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
66
+ * @param start The zero-based location in the array from which to start removing elements.
67
+ * @param deleteCount The number of elements to remove.
68
+ * @param items Elements to insert into the array in place of the deleted elements.
69
+ */
70
+ splice(start: number, deleteCount: number, ...items: T[]): T[];
71
+ /**
72
+ * Removes the last value from the array and returns it.
73
+ */
74
+ pop(): T;
75
+ /**
76
+ * Adds new item or items to the end of array.
77
+ * @param items Items to be added.
78
+ */
79
+ push(...items: T[]): void;
80
+ /**
81
+ * Removes the first value from the array and returns it.
82
+ */
83
+ shift(): T;
84
+ /**
85
+ * Inserts new item or items at the beginning of the array.
86
+ * @param items Items to be added.
87
+ */
88
+ unshift(...items: T[]): number;
89
+ /**
90
+ * Reverses the order of the array and returns the observableArray (not the underlying array).
91
+ */
92
+ reverse(): KnockoutObservableArray<T>;
93
+ /**
94
+ * Sorts the array contents and returns the observableArray.
95
+ */
96
+ sort(): KnockoutObservableArray<T>;
97
+ /**
98
+ * Sorts the array contents and returns the observableArray.
99
+ * @param compareFunction A function that returns negative value if first argument is smaller, positive value if second is smaller, or zero to treat them as equal.
100
+ */
101
+ sort(compareFunction: (left: T, right: T) => number): KnockoutObservableArray<T>;
102
+
103
+ // Ko specific
104
+ /**
105
+ * Replaces the first value that equals oldItem with newItem.
106
+ * @param oldItem Item to be replaced.
107
+ * @param newItem Replacing item.
108
+ */
109
+ replace(oldItem: T, newItem: T): void;
110
+ /**
111
+ * Removes all values that equal item and returns them as an array.
112
+ * @param item The item to be removed.
113
+ */
114
+ remove(item: T): T[];
115
+ /**
116
+ * Removes all values and returns them as an array.
117
+ * @param removeFunction A function used to determine true if item should be removed and fasle otherwise.
118
+ */
119
+ remove(removeFunction: (item: T) => boolean): T[];
120
+ /**
121
+ * Removes all values that equal any of the supplied items.
122
+ * @param items Items to be removed.
123
+ */
124
+ removeAll(items: T[]): T[];
125
+ /**
126
+ * Removes all values and returns them as an array.
127
+ */
128
+ removeAll(): T[];
129
+
130
+ // Ko specific Usually relevant to Ruby on Rails developers only
131
+ /**
132
+ * Finds any objects in the array that equal someItem and gives them a special property called _destroy with value true.
133
+ * @param item Items to be marked with the property.
134
+ */
135
+ destroy(item: T): void;
136
+ /**
137
+ * Finds any objects in the array filtered by a function and gives them a special property called _destroy with value true.
138
+ * @param destroyFunction A function used to determine which items should be marked with the property.
139
+ */
140
+ destroy(destroyFunction: (item: T) => boolean): void;
141
+ /**
142
+ * Finds any objects in the array that equal suplied items and gives them a special property called _destroy with value true.
143
+ * @param items
144
+ */
145
+ destroyAll(items: T[]): void;
146
+ /**
147
+ * Gives a special property called _destroy with value true to all objects in the array.
148
+ */
149
+ destroyAll(): void;
150
+ }
151
+
152
+ interface KnockoutSubscribableStatic {
153
+ fn: KnockoutSubscribableFunctions<any>;
154
+
155
+ new <T>(): KnockoutSubscribable<T>;
156
+ }
157
+
158
+ interface KnockoutSubscription {
159
+ /**
160
+ * Terminates a subscription.
161
+ */
162
+ dispose(): void;
163
+ }
164
+
165
+ interface KnockoutSubscribable<T> extends KnockoutSubscribableFunctions<T> {
166
+ /**
167
+ * Registers to be notified after the observable's value changes.
168
+ * @param callback Function that is called whenever the notification happens.
169
+ * @param target Defines the value of 'this' in the callback function.
170
+ * @param event The knockout event name.
171
+ */
172
+ subscribe(callback: (newValue: T) => void, target?: any, event?: "change"): KnockoutSubscription;
173
+ /**
174
+ * Registers to be notified before the observable's value changes.
175
+ * @param callback Function that is called whenever the notification happens.
176
+ * @param target Defines the value of 'this' in the callback function.
177
+ * @param event The knockout event name.
178
+ */
179
+ subscribe(callback: (newValue: T) => void, target: any, event: "beforeChange"): KnockoutSubscription;
180
+ /**
181
+ * Registers to be notified when a knockout or user defined event happens.
182
+ * @param callback Function that is called whenever the notification happens. eventValue can be anything. No relation to underlying observable.
183
+ * @param target Defines the value of 'this' in the callback function.
184
+ * @param event The knockout or user defined event name.
185
+ */
186
+ subscribe<U>(callback: (eventValue: U) => void, target: any, event: string): KnockoutSubscription;
187
+ /**
188
+ * Customizes observables basic functionality.
189
+ * @param requestedExtenders Name of the extender feature and its value, e.g. { notify: 'always' }, { rateLimit: 50 }
190
+ */
191
+ extend(requestedExtenders: { [key: string]: any; }): KnockoutSubscribable<T>;
192
+ /**
193
+ * Gets total number of subscribers.
194
+ */
195
+ getSubscriptionsCount(): number;
196
+ /**
197
+ * Gets number of subscribers of a particular event.
198
+ * @param event Event name.
199
+ */
200
+ getSubscriptionsCount(event: string): number;
201
+ }
202
+
203
+ interface KnockoutComputedStatic {
204
+ fn: KnockoutComputedFunctions<any>;
205
+
206
+ /**
207
+ * Creates computed observable.
208
+ */
209
+ <T>(): KnockoutComputed<T>;
210
+ /**
211
+ * Creates computed observable.
212
+ * @param evaluatorFunction Function that computes the observable value.
213
+ * @param context Defines the value of 'this' when evaluating the computed observable.
214
+ * @param options An object with further properties for the computed observable.
215
+ */
216
+ <T>(evaluatorFunction: () => T, context?: any, options?: KnockoutComputedOptions<T>): KnockoutComputed<T>;
217
+ /**
218
+ * Creates computed observable.
219
+ * @param options An object that defines the computed observable options and behavior.
220
+ * @param context Defines the value of 'this' when evaluating the computed observable.
221
+ */
222
+ <T>(options: KnockoutComputedDefine<T>, context?: any): KnockoutComputed<T>;
223
+ }
224
+
225
+ interface KnockoutReadonlyComputed<T> extends KnockoutReadonlyObservable<T> {
226
+ /**
227
+ * Returns whether the computed observable may be updated in the future. A computed observable is inactive if it has no dependencies.
228
+ */
229
+ isActive(): boolean;
230
+ /**
231
+ * Returns the current number of dependencies of the computed observable.
232
+ */
233
+ getDependenciesCount(): number;
234
+ }
235
+
236
+ interface KnockoutComputed<T> extends KnockoutReadonlyComputed<T>, KnockoutObservable<T>, KnockoutComputedFunctions<T> {
237
+ fn: KnockoutComputedFunctions<any>;
238
+
239
+ /**
240
+ * Manually disposes the computed observable, clearing all subscriptions to dependencies.
241
+ * This function is useful if you want to stop a computed observable from being updated or want to clean up memory for a
242
+ * computed observable that has dependencies on observables that won’t be cleaned.
243
+ */
244
+ dispose(): void;
245
+ /**
246
+ * Customizes observables basic functionality.
247
+ * @param requestedExtenders Name of the extender feature and it's value, e.g. { notify: 'always' }, { rateLimit: 50 }
248
+ */
249
+ extend(requestedExtenders: { [key: string]: any; }): KnockoutComputed<T>;
250
+ }
251
+
252
+ interface KnockoutObservableArrayStatic {
253
+ fn: KnockoutObservableArrayFunctions<any>;
254
+
255
+ <T>(value?: T[] | null): KnockoutObservableArray<T>;
256
+ }
257
+
258
+ /**
259
+ * While all observable arrays are writable at runtime, this type is analogous to the native ReadonlyArray type:
260
+ * casting an observable array to this type expresses the intention that it shouldn't be mutated.
261
+ */
262
+ interface KnockoutReadonlyObservableArray<T> extends KnockoutReadonlyObservable<ReadonlyArray<T>>, KnockoutReadonlyObservableArrayFunctions<T> {
263
+ // NOTE: Keep in sync with KnockoutObservableArray<T>, see note on KnockoutObservableArray<T>
264
+ subscribe(callback: (newValue: KnockoutArrayChange<T>[]) => void, target: any, event: "arrayChange"): KnockoutSubscription;
265
+ subscribe(callback: (newValue: T[]) => void, target: any, event: "beforeChange"): KnockoutSubscription;
266
+ subscribe(callback: (newValue: T[]) => void, target?: any, event?: "change"): KnockoutSubscription;
267
+ subscribe<U>(callback: (newValue: U) => void, target: any, event: string): KnockoutSubscription;
268
+ }
269
+
270
+ /*
271
+ NOTE: In theory this should extend both KnockoutObservable<T[]> and KnockoutReadonlyObservableArray<T>,
272
+ but can't since they both provide conflicting typings of .subscribe.
273
+ So it extends KnockoutObservable<T[]> and duplicates the subscribe definitions, which should be kept in sync
274
+ */
275
+ interface KnockoutObservableArray<T> extends KnockoutObservable<T[]>, KnockoutObservableArrayFunctions<T> {
276
+ subscribe(callback: (newValue: KnockoutArrayChange<T>[]) => void, target: any, event: "arrayChange"): KnockoutSubscription;
277
+ subscribe(callback: (newValue: T[]) => void, target: any, event: "beforeChange"): KnockoutSubscription;
278
+ subscribe(callback: (newValue: T[]) => void, target?: any, event?: "change"): KnockoutSubscription;
279
+ subscribe<U>(callback: (newValue: U) => void, target: any, event: string): KnockoutSubscription;
280
+
281
+ extend(requestedExtenders: { [key: string]: any; }): KnockoutObservableArray<T>;
282
+ }
283
+
284
+ interface KnockoutObservableStatic {
285
+ fn: KnockoutObservableFunctions<any>;
286
+
287
+ <T>(value: T): KnockoutObservable<T>;
288
+ <T = any>(value: null): KnockoutObservable<T | null>
289
+ <T = any>(): KnockoutObservable<T | undefined>
290
+ }
291
+
292
+ /**
293
+ * While all observable are writable at runtime, this type is analogous to the native ReadonlyArray type:
294
+ * casting an observable to this type expresses the intention that this observable shouldn't be mutated.
295
+ */
296
+ interface KnockoutReadonlyObservable<T> extends KnockoutSubscribable<T>, KnockoutObservableFunctions<T> {
297
+ (): T;
298
+
299
+ /**
300
+ * Returns the current value of the computed observable without creating a dependency.
301
+ */
302
+ peek(): T;
303
+ valueHasMutated?: { (): void; };
304
+ valueWillMutate?: { (): void; };
305
+ }
306
+
307
+ interface KnockoutObservable<T> extends KnockoutReadonlyObservable<T> {
308
+ (value: T): void;
309
+
310
+ // Since .extend does arbitrary thing to an observable, it's not safe to do on a readonly observable
311
+ /**
312
+ * Customizes observables basic functionality.
313
+ * @param requestedExtenders Name of the extender feature and it's value, e.g. { notify: 'always' }, { rateLimit: 50 }
314
+ */
315
+ extend(requestedExtenders: { [key: string]: any; }): KnockoutObservable<T>;
316
+ }
317
+
318
+ interface KnockoutComputedOptions<T> {
319
+ /**
320
+ * Makes the computed observable writable. This is a function that receives values that other code is trying to write to your computed observable.
321
+ * It’s up to you to supply custom logic to handle the incoming values, typically by writing the values to some underlying observable(s).
322
+ * @param value Value being written to the computer observable.
323
+ */
324
+ write?(value: T): void;
325
+ /**
326
+ * Disposal of the computed observable will be triggered when the specified DOM node is removed by KO.
327
+ * This feature is used to dispose computed observables used in bindings when nodes are removed by the template and control-flow bindings.
328
+ */
329
+ disposeWhenNodeIsRemoved?: Node;
330
+ /**
331
+ * This function is executed before each re-evaluation to determine if the computed observable should be disposed.
332
+ * A true-ish result will trigger disposal of the computed observable.
333
+ */
334
+ disposeWhen?(): boolean;
335
+ /**
336
+ * Defines the value of 'this' whenever KO invokes your 'read' or 'write' callbacks.
337
+ */
338
+ owner?: any;
339
+ /**
340
+ * If true, then the value of the computed observable will not be evaluated until something actually attempts to access its value or manually subscribes to it.
341
+ * By default, a computed observable has its value determined immediately during creation.
342
+ */
343
+ deferEvaluation?: boolean;
344
+ /**
345
+ * If true, the computed observable will be set up as a purecomputed observable. This option is an alternative to the ko.pureComputed constructor.
346
+ */
347
+ pure?: boolean;
348
+ }
349
+
350
+ interface KnockoutComputedDefine<T> extends KnockoutComputedOptions<T> {
351
+ /**
352
+ * A function that is used to evaluate the computed observable’s current value.
353
+ */
354
+ read(): T;
355
+ }
356
+
357
+ interface KnockoutBindingContext {
358
+ $parent: any;
359
+ $parents: any[];
360
+ $root: any;
361
+ $data: any;
362
+ $rawData: any | KnockoutObservable<any>;
363
+ $index?: KnockoutObservable<number>;
364
+ $parentContext?: KnockoutBindingContext;
365
+ $component: any;
366
+ $componentTemplateNodes: Node[];
367
+
368
+ /**
369
+ * Clones the current Binding Context, adding extra properties to it.
370
+ * @param properties object with properties to be added in the binding context.
371
+ */
372
+ extend(properties: { [key: string]: any; } | (() => { [key: string]: any; })): KnockoutBindingContext;
373
+ /**
374
+ * This returns a new binding context whose viewmodel is the first parameter and whose $parentContext is the current bindingContext.
375
+ * @param dataItemOrAccessor The binding context of the children.
376
+ * @param dataItemAlias An alias for the data item in descendant contexts.
377
+ * @param extendCallback Function to be called.
378
+ * @param options Further options.
379
+ */
380
+ createChildContext(dataItemOrAccessor: any, dataItemAlias?: string, extendCallback?: Function, options?: { "exportDependencies": boolean }): any;
381
+ }
382
+
383
+ interface KnockoutAllBindingsAccessor {
384
+ (): any;
385
+ get(name: string): any;
386
+ has(name: string): boolean;
387
+ }
388
+
389
+ interface KnockoutBindingHandler<E extends Node = any, V = any, VM = any> {
390
+ after?: Array<string>;
391
+ init?: (element: E, valueAccessor: () => V, allBindingsAccessor: KnockoutAllBindingsAccessor, viewModel: VM, bindingContext: KnockoutBindingContext) => void | { controlsDescendantBindings: boolean; };
392
+ update?: (element: E, valueAccessor: () => V, allBindingsAccessor: KnockoutAllBindingsAccessor, viewModel: VM, bindingContext: KnockoutBindingContext) => void;
393
+ options?: any;
394
+ preprocess?: (value: string, name: string, addBindingCallback?: (name: string, value: string) => void) => string;
395
+ [s: string]: any;
396
+ }
397
+
398
+ interface KnockoutBindingHandlers {
399
+ [bindingHandler: string]: KnockoutBindingHandler;
400
+
401
+ // Controlling text and appearance
402
+ visible: KnockoutBindingHandler;
403
+ text: KnockoutBindingHandler;
404
+ html: KnockoutBindingHandler;
405
+ css: KnockoutBindingHandler;
406
+ style: KnockoutBindingHandler;
407
+ attr: KnockoutBindingHandler;
408
+
409
+ // Control Flow
410
+ foreach: KnockoutBindingHandler;
411
+ if: KnockoutBindingHandler;
412
+ ifnot: KnockoutBindingHandler;
413
+ with: KnockoutBindingHandler;
414
+
415
+ // Working with form fields
416
+ click: KnockoutBindingHandler;
417
+ event: KnockoutBindingHandler;
418
+ submit: KnockoutBindingHandler;
419
+ enable: KnockoutBindingHandler;
420
+ disable: KnockoutBindingHandler;
421
+ value: KnockoutBindingHandler;
422
+ textInput: KnockoutBindingHandler;
423
+ hasfocus: KnockoutBindingHandler;
424
+ checked: KnockoutBindingHandler;
425
+ options: KnockoutBindingHandler;
426
+ selectedOptions: KnockoutBindingHandler;
427
+ uniqueName: KnockoutBindingHandler;
428
+
429
+ // Rendering templates
430
+ template: KnockoutBindingHandler;
431
+
432
+ // Components (new for v3.2)
433
+ component: KnockoutBindingHandler;
434
+ }
435
+
436
+ interface KnockoutMemoization {
437
+ memoize(callback: Function): string;
438
+ unmemoize(memoId: string, callbackParams: any[]): boolean;
439
+ unmemoizeDomNodeAndDescendants(domNode: any, extraCallbackParamsArray: any[]): boolean;
440
+ parseMemoText(memoText: string): string;
441
+ }
442
+
443
+ interface KnockoutVirtualElement { }
444
+
445
+ interface KnockoutVirtualElements {
446
+ allowedBindings: { [bindingName: string]: boolean; };
447
+ emptyNode(node: KnockoutVirtualElement): void;
448
+ firstChild(node: KnockoutVirtualElement): KnockoutVirtualElement;
449
+ insertAfter(container: KnockoutVirtualElement, nodeToInsert: Node, insertAfter: Node): void;
450
+ nextSibling(node: KnockoutVirtualElement): Node;
451
+ prepend(node: KnockoutVirtualElement, toInsert: Node): void;
452
+ setDomNodeChildren(node: KnockoutVirtualElement, newChildren: { length: number;[index: number]: Node; }): void;
453
+ childNodes(node: KnockoutVirtualElement): Node[];
454
+ }
455
+
456
+ interface KnockoutExtenders {
457
+ throttle(target: any, timeout: number): KnockoutComputed<any>;
458
+ notify(target: any, notifyWhen: string): any;
459
+
460
+ rateLimit(target: any, timeout: number): any;
461
+ rateLimit(target: any, options: { timeout: number; method?: string; }): any;
462
+
463
+ trackArrayChanges(target: any): any;
464
+ }
465
+
466
+ //
467
+ // NOTE TO MAINTAINERS AND CONTRIBUTORS : pay attention to only include symbols that are
468
+ // publicly exported in the minified version of ko, without that you can give the false
469
+ // impression that some functions will be available in production builds.
470
+ //
471
+ interface KnockoutUtils {
472
+ //////////////////////////////////
473
+ // utils.domData.js
474
+ //////////////////////////////////
475
+
476
+ domData: {
477
+ get(node: Node, key: string): any;
478
+
479
+ set(node: Node, key: string, value: any): void;
480
+
481
+ getAll(node: Node, createIfNotFound: boolean): any;
482
+
483
+ clear(node: Node): boolean;
484
+ };
485
+
486
+ //////////////////////////////////
487
+ // utils.domNodeDisposal.js
488
+ //////////////////////////////////
489
+
490
+ domNodeDisposal: {
491
+ addDisposeCallback(node: Node, callback: Function): void;
492
+
493
+ removeDisposeCallback(node: Node, callback: Function): void;
494
+
495
+ cleanNode(node: Node): Node;
496
+
497
+ removeNode(node: Node): void;
498
+ };
499
+
500
+ addOrRemoveItem<T>(array: T[] | KnockoutObservable<T>, value: T, included: T): void;
501
+
502
+ arrayFilter<T>(array: T[], predicate: (item: T) => boolean): T[];
503
+
504
+ arrayFirst<T>(array: T[], predicate: (item: T) => boolean, predicateOwner?: any): T;
505
+
506
+ arrayForEach<T>(array: T[], action: (item: T, index: number) => void): void;
507
+
508
+ arrayGetDistinctValues<T>(array: T[]): T[];
509
+
510
+ arrayIndexOf<T>(array: T[], item: T): number;
511
+
512
+ arrayMap<T, U>(array: T[], mapping: (item: T) => U): U[];
513
+
514
+ arrayPushAll<T>(array: T[] | KnockoutObservableArray<T>, valuesToPush: T[]): T[];
515
+
516
+ arrayRemoveItem(array: any[], itemToRemove: any): void;
517
+
518
+ compareArrays<T>(a: T[], b: T[]): Array<KnockoutArrayChange<T>>;
519
+
520
+ extend(target: Object, source: Object): Object;
521
+
522
+ fieldsIncludedWithJsonPost: any[];
523
+
524
+ getFormFields(form: any, fieldName: string): any[];
525
+
526
+ objectForEach(obj: any, action: (key: any, value: any) => void): void;
527
+
528
+ parseHtmlFragment(html: string): any[];
529
+
530
+ parseJson(jsonString: string): any;
531
+
532
+ postJson(urlOrForm: any, data: any, options: any): void;
533
+
534
+ peekObservable<T>(value: KnockoutObservable<T>): T;
535
+
536
+ range(min: any, max: any): any;
537
+
538
+ registerEventHandler(element: any, eventType: any, handler: Function): void;
539
+
540
+ setHtml(node: Element, html: () => string): void;
541
+
542
+ setHtml(node: Element, html: string): void;
543
+
544
+ setTextContent(element: any, textContent: string | KnockoutObservable<string>): void;
545
+
546
+ stringifyJson(data: any, replacer?: Function, space?: string): string;
547
+
548
+ toggleDomNodeCssClass(node: any, className: string, shouldHaveClass: boolean): void;
549
+
550
+ triggerEvent(element: any, eventType: any): void;
551
+
552
+ unwrapObservable<T>(value: KnockoutObservable<T> | T): T;
553
+ unwrapObservable<T>(value: KnockoutObservableArray<T> | T[]): T[];
554
+
555
+ // NOT PART OF THE MINIFIED API SURFACE (ONLY IN knockout-{version}.debug.js) https://github.com/SteveSanderson/knockout/issues/670
556
+ // forceRefresh(node: any): void;
557
+ // ieVersion: number;
558
+ // isIe6: boolean;
559
+ // isIe7: boolean;
560
+ // jQueryHtmlParse(html: string): any[];
561
+ // makeArray(arrayLikeObject: any): any[];
562
+ // moveCleanedNodesToContainerElement(nodes: any[]): HTMLElement;
563
+ // replaceDomNodes(nodeToReplaceOrNodeArray: any, newNodesArray: any[]): void;
564
+ // setDomNodeChildren(domNode: any, childNodes: any[]): void;
565
+ // setElementName(element: any, name: string): void;
566
+ // setOptionNodeSelectionState(optionNode: any, isSelected: boolean): void;
567
+ // simpleHtmlParse(html: string): any[];
568
+ // stringStartsWith(str: string, startsWith: string): boolean;
569
+ // stringTokenize(str: string, delimiter: string): string[];
570
+ // stringTrim(str: string): string;
571
+ // tagNameLower(element: any): string;
572
+ }
573
+
574
+ interface KnockoutArrayChange<T> {
575
+ status: "added" | "deleted" | "retained";
576
+ value: T;
577
+ index: number;
578
+ moved?: number;
579
+ }
580
+
581
+ //////////////////////////////////
582
+ // templateSources.js
583
+ //////////////////////////////////
584
+
585
+ interface KnockoutTemplateSourcesDomElement {
586
+ text(): any;
587
+ text(value: any): void;
588
+
589
+ data(key: string): any;
590
+ data(key: string, value: any): any;
591
+ }
592
+
593
+ interface KnockoutTemplateAnonymous extends KnockoutTemplateSourcesDomElement {
594
+ nodes(): any;
595
+ nodes(value: any): void;
596
+ }
597
+
598
+ interface KnockoutTemplateSources {
599
+
600
+ domElement: {
601
+ prototype: KnockoutTemplateSourcesDomElement
602
+ new(element: Element): KnockoutTemplateSourcesDomElement
603
+ };
604
+
605
+ anonymousTemplate: {
606
+ prototype: KnockoutTemplateAnonymous;
607
+ new(element: Element): KnockoutTemplateAnonymous;
608
+ };
609
+ }
610
+
611
+ //////////////////////////////////
612
+ // nativeTemplateEngine.js
613
+ //////////////////////////////////
614
+
615
+ interface KnockoutNativeTemplateEngine extends KnockoutTemplateEngine {
616
+
617
+ renderTemplateSource(templateSource: Object, bindingContext?: KnockoutBindingContext, options?: Object): any[];
618
+ }
619
+
620
+ //////////////////////////////////
621
+ // templateEngine.js
622
+ //////////////////////////////////
623
+
624
+ interface KnockoutTemplateEngine {
625
+
626
+ createJavaScriptEvaluatorBlock(script: string): string;
627
+
628
+ makeTemplateSource(template: any, templateDocument?: Document): any;
629
+
630
+ renderTemplate(template: any, bindingContext: KnockoutBindingContext, options: Object, templateDocument: Document): any;
631
+
632
+ isTemplateRewritten(template: any, templateDocument: Document): boolean;
633
+
634
+ rewriteTemplate(template: any, rewriterCallback: Function, templateDocument: Document): void;
635
+ }
636
+
637
+ //////////////////////////////////
638
+ // tasks.js
639
+ //////////////////////////////////
640
+
641
+ interface KnockoutTasks {
642
+ scheduler: (callback: Function) => any;
643
+ schedule(task: Function): number;
644
+ cancel(handle: number): void;
645
+ runEarly(): void;
646
+ }
647
+
648
+ /////////////////////////////////
649
+ interface KnockoutStatic {
650
+ utils: KnockoutUtils;
651
+ memoization: KnockoutMemoization;
652
+
653
+ bindingHandlers: KnockoutBindingHandlers;
654
+ getBindingHandler(handler: string): KnockoutBindingHandler;
655
+
656
+ virtualElements: KnockoutVirtualElements;
657
+ extenders: KnockoutExtenders;
658
+
659
+ applyBindings(viewModelOrBindingContext?: any, rootNode?: any): void;
660
+ applyBindingsToDescendants(viewModelOrBindingContext: any, rootNode: any): void;
661
+ applyBindingAccessorsToNode(node: Node, bindings: (bindingContext: KnockoutBindingContext, node: Node) => {}, bindingContext: KnockoutBindingContext): void;
662
+ applyBindingAccessorsToNode(node: Node, bindings: {}, bindingContext: KnockoutBindingContext): void;
663
+ applyBindingAccessorsToNode(node: Node, bindings: (bindingContext: KnockoutBindingContext, node: Node) => {}, viewModel: any): void;
664
+ applyBindingAccessorsToNode(node: Node, bindings: {}, viewModel: any): void;
665
+ applyBindingsToNode(node: Node, bindings: any, viewModelOrBindingContext?: any): any;
666
+
667
+ subscribable: KnockoutSubscribableStatic;
668
+ observable: KnockoutObservableStatic;
669
+
670
+ computed: KnockoutComputedStatic;
671
+ /**
672
+ * Creates a pure computed observable.
673
+ * @param evaluatorFunction Function that computes the observable value.
674
+ * @param context Defines the value of 'this' when evaluating the computed observable.
675
+ */
676
+ pureComputed<T>(evaluatorFunction: () => T, context?: any): KnockoutComputed<T>;
677
+ /**
678
+ * Creates a pure computed observable.
679
+ * @param options An object that defines the computed observable options and behavior.
680
+ * @param context Defines the value of 'this' when evaluating the computed observable.
681
+ */
682
+ pureComputed<T>(options: KnockoutComputedDefine<T>, context?: any): KnockoutComputed<T>;
683
+
684
+ observableArray: KnockoutObservableArrayStatic;
685
+
686
+ /**
687
+ * Evaluates if instance is a KnockoutSubscribable.
688
+ * @param instance Instance to be evaluated.
689
+ */
690
+ isSubscribable(instance: any): instance is KnockoutSubscribable<any>;
691
+ /**
692
+ * Clones object substituting each observable for it's underlying value. Uses browser JSON.stringify internally to stringify the result.
693
+ * @param viewModel Object with observables to be converted.
694
+ * @param replacer A Function or array of names that alters the behavior of the stringification process.
695
+ * @param space Used to insert white space into the output JSON string for readability purposes.
696
+ */
697
+ toJSON(viewModel: any, replacer?: Function | [string | number], space?: string | number): string;
698
+ /**
699
+ * Clones object substituting for each observable the current value of that observable.
700
+ * @param viewModel Object with observables to be converted.
701
+ */
702
+ toJS(viewModel: any): any;
703
+ /**
704
+ * Determine if argument is an observable. Returns true for observables, observable arrays, and all computed observables.
705
+ * @param instance Object to be checked.
706
+ */
707
+ isObservable(instance: any): instance is KnockoutObservable<any>;
708
+ /**
709
+ * Determine if argument is an observable. Returns true for observables, observable arrays, and all computed observables.
710
+ * @param instance Object to be checked.
711
+ */
712
+ isObservable<T>(instance: KnockoutObservable<T> | T): instance is KnockoutObservable<T>;
713
+ /**
714
+ * Determine if argument is a writable observable. Returns true for observables, observable arrays, and writable computed observables.
715
+ * @param instance Object to be checked.
716
+ */
717
+ isWriteableObservable(instance: any): instance is KnockoutObservable<any>;
718
+ /**
719
+ * Determine if argument is a writable observable. Returns true for observables, observable arrays, and writable computed observables.
720
+ * @param instance Object to be checked.
721
+ */
722
+ isWriteableObservable<T>(instance: KnockoutObservable<T> | T): instance is KnockoutObservable<T>;
723
+ /**
724
+ * Determine if argument is a computed observable.
725
+ * @param instance Object to be checked.
726
+ */
727
+ isComputed(instance: any): instance is KnockoutComputed<any>;
728
+ /**
729
+ * Determine if argument is a computed observable.
730
+ * @param instance Object to be checked.
731
+ */
732
+ isComputed<T>(instance: KnockoutObservable<T> | T): instance is KnockoutComputed<T>;
733
+
734
+ /**
735
+ * Returns the data that was available for binding against the element.
736
+ * @param node Html node that contains the binding context.
737
+ */
738
+ dataFor(node: Node): any;
739
+ /**
740
+ * Returns the entire binding context that was available to the DOM element.
741
+ * @param node Html node that contains the binding context.
742
+ */
743
+ contextFor(node: Node): any;
744
+ /**
745
+ * Removes a node from the DOM.
746
+ * @param node Node to be removed.
747
+ */
748
+ removeNode(node: Node): void;
749
+ /**
750
+ * Used internally by Knockout to clean up data/computeds that it created related to the element. It does not remove any event handlers added by bindings.
751
+ * @param node Node to be cleaned.
752
+ */
753
+ cleanNode(node: Node): Node;
754
+ renderTemplate(template: Function, viewModel: any, options?: any, target?: any, renderMode?: any): any;
755
+ renderTemplate(template: string, viewModel: any, options?: any, target?: any, renderMode?: any): any;
756
+ /**
757
+ * Returns the underlying value of the Knockout Observable or in case of plain js object, return the object. Use this to easily accept both observable and plain values.
758
+ * @param instance observable to be unwraped if it's an Observable.
759
+ */
760
+ unwrap<T>(instance: KnockoutObservable<T> | T): T;
761
+ /**
762
+ * Gets the array inside the KnockoutObservableArray.
763
+ * @param instance observable to be unwraped.
764
+ */
765
+ unwrap<T>(instance: KnockoutObservableArray<T> | T[]): T[];
766
+
767
+ /**
768
+ * Get information about the current computed property during the execution of a computed observable’s evaluator function.
769
+ */
770
+ computedContext: KnockoutComputedContext;
771
+
772
+ //////////////////////////////////
773
+ // templateSources.js
774
+ //////////////////////////////////
775
+
776
+ templateSources: KnockoutTemplateSources;
777
+
778
+ //////////////////////////////////
779
+ // templateEngine.js
780
+ //////////////////////////////////
781
+
782
+ templateEngine: {
783
+
784
+ prototype: KnockoutTemplateEngine;
785
+
786
+ new(): KnockoutTemplateEngine;
787
+ };
788
+
789
+ //////////////////////////////////
790
+ // templateRewriting.js
791
+ //////////////////////////////////
792
+
793
+ templateRewriting: {
794
+
795
+ ensureTemplateIsRewritten(template: Node, templateEngine: KnockoutTemplateEngine, templateDocument: Document): any;
796
+ ensureTemplateIsRewritten(template: string, templateEngine: KnockoutTemplateEngine, templateDocument: Document): any;
797
+
798
+ memoizeBindingAttributeSyntax(htmlString: string, templateEngine: KnockoutTemplateEngine): any;
799
+
800
+ applyMemoizedBindingsToNextSibling(bindings: any, nodeName: string): string;
801
+ };
802
+
803
+ //////////////////////////////////
804
+ // nativeTemplateEngine.js
805
+ //////////////////////////////////
806
+
807
+ nativeTemplateEngine: {
808
+
809
+ prototype: KnockoutNativeTemplateEngine;
810
+
811
+ new(): KnockoutNativeTemplateEngine;
812
+
813
+ instance: KnockoutNativeTemplateEngine;
814
+ };
815
+
816
+ //////////////////////////////////
817
+ // jqueryTmplTemplateEngine.js
818
+ //////////////////////////////////
819
+
820
+ jqueryTmplTemplateEngine: {
821
+
822
+ prototype: KnockoutTemplateEngine;
823
+
824
+ renderTemplateSource(templateSource: Object, bindingContext: KnockoutBindingContext, options: Object): Node[];
825
+
826
+ createJavaScriptEvaluatorBlock(script: string): string;
827
+
828
+ addTemplate(templateName: string, templateMarkup: string): void;
829
+ };
830
+
831
+ //////////////////////////////////
832
+ // templating.js
833
+ //////////////////////////////////
834
+
835
+ setTemplateEngine(templateEngine: KnockoutNativeTemplateEngine | undefined): void;
836
+
837
+ renderTemplate(template: Function, dataOrBindingContext: KnockoutBindingContext, options: Object, targetNodeOrNodeArray: Node, renderMode: string): any;
838
+ renderTemplate(template: any, dataOrBindingContext: KnockoutBindingContext, options: Object, targetNodeOrNodeArray: Node, renderMode: string): any;
839
+ renderTemplate(template: Function, dataOrBindingContext: any, options: Object, targetNodeOrNodeArray: Node, renderMode: string): any;
840
+ renderTemplate(template: any, dataOrBindingContext: any, options: Object, targetNodeOrNodeArray: Node, renderMode: string): any;
841
+ renderTemplate(template: Function, dataOrBindingContext: KnockoutBindingContext, options: Object, targetNodeOrNodeArray: Node[], renderMode: string): any;
842
+ renderTemplate(template: any, dataOrBindingContext: KnockoutBindingContext, options: Object, targetNodeOrNodeArray: Node[], renderMode: string): any;
843
+ renderTemplate(template: Function, dataOrBindingContext: any, options: Object, targetNodeOrNodeArray: Node[], renderMode: string): any;
844
+ renderTemplate(template: any, dataOrBindingContext: any, options: Object, targetNodeOrNodeArray: Node[], renderMode: string): any;
845
+
846
+ renderTemplateForEach(template: Function, arrayOrObservableArray: any[], options: Object, targetNode: Node, parentBindingContext: KnockoutBindingContext): any;
847
+ renderTemplateForEach(template: any, arrayOrObservableArray: any[], options: Object, targetNode: Node, parentBindingContext: KnockoutBindingContext): any;
848
+ renderTemplateForEach(template: Function, arrayOrObservableArray: KnockoutObservable<any>, options: Object, targetNode: Node, parentBindingContext: KnockoutBindingContext): any;
849
+ renderTemplateForEach(template: any, arrayOrObservableArray: KnockoutObservable<any>, options: Object, targetNode: Node, parentBindingContext: KnockoutBindingContext): any;
850
+
851
+ /**
852
+ * Executes a callback function inside a computed observable, without creating a dependecy between it and the observables inside the function.
853
+ * @param callback Function to be called.
854
+ * @param callbackTarget Defines the value of 'this' in the callback function.
855
+ * @param callbackArgs Arguments for the callback Function.
856
+ */
857
+ ignoreDependencies<T>(callback: () => T, callbackTarget?: any, callbackArgs?: any): T;
858
+
859
+ expressionRewriting: {
860
+ bindingRewriteValidators: any[];
861
+ twoWayBindings: any;
862
+ parseObjectLiteral: (objectLiteralString: string) => any[];
863
+
864
+ /**
865
+ Internal, private KO utility for updating model properties from within bindings
866
+ property: If the property being updated is (or might be) an observable, pass it here
867
+ If it turns out to be a writable observable, it will be written to directly
868
+ allBindings: An object with a get method to retrieve bindings in the current execution context.
869
+ This will be searched for a '_ko_property_writers' property in case you're writing to a non-observable
870
+ (See note below)
871
+ key: The key identifying the property to be written. Example: for { hasFocus: myValue }, write to 'myValue' by specifying the key 'hasFocus'
872
+ value: The value to be written
873
+ checkIfDifferent: If true, and if the property being written is a writable observable, the value will only be written if
874
+ it is !== existing value on that writable observable
875
+
876
+ Note that if you need to write to the viewModel without an observable property,
877
+ you need to set ko.expressionRewriting.twoWayBindings[key] = true; *before* the binding evaluation.
878
+ */
879
+ writeValueToProperty: (property: KnockoutObservable<any> | any, allBindings: KnockoutAllBindingsAccessor, key: string, value: any, checkIfDifferent?: boolean) => void;
880
+ };
881
+
882
+ /////////////////////////////////
883
+
884
+ bindingProvider: {
885
+ instance: KnockoutBindingProvider;
886
+ new(): KnockoutBindingProvider;
887
+ }
888
+
889
+ /////////////////////////////////
890
+ // selectExtensions.js
891
+ /////////////////////////////////
892
+
893
+ selectExtensions: {
894
+
895
+ readValue(element: HTMLElement): any;
896
+
897
+ writeValue(element: HTMLElement, value: any, allowUnset?: boolean): void;
898
+ };
899
+
900
+ components: KnockoutComponents;
901
+
902
+ /////////////////////////////////
903
+ // options.js
904
+ /////////////////////////////////
905
+
906
+ options: {
907
+ deferUpdates: boolean,
908
+
909
+ useOnlyNativeEvents: boolean
910
+ };
911
+
912
+ /////////////////////////////////
913
+ // tasks.js
914
+ /////////////////////////////////
915
+
916
+ tasks: KnockoutTasks;
917
+
918
+ /////////////////////////////////
919
+ // utils.js
920
+ /////////////////////////////////
921
+
922
+ onError?: (error: Error) => void;
923
+ }
924
+
925
+ interface KnockoutBindingProvider {
926
+ nodeHasBindings(node: Node): boolean;
927
+ getBindings(node: Node, bindingContext: KnockoutBindingContext): {};
928
+ getBindingAccessors?(node: Node, bindingContext: KnockoutBindingContext): { [key: string]: string; };
929
+ }
930
+
931
+ interface KnockoutComputedContext {
932
+ /**
933
+ * Returns the number of dependencies of the computed observable detected so far during the current evaluation.
934
+ */
935
+ getDependenciesCount(): number;
936
+ /**
937
+ * A function that returns true if called during the first ever evaluation of the current computed observable, or false otherwise.
938
+ * For pure computed observables, isInitial() is always undefined.
939
+ */
940
+ isInitial: () => boolean;
941
+ isSleeping: boolean;
942
+ }
943
+
944
+ //
945
+ // refactored types into a namespace to reduce global pollution
946
+ // and used Union Types to simplify overloads (requires TypeScript 1.4)
947
+ //
948
+ declare namespace KnockoutComponentTypes {
949
+
950
+ interface Config {
951
+ viewModel?: ViewModelFunction | ViewModelSharedInstance | ViewModelFactoryFunction | AMDModule;
952
+ template: string | Node[] | DocumentFragment | TemplateElement | AMDModule;
953
+ synchronous?: boolean;
954
+ }
955
+
956
+ interface ComponentConfig {
957
+ viewModel?: ViewModelFunction | ViewModelSharedInstance | ViewModelFactoryFunction | AMDModule;
958
+ template: any;
959
+ createViewModel?: any;
960
+ }
961
+
962
+ interface EmptyConfig {
963
+ }
964
+
965
+ // common AMD type
966
+ interface AMDModule {
967
+ require: string;
968
+ }
969
+
970
+ // viewmodel types
971
+ interface ViewModelFunction {
972
+ (params?: any): any;
973
+ }
974
+
975
+ interface ViewModelSharedInstance {
976
+ instance: any;
977
+ }
978
+
979
+ interface ViewModelFactoryFunction {
980
+ createViewModel: (params: any, componentInfo: ComponentInfo) => any;
981
+ }
982
+
983
+ interface ComponentInfo {
984
+ element: Node;
985
+ templateNodes: Node[];
986
+ }
987
+
988
+ interface TemplateElement {
989
+ element: string | Node;
990
+ }
991
+
992
+ interface Loader {
993
+ /**
994
+ * Define this if: you want to supply configurations programmatically based on names, e.g., to implement a naming convention.
995
+ * @see {@link https://knockoutjs.com/documentation/component-loaders.html}
996
+ */
997
+ getConfig?(componentName: string, callback: (result: ComponentConfig | null) => void): void;
998
+ /**
999
+ * Define this if: you want to take control over how component configurations are interpreted, e.g., if you do not want to use the standard 'viewModel/template' pair format.
1000
+ * @see {@link https://knockoutjs.com/documentation/component-loaders.html}
1001
+ */
1002
+ loadComponent?(componentName: string, config: ComponentConfig, callback: (result: Definition | null) => void): void;
1003
+ /**
1004
+ * Define this if: you want to use custom logic to supply DOM nodes for a given template configuration (e.g., using an ajax request to fetch a template by URL).
1005
+ * @see {@link https://knockoutjs.com/documentation/component-loaders.html}
1006
+ */
1007
+ loadTemplate?(componentName: string, templateConfig: any, callback: (result: Node[] | null) => void): void;
1008
+ /**
1009
+ * Define this if: you want to use custom logic to supply a viewmodel factory for a given viewmodel configuration (e.g., integrating with a third-party module loader or dependency injection system).
1010
+ * @see {@link https://knockoutjs.com/documentation/component-loaders.html}
1011
+ */
1012
+ loadViewModel?(componentName: string, viewModelConfig: any, callback: (result: any) => void): void;
1013
+ suppressLoaderExceptions?: boolean;
1014
+ }
1015
+
1016
+ interface Definition {
1017
+ template: Node[];
1018
+ createViewModel?(params: any, options: { element: Node; }): any;
1019
+ }
1020
+ }
1021
+
1022
+ interface KnockoutComponents {
1023
+
1024
+ /**
1025
+ * Registers a component, in the default component loader, to be used by name in the component binding.
1026
+ * @param componentName Component name. Will be used for your custom HTML tag name.
1027
+ * @param config Component configuration.
1028
+ */
1029
+ register(componentName: string, config: KnockoutComponentTypes.Config | KnockoutComponentTypes.EmptyConfig): void;
1030
+ /**
1031
+ * Determine if a component with the specified name is already registered in the default component loader.
1032
+ * @param componentName Component name.
1033
+ */
1034
+ isRegistered(componentName: string): boolean;
1035
+ /**
1036
+ * Removes the named component from the default component loader registry. Or if no such component was registered, does nothing.
1037
+ * @param componentName Component name.
1038
+ */
1039
+ unregister(componentName: string): void;
1040
+ /**
1041
+ * Searchs each registered component loader by component name, and returns the viewmodel/template declaration via callback parameter.
1042
+ * @param componentName Component name.
1043
+ * @param callback Function to be called with the viewmodel/template declaration parameter.
1044
+ */
1045
+ get(componentName: string, callback: (definition: KnockoutComponentTypes.Definition) => void): void;
1046
+ /**
1047
+ * Clears the cache knockout creates to speed up component loading, for a given component.
1048
+ * @param componentName Component name.
1049
+ */
1050
+ clearCachedDefinition(componentName: string): void
1051
+ defaultLoader: KnockoutComponentTypes.Loader;
1052
+ loaders: KnockoutComponentTypes.Loader[];
1053
+ /**
1054
+ * Returns the registered component name for a HTML element. Can be overwriten to to control dynamically which HTML element map to which component name.
1055
+ * @param node html element that corresponds to a custom component.
1056
+ */
1057
+ getComponentNameForNode(node: Node): string;
1058
+ }
1059
+
1060
+ declare var ko: KnockoutStatic;
1061
+
1062
+ declare module "knockout" {
1063
+ export = ko;
1064
+ }
js/knockout.js CHANGED
@@ -1,124 +1,139 @@
1
  /*!
2
- * Knockout JavaScript library v3.4.2
3
  * (c) The Knockout.js team - http://knockoutjs.com/
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
  */
6
 
7
- (function() {(function(n){var x=this||(0,eval)("this"),t=x.document,M=x.navigator,u=x.jQuery,H=x.JSON;(function(n){"function"===typeof define&&define.amd?define(["exports","require"],n):"object"===typeof exports&&"object"===typeof module?n(module.exports||exports):n(x.ko={})})(function(N,O){function J(a,c){return null===a||typeof a in R?a===c:!1}function S(b,c){var d;return function(){d||(d=a.a.setTimeout(function(){d=n;b()},c))}}function T(b,c){var d;return function(){clearTimeout(d);d=a.a.setTimeout(b,c)}}function U(a,
8
- c){c&&c!==E?"beforeChange"===c?this.Ob(a):this.Ja(a,c):this.Pb(a)}function V(a,c){null!==c&&c.k&&c.k()}function W(a,c){var d=this.Mc,e=d[s];e.T||(this.ob&&this.Oa[c]?(d.Sb(c,a,this.Oa[c]),this.Oa[c]=null,--this.ob):e.s[c]||d.Sb(c,a,e.t?{$:a}:d.yc(a)),a.Ha&&a.Hc())}function K(b,c,d,e){a.d[b]={init:function(b,g,h,l,m){var k,r;a.m(function(){var q=g(),p=a.a.c(q),p=!d!==!p,A=!r;if(A||c||p!==k)A&&a.xa.Ca()&&(r=a.a.wa(a.f.childNodes(b),!0)),p?(A||a.f.fa(b,a.a.wa(r)),a.hb(e?e(m,q):m,b)):a.f.za(b),k=p},null,
9
- {i:b});return{controlsDescendantBindings:!0}}};a.h.va[b]=!1;a.f.aa[b]=!0}var a="undefined"!==typeof N?N:{};a.b=function(b,c){for(var d=b.split("."),e=a,f=0;f<d.length-1;f++)e=e[d[f]];e[d[d.length-1]]=c};a.H=function(a,c,d){a[c]=d};a.version="3.4.2";a.b("version",a.version);a.options={deferUpdates:!1,useOnlyNativeEvents:!1};a.a=function(){function b(a,b){for(var c in a)a.hasOwnProperty(c)&&b(c,a[c])}function c(a,b){if(b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function d(a,b){a.__proto__=
10
- b;return a}function e(b,c,d,e){var m=b[c].match(r)||[];a.a.r(d.match(r),function(b){a.a.ra(m,b,e)});b[c]=m.join(" ")}var f={__proto__:[]}instanceof Array,g="function"===typeof Symbol,h={},l={};h[M&&/Firefox\/2/i.test(M.userAgent)?"KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"];h.MouseEvents="click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" ");b(h,function(a,b){if(b.length)for(var c=0,d=b.length;c<d;c++)l[b[c]]=a});var m={propertychange:!0},k=
11
- t&&function(){for(var a=3,b=t.createElement("div"),c=b.getElementsByTagName("i");b.innerHTML="\x3c!--[if gt IE "+ ++a+"]><i></i><![endif]--\x3e",c[0];);return 4<a?a:n}(),r=/\S+/g;return{gc:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],r:function(a,b){for(var c=0,d=a.length;c<d;c++)b(a[c],c)},o:function(a,b){if("function"==typeof Array.prototype.indexOf)return Array.prototype.indexOf.call(a,b);for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return c;return-1},Vb:function(a,b,c){for(var d=
12
- 0,e=a.length;d<e;d++)if(b.call(c,a[d],d))return a[d];return null},Na:function(b,c){var d=a.a.o(b,c);0<d?b.splice(d,1):0===d&&b.shift()},Wb:function(b){b=b||[];for(var c=[],d=0,e=b.length;d<e;d++)0>a.a.o(c,b[d])&&c.push(b[d]);return c},ib:function(a,b){a=a||[];for(var c=[],d=0,e=a.length;d<e;d++)c.push(b(a[d],d));return c},Ma:function(a,b){a=a||[];for(var c=[],d=0,e=a.length;d<e;d++)b(a[d],d)&&c.push(a[d]);return c},ta:function(a,b){if(b instanceof Array)a.push.apply(a,b);else for(var c=0,d=b.length;c<
13
- d;c++)a.push(b[c]);return a},ra:function(b,c,d){var e=a.a.o(a.a.Bb(b),c);0>e?d&&b.push(c):d||b.splice(e,1)},la:f,extend:c,$a:d,ab:f?d:c,D:b,Ea:function(a,b){if(!a)return a;var c={},d;for(d in a)a.hasOwnProperty(d)&&(c[d]=b(a[d],d,a));return c},rb:function(b){for(;b.firstChild;)a.removeNode(b.firstChild)},nc:function(b){b=a.a.W(b);for(var c=(b[0]&&b[0].ownerDocument||t).createElement("div"),d=0,e=b.length;d<e;d++)c.appendChild(a.ba(b[d]));return c},wa:function(b,c){for(var d=0,e=b.length,m=[];d<e;d++){var k=
14
- b[d].cloneNode(!0);m.push(c?a.ba(k):k)}return m},fa:function(b,c){a.a.rb(b);if(c)for(var d=0,e=c.length;d<e;d++)b.appendChild(c[d])},uc:function(b,c){var d=b.nodeType?[b]:b;if(0<d.length){for(var e=d[0],m=e.parentNode,k=0,f=c.length;k<f;k++)m.insertBefore(c[k],e);k=0;for(f=d.length;k<f;k++)a.removeNode(d[k])}},Ba:function(a,b){if(a.length){for(b=8===b.nodeType&&b.parentNode||b;a.length&&a[0].parentNode!==b;)a.splice(0,1);for(;1<a.length&&a[a.length-1].parentNode!==b;)a.length--;if(1<a.length){var c=
15
- a[0],d=a[a.length-1];for(a.length=0;c!==d;)a.push(c),c=c.nextSibling;a.push(d)}}return a},wc:function(a,b){7>k?a.setAttribute("selected",b):a.selected=b},cb:function(a){return null===a||a===n?"":a.trim?a.trim():a.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},sd:function(a,b){a=a||"";return b.length>a.length?!1:a.substring(0,b.length)===b},Rc:function(a,b){if(a===b)return!0;if(11===a.nodeType)return!1;if(b.contains)return b.contains(3===a.nodeType?a.parentNode:a);if(b.compareDocumentPosition)return 16==
16
- (b.compareDocumentPosition(a)&16);for(;a&&a!=b;)a=a.parentNode;return!!a},qb:function(b){return a.a.Rc(b,b.ownerDocument.documentElement)},Tb:function(b){return!!a.a.Vb(b,a.a.qb)},A:function(a){return a&&a.tagName&&a.tagName.toLowerCase()},Zb:function(b){return a.onError?function(){try{return b.apply(this,arguments)}catch(c){throw a.onError&&a.onError(c),c;}}:b},setTimeout:function(b,c){return setTimeout(a.a.Zb(b),c)},dc:function(b){setTimeout(function(){a.onError&&a.onError(b);throw b;},0)},q:function(b,
17
- c,d){var e=a.a.Zb(d);d=k&&m[c];if(a.options.useOnlyNativeEvents||d||!u)if(d||"function"!=typeof b.addEventListener)if("undefined"!=typeof b.attachEvent){var f=function(a){e.call(b,a)},l="on"+c;b.attachEvent(l,f);a.a.G.qa(b,function(){b.detachEvent(l,f)})}else throw Error("Browser doesn't support addEventListener or attachEvent");else b.addEventListener(c,e,!1);else u(b).bind(c,e)},Fa:function(b,c){if(!b||!b.nodeType)throw Error("element must be a DOM node when calling triggerEvent");var d;"input"===
18
- a.a.A(b)&&b.type&&"click"==c.toLowerCase()?(d=b.type,d="checkbox"==d||"radio"==d):d=!1;if(a.options.useOnlyNativeEvents||!u||d)if("function"==typeof t.createEvent)if("function"==typeof b.dispatchEvent)d=t.createEvent(l[c]||"HTMLEvents"),d.initEvent(c,!0,!0,x,0,0,0,0,0,!1,!1,!1,!1,0,b),b.dispatchEvent(d);else throw Error("The supplied element doesn't support dispatchEvent");else if(d&&b.click)b.click();else if("undefined"!=typeof b.fireEvent)b.fireEvent("on"+c);else throw Error("Browser doesn't support triggering events");
19
- else u(b).trigger(c)},c:function(b){return a.I(b)?b():b},Bb:function(b){return a.I(b)?b.p():b},fb:function(b,c,d){var k;c&&("object"===typeof b.classList?(k=b.classList[d?"add":"remove"],a.a.r(c.match(r),function(a){k.call(b.classList,a)})):"string"===typeof b.className.baseVal?e(b.className,"baseVal",c,d):e(b,"className",c,d))},bb:function(b,c){var d=a.a.c(c);if(null===d||d===n)d="";var e=a.f.firstChild(b);!e||3!=e.nodeType||a.f.nextSibling(e)?a.f.fa(b,[b.ownerDocument.createTextNode(d)]):e.data=
20
- d;a.a.Wc(b)},vc:function(a,b){a.name=b;if(7>=k)try{a.mergeAttributes(t.createElement("<input name='"+a.name+"'/>"),!1)}catch(c){}},Wc:function(a){9<=k&&(a=1==a.nodeType?a:a.parentNode,a.style&&(a.style.zoom=a.style.zoom))},Sc:function(a){if(k){var b=a.style.width;a.style.width=0;a.style.width=b}},nd:function(b,c){b=a.a.c(b);c=a.a.c(c);for(var d=[],e=b;e<=c;e++)d.push(e);return d},W:function(a){for(var b=[],c=0,d=a.length;c<d;c++)b.push(a[c]);return b},bc:function(a){return g?Symbol(a):a},xd:6===k,
21
- yd:7===k,C:k,ic:function(b,c){for(var d=a.a.W(b.getElementsByTagName("input")).concat(a.a.W(b.getElementsByTagName("textarea"))),e="string"==typeof c?function(a){return a.name===c}:function(a){return c.test(a.name)},k=[],m=d.length-1;0<=m;m--)e(d[m])&&k.push(d[m]);return k},kd:function(b){return"string"==typeof b&&(b=a.a.cb(b))?H&&H.parse?H.parse(b):(new Function("return "+b))():null},Gb:function(b,c,d){if(!H||!H.stringify)throw Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js");
22
- return H.stringify(a.a.c(b),c,d)},ld:function(c,d,e){e=e||{};var k=e.params||{},m=e.includeFields||this.gc,f=c;if("object"==typeof c&&"form"===a.a.A(c))for(var f=c.action,l=m.length-1;0<=l;l--)for(var g=a.a.ic(c,m[l]),h=g.length-1;0<=h;h--)k[g[h].name]=g[h].value;d=a.a.c(d);var r=t.createElement("form");r.style.display="none";r.action=f;r.method="post";for(var n in d)c=t.createElement("input"),c.type="hidden",c.name=n,c.value=a.a.Gb(a.a.c(d[n])),r.appendChild(c);b(k,function(a,b){var c=t.createElement("input");
23
- c.type="hidden";c.name=a;c.value=b;r.appendChild(c)});t.body.appendChild(r);e.submitter?e.submitter(r):r.submit();setTimeout(function(){r.parentNode.removeChild(r)},0)}}}();a.b("utils",a.a);a.b("utils.arrayForEach",a.a.r);a.b("utils.arrayFirst",a.a.Vb);a.b("utils.arrayFilter",a.a.Ma);a.b("utils.arrayGetDistinctValues",a.a.Wb);a.b("utils.arrayIndexOf",a.a.o);a.b("utils.arrayMap",a.a.ib);a.b("utils.arrayPushAll",a.a.ta);a.b("utils.arrayRemoveItem",a.a.Na);a.b("utils.extend",a.a.extend);a.b("utils.fieldsIncludedWithJsonPost",
24
- a.a.gc);a.b("utils.getFormFields",a.a.ic);a.b("utils.peekObservable",a.a.Bb);a.b("utils.postJson",a.a.ld);a.b("utils.parseJson",a.a.kd);a.b("utils.registerEventHandler",a.a.q);a.b("utils.stringifyJson",a.a.Gb);a.b("utils.range",a.a.nd);a.b("utils.toggleDomNodeCssClass",a.a.fb);a.b("utils.triggerEvent",a.a.Fa);a.b("utils.unwrapObservable",a.a.c);a.b("utils.objectForEach",a.a.D);a.b("utils.addOrRemoveItem",a.a.ra);a.b("utils.setTextContent",a.a.bb);a.b("unwrap",a.a.c);Function.prototype.bind||(Function.prototype.bind=
25
- function(a){var c=this;if(1===arguments.length)return function(){return c.apply(a,arguments)};var d=Array.prototype.slice.call(arguments,1);return function(){var e=d.slice(0);e.push.apply(e,arguments);return c.apply(a,e)}});a.a.e=new function(){function a(b,g){var h=b[d];if(!h||"null"===h||!e[h]){if(!g)return n;h=b[d]="ko"+c++;e[h]={}}return e[h]}var c=0,d="__ko__"+(new Date).getTime(),e={};return{get:function(c,d){var e=a(c,!1);return e===n?n:e[d]},set:function(c,d,e){if(e!==n||a(c,!1)!==n)a(c,!0)[d]=
26
- e},clear:function(a){var b=a[d];return b?(delete e[b],a[d]=null,!0):!1},J:function(){return c++ +d}}};a.b("utils.domData",a.a.e);a.b("utils.domData.clear",a.a.e.clear);a.a.G=new function(){function b(b,c){var e=a.a.e.get(b,d);e===n&&c&&(e=[],a.a.e.set(b,d,e));return e}function c(d){var e=b(d,!1);if(e)for(var e=e.slice(0),l=0;l<e.length;l++)e[l](d);a.a.e.clear(d);a.a.G.cleanExternalData(d);if(f[d.nodeType])for(e=d.firstChild;d=e;)e=d.nextSibling,8===d.nodeType&&c(d)}var d=a.a.e.J(),e={1:!0,8:!0,9:!0},
27
- f={1:!0,9:!0};return{qa:function(a,c){if("function"!=typeof c)throw Error("Callback must be a function");b(a,!0).push(c)},tc:function(c,e){var f=b(c,!1);f&&(a.a.Na(f,e),0==f.length&&a.a.e.set(c,d,n))},ba:function(b){if(e[b.nodeType]&&(c(b),f[b.nodeType])){var d=[];a.a.ta(d,b.getElementsByTagName("*"));for(var l=0,m=d.length;l<m;l++)c(d[l])}return b},removeNode:function(b){a.ba(b);b.parentNode&&b.parentNode.removeChild(b)},cleanExternalData:function(a){u&&"function"==typeof u.cleanData&&u.cleanData([a])}}};
28
- a.ba=a.a.G.ba;a.removeNode=a.a.G.removeNode;a.b("cleanNode",a.ba);a.b("removeNode",a.removeNode);a.b("utils.domNodeDisposal",a.a.G);a.b("utils.domNodeDisposal.addDisposeCallback",a.a.G.qa);a.b("utils.domNodeDisposal.removeDisposeCallback",a.a.G.tc);(function(){var b=[0,"",""],c=[1,"<table>","</table>"],d=[3,"<table><tbody><tr>","</tr></tbody></table>"],e=[1,"<select multiple='multiple'>","</select>"],f={thead:c,tbody:c,tfoot:c,tr:[2,"<table><tbody>","</tbody></table>"],td:d,th:d,option:e,optgroup:e},
29
- g=8>=a.a.C;a.a.na=function(c,d){var e;if(u)if(u.parseHTML)e=u.parseHTML(c,d)||[];else{if((e=u.clean([c],d))&&e[0]){for(var k=e[0];k.parentNode&&11!==k.parentNode.nodeType;)k=k.parentNode;k.parentNode&&k.parentNode.removeChild(k)}}else{(e=d)||(e=t);var k=e.parentWindow||e.defaultView||x,r=a.a.cb(c).toLowerCase(),q=e.createElement("div"),p;p=(r=r.match(/^<([a-z]+)[ >]/))&&f[r[1]]||b;r=p[0];p="ignored<div>"+p[1]+c+p[2]+"</div>";"function"==typeof k.innerShiv?q.appendChild(k.innerShiv(p)):(g&&e.appendChild(q),
30
- q.innerHTML=p,g&&q.parentNode.removeChild(q));for(;r--;)q=q.lastChild;e=a.a.W(q.lastChild.childNodes)}return e};a.a.Eb=function(b,c){a.a.rb(b);c=a.a.c(c);if(null!==c&&c!==n)if("string"!=typeof c&&(c=c.toString()),u)u(b).html(c);else for(var d=a.a.na(c,b.ownerDocument),e=0;e<d.length;e++)b.appendChild(d[e])}})();a.b("utils.parseHtmlFragment",a.a.na);a.b("utils.setHtml",a.a.Eb);a.N=function(){function b(c,e){if(c)if(8==c.nodeType){var f=a.N.pc(c.nodeValue);null!=f&&e.push({Qc:c,hd:f})}else if(1==c.nodeType)for(var f=
31
- 0,g=c.childNodes,h=g.length;f<h;f++)b(g[f],e)}var c={};return{yb:function(a){if("function"!=typeof a)throw Error("You can only pass a function to ko.memoization.memoize()");var b=(4294967296*(1+Math.random())|0).toString(16).substring(1)+(4294967296*(1+Math.random())|0).toString(16).substring(1);c[b]=a;return"\x3c!--[ko_memo:"+b+"]--\x3e"},Bc:function(a,b){var f=c[a];if(f===n)throw Error("Couldn't find any memo with ID "+a+". Perhaps it's already been unmemoized.");try{return f.apply(null,b||[]),
32
- !0}finally{delete c[a]}},Cc:function(c,e){var f=[];b(c,f);for(var g=0,h=f.length;g<h;g++){var l=f[g].Qc,m=[l];e&&a.a.ta(m,e);a.N.Bc(f[g].hd,m);l.nodeValue="";l.parentNode&&l.parentNode.removeChild(l)}},pc:function(a){return(a=a.match(/^\[ko_memo\:(.*?)\]$/))?a[1]:null}}}();a.b("memoization",a.N);a.b("memoization.memoize",a.N.yb);a.b("memoization.unmemoize",a.N.Bc);a.b("memoization.parseMemoText",a.N.pc);a.b("memoization.unmemoizeDomNodeAndDescendants",a.N.Cc);a.Z=function(){function b(){if(e)for(var b=
33
- e,c=0,m;g<e;)if(m=d[g++]){if(g>b){if(5E3<=++c){g=e;a.a.dc(Error("'Too much recursion' after processing "+c+" task groups."));break}b=e}try{m()}catch(k){a.a.dc(k)}}}function c(){b();g=e=d.length=0}var d=[],e=0,f=1,g=0;return{scheduler:x.MutationObserver?function(a){var b=t.createElement("div");(new MutationObserver(a)).observe(b,{attributes:!0});return function(){b.classList.toggle("foo")}}(c):t&&"onreadystatechange"in t.createElement("script")?function(a){var b=t.createElement("script");b.onreadystatechange=
34
- function(){b.onreadystatechange=null;t.documentElement.removeChild(b);b=null;a()};t.documentElement.appendChild(b)}:function(a){setTimeout(a,0)},Za:function(b){e||a.Z.scheduler(c);d[e++]=b;return f++},cancel:function(a){a-=f-e;a>=g&&a<e&&(d[a]=null)},resetForTesting:function(){var a=e-g;g=e=d.length=0;return a},rd:b}}();a.b("tasks",a.Z);a.b("tasks.schedule",a.Z.Za);a.b("tasks.runEarly",a.Z.rd);a.Aa={throttle:function(b,c){b.throttleEvaluation=c;var d=null;return a.B({read:b,write:function(e){clearTimeout(d);
35
- d=a.a.setTimeout(function(){b(e)},c)}})},rateLimit:function(a,c){var d,e,f;"number"==typeof c?d=c:(d=c.timeout,e=c.method);a.gb=!1;f="notifyWhenChangesStop"==e?T:S;a.Wa(function(a){return f(a,d)})},deferred:function(b,c){if(!0!==c)throw Error("The 'deferred' extender only accepts the value 'true', because it is not supported to turn deferral off once enabled.");b.gb||(b.gb=!0,b.Wa(function(c){var e,f=!1;return function(){if(!f){a.Z.cancel(e);e=a.Z.Za(c);try{f=!0,b.notifySubscribers(n,"dirty")}finally{f=
36
- !1}}}}))},notify:function(a,c){a.equalityComparer="always"==c?null:J}};var R={undefined:1,"boolean":1,number:1,string:1};a.b("extenders",a.Aa);a.zc=function(b,c,d){this.$=b;this.jb=c;this.Pc=d;this.T=!1;a.H(this,"dispose",this.k)};a.zc.prototype.k=function(){this.T=!0;this.Pc()};a.K=function(){a.a.ab(this,D);D.ub(this)};var E="change",D={ub:function(a){a.F={change:[]};a.Qb=1},Y:function(b,c,d){var e=this;d=d||E;var f=new a.zc(e,c?b.bind(c):b,function(){a.a.Na(e.F[d],f);e.Ka&&e.Ka(d)});e.ua&&e.ua(d);
37
- e.F[d]||(e.F[d]=[]);e.F[d].push(f);return f},notifySubscribers:function(b,c){c=c||E;c===E&&this.Kb();if(this.Ra(c)){var d=c===E&&this.Fc||this.F[c].slice(0);try{a.l.Xb();for(var e=0,f;f=d[e];++e)f.T||f.jb(b)}finally{a.l.end()}}},Pa:function(){return this.Qb},Zc:function(a){return this.Pa()!==a},Kb:function(){++this.Qb},Wa:function(b){var c=this,d=a.I(c),e,f,g,h;c.Ja||(c.Ja=c.notifySubscribers,c.notifySubscribers=U);var l=b(function(){c.Ha=!1;d&&h===c&&(h=c.Mb?c.Mb():c());var a=f||c.Ua(g,h);f=e=!1;
38
- a&&c.Ja(g=h)});c.Pb=function(a){c.Fc=c.F[E].slice(0);c.Ha=e=!0;h=a;l()};c.Ob=function(a){e||(g=a,c.Ja(a,"beforeChange"))};c.Hc=function(){c.Ua(g,c.p(!0))&&(f=!0)}},Ra:function(a){return this.F[a]&&this.F[a].length},Xc:function(b){if(b)return this.F[b]&&this.F[b].length||0;var c=0;a.a.D(this.F,function(a,b){"dirty"!==a&&(c+=b.length)});return c},Ua:function(a,c){return!this.equalityComparer||!this.equalityComparer(a,c)},extend:function(b){var c=this;b&&a.a.D(b,function(b,e){var f=a.Aa[b];"function"==
39
- typeof f&&(c=f(c,e)||c)});return c}};a.H(D,"subscribe",D.Y);a.H(D,"extend",D.extend);a.H(D,"getSubscriptionsCount",D.Xc);a.a.la&&a.a.$a(D,Function.prototype);a.K.fn=D;a.lc=function(a){return null!=a&&"function"==typeof a.Y&&"function"==typeof a.notifySubscribers};a.b("subscribable",a.K);a.b("isSubscribable",a.lc);a.xa=a.l=function(){function b(a){d.push(e);e=a}function c(){e=d.pop()}var d=[],e,f=0;return{Xb:b,end:c,sc:function(b){if(e){if(!a.lc(b))throw Error("Only subscribable things can act as dependencies");
40
- e.jb.call(e.Lc,b,b.Gc||(b.Gc=++f))}},w:function(a,d,e){try{return b(),a.apply(d,e||[])}finally{c()}},Ca:function(){if(e)return e.m.Ca()},Va:function(){if(e)return e.Va}}}();a.b("computedContext",a.xa);a.b("computedContext.getDependenciesCount",a.xa.Ca);a.b("computedContext.isInitial",a.xa.Va);a.b("ignoreDependencies",a.wd=a.l.w);var F=a.a.bc("_latestValue");a.O=function(b){function c(){if(0<arguments.length)return c.Ua(c[F],arguments[0])&&(c.ia(),c[F]=arguments[0],c.ha()),this;a.l.sc(c);return c[F]}
41
- c[F]=b;a.a.la||a.a.extend(c,a.K.fn);a.K.fn.ub(c);a.a.ab(c,B);a.options.deferUpdates&&a.Aa.deferred(c,!0);return c};var B={equalityComparer:J,p:function(){return this[F]},ha:function(){this.notifySubscribers(this[F])},ia:function(){this.notifySubscribers(this[F],"beforeChange")}};a.a.la&&a.a.$a(B,a.K.fn);var I=a.O.md="__ko_proto__";B[I]=a.O;a.Qa=function(b,c){return null===b||b===n||b[I]===n?!1:b[I]===c?!0:a.Qa(b[I],c)};a.I=function(b){return a.Qa(b,a.O)};a.Da=function(b){return"function"==typeof b&&
42
- b[I]===a.O||"function"==typeof b&&b[I]===a.B&&b.$c?!0:!1};a.b("observable",a.O);a.b("isObservable",a.I);a.b("isWriteableObservable",a.Da);a.b("isWritableObservable",a.Da);a.b("observable.fn",B);a.H(B,"peek",B.p);a.H(B,"valueHasMutated",B.ha);a.H(B,"valueWillMutate",B.ia);a.ma=function(b){b=b||[];if("object"!=typeof b||!("length"in b))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");b=a.O(b);a.a.ab(b,a.ma.fn);return b.extend({trackArrayChanges:!0})};
43
- a.ma.fn={remove:function(b){for(var c=this.p(),d=[],e="function"!=typeof b||a.I(b)?function(a){return a===b}:b,f=0;f<c.length;f++){var g=c[f];e(g)&&(0===d.length&&this.ia(),d.push(g),c.splice(f,1),f--)}d.length&&this.ha();return d},removeAll:function(b){if(b===n){var c=this.p(),d=c.slice(0);this.ia();c.splice(0,c.length);this.ha();return d}return b?this.remove(function(c){return 0<=a.a.o(b,c)}):[]},destroy:function(b){var c=this.p(),d="function"!=typeof b||a.I(b)?function(a){return a===b}:b;this.ia();
44
- for(var e=c.length-1;0<=e;e--)d(c[e])&&(c[e]._destroy=!0);this.ha()},destroyAll:function(b){return b===n?this.destroy(function(){return!0}):b?this.destroy(function(c){return 0<=a.a.o(b,c)}):[]},indexOf:function(b){var c=this();return a.a.o(c,b)},replace:function(a,c){var d=this.indexOf(a);0<=d&&(this.ia(),this.p()[d]=c,this.ha())}};a.a.la&&a.a.$a(a.ma.fn,a.O.fn);a.a.r("pop push reverse shift sort splice unshift".split(" "),function(b){a.ma.fn[b]=function(){var a=this.p();this.ia();this.Yb(a,b,arguments);
45
- var d=a[b].apply(a,arguments);this.ha();return d===a?this:d}});a.a.r(["slice"],function(b){a.ma.fn[b]=function(){var a=this();return a[b].apply(a,arguments)}});a.b("observableArray",a.ma);a.Aa.trackArrayChanges=function(b,c){function d(){if(!e){e=!0;l=b.notifySubscribers;b.notifySubscribers=function(a,b){b&&b!==E||++h;return l.apply(this,arguments)};var c=[].concat(b.p()||[]);f=null;g=b.Y(function(d){d=[].concat(d||[]);if(b.Ra("arrayChange")){var e;if(!f||1<h)f=a.a.lb(c,d,b.kb);e=f}c=d;f=null;h=0;
46
- e&&e.length&&b.notifySubscribers(e,"arrayChange")})}}b.kb={};c&&"object"==typeof c&&a.a.extend(b.kb,c);b.kb.sparse=!0;if(!b.Yb){var e=!1,f=null,g,h=0,l,m=b.ua,k=b.Ka;b.ua=function(a){m&&m.call(b,a);"arrayChange"===a&&d()};b.Ka=function(a){k&&k.call(b,a);"arrayChange"!==a||b.Ra("arrayChange")||(l&&(b.notifySubscribers=l,l=n),g.k(),e=!1)};b.Yb=function(b,c,d){function k(a,b,c){return m[m.length]={status:a,value:b,index:c}}if(e&&!h){var m=[],l=b.length,g=d.length,G=0;switch(c){case "push":G=l;case "unshift":for(c=
47
- 0;c<g;c++)k("added",d[c],G+c);break;case "pop":G=l-1;case "shift":l&&k("deleted",b[G],G);break;case "splice":c=Math.min(Math.max(0,0>d[0]?l+d[0]:d[0]),l);for(var l=1===g?l:Math.min(c+(d[1]||0),l),g=c+g-2,G=Math.max(l,g),n=[],s=[],w=2;c<G;++c,++w)c<l&&s.push(k("deleted",b[c],c)),c<g&&n.push(k("added",d[w],c));a.a.hc(s,n);break;default:return}f=m}}}};var s=a.a.bc("_state");a.m=a.B=function(b,c,d){function e(){if(0<arguments.length){if("function"===typeof f)f.apply(g.sb,arguments);else throw Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");
48
- return this}a.l.sc(e);(g.V||g.t&&e.Sa())&&e.U();return g.M}"object"===typeof b?d=b:(d=d||{},b&&(d.read=b));if("function"!=typeof d.read)throw Error("Pass a function that returns the value of the ko.computed");var f=d.write,g={M:n,da:!0,V:!0,Ta:!1,Hb:!1,T:!1,Ya:!1,t:!1,od:d.read,sb:c||d.owner,i:d.disposeWhenNodeIsRemoved||d.i||null,ya:d.disposeWhen||d.ya,pb:null,s:{},L:0,fc:null};e[s]=g;e.$c="function"===typeof f;a.a.la||a.a.extend(e,a.K.fn);a.K.fn.ub(e);a.a.ab(e,z);d.pure?(g.Ya=!0,g.t=!0,a.a.extend(e,
49
- Y)):d.deferEvaluation&&a.a.extend(e,Z);a.options.deferUpdates&&a.Aa.deferred(e,!0);g.i&&(g.Hb=!0,g.i.nodeType||(g.i=null));g.t||d.deferEvaluation||e.U();g.i&&e.ca()&&a.a.G.qa(g.i,g.pb=function(){e.k()});return e};var z={equalityComparer:J,Ca:function(){return this[s].L},Sb:function(a,c,d){if(this[s].Ya&&c===this)throw Error("A 'pure' computed must not be called recursively");this[s].s[a]=d;d.Ia=this[s].L++;d.pa=c.Pa()},Sa:function(){var a,c,d=this[s].s;for(a in d)if(d.hasOwnProperty(a)&&(c=d[a],this.oa&&
50
- c.$.Ha||c.$.Zc(c.pa)))return!0},gd:function(){this.oa&&!this[s].Ta&&this.oa(!1)},ca:function(){var a=this[s];return a.V||0<a.L},qd:function(){this.Ha?this[s].V&&(this[s].da=!0):this.ec()},yc:function(a){if(a.gb&&!this[s].i){var c=a.Y(this.gd,this,"dirty"),d=a.Y(this.qd,this);return{$:a,k:function(){c.k();d.k()}}}return a.Y(this.ec,this)},ec:function(){var b=this,c=b.throttleEvaluation;c&&0<=c?(clearTimeout(this[s].fc),this[s].fc=a.a.setTimeout(function(){b.U(!0)},c)):b.oa?b.oa(!0):b.U(!0)},U:function(b){var c=
51
- this[s],d=c.ya,e=!1;if(!c.Ta&&!c.T){if(c.i&&!a.a.qb(c.i)||d&&d()){if(!c.Hb){this.k();return}}else c.Hb=!1;c.Ta=!0;try{e=this.Vc(b)}finally{c.Ta=!1}c.L||this.k();return e}},Vc:function(b){var c=this[s],d=!1,e=c.Ya?n:!c.L,f={Mc:this,Oa:c.s,ob:c.L};a.l.Xb({Lc:f,jb:W,m:this,Va:e});c.s={};c.L=0;f=this.Uc(c,f);this.Ua(c.M,f)&&(c.t||this.notifySubscribers(c.M,"beforeChange"),c.M=f,c.t?this.Kb():b&&this.notifySubscribers(c.M),d=!0);e&&this.notifySubscribers(c.M,"awake");return d},Uc:function(b,c){try{var d=
52
- b.od;return b.sb?d.call(b.sb):d()}finally{a.l.end(),c.ob&&!b.t&&a.a.D(c.Oa,V),b.da=b.V=!1}},p:function(a){var c=this[s];(c.V&&(a||!c.L)||c.t&&this.Sa())&&this.U();return c.M},Wa:function(b){a.K.fn.Wa.call(this,b);this.Mb=function(){this[s].da?this.U():this[s].V=!1;return this[s].M};this.oa=function(a){this.Ob(this[s].M);this[s].V=!0;a&&(this[s].da=!0);this.Pb(this)}},k:function(){var b=this[s];!b.t&&b.s&&a.a.D(b.s,function(a,b){b.k&&b.k()});b.i&&b.pb&&a.a.G.tc(b.i,b.pb);b.s=null;b.L=0;b.T=!0;b.da=
53
- !1;b.V=!1;b.t=!1;b.i=null}},Y={ua:function(b){var c=this,d=c[s];if(!d.T&&d.t&&"change"==b){d.t=!1;if(d.da||c.Sa())d.s=null,d.L=0,c.U()&&c.Kb();else{var e=[];a.a.D(d.s,function(a,b){e[b.Ia]=a});a.a.r(e,function(a,b){var e=d.s[a],l=c.yc(e.$);l.Ia=b;l.pa=e.pa;d.s[a]=l})}d.T||c.notifySubscribers(d.M,"awake")}},Ka:function(b){var c=this[s];c.T||"change"!=b||this.Ra("change")||(a.a.D(c.s,function(a,b){b.k&&(c.s[a]={$:b.$,Ia:b.Ia,pa:b.pa},b.k())}),c.t=!0,this.notifySubscribers(n,"asleep"))},Pa:function(){var b=
54
- this[s];b.t&&(b.da||this.Sa())&&this.U();return a.K.fn.Pa.call(this)}},Z={ua:function(a){"change"!=a&&"beforeChange"!=a||this.p()}};a.a.la&&a.a.$a(z,a.K.fn);var P=a.O.md;a.m[P]=a.O;z[P]=a.m;a.bd=function(b){return a.Qa(b,a.m)};a.cd=function(b){return a.Qa(b,a.m)&&b[s]&&b[s].Ya};a.b("computed",a.m);a.b("dependentObservable",a.m);a.b("isComputed",a.bd);a.b("isPureComputed",a.cd);a.b("computed.fn",z);a.H(z,"peek",z.p);a.H(z,"dispose",z.k);a.H(z,"isActive",z.ca);a.H(z,"getDependenciesCount",z.Ca);a.rc=
55
- function(b,c){if("function"===typeof b)return a.m(b,c,{pure:!0});b=a.a.extend({},b);b.pure=!0;return a.m(b,c)};a.b("pureComputed",a.rc);(function(){function b(a,f,g){g=g||new d;a=f(a);if("object"!=typeof a||null===a||a===n||a instanceof RegExp||a instanceof Date||a instanceof String||a instanceof Number||a instanceof Boolean)return a;var h=a instanceof Array?[]:{};g.save(a,h);c(a,function(c){var d=f(a[c]);switch(typeof d){case "boolean":case "number":case "string":case "function":h[c]=d;break;case "object":case "undefined":var k=
56
- g.get(d);h[c]=k!==n?k:b(d,f,g)}});return h}function c(a,b){if(a instanceof Array){for(var c=0;c<a.length;c++)b(c);"function"==typeof a.toJSON&&b("toJSON")}else for(c in a)b(c)}function d(){this.keys=[];this.Lb=[]}a.Ac=function(c){if(0==arguments.length)throw Error("When calling ko.toJS, pass the object you want to convert.");return b(c,function(b){for(var c=0;a.I(b)&&10>c;c++)b=b();return b})};a.toJSON=function(b,c,d){b=a.Ac(b);return a.a.Gb(b,c,d)};d.prototype={save:function(b,c){var d=a.a.o(this.keys,
57
- b);0<=d?this.Lb[d]=c:(this.keys.push(b),this.Lb.push(c))},get:function(b){b=a.a.o(this.keys,b);return 0<=b?this.Lb[b]:n}}})();a.b("toJS",a.Ac);a.b("toJSON",a.toJSON);(function(){a.j={u:function(b){switch(a.a.A(b)){case "option":return!0===b.__ko__hasDomDataOptionValue__?a.a.e.get(b,a.d.options.zb):7>=a.a.C?b.getAttributeNode("value")&&b.getAttributeNode("value").specified?b.value:b.text:b.value;case "select":return 0<=b.selectedIndex?a.j.u(b.options[b.selectedIndex]):n;default:return b.value}},ja:function(b,
58
- c,d){switch(a.a.A(b)){case "option":switch(typeof c){case "string":a.a.e.set(b,a.d.options.zb,n);"__ko__hasDomDataOptionValue__"in b&&delete b.__ko__hasDomDataOptionValue__;b.value=c;break;default:a.a.e.set(b,a.d.options.zb,c),b.__ko__hasDomDataOptionValue__=!0,b.value="number"===typeof c?c:""}break;case "select":if(""===c||null===c)c=n;for(var e=-1,f=0,g=b.options.length,h;f<g;++f)if(h=a.j.u(b.options[f]),h==c||""==h&&c===n){e=f;break}if(d||0<=e||c===n&&1<b.size)b.selectedIndex=e;break;default:if(null===
59
- c||c===n)c="";b.value=c}}}})();a.b("selectExtensions",a.j);a.b("selectExtensions.readValue",a.j.u);a.b("selectExtensions.writeValue",a.j.ja);a.h=function(){function b(b){b=a.a.cb(b);123===b.charCodeAt(0)&&(b=b.slice(1,-1));var c=[],d=b.match(e),r,h=[],p=0;if(d){d.push(",");for(var A=0,y;y=d[A];++A){var v=y.charCodeAt(0);if(44===v){if(0>=p){c.push(r&&h.length?{key:r,value:h.join("")}:{unknown:r||h.join("")});r=p=0;h=[];continue}}else if(58===v){if(!p&&!r&&1===h.length){r=h.pop();continue}}else 47===
60
- v&&A&&1<y.length?(v=d[A-1].match(f))&&!g[v[0]]&&(b=b.substr(b.indexOf(y)+1),d=b.match(e),d.push(","),A=-1,y="/"):40===v||123===v||91===v?++p:41===v||125===v||93===v?--p:r||h.length||34!==v&&39!==v||(y=y.slice(1,-1));h.push(y)}}return c}var c=["true","false","null","undefined"],d=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,e=RegExp("\"(?:[^\"\\\\]|\\\\.)*\"|'(?:[^'\\\\]|\\\\.)*'|/(?:[^/\\\\]|\\\\.)*/w*|[^\\s:,/][^,\"'{}()/:[\\]]*[^\\s,\"'{}()/:[\\]]|[^\\s]","g"),f=/[\])"'A-Za-z0-9_$]+$/,
61
- g={"in":1,"return":1,"typeof":1},h={};return{va:[],ga:h,Ab:b,Xa:function(e,m){function k(b,e){var m;if(!A){var l=a.getBindingHandler(b);if(l&&l.preprocess&&!(e=l.preprocess(e,b,k)))return;if(l=h[b])m=e,0<=a.a.o(c,m)?m=!1:(l=m.match(d),m=null===l?!1:l[1]?"Object("+l[1]+")"+l[2]:m),l=m;l&&g.push("'"+b+"':function(_z){"+m+"=_z}")}p&&(e="function(){return "+e+" }");f.push("'"+b+"':"+e)}m=m||{};var f=[],g=[],p=m.valueAccessors,A=m.bindingParams,y="string"===typeof e?b(e):e;a.a.r(y,function(a){k(a.key||
62
- a.unknown,a.value)});g.length&&k("_ko_property_writers","{"+g.join(",")+" }");return f.join(",")},fd:function(a,b){for(var c=0;c<a.length;c++)if(a[c].key==b)return!0;return!1},Ga:function(b,c,d,e,f){if(b&&a.I(b))!a.Da(b)||f&&b.p()===e||b(e);else if((b=c.get("_ko_property_writers"))&&b[d])b[d](e)}}}();a.b("expressionRewriting",a.h);a.b("expressionRewriting.bindingRewriteValidators",a.h.va);a.b("expressionRewriting.parseObjectLiteral",a.h.Ab);a.b("expressionRewriting.preProcessBindings",a.h.Xa);a.b("expressionRewriting._twoWayBindings",
63
- a.h.ga);a.b("jsonExpressionRewriting",a.h);a.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson",a.h.Xa);(function(){function b(a){return 8==a.nodeType&&g.test(f?a.text:a.nodeValue)}function c(a){return 8==a.nodeType&&h.test(f?a.text:a.nodeValue)}function d(a,d){for(var e=a,f=1,l=[];e=e.nextSibling;){if(c(e)&&(f--,0===f))return l;l.push(e);b(e)&&f++}if(!d)throw Error("Cannot find closing comment tag to match: "+a.nodeValue);return null}function e(a,b){var c=d(a,b);return c?0<c.length?c[c.length-
64
- 1].nextSibling:a.nextSibling:null}var f=t&&"\x3c!--test--\x3e"===t.createComment("test").text,g=f?/^\x3c!--\s*ko(?:\s+([\s\S]+))?\s*--\x3e$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/,h=f?/^\x3c!--\s*\/ko\s*--\x3e$/:/^\s*\/ko\s*$/,l={ul:!0,ol:!0};a.f={aa:{},childNodes:function(a){return b(a)?d(a):a.childNodes},za:function(c){if(b(c)){c=a.f.childNodes(c);for(var d=0,e=c.length;d<e;d++)a.removeNode(c[d])}else a.a.rb(c)},fa:function(c,d){if(b(c)){a.f.za(c);for(var e=c.nextSibling,f=0,l=d.length;f<l;f++)e.parentNode.insertBefore(d[f],
65
- e)}else a.a.fa(c,d)},qc:function(a,c){b(a)?a.parentNode.insertBefore(c,a.nextSibling):a.firstChild?a.insertBefore(c,a.firstChild):a.appendChild(c)},kc:function(c,d,e){e?b(c)?c.parentNode.insertBefore(d,e.nextSibling):e.nextSibling?c.insertBefore(d,e.nextSibling):c.appendChild(d):a.f.qc(c,d)},firstChild:function(a){return b(a)?!a.nextSibling||c(a.nextSibling)?null:a.nextSibling:a.firstChild},nextSibling:function(a){b(a)&&(a=e(a));return a.nextSibling&&c(a.nextSibling)?null:a.nextSibling},Yc:b,vd:function(a){return(a=
66
- (f?a.text:a.nodeValue).match(g))?a[1]:null},oc:function(d){if(l[a.a.A(d)]){var k=d.firstChild;if(k){do if(1===k.nodeType){var f;f=k.firstChild;var g=null;if(f){do if(g)g.push(f);else if(b(f)){var h=e(f,!0);h?f=h:g=[f]}else c(f)&&(g=[f]);while(f=f.nextSibling)}if(f=g)for(g=k.nextSibling,h=0;h<f.length;h++)g?d.insertBefore(f[h],g):d.appendChild(f[h])}while(k=k.nextSibling)}}}}})();a.b("virtualElements",a.f);a.b("virtualElements.allowedBindings",a.f.aa);a.b("virtualElements.emptyNode",a.f.za);a.b("virtualElements.insertAfter",
67
- a.f.kc);a.b("virtualElements.prepend",a.f.qc);a.b("virtualElements.setDomNodeChildren",a.f.fa);(function(){a.S=function(){this.Kc={}};a.a.extend(a.S.prototype,{nodeHasBindings:function(b){switch(b.nodeType){case 1:return null!=b.getAttribute("data-bind")||a.g.getComponentNameForNode(b);case 8:return a.f.Yc(b);default:return!1}},getBindings:function(b,c){var d=this.getBindingsString(b,c),d=d?this.parseBindingsString(d,c,b):null;return a.g.Rb(d,b,c,!1)},getBindingAccessors:function(b,c){var d=this.getBindingsString(b,
68
- c),d=d?this.parseBindingsString(d,c,b,{valueAccessors:!0}):null;return a.g.Rb(d,b,c,!0)},getBindingsString:function(b){switch(b.nodeType){case 1:return b.getAttribute("data-bind");case 8:return a.f.vd(b);default:return null}},parseBindingsString:function(b,c,d,e){try{var f=this.Kc,g=b+(e&&e.valueAccessors||""),h;if(!(h=f[g])){var l,m="with($context){with($data||{}){return{"+a.h.Xa(b,e)+"}}}";l=new Function("$context","$element",m);h=f[g]=l}return h(c,d)}catch(k){throw k.message="Unable to parse bindings.\nBindings value: "+
69
- b+"\nMessage: "+k.message,k;}}});a.S.instance=new a.S})();a.b("bindingProvider",a.S);(function(){function b(a){return function(){return a}}function c(a){return a()}function d(b){return a.a.Ea(a.l.w(b),function(a,c){return function(){return b()[c]}})}function e(c,e,k){return"function"===typeof c?d(c.bind(null,e,k)):a.a.Ea(c,b)}function f(a,b){return d(this.getBindings.bind(this,a,b))}function g(b,c,d){var e,k=a.f.firstChild(c),f=a.S.instance,m=f.preprocessNode;if(m){for(;e=k;)k=a.f.nextSibling(e),
70
- m.call(f,e);k=a.f.firstChild(c)}for(;e=k;)k=a.f.nextSibling(e),h(b,e,d)}function h(b,c,d){var e=!0,k=1===c.nodeType;k&&a.f.oc(c);if(k&&d||a.S.instance.nodeHasBindings(c))e=m(c,null,b,d).shouldBindDescendants;e&&!r[a.a.A(c)]&&g(b,c,!k)}function l(b){var c=[],d={},e=[];a.a.D(b,function X(k){if(!d[k]){var f=a.getBindingHandler(k);f&&(f.after&&(e.push(k),a.a.r(f.after,function(c){if(b[c]){if(-1!==a.a.o(e,c))throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+e.join(", "));
71
- X(c)}}),e.length--),c.push({key:k,jc:f}));d[k]=!0}});return c}function m(b,d,e,k){var m=a.a.e.get(b,q);if(!d){if(m)throw Error("You cannot apply bindings multiple times to the same element.");a.a.e.set(b,q,!0)}!m&&k&&a.xc(b,e);var g;if(d&&"function"!==typeof d)g=d;else{var h=a.S.instance,r=h.getBindingAccessors||f,p=a.B(function(){(g=d?d(e,b):r.call(h,b,e))&&e.Q&&e.Q();return g},null,{i:b});g&&p.ca()||(p=null)}var s;if(g){var t=p?function(a){return function(){return c(p()[a])}}:function(a){return g[a]},
72
- u=function(){return a.a.Ea(p?p():g,c)};u.get=function(a){return g[a]&&c(t(a))};u.has=function(a){return a in g};k=l(g);a.a.r(k,function(c){var d=c.jc.init,k=c.jc.update,f=c.key;if(8===b.nodeType&&!a.f.aa[f])throw Error("The binding '"+f+"' cannot be used with virtual elements");try{"function"==typeof d&&a.l.w(function(){var a=d(b,t(f),u,e.$data,e);if(a&&a.controlsDescendantBindings){if(s!==n)throw Error("Multiple bindings ("+s+" and "+f+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");
73
- s=f}}),"function"==typeof k&&a.B(function(){k(b,t(f),u,e.$data,e)},null,{i:b})}catch(m){throw m.message='Unable to process binding "'+f+": "+g[f]+'"\nMessage: '+m.message,m;}})}return{shouldBindDescendants:s===n}}function k(b){return b&&b instanceof a.R?b:new a.R(b)}a.d={};var r={script:!0,textarea:!0,template:!0};a.getBindingHandler=function(b){return a.d[b]};a.R=function(b,c,d,e,k){function f(){var k=g?b():b,m=a.a.c(k);c?(c.Q&&c.Q(),a.a.extend(l,c),l.Q=r):(l.$parents=[],l.$root=m,l.ko=a);l.$rawData=
74
- k;l.$data=m;d&&(l[d]=m);e&&e(l,c,m);return l.$data}function m(){return h&&!a.a.Tb(h)}var l=this,g="function"==typeof b&&!a.I(b),h,r;k&&k.exportDependencies?f():(r=a.B(f,null,{ya:m,i:!0}),r.ca()&&(l.Q=r,r.equalityComparer=null,h=[],r.Dc=function(b){h.push(b);a.a.G.qa(b,function(b){a.a.Na(h,b);h.length||(r.k(),l.Q=r=n)})}))};a.R.prototype.createChildContext=function(b,c,d,e){return new a.R(b,this,c,function(a,b){a.$parentContext=b;a.$parent=b.$data;a.$parents=(b.$parents||[]).slice(0);a.$parents.unshift(a.$parent);
75
- d&&d(a)},e)};a.R.prototype.extend=function(b){return new a.R(this.Q||this.$data,this,null,function(c,d){c.$rawData=d.$rawData;a.a.extend(c,"function"==typeof b?b():b)})};a.R.prototype.ac=function(a,b){return this.createChildContext(a,b,null,{exportDependencies:!0})};var q=a.a.e.J(),p=a.a.e.J();a.xc=function(b,c){if(2==arguments.length)a.a.e.set(b,p,c),c.Q&&c.Q.Dc(b);else return a.a.e.get(b,p)};a.La=function(b,c,d){1===b.nodeType&&a.f.oc(b);return m(b,c,k(d),!0)};a.Ic=function(b,c,d){d=k(d);return a.La(b,
76
- e(c,d,b),d)};a.hb=function(a,b){1!==b.nodeType&&8!==b.nodeType||g(k(a),b,!0)};a.Ub=function(a,b){!u&&x.jQuery&&(u=x.jQuery);if(b&&1!==b.nodeType&&8!==b.nodeType)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");b=b||x.document.body;h(k(a),b,!0)};a.nb=function(b){switch(b.nodeType){case 1:case 8:var c=a.xc(b);if(c)return c;if(b.parentNode)return a.nb(b.parentNode)}return n};a.Oc=function(b){return(b=a.nb(b))?b.$data:n};a.b("bindingHandlers",
77
- a.d);a.b("applyBindings",a.Ub);a.b("applyBindingsToDescendants",a.hb);a.b("applyBindingAccessorsToNode",a.La);a.b("applyBindingsToNode",a.Ic);a.b("contextFor",a.nb);a.b("dataFor",a.Oc)})();(function(b){function c(c,e){var m=f.hasOwnProperty(c)?f[c]:b,k;m?m.Y(e):(m=f[c]=new a.K,m.Y(e),d(c,function(b,d){var e=!(!d||!d.synchronous);g[c]={definition:b,dd:e};delete f[c];k||e?m.notifySubscribers(b):a.Z.Za(function(){m.notifySubscribers(b)})}),k=!0)}function d(a,b){e("getConfig",[a],function(c){c?e("loadComponent",
78
- [a,c],function(a){b(a,c)}):b(null,null)})}function e(c,d,f,k){k||(k=a.g.loaders.slice(0));var g=k.shift();if(g){var q=g[c];if(q){var p=!1;if(q.apply(g,d.concat(function(a){p?f(null):null!==a?f(a):e(c,d,f,k)}))!==b&&(p=!0,!g.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.");}else e(c,d,f,k)}else f(null)}var f={},g={};a.g={get:function(d,e){var f=g.hasOwnProperty(d)?g[d]:b;f?f.dd?a.l.w(function(){e(f.definition)}):
79
- a.Z.Za(function(){e(f.definition)}):c(d,e)},$b:function(a){delete g[a]},Nb:e};a.g.loaders=[];a.b("components",a.g);a.b("components.get",a.g.get);a.b("components.clearCachedDefinition",a.g.$b)})();(function(){function b(b,c,d,e){function g(){0===--y&&e(h)}var h={},y=2,v=d.template;d=d.viewModel;v?f(c,v,function(c){a.g.Nb("loadTemplate",[b,c],function(a){h.template=a;g()})}):g();d?f(c,d,function(c){a.g.Nb("loadViewModel",[b,c],function(a){h[l]=a;g()})}):g()}function c(a,b,d){if("function"===typeof b)d(function(a){return new b(a)});
80
- else if("function"===typeof b[l])d(b[l]);else if("instance"in b){var e=b.instance;d(function(){return e})}else"viewModel"in b?c(a,b.viewModel,d):a("Unknown viewModel value: "+b)}function d(b){switch(a.a.A(b)){case "script":return a.a.na(b.text);case "textarea":return a.a.na(b.value);case "template":if(e(b.content))return a.a.wa(b.content.childNodes)}return a.a.wa(b.childNodes)}function e(a){return x.DocumentFragment?a instanceof DocumentFragment:a&&11===a.nodeType}function f(a,b,c){"string"===typeof b.require?
81
- O||x.require?(O||x.require)([b.require],c):a("Uses require, but no AMD loader is present"):c(b)}function g(a){return function(b){throw Error("Component '"+a+"': "+b);}}var h={};a.g.register=function(b,c){if(!c)throw Error("Invalid configuration for "+b);if(a.g.wb(b))throw Error("Component "+b+" is already registered");h[b]=c};a.g.wb=function(a){return h.hasOwnProperty(a)};a.g.ud=function(b){delete h[b];a.g.$b(b)};a.g.cc={getConfig:function(a,b){b(h.hasOwnProperty(a)?h[a]:null)},loadComponent:function(a,
82
- c,d){var e=g(a);f(e,c,function(c){b(a,e,c,d)})},loadTemplate:function(b,c,f){b=g(b);if("string"===typeof c)f(a.a.na(c));else if(c instanceof Array)f(c);else if(e(c))f(a.a.W(c.childNodes));else if(c.element)if(c=c.element,x.HTMLElement?c instanceof HTMLElement:c&&c.tagName&&1===c.nodeType)f(d(c));else if("string"===typeof c){var l=t.getElementById(c);l?f(d(l)):b("Cannot find element with ID "+c)}else b("Unknown element type: "+c);else b("Unknown template value: "+c)},loadViewModel:function(a,b,d){c(g(a),
83
- b,d)}};var l="createViewModel";a.b("components.register",a.g.register);a.b("components.isRegistered",a.g.wb);a.b("components.unregister",a.g.ud);a.b("components.defaultLoader",a.g.cc);a.g.loaders.push(a.g.cc);a.g.Ec=h})();(function(){function b(b,e){var f=b.getAttribute("params");if(f){var f=c.parseBindingsString(f,e,b,{valueAccessors:!0,bindingParams:!0}),f=a.a.Ea(f,function(c){return a.m(c,null,{i:b})}),g=a.a.Ea(f,function(c){var e=c.p();return c.ca()?a.m({read:function(){return a.a.c(c())},write:a.Da(e)&&
84
- function(a){c()(a)},i:b}):e});g.hasOwnProperty("$raw")||(g.$raw=f);return g}return{$raw:{}}}a.g.getComponentNameForNode=function(b){var c=a.a.A(b);if(a.g.wb(c)&&(-1!=c.indexOf("-")||"[object HTMLUnknownElement]"==""+b||8>=a.a.C&&b.tagName===c))return c};a.g.Rb=function(c,e,f,g){if(1===e.nodeType){var h=a.g.getComponentNameForNode(e);if(h){c=c||{};if(c.component)throw Error('Cannot use the "component" binding on a custom element matching a component');var l={name:h,params:b(e,f)};c.component=g?function(){return l}:
85
- l}}return c};var c=new a.S;9>a.a.C&&(a.g.register=function(a){return function(b){t.createElement(b);return a.apply(this,arguments)}}(a.g.register),t.createDocumentFragment=function(b){return function(){var c=b(),f=a.g.Ec,g;for(g in f)f.hasOwnProperty(g)&&c.createElement(g);return c}}(t.createDocumentFragment))})();(function(b){function c(b,c,d){c=c.template;if(!c)throw Error("Component '"+b+"' has no template");b=a.a.wa(c);a.f.fa(d,b)}function d(a,b,c,d){var e=a.createViewModel;return e?e.call(a,
86
- d,{element:b,templateNodes:c}):d}var e=0;a.d.component={init:function(f,g,h,l,m){function k(){var a=r&&r.dispose;"function"===typeof a&&a.call(r);q=r=null}var r,q,p=a.a.W(a.f.childNodes(f));a.a.G.qa(f,k);a.m(function(){var l=a.a.c(g()),h,v;"string"===typeof l?h=l:(h=a.a.c(l.name),v=a.a.c(l.params));if(!h)throw Error("No component name specified");var n=q=++e;a.g.get(h,function(e){if(q===n){k();if(!e)throw Error("Unknown component '"+h+"'");c(h,e,f);var l=d(e,f,p,v);e=m.createChildContext(l,b,function(a){a.$component=
87
- l;a.$componentTemplateNodes=p});r=l;a.hb(e,f)}})},null,{i:f});return{controlsDescendantBindings:!0}}};a.f.aa.component=!0})();var Q={"class":"className","for":"htmlFor"};a.d.attr={update:function(b,c){var d=a.a.c(c())||{};a.a.D(d,function(c,d){d=a.a.c(d);var g=!1===d||null===d||d===n;g&&b.removeAttribute(c);8>=a.a.C&&c in Q?(c=Q[c],g?b.removeAttribute(c):b[c]=d):g||b.setAttribute(c,d.toString());"name"===c&&a.a.vc(b,g?"":d.toString())})}};(function(){a.d.checked={after:["value","attr"],init:function(b,
88
- c,d){function e(){var e=b.checked,f=p?g():e;if(!a.xa.Va()&&(!l||e)){var h=a.l.w(c);if(k){var m=r?h.p():h;q!==f?(e&&(a.a.ra(m,f,!0),a.a.ra(m,q,!1)),q=f):a.a.ra(m,f,e);r&&a.Da(h)&&h(m)}else a.h.Ga(h,d,"checked",f,!0)}}function f(){var d=a.a.c(c());b.checked=k?0<=a.a.o(d,g()):h?d:g()===d}var g=a.rc(function(){return d.has("checkedValue")?a.a.c(d.get("checkedValue")):d.has("value")?a.a.c(d.get("value")):b.value}),h="checkbox"==b.type,l="radio"==b.type;if(h||l){var m=c(),k=h&&a.a.c(m)instanceof Array,
89
- r=!(k&&m.push&&m.splice),q=k?g():n,p=l||k;l&&!b.name&&a.d.uniqueName.init(b,function(){return!0});a.m(e,null,{i:b});a.a.q(b,"click",e);a.m(f,null,{i:b});m=n}}};a.h.ga.checked=!0;a.d.checkedValue={update:function(b,c){b.value=a.a.c(c())}}})();a.d.css={update:function(b,c){var d=a.a.c(c());null!==d&&"object"==typeof d?a.a.D(d,function(c,d){d=a.a.c(d);a.a.fb(b,c,d)}):(d=a.a.cb(String(d||"")),a.a.fb(b,b.__ko__cssValue,!1),b.__ko__cssValue=d,a.a.fb(b,d,!0))}};a.d.enable={update:function(b,c){var d=a.a.c(c());
90
- d&&b.disabled?b.removeAttribute("disabled"):d||b.disabled||(b.disabled=!0)}};a.d.disable={update:function(b,c){a.d.enable.update(b,function(){return!a.a.c(c())})}};a.d.event={init:function(b,c,d,e,f){var g=c()||{};a.a.D(g,function(g){"string"==typeof g&&a.a.q(b,g,function(b){var m,k=c()[g];if(k){try{var r=a.a.W(arguments);e=f.$data;r.unshift(e);m=k.apply(e,r)}finally{!0!==m&&(b.preventDefault?b.preventDefault():b.returnValue=!1)}!1===d.get(g+"Bubble")&&(b.cancelBubble=!0,b.stopPropagation&&b.stopPropagation())}})})}};
91
- a.d.foreach={mc:function(b){return function(){var c=b(),d=a.a.Bb(c);if(!d||"number"==typeof d.length)return{foreach:c,templateEngine:a.X.vb};a.a.c(c);return{foreach:d.data,as:d.as,includeDestroyed:d.includeDestroyed,afterAdd:d.afterAdd,beforeRemove:d.beforeRemove,afterRender:d.afterRender,beforeMove:d.beforeMove,afterMove:d.afterMove,templateEngine:a.X.vb}}},init:function(b,c){return a.d.template.init(b,a.d.foreach.mc(c))},update:function(b,c,d,e,f){return a.d.template.update(b,a.d.foreach.mc(c),
92
- d,e,f)}};a.h.va.foreach=!1;a.f.aa.foreach=!0;a.d.hasfocus={init:function(b,c,d){function e(e){b.__ko_hasfocusUpdating=!0;var f=b.ownerDocument;if("activeElement"in f){var g;try{g=f.activeElement}catch(k){g=f.body}e=g===b}f=c();a.h.Ga(f,d,"hasfocus",e,!0);b.__ko_hasfocusLastValue=e;b.__ko_hasfocusUpdating=!1}var f=e.bind(null,!0),g=e.bind(null,!1);a.a.q(b,"focus",f);a.a.q(b,"focusin",f);a.a.q(b,"blur",g);a.a.q(b,"focusout",g)},update:function(b,c){var d=!!a.a.c(c());b.__ko_hasfocusUpdating||b.__ko_hasfocusLastValue===
93
- d||(d?b.focus():b.blur(),!d&&b.__ko_hasfocusLastValue&&b.ownerDocument.body.focus(),a.l.w(a.a.Fa,null,[b,d?"focusin":"focusout"]))}};a.h.ga.hasfocus=!0;a.d.hasFocus=a.d.hasfocus;a.h.ga.hasFocus=!0;a.d.html={init:function(){return{controlsDescendantBindings:!0}},update:function(b,c){a.a.Eb(b,c())}};K("if");K("ifnot",!1,!0);K("with",!0,!1,function(a,c){return a.ac(c)});var L={};a.d.options={init:function(b){if("select"!==a.a.A(b))throw Error("options binding applies only to SELECT elements");for(;0<
94
- b.length;)b.remove(0);return{controlsDescendantBindings:!0}},update:function(b,c,d){function e(){return a.a.Ma(b.options,function(a){return a.selected})}function f(a,b,c){var d=typeof b;return"function"==d?b(a):"string"==d?a[b]:c}function g(c,e){if(A&&k)a.j.ja(b,a.a.c(d.get("value")),!0);else if(p.length){var f=0<=a.a.o(p,a.j.u(e[0]));a.a.wc(e[0],f);A&&!f&&a.l.w(a.a.Fa,null,[b,"change"])}}var h=b.multiple,l=0!=b.length&&h?b.scrollTop:null,m=a.a.c(c()),k=d.get("valueAllowUnset")&&d.has("value"),r=
95
- d.get("optionsIncludeDestroyed");c={};var q,p=[];k||(h?p=a.a.ib(e(),a.j.u):0<=b.selectedIndex&&p.push(a.j.u(b.options[b.selectedIndex])));m&&("undefined"==typeof m.length&&(m=[m]),q=a.a.Ma(m,function(b){return r||b===n||null===b||!a.a.c(b._destroy)}),d.has("optionsCaption")&&(m=a.a.c(d.get("optionsCaption")),null!==m&&m!==n&&q.unshift(L)));var A=!1;c.beforeRemove=function(a){b.removeChild(a)};m=g;d.has("optionsAfterRender")&&"function"==typeof d.get("optionsAfterRender")&&(m=function(b,c){g(0,c);
96
- a.l.w(d.get("optionsAfterRender"),null,[c[0],b!==L?b:n])});a.a.Db(b,q,function(c,e,g){g.length&&(p=!k&&g[0].selected?[a.j.u(g[0])]:[],A=!0);e=b.ownerDocument.createElement("option");c===L?(a.a.bb(e,d.get("optionsCaption")),a.j.ja(e,n)):(g=f(c,d.get("optionsValue"),c),a.j.ja(e,a.a.c(g)),c=f(c,d.get("optionsText"),g),a.a.bb(e,c));return[e]},c,m);a.l.w(function(){k?a.j.ja(b,a.a.c(d.get("value")),!0):(h?p.length&&e().length<p.length:p.length&&0<=b.selectedIndex?a.j.u(b.options[b.selectedIndex])!==p[0]:
97
- p.length||0<=b.selectedIndex)&&a.a.Fa(b,"change")});a.a.Sc(b);l&&20<Math.abs(l-b.scrollTop)&&(b.scrollTop=l)}};a.d.options.zb=a.a.e.J();a.d.selectedOptions={after:["options","foreach"],init:function(b,c,d){a.a.q(b,"change",function(){var e=c(),f=[];a.a.r(b.getElementsByTagName("option"),function(b){b.selected&&f.push(a.j.u(b))});a.h.Ga(e,d,"selectedOptions",f)})},update:function(b,c){if("select"!=a.a.A(b))throw Error("values binding applies only to SELECT elements");var d=a.a.c(c()),e=b.scrollTop;
98
- d&&"number"==typeof d.length&&a.a.r(b.getElementsByTagName("option"),function(b){var c=0<=a.a.o(d,a.j.u(b));b.selected!=c&&a.a.wc(b,c)});b.scrollTop=e}};a.h.ga.selectedOptions=!0;a.d.style={update:function(b,c){var d=a.a.c(c()||{});a.a.D(d,function(c,d){d=a.a.c(d);if(null===d||d===n||!1===d)d="";b.style[c]=d})}};a.d.submit={init:function(b,c,d,e,f){if("function"!=typeof c())throw Error("The value for a submit binding must be a function");a.a.q(b,"submit",function(a){var d,e=c();try{d=e.call(f.$data,
99
- b)}finally{!0!==d&&(a.preventDefault?a.preventDefault():a.returnValue=!1)}})}};a.d.text={init:function(){return{controlsDescendantBindings:!0}},update:function(b,c){a.a.bb(b,c())}};a.f.aa.text=!0;(function(){if(x&&x.navigator)var b=function(a){if(a)return parseFloat(a[1])},c=x.opera&&x.opera.version&&parseInt(x.opera.version()),d=x.navigator.userAgent,e=b(d.match(/^(?:(?!chrome).)*version\/([^ ]*) safari/i)),f=b(d.match(/Firefox\/([^ ]*)/));if(10>a.a.C)var g=a.a.e.J(),h=a.a.e.J(),l=function(b){var c=
100
- this.activeElement;(c=c&&a.a.e.get(c,h))&&c(b)},m=function(b,c){var d=b.ownerDocument;a.a.e.get(d,g)||(a.a.e.set(d,g,!0),a.a.q(d,"selectionchange",l));a.a.e.set(b,h,c)};a.d.textInput={init:function(b,d,g){function l(c,d){a.a.q(b,c,d)}function h(){var c=a.a.c(d());if(null===c||c===n)c="";u!==n&&c===u?a.a.setTimeout(h,4):b.value!==c&&(s=c,b.value=c)}function y(){t||(u=b.value,t=a.a.setTimeout(v,4))}function v(){clearTimeout(t);u=t=n;var c=b.value;s!==c&&(s=c,a.h.Ga(d(),g,"textInput",c))}var s=b.value,
101
- t,u,x=9==a.a.C?y:v;10>a.a.C?(l("propertychange",function(a){"value"===a.propertyName&&x(a)}),8==a.a.C&&(l("keyup",v),l("keydown",v)),8<=a.a.C&&(m(b,x),l("dragend",y))):(l("input",v),5>e&&"textarea"===a.a.A(b)?(l("keydown",y),l("paste",y),l("cut",y)):11>c?l("keydown",y):4>f&&(l("DOMAutoComplete",v),l("dragdrop",v),l("drop",v)));l("change",v);a.m(h,null,{i:b})}};a.h.ga.textInput=!0;a.d.textinput={preprocess:function(a,b,c){c("textInput",a)}}})();a.d.uniqueName={init:function(b,c){if(c()){var d="ko_unique_"+
102
- ++a.d.uniqueName.Nc;a.a.vc(b,d)}}};a.d.uniqueName.Nc=0;a.d.value={after:["options","foreach"],init:function(b,c,d){if("input"!=b.tagName.toLowerCase()||"checkbox"!=b.type&&"radio"!=b.type){var e=["change"],f=d.get("valueUpdate"),g=!1,h=null;f&&("string"==typeof f&&(f=[f]),a.a.ta(e,f),e=a.a.Wb(e));var l=function(){h=null;g=!1;var e=c(),f=a.j.u(b);a.h.Ga(e,d,"value",f)};!a.a.C||"input"!=b.tagName.toLowerCase()||"text"!=b.type||"off"==b.autocomplete||b.form&&"off"==b.form.autocomplete||-1!=a.a.o(e,"propertychange")||
103
- (a.a.q(b,"propertychange",function(){g=!0}),a.a.q(b,"focus",function(){g=!1}),a.a.q(b,"blur",function(){g&&l()}));a.a.r(e,function(c){var d=l;a.a.sd(c,"after")&&(d=function(){h=a.j.u(b);a.a.setTimeout(l,0)},c=c.substring(5));a.a.q(b,c,d)});var m=function(){var e=a.a.c(c()),f=a.j.u(b);if(null!==h&&e===h)a.a.setTimeout(m,0);else if(e!==f)if("select"===a.a.A(b)){var g=d.get("valueAllowUnset"),f=function(){a.j.ja(b,e,g)};f();g||e===a.j.u(b)?a.a.setTimeout(f,0):a.l.w(a.a.Fa,null,[b,"change"])}else a.j.ja(b,
104
- e)};a.m(m,null,{i:b})}else a.La(b,{checkedValue:c})},update:function(){}};a.h.ga.value=!0;a.d.visible={update:function(b,c){var d=a.a.c(c()),e="none"!=b.style.display;d&&!e?b.style.display="":!d&&e&&(b.style.display="none")}};(function(b){a.d[b]={init:function(c,d,e,f,g){return a.d.event.init.call(this,c,function(){var a={};a[b]=d();return a},e,f,g)}}})("click");a.P=function(){};a.P.prototype.renderTemplateSource=function(){throw Error("Override renderTemplateSource");};a.P.prototype.createJavaScriptEvaluatorBlock=
105
- function(){throw Error("Override createJavaScriptEvaluatorBlock");};a.P.prototype.makeTemplateSource=function(b,c){if("string"==typeof b){c=c||t;var d=c.getElementById(b);if(!d)throw Error("Cannot find template with ID "+b);return new a.v.n(d)}if(1==b.nodeType||8==b.nodeType)return new a.v.sa(b);throw Error("Unknown template type: "+b);};a.P.prototype.renderTemplate=function(a,c,d,e){a=this.makeTemplateSource(a,e);return this.renderTemplateSource(a,c,d,e)};a.P.prototype.isTemplateRewritten=function(a,
106
- c){return!1===this.allowTemplateRewriting?!0:this.makeTemplateSource(a,c).data("isRewritten")};a.P.prototype.rewriteTemplate=function(a,c,d){a=this.makeTemplateSource(a,d);c=c(a.text());a.text(c);a.data("isRewritten",!0)};a.b("templateEngine",a.P);a.Ib=function(){function b(b,c,d,h){b=a.h.Ab(b);for(var l=a.h.va,m=0;m<b.length;m++){var k=b[m].key;if(l.hasOwnProperty(k)){var r=l[k];if("function"===typeof r){if(k=r(b[m].value))throw Error(k);}else if(!r)throw Error("This template engine does not support the '"+
107
- k+"' binding within its templates");}}d="ko.__tr_ambtns(function($context,$element){return(function(){return{ "+a.h.Xa(b,{valueAccessors:!0})+" } })()},'"+d.toLowerCase()+"')";return h.createJavaScriptEvaluatorBlock(d)+c}var c=/(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'|[^>]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi,d=/\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;return{Tc:function(b,c,d){c.isTemplateRewritten(b,d)||c.rewriteTemplate(b,function(b){return a.Ib.jd(b,
108
- c)},d)},jd:function(a,f){return a.replace(c,function(a,c,d,e,k){return b(k,c,d,f)}).replace(d,function(a,c){return b(c,"\x3c!-- ko --\x3e","#comment",f)})},Jc:function(b,c){return a.N.yb(function(d,h){var l=d.nextSibling;l&&l.nodeName.toLowerCase()===c&&a.La(l,b,h)})}}}();a.b("__tr_ambtns",a.Ib.Jc);(function(){a.v={};a.v.n=function(b){if(this.n=b){var c=a.a.A(b);this.eb="script"===c?1:"textarea"===c?2:"template"==c&&b.content&&11===b.content.nodeType?3:4}};a.v.n.prototype.text=function(){var b=1===
109
- this.eb?"text":2===this.eb?"value":"innerHTML";if(0==arguments.length)return this.n[b];var c=arguments[0];"innerHTML"===b?a.a.Eb(this.n,c):this.n[b]=c};var b=a.a.e.J()+"_";a.v.n.prototype.data=function(c){if(1===arguments.length)return a.a.e.get(this.n,b+c);a.a.e.set(this.n,b+c,arguments[1])};var c=a.a.e.J();a.v.n.prototype.nodes=function(){var b=this.n;if(0==arguments.length)return(a.a.e.get(b,c)||{}).mb||(3===this.eb?b.content:4===this.eb?b:n);a.a.e.set(b,c,{mb:arguments[0]})};a.v.sa=function(a){this.n=
110
- a};a.v.sa.prototype=new a.v.n;a.v.sa.prototype.text=function(){if(0==arguments.length){var b=a.a.e.get(this.n,c)||{};b.Jb===n&&b.mb&&(b.Jb=b.mb.innerHTML);return b.Jb}a.a.e.set(this.n,c,{Jb:arguments[0]})};a.b("templateSources",a.v);a.b("templateSources.domElement",a.v.n);a.b("templateSources.anonymousTemplate",a.v.sa)})();(function(){function b(b,c,d){var e;for(c=a.f.nextSibling(c);b&&(e=b)!==c;)b=a.f.nextSibling(e),d(e,b)}function c(c,d){if(c.length){var e=c[0],f=c[c.length-1],g=e.parentNode,h=
111
- a.S.instance,n=h.preprocessNode;if(n){b(e,f,function(a,b){var c=a.previousSibling,d=n.call(h,a);d&&(a===e&&(e=d[0]||b),a===f&&(f=d[d.length-1]||c))});c.length=0;if(!e)return;e===f?c.push(e):(c.push(e,f),a.a.Ba(c,g))}b(e,f,function(b){1!==b.nodeType&&8!==b.nodeType||a.Ub(d,b)});b(e,f,function(b){1!==b.nodeType&&8!==b.nodeType||a.N.Cc(b,[d])});a.a.Ba(c,g)}}function d(a){return a.nodeType?a:0<a.length?a[0]:null}function e(b,e,f,h,q){q=q||{};var p=(b&&d(b)||f||{}).ownerDocument,n=q.templateEngine||g;
112
- a.Ib.Tc(f,n,p);f=n.renderTemplate(f,h,q,p);if("number"!=typeof f.length||0<f.length&&"number"!=typeof f[0].nodeType)throw Error("Template engine must return an array of DOM nodes");p=!1;switch(e){case "replaceChildren":a.f.fa(b,f);p=!0;break;case "replaceNode":a.a.uc(b,f);p=!0;break;case "ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+e);}p&&(c(f,h),q.afterRender&&a.l.w(q.afterRender,null,[f,h.$data]));return f}function f(b,c,d){return a.I(b)?b():"function"===typeof b?b(c,d):b}
113
- var g;a.Fb=function(b){if(b!=n&&!(b instanceof a.P))throw Error("templateEngine must inherit from ko.templateEngine");g=b};a.Cb=function(b,c,k,h,q){k=k||{};if((k.templateEngine||g)==n)throw Error("Set a template engine before calling renderTemplate");q=q||"replaceChildren";if(h){var p=d(h);return a.B(function(){var g=c&&c instanceof a.R?c:new a.R(c,null,null,null,{exportDependencies:!0}),n=f(b,g.$data,g),g=e(h,q,n,g,k);"replaceNode"==q&&(h=g,p=d(h))},null,{ya:function(){return!p||!a.a.qb(p)},i:p&&
114
- "replaceNode"==q?p.parentNode:p})}return a.N.yb(function(d){a.Cb(b,c,k,d,"replaceNode")})};a.pd=function(b,d,g,h,q){function p(a,b){c(b,t);g.afterRender&&g.afterRender(b,a);t=null}function s(a,c){t=q.createChildContext(a,g.as,function(a){a.$index=c});var d=f(b,a,t);return e(null,"ignoreTargetNode",d,t,g)}var t;return a.B(function(){var b=a.a.c(d)||[];"undefined"==typeof b.length&&(b=[b]);b=a.a.Ma(b,function(b){return g.includeDestroyed||b===n||null===b||!a.a.c(b._destroy)});a.l.w(a.a.Db,null,[h,b,
115
- s,g,p])},null,{i:h})};var h=a.a.e.J();a.d.template={init:function(b,c){var d=a.a.c(c());if("string"==typeof d||d.name)a.f.za(b);else{if("nodes"in d){if(d=d.nodes||[],a.I(d))throw Error('The "nodes" option must be a plain, non-observable array.');}else d=a.f.childNodes(b);d=a.a.nc(d);(new a.v.sa(b)).nodes(d)}return{controlsDescendantBindings:!0}},update:function(b,c,d,e,f){var g=c();c=a.a.c(g);d=!0;e=null;"string"==typeof c?c={}:(g=c.name,"if"in c&&(d=a.a.c(c["if"])),d&&"ifnot"in c&&(d=!a.a.c(c.ifnot)));
116
- "foreach"in c?e=a.pd(g||b,d&&c.foreach||[],c,b,f):d?(f="data"in c?f.ac(c.data,c.as):f,e=a.Cb(g||b,f,c,b)):a.f.za(b);f=e;(c=a.a.e.get(b,h))&&"function"==typeof c.k&&c.k();a.a.e.set(b,h,f&&f.ca()?f:n)}};a.h.va.template=function(b){b=a.h.Ab(b);return 1==b.length&&b[0].unknown||a.h.fd(b,"name")?null:"This template engine does not support anonymous templates nested within its templates"};a.f.aa.template=!0})();a.b("setTemplateEngine",a.Fb);a.b("renderTemplate",a.Cb);a.a.hc=function(a,c,d){if(a.length&&
117
- c.length){var e,f,g,h,l;for(e=f=0;(!d||e<d)&&(h=a[f]);++f){for(g=0;l=c[g];++g)if(h.value===l.value){h.moved=l.index;l.moved=h.index;c.splice(g,1);e=g=0;break}e+=g}}};a.a.lb=function(){function b(b,d,e,f,g){var h=Math.min,l=Math.max,m=[],k,n=b.length,q,p=d.length,s=p-n||1,t=n+p+1,v,u,x;for(k=0;k<=n;k++)for(u=v,m.push(v=[]),x=h(p,k+s),q=l(0,k-1);q<=x;q++)v[q]=q?k?b[k-1]===d[q-1]?u[q-1]:h(u[q]||t,v[q-1]||t)+1:q+1:k+1;h=[];l=[];s=[];k=n;for(q=p;k||q;)p=m[k][q]-1,q&&p===m[k][q-1]?l.push(h[h.length]={status:e,
118
- value:d[--q],index:q}):k&&p===m[k-1][q]?s.push(h[h.length]={status:f,value:b[--k],index:k}):(--q,--k,g.sparse||h.push({status:"retained",value:d[q]}));a.a.hc(s,l,!g.dontLimitMoves&&10*n);return h.reverse()}return function(a,d,e){e="boolean"===typeof e?{dontLimitMoves:e}:e||{};a=a||[];d=d||[];return a.length<d.length?b(a,d,"added","deleted",e):b(d,a,"deleted","added",e)}}();a.b("utils.compareArrays",a.a.lb);(function(){function b(b,c,d,h,l){var m=[],k=a.B(function(){var k=c(d,l,a.a.Ba(m,b))||[];0<
119
- m.length&&(a.a.uc(m,k),h&&a.l.w(h,null,[d,k,l]));m.length=0;a.a.ta(m,k)},null,{i:b,ya:function(){return!a.a.Tb(m)}});return{ea:m,B:k.ca()?k:n}}var c=a.a.e.J(),d=a.a.e.J();a.a.Db=function(e,f,g,h,l){function m(b,c){w=q[c];u!==c&&(D[b]=w);w.tb(u++);a.a.Ba(w.ea,e);t.push(w);z.push(w)}function k(b,c){if(b)for(var d=0,e=c.length;d<e;d++)c[d]&&a.a.r(c[d].ea,function(a){b(a,d,c[d].ka)})}f=f||[];h=h||{};var r=a.a.e.get(e,c)===n,q=a.a.e.get(e,c)||[],p=a.a.ib(q,function(a){return a.ka}),s=a.a.lb(p,f,h.dontLimitMoves),
120
- t=[],v=0,u=0,x=[],z=[];f=[];for(var D=[],p=[],w,C=0,B,E;B=s[C];C++)switch(E=B.moved,B.status){case "deleted":E===n&&(w=q[v],w.B&&(w.B.k(),w.B=n),a.a.Ba(w.ea,e).length&&(h.beforeRemove&&(t.push(w),z.push(w),w.ka===d?w=null:f[C]=w),w&&x.push.apply(x,w.ea)));v++;break;case "retained":m(C,v++);break;case "added":E!==n?m(C,E):(w={ka:B.value,tb:a.O(u++)},t.push(w),z.push(w),r||(p[C]=w))}a.a.e.set(e,c,t);k(h.beforeMove,D);a.a.r(x,h.beforeRemove?a.ba:a.removeNode);for(var C=0,r=a.f.firstChild(e),F;w=z[C];C++){w.ea||
121
- a.a.extend(w,b(e,g,w.ka,l,w.tb));for(v=0;s=w.ea[v];r=s.nextSibling,F=s,v++)s!==r&&a.f.kc(e,s,F);!w.ad&&l&&(l(w.ka,w.ea,w.tb),w.ad=!0)}k(h.beforeRemove,f);for(C=0;C<f.length;++C)f[C]&&(f[C].ka=d);k(h.afterMove,D);k(h.afterAdd,p)}})();a.b("utils.setDomNodeChildrenFromArrayMapping",a.a.Db);a.X=function(){this.allowTemplateRewriting=!1};a.X.prototype=new a.P;a.X.prototype.renderTemplateSource=function(b,c,d,e){if(c=(9>a.a.C?0:b.nodes)?b.nodes():null)return a.a.W(c.cloneNode(!0).childNodes);b=b.text();
122
- return a.a.na(b,e)};a.X.vb=new a.X;a.Fb(a.X.vb);a.b("nativeTemplateEngine",a.X);(function(){a.xb=function(){var a=this.ed=function(){if(!u||!u.tmpl)return 0;try{if(0<=u.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch(a){}return 1}();this.renderTemplateSource=function(b,e,f,g){g=g||t;f=f||{};if(2>a)throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");var h=b.data("precompiled");h||(h=b.text()||"",h=u.template(null,"{{ko_with $item.koBindingContext}}"+
123
- h+"{{/ko_with}}"),b.data("precompiled",h));b=[e.$data];e=u.extend({koBindingContext:e},f.templateOptions);e=u.tmpl(h,b,e);e.appendTo(g.createElement("div"));u.fragments={};return e};this.createJavaScriptEvaluatorBlock=function(a){return"{{ko_code ((function() { return "+a+" })()) }}"};this.addTemplate=function(a,b){t.write("<script type='text/html' id='"+a+"'>"+b+"\x3c/script>")};0<a&&(u.tmpl.tag.ko_code={open:"__.push($1 || '');"},u.tmpl.tag.ko_with={open:"with($1) {",close:"} "})};a.xb.prototype=
124
- new a.P;var b=new a.xb;0<b.ed&&a.Fb(b);a.b("jqueryTmplTemplateEngine",a.xb)})()})})();})();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  /*!
2
+ * Knockout JavaScript library v3.5.1
3
  * (c) The Knockout.js team - http://knockoutjs.com/
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
  */
6
 
7
+ (function() {(function(n){var A=this||(0,eval)("this"),w=A.document,R=A.navigator,v=A.jQuery,H=A.JSON;v||"undefined"===typeof jQuery||(v=jQuery);(function(n){"function"===typeof define&&define.amd?define(["exports","require"],n):"object"===typeof exports&&"object"===typeof module?n(module.exports||exports):n(A.ko={})})(function(S,T){function K(a,c){return null===a||typeof a in W?a===c:!1}function X(b,c){var d;return function(){d||(d=a.a.setTimeout(function(){d=n;b()},c))}}function Y(b,c){var d;return function(){clearTimeout(d);
8
+ d=a.a.setTimeout(b,c)}}function Z(a,c){c&&"change"!==c?"beforeChange"===c?this.pc(a):this.gb(a,c):this.qc(a)}function aa(a,c){null!==c&&c.s&&c.s()}function ba(a,c){var d=this.qd,e=d[r];e.ra||(this.Qb&&this.mb[c]?(d.uc(c,a,this.mb[c]),this.mb[c]=null,--this.Qb):e.I[c]||d.uc(c,a,e.J?{da:a}:d.$c(a)),a.Ja&&a.gd())}var a="undefined"!==typeof S?S:{};a.b=function(b,c){for(var d=b.split("."),e=a,f=0;f<d.length-1;f++)e=e[d[f]];e[d[d.length-1]]=c};a.L=function(a,c,d){a[c]=d};a.version="3.5.1";a.b("version",
9
+ a.version);a.options={deferUpdates:!1,useOnlyNativeEvents:!1,foreachHidesDestroyed:!1};a.a=function(){function b(a,b){for(var c in a)f.call(a,c)&&b(c,a[c])}function c(a,b){if(b)for(var c in b)f.call(b,c)&&(a[c]=b[c]);return a}function d(a,b){a.__proto__=b;return a}function e(b,c,d,e){var l=b[c].match(q)||[];a.a.D(d.match(q),function(b){a.a.Na(l,b,e)});b[c]=l.join(" ")}var f=Object.prototype.hasOwnProperty,g={__proto__:[]}instanceof Array,h="function"===typeof Symbol,m={},k={};m[R&&/Firefox\/2/i.test(R.userAgent)?
10
+ "KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"];m.MouseEvents="click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" ");b(m,function(a,b){if(b.length)for(var c=0,d=b.length;c<d;c++)k[b[c]]=a});var l={propertychange:!0},p=w&&function(){for(var a=3,b=w.createElement("div"),c=b.getElementsByTagName("i");b.innerHTML="\x3c!--[if gt IE "+ ++a+"]><i></i><![endif]--\x3e",c[0];);return 4<a?a:n}(),q=/\S+/g,t;return{Jc:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],
11
+ D:function(a,b,c){for(var d=0,e=a.length;d<e;d++)b.call(c,a[d],d,a)},A:"function"==typeof Array.prototype.indexOf?function(a,b){return Array.prototype.indexOf.call(a,b)}:function(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return c;return-1},Lb:function(a,b,c){for(var d=0,e=a.length;d<e;d++)if(b.call(c,a[d],d,a))return a[d];return n},Pa:function(b,c){var d=a.a.A(b,c);0<d?b.splice(d,1):0===d&&b.shift()},wc:function(b){var c=[];b&&a.a.D(b,function(b){0>a.a.A(c,b)&&c.push(b)});return c},Mb:function(a,
12
+ b,c){var d=[];if(a)for(var e=0,l=a.length;e<l;e++)d.push(b.call(c,a[e],e));return d},jb:function(a,b,c){var d=[];if(a)for(var e=0,l=a.length;e<l;e++)b.call(c,a[e],e)&&d.push(a[e]);return d},Nb:function(a,b){if(b instanceof Array)a.push.apply(a,b);else for(var c=0,d=b.length;c<d;c++)a.push(b[c]);return a},Na:function(b,c,d){var e=a.a.A(a.a.bc(b),c);0>e?d&&b.push(c):d||b.splice(e,1)},Ba:g,extend:c,setPrototypeOf:d,Ab:g?d:c,P:b,Ga:function(a,b,c){if(!a)return a;var d={},e;for(e in a)f.call(a,e)&&(d[e]=
13
+ b.call(c,a[e],e,a));return d},Tb:function(b){for(;b.firstChild;)a.removeNode(b.firstChild)},Yb:function(b){b=a.a.la(b);for(var c=(b[0]&&b[0].ownerDocument||w).createElement("div"),d=0,e=b.length;d<e;d++)c.appendChild(a.oa(b[d]));return c},Ca:function(b,c){for(var d=0,e=b.length,l=[];d<e;d++){var k=b[d].cloneNode(!0);l.push(c?a.oa(k):k)}return l},va:function(b,c){a.a.Tb(b);if(c)for(var d=0,e=c.length;d<e;d++)b.appendChild(c[d])},Xc:function(b,c){var d=b.nodeType?[b]:b;if(0<d.length){for(var e=d[0],
14
+ l=e.parentNode,k=0,f=c.length;k<f;k++)l.insertBefore(c[k],e);k=0;for(f=d.length;k<f;k++)a.removeNode(d[k])}},Ua:function(a,b){if(a.length){for(b=8===b.nodeType&&b.parentNode||b;a.length&&a[0].parentNode!==b;)a.splice(0,1);for(;1<a.length&&a[a.length-1].parentNode!==b;)a.length--;if(1<a.length){var c=a[0],d=a[a.length-1];for(a.length=0;c!==d;)a.push(c),c=c.nextSibling;a.push(d)}}return a},Zc:function(a,b){7>p?a.setAttribute("selected",b):a.selected=b},Db:function(a){return null===a||a===n?"":a.trim?
15
+ a.trim():a.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},Ud:function(a,b){a=a||"";return b.length>a.length?!1:a.substring(0,b.length)===b},vd:function(a,b){if(a===b)return!0;if(11===a.nodeType)return!1;if(b.contains)return b.contains(1!==a.nodeType?a.parentNode:a);if(b.compareDocumentPosition)return 16==(b.compareDocumentPosition(a)&16);for(;a&&a!=b;)a=a.parentNode;return!!a},Sb:function(b){return a.a.vd(b,b.ownerDocument.documentElement)},kd:function(b){return!!a.a.Lb(b,a.a.Sb)},R:function(a){return a&&
16
+ a.tagName&&a.tagName.toLowerCase()},Ac:function(b){return a.onError?function(){try{return b.apply(this,arguments)}catch(c){throw a.onError&&a.onError(c),c;}}:b},setTimeout:function(b,c){return setTimeout(a.a.Ac(b),c)},Gc:function(b){setTimeout(function(){a.onError&&a.onError(b);throw b;},0)},B:function(b,c,d){var e=a.a.Ac(d);d=l[c];if(a.options.useOnlyNativeEvents||d||!v)if(d||"function"!=typeof b.addEventListener)if("undefined"!=typeof b.attachEvent){var k=function(a){e.call(b,a)},f="on"+c;b.attachEvent(f,
17
+ k);a.a.K.za(b,function(){b.detachEvent(f,k)})}else throw Error("Browser doesn't support addEventListener or attachEvent");else b.addEventListener(c,e,!1);else t||(t="function"==typeof v(b).on?"on":"bind"),v(b)[t](c,e)},Fb:function(b,c){if(!b||!b.nodeType)throw Error("element must be a DOM node when calling triggerEvent");var d;"input"===a.a.R(b)&&b.type&&"click"==c.toLowerCase()?(d=b.type,d="checkbox"==d||"radio"==d):d=!1;if(a.options.useOnlyNativeEvents||!v||d)if("function"==typeof w.createEvent)if("function"==
18
+ typeof b.dispatchEvent)d=w.createEvent(k[c]||"HTMLEvents"),d.initEvent(c,!0,!0,A,0,0,0,0,0,!1,!1,!1,!1,0,b),b.dispatchEvent(d);else throw Error("The supplied element doesn't support dispatchEvent");else if(d&&b.click)b.click();else if("undefined"!=typeof b.fireEvent)b.fireEvent("on"+c);else throw Error("Browser doesn't support triggering events");else v(b).trigger(c)},f:function(b){return a.O(b)?b():b},bc:function(b){return a.O(b)?b.v():b},Eb:function(b,c,d){var l;c&&("object"===typeof b.classList?
19
+ (l=b.classList[d?"add":"remove"],a.a.D(c.match(q),function(a){l.call(b.classList,a)})):"string"===typeof b.className.baseVal?e(b.className,"baseVal",c,d):e(b,"className",c,d))},Bb:function(b,c){var d=a.a.f(c);if(null===d||d===n)d="";var e=a.h.firstChild(b);!e||3!=e.nodeType||a.h.nextSibling(e)?a.h.va(b,[b.ownerDocument.createTextNode(d)]):e.data=d;a.a.Ad(b)},Yc:function(a,b){a.name=b;if(7>=p)try{var c=a.name.replace(/[&<>'"]/g,function(a){return"&#"+a.charCodeAt(0)+";"});a.mergeAttributes(w.createElement("<input name='"+
20
+ c+"'/>"),!1)}catch(d){}},Ad:function(a){9<=p&&(a=1==a.nodeType?a:a.parentNode,a.style&&(a.style.zoom=a.style.zoom))},wd:function(a){if(p){var b=a.style.width;a.style.width=0;a.style.width=b}},Pd:function(b,c){b=a.a.f(b);c=a.a.f(c);for(var d=[],e=b;e<=c;e++)d.push(e);return d},la:function(a){for(var b=[],c=0,d=a.length;c<d;c++)b.push(a[c]);return b},Da:function(a){return h?Symbol(a):a},Zd:6===p,$d:7===p,W:p,Lc:function(b,c){for(var d=a.a.la(b.getElementsByTagName("input")).concat(a.a.la(b.getElementsByTagName("textarea"))),
21
+ e="string"==typeof c?function(a){return a.name===c}:function(a){return c.test(a.name)},l=[],k=d.length-1;0<=k;k--)e(d[k])&&l.push(d[k]);return l},Nd:function(b){return"string"==typeof b&&(b=a.a.Db(b))?H&&H.parse?H.parse(b):(new Function("return "+b))():null},hc:function(b,c,d){if(!H||!H.stringify)throw Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js");
22
+ return H.stringify(a.a.f(b),c,d)},Od:function(c,d,e){e=e||{};var l=e.params||{},k=e.includeFields||this.Jc,f=c;if("object"==typeof c&&"form"===a.a.R(c))for(var f=c.action,h=k.length-1;0<=h;h--)for(var g=a.a.Lc(c,k[h]),m=g.length-1;0<=m;m--)l[g[m].name]=g[m].value;d=a.a.f(d);var p=w.createElement("form");p.style.display="none";p.action=f;p.method="post";for(var q in d)c=w.createElement("input"),c.type="hidden",c.name=q,c.value=a.a.hc(a.a.f(d[q])),p.appendChild(c);b(l,function(a,b){var c=w.createElement("input");
23
+ c.type="hidden";c.name=a;c.value=b;p.appendChild(c)});w.body.appendChild(p);e.submitter?e.submitter(p):p.submit();setTimeout(function(){p.parentNode.removeChild(p)},0)}}}();a.b("utils",a.a);a.b("utils.arrayForEach",a.a.D);a.b("utils.arrayFirst",a.a.Lb);a.b("utils.arrayFilter",a.a.jb);a.b("utils.arrayGetDistinctValues",a.a.wc);a.b("utils.arrayIndexOf",a.a.A);a.b("utils.arrayMap",a.a.Mb);a.b("utils.arrayPushAll",a.a.Nb);a.b("utils.arrayRemoveItem",a.a.Pa);a.b("utils.cloneNodes",a.a.Ca);a.b("utils.createSymbolOrString",
24
+ a.a.Da);a.b("utils.extend",a.a.extend);a.b("utils.fieldsIncludedWithJsonPost",a.a.Jc);a.b("utils.getFormFields",a.a.Lc);a.b("utils.objectMap",a.a.Ga);a.b("utils.peekObservable",a.a.bc);a.b("utils.postJson",a.a.Od);a.b("utils.parseJson",a.a.Nd);a.b("utils.registerEventHandler",a.a.B);a.b("utils.stringifyJson",a.a.hc);a.b("utils.range",a.a.Pd);a.b("utils.toggleDomNodeCssClass",a.a.Eb);a.b("utils.triggerEvent",a.a.Fb);a.b("utils.unwrapObservable",a.a.f);a.b("utils.objectForEach",a.a.P);a.b("utils.addOrRemoveItem",
25
+ a.a.Na);a.b("utils.setTextContent",a.a.Bb);a.b("unwrap",a.a.f);Function.prototype.bind||(Function.prototype.bind=function(a){var c=this;if(1===arguments.length)return function(){return c.apply(a,arguments)};var d=Array.prototype.slice.call(arguments,1);return function(){var e=d.slice(0);e.push.apply(e,arguments);return c.apply(a,e)}});a.a.g=new function(){var b=0,c="__ko__"+(new Date).getTime(),d={},e,f;a.a.W?(e=function(a,e){var f=a[c];if(!f||"null"===f||!d[f]){if(!e)return n;f=a[c]="ko"+b++;d[f]=
26
+ {}}return d[f]},f=function(a){var b=a[c];return b?(delete d[b],a[c]=null,!0):!1}):(e=function(a,b){var d=a[c];!d&&b&&(d=a[c]={});return d},f=function(a){return a[c]?(delete a[c],!0):!1});return{get:function(a,b){var c=e(a,!1);return c&&c[b]},set:function(a,b,c){(a=e(a,c!==n))&&(a[b]=c)},Ub:function(a,b,c){a=e(a,!0);return a[b]||(a[b]=c)},clear:f,Z:function(){return b++ +c}}};a.b("utils.domData",a.a.g);a.b("utils.domData.clear",a.a.g.clear);a.a.K=new function(){function b(b,c){var d=a.a.g.get(b,e);
27
+ d===n&&c&&(d=[],a.a.g.set(b,e,d));return d}function c(c){var e=b(c,!1);if(e)for(var e=e.slice(0),k=0;k<e.length;k++)e[k](c);a.a.g.clear(c);a.a.K.cleanExternalData(c);g[c.nodeType]&&d(c.childNodes,!0)}function d(b,d){for(var e=[],l,f=0;f<b.length;f++)if(!d||8===b[f].nodeType)if(c(e[e.length]=l=b[f]),b[f]!==l)for(;f--&&-1==a.a.A(e,b[f]););}var e=a.a.g.Z(),f={1:!0,8:!0,9:!0},g={1:!0,9:!0};return{za:function(a,c){if("function"!=typeof c)throw Error("Callback must be a function");b(a,!0).push(c)},yb:function(c,
28
+ d){var f=b(c,!1);f&&(a.a.Pa(f,d),0==f.length&&a.a.g.set(c,e,n))},oa:function(b){a.u.G(function(){f[b.nodeType]&&(c(b),g[b.nodeType]&&d(b.getElementsByTagName("*")))});return b},removeNode:function(b){a.oa(b);b.parentNode&&b.parentNode.removeChild(b)},cleanExternalData:function(a){v&&"function"==typeof v.cleanData&&v.cleanData([a])}}};a.oa=a.a.K.oa;a.removeNode=a.a.K.removeNode;a.b("cleanNode",a.oa);a.b("removeNode",a.removeNode);a.b("utils.domNodeDisposal",a.a.K);a.b("utils.domNodeDisposal.addDisposeCallback",
29
+ a.a.K.za);a.b("utils.domNodeDisposal.removeDisposeCallback",a.a.K.yb);(function(){var b=[0,"",""],c=[1,"<table>","</table>"],d=[3,"<table><tbody><tr>","</tr></tbody></table>"],e=[1,"<select multiple='multiple'>","</select>"],f={thead:c,tbody:c,tfoot:c,tr:[2,"<table><tbody>","</tbody></table>"],td:d,th:d,option:e,optgroup:e},g=8>=a.a.W;a.a.ua=function(c,d){var e;if(v)if(v.parseHTML)e=v.parseHTML(c,d)||[];else{if((e=v.clean([c],d))&&e[0]){for(var l=e[0];l.parentNode&&11!==l.parentNode.nodeType;)l=l.parentNode;
30
+ l.parentNode&&l.parentNode.removeChild(l)}}else{(e=d)||(e=w);var l=e.parentWindow||e.defaultView||A,p=a.a.Db(c).toLowerCase(),q=e.createElement("div"),t;t=(p=p.match(/^(?:\x3c!--.*?--\x3e\s*?)*?<([a-z]+)[\s>]/))&&f[p[1]]||b;p=t[0];t="ignored<div>"+t[1]+c+t[2]+"</div>";"function"==typeof l.innerShiv?q.appendChild(l.innerShiv(t)):(g&&e.body.appendChild(q),q.innerHTML=t,g&&q.parentNode.removeChild(q));for(;p--;)q=q.lastChild;e=a.a.la(q.lastChild.childNodes)}return e};a.a.Md=function(b,c){var d=a.a.ua(b,
31
+ c);return d.length&&d[0].parentElement||a.a.Yb(d)};a.a.fc=function(b,c){a.a.Tb(b);c=a.a.f(c);if(null!==c&&c!==n)if("string"!=typeof c&&(c=c.toString()),v)v(b).html(c);else for(var d=a.a.ua(c,b.ownerDocument),e=0;e<d.length;e++)b.appendChild(d[e])}})();a.b("utils.parseHtmlFragment",a.a.ua);a.b("utils.setHtml",a.a.fc);a.aa=function(){function b(c,e){if(c)if(8==c.nodeType){var f=a.aa.Uc(c.nodeValue);null!=f&&e.push({ud:c,Kd:f})}else if(1==c.nodeType)for(var f=0,g=c.childNodes,h=g.length;f<h;f++)b(g[f],
32
+ e)}var c={};return{Xb:function(a){if("function"!=typeof a)throw Error("You can only pass a function to ko.memoization.memoize()");var b=(4294967296*(1+Math.random())|0).toString(16).substring(1)+(4294967296*(1+Math.random())|0).toString(16).substring(1);c[b]=a;return"\x3c!--[ko_memo:"+b+"]--\x3e"},bd:function(a,b){var f=c[a];if(f===n)throw Error("Couldn't find any memo with ID "+a+". Perhaps it's already been unmemoized.");try{return f.apply(null,b||[]),!0}finally{delete c[a]}},cd:function(c,e){var f=
33
+ [];b(c,f);for(var g=0,h=f.length;g<h;g++){var m=f[g].ud,k=[m];e&&a.a.Nb(k,e);a.aa.bd(f[g].Kd,k);m.nodeValue="";m.parentNode&&m.parentNode.removeChild(m)}},Uc:function(a){return(a=a.match(/^\[ko_memo\:(.*?)\]$/))?a[1]:null}}}();a.b("memoization",a.aa);a.b("memoization.memoize",a.aa.Xb);a.b("memoization.unmemoize",a.aa.bd);a.b("memoization.parseMemoText",a.aa.Uc);a.b("memoization.unmemoizeDomNodeAndDescendants",a.aa.cd);a.na=function(){function b(){if(f)for(var b=f,c=0,d;h<f;)if(d=e[h++]){if(h>b){if(5E3<=
34
+ ++c){h=f;a.a.Gc(Error("'Too much recursion' after processing "+c+" task groups."));break}b=f}try{d()}catch(p){a.a.Gc(p)}}}function c(){b();h=f=e.length=0}var d,e=[],f=0,g=1,h=0;A.MutationObserver?d=function(a){var b=w.createElement("div");(new MutationObserver(a)).observe(b,{attributes:!0});return function(){b.classList.toggle("foo")}}(c):d=w&&"onreadystatechange"in w.createElement("script")?function(a){var b=w.createElement("script");b.onreadystatechange=function(){b.onreadystatechange=null;w.documentElement.removeChild(b);
35
+ b=null;a()};w.documentElement.appendChild(b)}:function(a){setTimeout(a,0)};return{scheduler:d,zb:function(b){f||a.na.scheduler(c);e[f++]=b;return g++},cancel:function(a){a=a-(g-f);a>=h&&a<f&&(e[a]=null)},resetForTesting:function(){var a=f-h;h=f=e.length=0;return a},Sd:b}}();a.b("tasks",a.na);a.b("tasks.schedule",a.na.zb);a.b("tasks.runEarly",a.na.Sd);a.Ta={throttle:function(b,c){b.throttleEvaluation=c;var d=null;return a.$({read:b,write:function(e){clearTimeout(d);d=a.a.setTimeout(function(){b(e)},
36
+ c)}})},rateLimit:function(a,c){var d,e,f;"number"==typeof c?d=c:(d=c.timeout,e=c.method);a.Hb=!1;f="function"==typeof e?e:"notifyWhenChangesStop"==e?Y:X;a.ub(function(a){return f(a,d,c)})},deferred:function(b,c){if(!0!==c)throw Error("The 'deferred' extender only accepts the value 'true', because it is not supported to turn deferral off once enabled.");b.Hb||(b.Hb=!0,b.ub(function(c){var e,f=!1;return function(){if(!f){a.na.cancel(e);e=a.na.zb(c);try{f=!0,b.notifySubscribers(n,"dirty")}finally{f=
37
+ !1}}}}))},notify:function(a,c){a.equalityComparer="always"==c?null:K}};var W={undefined:1,"boolean":1,number:1,string:1};a.b("extenders",a.Ta);a.ic=function(b,c,d){this.da=b;this.lc=c;this.mc=d;this.Ib=!1;this.fb=this.Jb=null;a.L(this,"dispose",this.s);a.L(this,"disposeWhenNodeIsRemoved",this.l)};a.ic.prototype.s=function(){this.Ib||(this.fb&&a.a.K.yb(this.Jb,this.fb),this.Ib=!0,this.mc(),this.da=this.lc=this.mc=this.Jb=this.fb=null)};a.ic.prototype.l=function(b){this.Jb=b;a.a.K.za(b,this.fb=this.s.bind(this))};
38
+ a.T=function(){a.a.Ab(this,D);D.qb(this)};var D={qb:function(a){a.U={change:[]};a.sc=1},subscribe:function(b,c,d){var e=this;d=d||"change";var f=new a.ic(e,c?b.bind(c):b,function(){a.a.Pa(e.U[d],f);e.hb&&e.hb(d)});e.Qa&&e.Qa(d);e.U[d]||(e.U[d]=[]);e.U[d].push(f);return f},notifySubscribers:function(b,c){c=c||"change";"change"===c&&this.Gb();if(this.Wa(c)){var d="change"===c&&this.ed||this.U[c].slice(0);try{a.u.xc();for(var e=0,f;f=d[e];++e)f.Ib||f.lc(b)}finally{a.u.end()}}},ob:function(){return this.sc},
39
+ Dd:function(a){return this.ob()!==a},Gb:function(){++this.sc},ub:function(b){var c=this,d=a.O(c),e,f,g,h,m;c.gb||(c.gb=c.notifySubscribers,c.notifySubscribers=Z);var k=b(function(){c.Ja=!1;d&&h===c&&(h=c.nc?c.nc():c());var a=f||m&&c.sb(g,h);m=f=e=!1;a&&c.gb(g=h)});c.qc=function(a,b){b&&c.Ja||(m=!b);c.ed=c.U.change.slice(0);c.Ja=e=!0;h=a;k()};c.pc=function(a){e||(g=a,c.gb(a,"beforeChange"))};c.rc=function(){m=!0};c.gd=function(){c.sb(g,c.v(!0))&&(f=!0)}},Wa:function(a){return this.U[a]&&this.U[a].length},
40
+ Bd:function(b){if(b)return this.U[b]&&this.U[b].length||0;var c=0;a.a.P(this.U,function(a,b){"dirty"!==a&&(c+=b.length)});return c},sb:function(a,c){return!this.equalityComparer||!this.equalityComparer(a,c)},toString:function(){return"[object Object]"},extend:function(b){var c=this;b&&a.a.P(b,function(b,e){var f=a.Ta[b];"function"==typeof f&&(c=f(c,e)||c)});return c}};a.L(D,"init",D.qb);a.L(D,"subscribe",D.subscribe);a.L(D,"extend",D.extend);a.L(D,"getSubscriptionsCount",D.Bd);a.a.Ba&&a.a.setPrototypeOf(D,
41
+ Function.prototype);a.T.fn=D;a.Qc=function(a){return null!=a&&"function"==typeof a.subscribe&&"function"==typeof a.notifySubscribers};a.b("subscribable",a.T);a.b("isSubscribable",a.Qc);a.S=a.u=function(){function b(a){d.push(e);e=a}function c(){e=d.pop()}var d=[],e,f=0;return{xc:b,end:c,cc:function(b){if(e){if(!a.Qc(b))throw Error("Only subscribable things can act as dependencies");e.od.call(e.pd,b,b.fd||(b.fd=++f))}},G:function(a,d,e){try{return b(),a.apply(d,e||[])}finally{c()}},qa:function(){if(e)return e.o.qa()},
42
+ Va:function(){if(e)return e.o.Va()},Ya:function(){if(e)return e.Ya},o:function(){if(e)return e.o}}}();a.b("computedContext",a.S);a.b("computedContext.getDependenciesCount",a.S.qa);a.b("computedContext.getDependencies",a.S.Va);a.b("computedContext.isInitial",a.S.Ya);a.b("computedContext.registerDependency",a.S.cc);a.b("ignoreDependencies",a.Yd=a.u.G);var I=a.a.Da("_latestValue");a.ta=function(b){function c(){if(0<arguments.length)return c.sb(c[I],arguments[0])&&(c.ya(),c[I]=arguments[0],c.xa()),this;
43
+ a.u.cc(c);return c[I]}c[I]=b;a.a.Ba||a.a.extend(c,a.T.fn);a.T.fn.qb(c);a.a.Ab(c,F);a.options.deferUpdates&&a.Ta.deferred(c,!0);return c};var F={equalityComparer:K,v:function(){return this[I]},xa:function(){this.notifySubscribers(this[I],"spectate");this.notifySubscribers(this[I])},ya:function(){this.notifySubscribers(this[I],"beforeChange")}};a.a.Ba&&a.a.setPrototypeOf(F,a.T.fn);var G=a.ta.Ma="__ko_proto__";F[G]=a.ta;a.O=function(b){if((b="function"==typeof b&&b[G])&&b!==F[G]&&b!==a.o.fn[G])throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");
44
+ return!!b};a.Za=function(b){return"function"==typeof b&&(b[G]===F[G]||b[G]===a.o.fn[G]&&b.Nc)};a.b("observable",a.ta);a.b("isObservable",a.O);a.b("isWriteableObservable",a.Za);a.b("isWritableObservable",a.Za);a.b("observable.fn",F);a.L(F,"peek",F.v);a.L(F,"valueHasMutated",F.xa);a.L(F,"valueWillMutate",F.ya);a.Ha=function(b){b=b||[];if("object"!=typeof b||!("length"in b))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");b=a.ta(b);a.a.Ab(b,
45
+ a.Ha.fn);return b.extend({trackArrayChanges:!0})};a.Ha.fn={remove:function(b){for(var c=this.v(),d=[],e="function"!=typeof b||a.O(b)?function(a){return a===b}:b,f=0;f<c.length;f++){var g=c[f];if(e(g)){0===d.length&&this.ya();if(c[f]!==g)throw Error("Array modified during remove; cannot remove item");d.push(g);c.splice(f,1);f--}}d.length&&this.xa();return d},removeAll:function(b){if(b===n){var c=this.v(),d=c.slice(0);this.ya();c.splice(0,c.length);this.xa();return d}return b?this.remove(function(c){return 0<=
46
+ a.a.A(b,c)}):[]},destroy:function(b){var c=this.v(),d="function"!=typeof b||a.O(b)?function(a){return a===b}:b;this.ya();for(var e=c.length-1;0<=e;e--){var f=c[e];d(f)&&(f._destroy=!0)}this.xa()},destroyAll:function(b){return b===n?this.destroy(function(){return!0}):b?this.destroy(function(c){return 0<=a.a.A(b,c)}):[]},indexOf:function(b){var c=this();return a.a.A(c,b)},replace:function(a,c){var d=this.indexOf(a);0<=d&&(this.ya(),this.v()[d]=c,this.xa())},sorted:function(a){var c=this().slice(0);
47
+ return a?c.sort(a):c.sort()},reversed:function(){return this().slice(0).reverse()}};a.a.Ba&&a.a.setPrototypeOf(a.Ha.fn,a.ta.fn);a.a.D("pop push reverse shift sort splice unshift".split(" "),function(b){a.Ha.fn[b]=function(){var a=this.v();this.ya();this.zc(a,b,arguments);var d=a[b].apply(a,arguments);this.xa();return d===a?this:d}});a.a.D(["slice"],function(b){a.Ha.fn[b]=function(){var a=this();return a[b].apply(a,arguments)}});a.Pc=function(b){return a.O(b)&&"function"==typeof b.remove&&"function"==
48
+ typeof b.push};a.b("observableArray",a.Ha);a.b("isObservableArray",a.Pc);a.Ta.trackArrayChanges=function(b,c){function d(){function c(){if(m){var d=[].concat(b.v()||[]),e;if(b.Wa("arrayChange")){if(!f||1<m)f=a.a.Pb(k,d,b.Ob);e=f}k=d;f=null;m=0;e&&e.length&&b.notifySubscribers(e,"arrayChange")}}e?c():(e=!0,h=b.subscribe(function(){++m},null,"spectate"),k=[].concat(b.v()||[]),f=null,g=b.subscribe(c))}b.Ob={};c&&"object"==typeof c&&a.a.extend(b.Ob,c);b.Ob.sparse=!0;if(!b.zc){var e=!1,f=null,g,h,m=0,
49
+ k,l=b.Qa,p=b.hb;b.Qa=function(a){l&&l.call(b,a);"arrayChange"===a&&d()};b.hb=function(a){p&&p.call(b,a);"arrayChange"!==a||b.Wa("arrayChange")||(g&&g.s(),h&&h.s(),h=g=null,e=!1,k=n)};b.zc=function(b,c,d){function l(a,b,c){return k[k.length]={status:a,value:b,index:c}}if(e&&!m){var k=[],p=b.length,g=d.length,h=0;switch(c){case "push":h=p;case "unshift":for(c=0;c<g;c++)l("added",d[c],h+c);break;case "pop":h=p-1;case "shift":p&&l("deleted",b[h],h);break;case "splice":c=Math.min(Math.max(0,0>d[0]?p+d[0]:
50
+ d[0]),p);for(var p=1===g?p:Math.min(c+(d[1]||0),p),g=c+g-2,h=Math.max(p,g),U=[],L=[],n=2;c<h;++c,++n)c<p&&L.push(l("deleted",b[c],c)),c<g&&U.push(l("added",d[n],c));a.a.Kc(L,U);break;default:return}f=k}}}};var r=a.a.Da("_state");a.o=a.$=function(b,c,d){function e(){if(0<arguments.length){if("function"===typeof f)f.apply(g.nb,arguments);else throw Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");return this}g.ra||
51
+ a.u.cc(e);(g.ka||g.J&&e.Xa())&&e.ha();return g.X}"object"===typeof b?d=b:(d=d||{},b&&(d.read=b));if("function"!=typeof d.read)throw Error("Pass a function that returns the value of the ko.computed");var f=d.write,g={X:n,sa:!0,ka:!0,rb:!1,jc:!1,ra:!1,wb:!1,J:!1,Wc:d.read,nb:c||d.owner,l:d.disposeWhenNodeIsRemoved||d.l||null,Sa:d.disposeWhen||d.Sa,Rb:null,I:{},V:0,Ic:null};e[r]=g;e.Nc="function"===typeof f;a.a.Ba||a.a.extend(e,a.T.fn);a.T.fn.qb(e);a.a.Ab(e,C);d.pure?(g.wb=!0,g.J=!0,a.a.extend(e,da)):
52
+ d.deferEvaluation&&a.a.extend(e,ea);a.options.deferUpdates&&a.Ta.deferred(e,!0);g.l&&(g.jc=!0,g.l.nodeType||(g.l=null));g.J||d.deferEvaluation||e.ha();g.l&&e.ja()&&a.a.K.za(g.l,g.Rb=function(){e.s()});return e};var C={equalityComparer:K,qa:function(){return this[r].V},Va:function(){var b=[];a.a.P(this[r].I,function(a,d){b[d.Ka]=d.da});return b},Vb:function(b){if(!this[r].V)return!1;var c=this.Va();return-1!==a.a.A(c,b)?!0:!!a.a.Lb(c,function(a){return a.Vb&&a.Vb(b)})},uc:function(a,c,d){if(this[r].wb&&
53
+ c===this)throw Error("A 'pure' computed must not be called recursively");this[r].I[a]=d;d.Ka=this[r].V++;d.La=c.ob()},Xa:function(){var a,c,d=this[r].I;for(a in d)if(Object.prototype.hasOwnProperty.call(d,a)&&(c=d[a],this.Ia&&c.da.Ja||c.da.Dd(c.La)))return!0},Jd:function(){this.Ia&&!this[r].rb&&this.Ia(!1)},ja:function(){var a=this[r];return a.ka||0<a.V},Rd:function(){this.Ja?this[r].ka&&(this[r].sa=!0):this.Hc()},$c:function(a){if(a.Hb){var c=a.subscribe(this.Jd,this,"dirty"),d=a.subscribe(this.Rd,
54
+ this);return{da:a,s:function(){c.s();d.s()}}}return a.subscribe(this.Hc,this)},Hc:function(){var b=this,c=b.throttleEvaluation;c&&0<=c?(clearTimeout(this[r].Ic),this[r].Ic=a.a.setTimeout(function(){b.ha(!0)},c)):b.Ia?b.Ia(!0):b.ha(!0)},ha:function(b){var c=this[r],d=c.Sa,e=!1;if(!c.rb&&!c.ra){if(c.l&&!a.a.Sb(c.l)||d&&d()){if(!c.jc){this.s();return}}else c.jc=!1;c.rb=!0;try{e=this.zd(b)}finally{c.rb=!1}return e}},zd:function(b){var c=this[r],d=!1,e=c.wb?n:!c.V,d={qd:this,mb:c.I,Qb:c.V};a.u.xc({pd:d,
55
+ od:ba,o:this,Ya:e});c.I={};c.V=0;var f=this.yd(c,d);c.V?d=this.sb(c.X,f):(this.s(),d=!0);d&&(c.J?this.Gb():this.notifySubscribers(c.X,"beforeChange"),c.X=f,this.notifySubscribers(c.X,"spectate"),!c.J&&b&&this.notifySubscribers(c.X),this.rc&&this.rc());e&&this.notifySubscribers(c.X,"awake");return d},yd:function(b,c){try{var d=b.Wc;return b.nb?d.call(b.nb):d()}finally{a.u.end(),c.Qb&&!b.J&&a.a.P(c.mb,aa),b.sa=b.ka=!1}},v:function(a){var c=this[r];(c.ka&&(a||!c.V)||c.J&&this.Xa())&&this.ha();return c.X},
56
+ ub:function(b){a.T.fn.ub.call(this,b);this.nc=function(){this[r].J||(this[r].sa?this.ha():this[r].ka=!1);return this[r].X};this.Ia=function(a){this.pc(this[r].X);this[r].ka=!0;a&&(this[r].sa=!0);this.qc(this,!a)}},s:function(){var b=this[r];!b.J&&b.I&&a.a.P(b.I,function(a,b){b.s&&b.s()});b.l&&b.Rb&&a.a.K.yb(b.l,b.Rb);b.I=n;b.V=0;b.ra=!0;b.sa=!1;b.ka=!1;b.J=!1;b.l=n;b.Sa=n;b.Wc=n;this.Nc||(b.nb=n)}},da={Qa:function(b){var c=this,d=c[r];if(!d.ra&&d.J&&"change"==b){d.J=!1;if(d.sa||c.Xa())d.I=null,d.V=
57
+ 0,c.ha()&&c.Gb();else{var e=[];a.a.P(d.I,function(a,b){e[b.Ka]=a});a.a.D(e,function(a,b){var e=d.I[a],m=c.$c(e.da);m.Ka=b;m.La=e.La;d.I[a]=m});c.Xa()&&c.ha()&&c.Gb()}d.ra||c.notifySubscribers(d.X,"awake")}},hb:function(b){var c=this[r];c.ra||"change"!=b||this.Wa("change")||(a.a.P(c.I,function(a,b){b.s&&(c.I[a]={da:b.da,Ka:b.Ka,La:b.La},b.s())}),c.J=!0,this.notifySubscribers(n,"asleep"))},ob:function(){var b=this[r];b.J&&(b.sa||this.Xa())&&this.ha();return a.T.fn.ob.call(this)}},ea={Qa:function(a){"change"!=
58
+ a&&"beforeChange"!=a||this.v()}};a.a.Ba&&a.a.setPrototypeOf(C,a.T.fn);var N=a.ta.Ma;C[N]=a.o;a.Oc=function(a){return"function"==typeof a&&a[N]===C[N]};a.Fd=function(b){return a.Oc(b)&&b[r]&&b[r].wb};a.b("computed",a.o);a.b("dependentObservable",a.o);a.b("isComputed",a.Oc);a.b("isPureComputed",a.Fd);a.b("computed.fn",C);a.L(C,"peek",C.v);a.L(C,"dispose",C.s);a.L(C,"isActive",C.ja);a.L(C,"getDependenciesCount",C.qa);a.L(C,"getDependencies",C.Va);a.xb=function(b,c){if("function"===typeof b)return a.o(b,
59
+ c,{pure:!0});b=a.a.extend({},b);b.pure=!0;return a.o(b,c)};a.b("pureComputed",a.xb);(function(){function b(a,f,g){g=g||new d;a=f(a);if("object"!=typeof a||null===a||a===n||a instanceof RegExp||a instanceof Date||a instanceof String||a instanceof Number||a instanceof Boolean)return a;var h=a instanceof Array?[]:{};g.save(a,h);c(a,function(c){var d=f(a[c]);switch(typeof d){case "boolean":case "number":case "string":case "function":h[c]=d;break;case "object":case "undefined":var l=g.get(d);h[c]=l!==
60
+ n?l:b(d,f,g)}});return h}function c(a,b){if(a instanceof Array){for(var c=0;c<a.length;c++)b(c);"function"==typeof a.toJSON&&b("toJSON")}else for(c in a)b(c)}function d(){this.keys=[];this.values=[]}a.ad=function(c){if(0==arguments.length)throw Error("When calling ko.toJS, pass the object you want to convert.");return b(c,function(b){for(var c=0;a.O(b)&&10>c;c++)b=b();return b})};a.toJSON=function(b,c,d){b=a.ad(b);return a.a.hc(b,c,d)};d.prototype={constructor:d,save:function(b,c){var d=a.a.A(this.keys,
61
+ b);0<=d?this.values[d]=c:(this.keys.push(b),this.values.push(c))},get:function(b){b=a.a.A(this.keys,b);return 0<=b?this.values[b]:n}}})();a.b("toJS",a.ad);a.b("toJSON",a.toJSON);a.Wd=function(b,c,d){function e(c){var e=a.xb(b,d).extend({ma:"always"}),h=e.subscribe(function(a){a&&(h.s(),c(a))});e.notifySubscribers(e.v());return h}return"function"!==typeof Promise||c?e(c.bind(d)):new Promise(e)};a.b("when",a.Wd);(function(){a.w={M:function(b){switch(a.a.R(b)){case "option":return!0===b.__ko__hasDomDataOptionValue__?
62
+ a.a.g.get(b,a.c.options.$b):7>=a.a.W?b.getAttributeNode("value")&&b.getAttributeNode("value").specified?b.value:b.text:b.value;case "select":return 0<=b.selectedIndex?a.w.M(b.options[b.selectedIndex]):n;default:return b.value}},cb:function(b,c,d){switch(a.a.R(b)){case "option":"string"===typeof c?(a.a.g.set(b,a.c.options.$b,n),"__ko__hasDomDataOptionValue__"in b&&delete b.__ko__hasDomDataOptionValue__,b.value=c):(a.a.g.set(b,a.c.options.$b,c),b.__ko__hasDomDataOptionValue__=!0,b.value="number"===
63
+ typeof c?c:"");break;case "select":if(""===c||null===c)c=n;for(var e=-1,f=0,g=b.options.length,h;f<g;++f)if(h=a.w.M(b.options[f]),h==c||""===h&&c===n){e=f;break}if(d||0<=e||c===n&&1<b.size)b.selectedIndex=e,6===a.a.W&&a.a.setTimeout(function(){b.selectedIndex=e},0);break;default:if(null===c||c===n)c="";b.value=c}}}})();a.b("selectExtensions",a.w);a.b("selectExtensions.readValue",a.w.M);a.b("selectExtensions.writeValue",a.w.cb);a.m=function(){function b(b){b=a.a.Db(b);123===b.charCodeAt(0)&&(b=b.slice(1,
64
+ -1));b+="\n,";var c=[],d=b.match(e),p,q=[],h=0;if(1<d.length){for(var x=0,B;B=d[x];++x){var u=B.charCodeAt(0);if(44===u){if(0>=h){c.push(p&&q.length?{key:p,value:q.join("")}:{unknown:p||q.join("")});p=h=0;q=[];continue}}else if(58===u){if(!h&&!p&&1===q.length){p=q.pop();continue}}else if(47===u&&1<B.length&&(47===B.charCodeAt(1)||42===B.charCodeAt(1)))continue;else 47===u&&x&&1<B.length?(u=d[x-1].match(f))&&!g[u[0]]&&(b=b.substr(b.indexOf(B)+1),d=b.match(e),x=-1,B="/"):40===u||123===u||91===u?++h:
65
+ 41===u||125===u||93===u?--h:p||q.length||34!==u&&39!==u||(B=B.slice(1,-1));q.push(B)}if(0<h)throw Error("Unbalanced parentheses, braces, or brackets");}return c}var c=["true","false","null","undefined"],d=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,e=RegExp("\"(?:\\\\.|[^\"])*\"|'(?:\\\\.|[^'])*'|`(?:\\\\.|[^`])*`|/\\*(?:[^*]|\\*+[^*/])*\\*+/|//.*\n|/(?:\\\\.|[^/])+/w*|[^\\s:,/][^,\"'`{}()/:[\\]]*[^\\s,\"'`{}()/:[\\]]|[^\\s]","g"),f=/[\])"'A-Za-z0-9_$]+$/,g={"in":1,"return":1,"typeof":1},
66
+ h={};return{Ra:[],wa:h,ac:b,vb:function(e,f){function l(b,e){var f;if(!x){var k=a.getBindingHandler(b);if(k&&k.preprocess&&!(e=k.preprocess(e,b,l)))return;if(k=h[b])f=e,0<=a.a.A(c,f)?f=!1:(k=f.match(d),f=null===k?!1:k[1]?"Object("+k[1]+")"+k[2]:f),k=f;k&&q.push("'"+("string"==typeof h[b]?h[b]:b)+"':function(_z){"+f+"=_z}")}g&&(e="function(){return "+e+" }");p.push("'"+b+"':"+e)}f=f||{};var p=[],q=[],g=f.valueAccessors,x=f.bindingParams,B="string"===typeof e?b(e):e;a.a.D(B,function(a){l(a.key||a.unknown,
67
+ a.value)});q.length&&l("_ko_property_writers","{"+q.join(",")+" }");return p.join(",")},Id:function(a,b){for(var c=0;c<a.length;c++)if(a[c].key==b)return!0;return!1},eb:function(b,c,d,e,f){if(b&&a.O(b))!a.Za(b)||f&&b.v()===e||b(e);else if((b=c.get("_ko_property_writers"))&&b[d])b[d](e)}}}();a.b("expressionRewriting",a.m);a.b("expressionRewriting.bindingRewriteValidators",a.m.Ra);a.b("expressionRewriting.parseObjectLiteral",a.m.ac);a.b("expressionRewriting.preProcessBindings",a.m.vb);a.b("expressionRewriting._twoWayBindings",
68
+ a.m.wa);a.b("jsonExpressionRewriting",a.m);a.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson",a.m.vb);(function(){function b(a){return 8==a.nodeType&&g.test(f?a.text:a.nodeValue)}function c(a){return 8==a.nodeType&&h.test(f?a.text:a.nodeValue)}function d(d,e){for(var f=d,h=1,g=[];f=f.nextSibling;){if(c(f)&&(a.a.g.set(f,k,!0),h--,0===h))return g;g.push(f);b(f)&&h++}if(!e)throw Error("Cannot find closing comment tag to match: "+d.nodeValue);return null}function e(a,b){var c=d(a,b);return c?
69
+ 0<c.length?c[c.length-1].nextSibling:a.nextSibling:null}var f=w&&"\x3c!--test--\x3e"===w.createComment("test").text,g=f?/^\x3c!--\s*ko(?:\s+([\s\S]+))?\s*--\x3e$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/,h=f?/^\x3c!--\s*\/ko\s*--\x3e$/:/^\s*\/ko\s*$/,m={ul:!0,ol:!0},k="__ko_matchedEndComment__";a.h={ea:{},childNodes:function(a){return b(a)?d(a):a.childNodes},Ea:function(c){if(b(c)){c=a.h.childNodes(c);for(var d=0,e=c.length;d<e;d++)a.removeNode(c[d])}else a.a.Tb(c)},va:function(c,d){if(b(c)){a.h.Ea(c);for(var e=
70
+ c.nextSibling,f=0,k=d.length;f<k;f++)e.parentNode.insertBefore(d[f],e)}else a.a.va(c,d)},Vc:function(a,c){var d;b(a)?(d=a.nextSibling,a=a.parentNode):d=a.firstChild;d?c!==d&&a.insertBefore(c,d):a.appendChild(c)},Wb:function(c,d,e){e?(e=e.nextSibling,b(c)&&(c=c.parentNode),e?d!==e&&c.insertBefore(d,e):c.appendChild(d)):a.h.Vc(c,d)},firstChild:function(a){if(b(a))return!a.nextSibling||c(a.nextSibling)?null:a.nextSibling;if(a.firstChild&&c(a.firstChild))throw Error("Found invalid end comment, as the first child of "+
71
+ a);return a.firstChild},nextSibling:function(d){b(d)&&(d=e(d));if(d.nextSibling&&c(d.nextSibling)){var f=d.nextSibling;if(c(f)&&!a.a.g.get(f,k))throw Error("Found end comment without a matching opening comment, as child of "+d);return null}return d.nextSibling},Cd:b,Vd:function(a){return(a=(f?a.text:a.nodeValue).match(g))?a[1]:null},Sc:function(d){if(m[a.a.R(d)]){var f=d.firstChild;if(f){do if(1===f.nodeType){var k;k=f.firstChild;var h=null;if(k){do if(h)h.push(k);else if(b(k)){var g=e(k,!0);g?k=
72
+ g:h=[k]}else c(k)&&(h=[k]);while(k=k.nextSibling)}if(k=h)for(h=f.nextSibling,g=0;g<k.length;g++)h?d.insertBefore(k[g],h):d.appendChild(k[g])}while(f=f.nextSibling)}}}}})();a.b("virtualElements",a.h);a.b("virtualElements.allowedBindings",a.h.ea);a.b("virtualElements.emptyNode",a.h.Ea);a.b("virtualElements.insertAfter",a.h.Wb);a.b("virtualElements.prepend",a.h.Vc);a.b("virtualElements.setDomNodeChildren",a.h.va);(function(){a.ga=function(){this.nd={}};a.a.extend(a.ga.prototype,{nodeHasBindings:function(b){switch(b.nodeType){case 1:return null!=
73
+ b.getAttribute("data-bind")||a.j.getComponentNameForNode(b);case 8:return a.h.Cd(b);default:return!1}},getBindings:function(b,c){var d=this.getBindingsString(b,c),d=d?this.parseBindingsString(d,c,b):null;return a.j.tc(d,b,c,!1)},getBindingAccessors:function(b,c){var d=this.getBindingsString(b,c),d=d?this.parseBindingsString(d,c,b,{valueAccessors:!0}):null;return a.j.tc(d,b,c,!0)},getBindingsString:function(b){switch(b.nodeType){case 1:return b.getAttribute("data-bind");case 8:return a.h.Vd(b);default:return null}},
74
+ parseBindingsString:function(b,c,d,e){try{var f=this.nd,g=b+(e&&e.valueAccessors||""),h;if(!(h=f[g])){var m,k="with($context){with($data||{}){return{"+a.m.vb(b,e)+"}}}";m=new Function("$context","$element",k);h=f[g]=m}return h(c,d)}catch(l){throw l.message="Unable to parse bindings.\nBindings value: "+b+"\nMessage: "+l.message,l;}}});a.ga.instance=new a.ga})();a.b("bindingProvider",a.ga);(function(){function b(b){var c=(b=a.a.g.get(b,z))&&b.N;c&&(b.N=null,c.Tc())}function c(c,d,e){this.node=c;this.yc=
75
+ d;this.kb=[];this.H=!1;d.N||a.a.K.za(c,b);e&&e.N&&(e.N.kb.push(c),this.Kb=e)}function d(a){return function(){return a}}function e(a){return a()}function f(b){return a.a.Ga(a.u.G(b),function(a,c){return function(){return b()[c]}})}function g(b,c,e){return"function"===typeof b?f(b.bind(null,c,e)):a.a.Ga(b,d)}function h(a,b){return f(this.getBindings.bind(this,a,b))}function m(b,c){var d=a.h.firstChild(c);if(d){var e,f=a.ga.instance,l=f.preprocessNode;if(l){for(;e=d;)d=a.h.nextSibling(e),l.call(f,e);
76
+ d=a.h.firstChild(c)}for(;e=d;)d=a.h.nextSibling(e),k(b,e)}a.i.ma(c,a.i.H)}function k(b,c){var d=b,e=1===c.nodeType;e&&a.h.Sc(c);if(e||a.ga.instance.nodeHasBindings(c))d=p(c,null,b).bindingContextForDescendants;d&&!u[a.a.R(c)]&&m(d,c)}function l(b){var c=[],d={},e=[];a.a.P(b,function ca(f){if(!d[f]){var k=a.getBindingHandler(f);k&&(k.after&&(e.push(f),a.a.D(k.after,function(c){if(b[c]){if(-1!==a.a.A(e,c))throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+e.join(", "));
77
+ ca(c)}}),e.length--),c.push({key:f,Mc:k}));d[f]=!0}});return c}function p(b,c,d){var f=a.a.g.Ub(b,z,{}),k=f.hd;if(!c){if(k)throw Error("You cannot apply bindings multiple times to the same element.");f.hd=!0}k||(f.context=d);f.Zb||(f.Zb={});var g;if(c&&"function"!==typeof c)g=c;else{var p=a.ga.instance,q=p.getBindingAccessors||h,m=a.$(function(){if(g=c?c(d,b):q.call(p,b,d)){if(d[t])d[t]();if(d[B])d[B]()}return g},null,{l:b});g&&m.ja()||(m=null)}var x=d,u;if(g){var J=function(){return a.a.Ga(m?m():
78
+ g,e)},r=m?function(a){return function(){return e(m()[a])}}:function(a){return g[a]};J.get=function(a){return g[a]&&e(r(a))};J.has=function(a){return a in g};a.i.H in g&&a.i.subscribe(b,a.i.H,function(){var c=(0,g[a.i.H])();if(c){var d=a.h.childNodes(b);d.length&&c(d,a.Ec(d[0]))}});a.i.pa in g&&(x=a.i.Cb(b,d),a.i.subscribe(b,a.i.pa,function(){var c=(0,g[a.i.pa])();c&&a.h.firstChild(b)&&c(b)}));f=l(g);a.a.D(f,function(c){var d=c.Mc.init,e=c.Mc.update,f=c.key;if(8===b.nodeType&&!a.h.ea[f])throw Error("The binding '"+
79
+ f+"' cannot be used with virtual elements");try{"function"==typeof d&&a.u.G(function(){var a=d(b,r(f),J,x.$data,x);if(a&&a.controlsDescendantBindings){if(u!==n)throw Error("Multiple bindings ("+u+" and "+f+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");u=f}}),"function"==typeof e&&a.$(function(){e(b,r(f),J,x.$data,x)},null,{l:b})}catch(k){throw k.message='Unable to process binding "'+f+": "+g[f]+'"\nMessage: '+k.message,
80
+ k;}})}f=u===n;return{shouldBindDescendants:f,bindingContextForDescendants:f&&x}}function q(b,c){return b&&b instanceof a.fa?b:new a.fa(b,n,n,c)}var t=a.a.Da("_subscribable"),x=a.a.Da("_ancestorBindingInfo"),B=a.a.Da("_dataDependency");a.c={};var u={script:!0,textarea:!0,template:!0};a.getBindingHandler=function(b){return a.c[b]};var J={};a.fa=function(b,c,d,e,f){function k(){var b=p?h():h,f=a.a.f(b);c?(a.a.extend(l,c),x in c&&(l[x]=c[x])):(l.$parents=[],l.$root=f,l.ko=a);l[t]=q;g?f=l.$data:(l.$rawData=
81
+ b,l.$data=f);d&&(l[d]=f);e&&e(l,c,f);if(c&&c[t]&&!a.S.o().Vb(c[t]))c[t]();m&&(l[B]=m);return l.$data}var l=this,g=b===J,h=g?n:b,p="function"==typeof h&&!a.O(h),q,m=f&&f.dataDependency;f&&f.exportDependencies?k():(q=a.xb(k),q.v(),q.ja()?q.equalityComparer=null:l[t]=n)};a.fa.prototype.createChildContext=function(b,c,d,e){!e&&c&&"object"==typeof c&&(e=c,c=e.as,d=e.extend);if(c&&e&&e.noChildContext){var f="function"==typeof b&&!a.O(b);return new a.fa(J,this,null,function(a){d&&d(a);a[c]=f?b():b},e)}return new a.fa(b,
82
+ this,c,function(a,b){a.$parentContext=b;a.$parent=b.$data;a.$parents=(b.$parents||[]).slice(0);a.$parents.unshift(a.$parent);d&&d(a)},e)};a.fa.prototype.extend=function(b,c){return new a.fa(J,this,null,function(c){a.a.extend(c,"function"==typeof b?b(c):b)},c)};var z=a.a.g.Z();c.prototype.Tc=function(){this.Kb&&this.Kb.N&&this.Kb.N.sd(this.node)};c.prototype.sd=function(b){a.a.Pa(this.kb,b);!this.kb.length&&this.H&&this.Cc()};c.prototype.Cc=function(){this.H=!0;this.yc.N&&!this.kb.length&&(this.yc.N=
83
+ null,a.a.K.yb(this.node,b),a.i.ma(this.node,a.i.pa),this.Tc())};a.i={H:"childrenComplete",pa:"descendantsComplete",subscribe:function(b,c,d,e,f){var k=a.a.g.Ub(b,z,{});k.Fa||(k.Fa=new a.T);f&&f.notifyImmediately&&k.Zb[c]&&a.u.G(d,e,[b]);return k.Fa.subscribe(d,e,c)},ma:function(b,c){var d=a.a.g.get(b,z);if(d&&(d.Zb[c]=!0,d.Fa&&d.Fa.notifySubscribers(b,c),c==a.i.H))if(d.N)d.N.Cc();else if(d.N===n&&d.Fa&&d.Fa.Wa(a.i.pa))throw Error("descendantsComplete event not supported for bindings on this node");
84
+ },Cb:function(b,d){var e=a.a.g.Ub(b,z,{});e.N||(e.N=new c(b,e,d[x]));return d[x]==e?d:d.extend(function(a){a[x]=e})}};a.Td=function(b){return(b=a.a.g.get(b,z))&&b.context};a.ib=function(b,c,d){1===b.nodeType&&a.h.Sc(b);return p(b,c,q(d))};a.ld=function(b,c,d){d=q(d);return a.ib(b,g(c,d,b),d)};a.Oa=function(a,b){1!==b.nodeType&&8!==b.nodeType||m(q(a),b)};a.vc=function(a,b,c){!v&&A.jQuery&&(v=A.jQuery);if(2>arguments.length){if(b=w.body,!b)throw Error("ko.applyBindings: could not find document.body; has the document been loaded?");
85
+ }else if(!b||1!==b.nodeType&&8!==b.nodeType)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");k(q(a,c),b)};a.Dc=function(b){return!b||1!==b.nodeType&&8!==b.nodeType?n:a.Td(b)};a.Ec=function(b){return(b=a.Dc(b))?b.$data:n};a.b("bindingHandlers",a.c);a.b("bindingEvent",a.i);a.b("bindingEvent.subscribe",a.i.subscribe);a.b("bindingEvent.startPossiblyAsyncContentBinding",a.i.Cb);a.b("applyBindings",a.vc);a.b("applyBindingsToDescendants",a.Oa);
86
+ a.b("applyBindingAccessorsToNode",a.ib);a.b("applyBindingsToNode",a.ld);a.b("contextFor",a.Dc);a.b("dataFor",a.Ec)})();(function(b){function c(c,e){var k=Object.prototype.hasOwnProperty.call(f,c)?f[c]:b,l;k?k.subscribe(e):(k=f[c]=new a.T,k.subscribe(e),d(c,function(b,d){var e=!(!d||!d.synchronous);g[c]={definition:b,Gd:e};delete f[c];l||e?k.notifySubscribers(b):a.na.zb(function(){k.notifySubscribers(b)})}),l=!0)}function d(a,b){e("getConfig",[a],function(c){c?e("loadComponent",[a,c],function(a){b(a,
87
+ c)}):b(null,null)})}function e(c,d,f,l){l||(l=a.j.loaders.slice(0));var g=l.shift();if(g){var q=g[c];if(q){var t=!1;if(q.apply(g,d.concat(function(a){t?f(null):null!==a?f(a):e(c,d,f,l)}))!==b&&(t=!0,!g.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.");}else e(c,d,f,l)}else f(null)}var f={},g={};a.j={get:function(d,e){var f=Object.prototype.hasOwnProperty.call(g,d)?g[d]:b;f?f.Gd?a.u.G(function(){e(f.definition)}):
88
+ a.na.zb(function(){e(f.definition)}):c(d,e)},Bc:function(a){delete g[a]},oc:e};a.j.loaders=[];a.b("components",a.j);a.b("components.get",a.j.get);a.b("components.clearCachedDefinition",a.j.Bc)})();(function(){function b(b,c,d,e){function g(){0===--B&&e(h)}var h={},B=2,u=d.template;d=d.viewModel;u?f(c,u,function(c){a.j.oc("loadTemplate",[b,c],function(a){h.template=a;g()})}):g();d?f(c,d,function(c){a.j.oc("loadViewModel",[b,c],function(a){h[m]=a;g()})}):g()}function c(a,b,d){if("function"===typeof b)d(function(a){return new b(a)});
89
+ else if("function"===typeof b[m])d(b[m]);else if("instance"in b){var e=b.instance;d(function(){return e})}else"viewModel"in b?c(a,b.viewModel,d):a("Unknown viewModel value: "+b)}function d(b){switch(a.a.R(b)){case "script":return a.a.ua(b.text);case "textarea":return a.a.ua(b.value);case "template":if(e(b.content))return a.a.Ca(b.content.childNodes)}return a.a.Ca(b.childNodes)}function e(a){return A.DocumentFragment?a instanceof DocumentFragment:a&&11===a.nodeType}function f(a,b,c){"string"===typeof b.require?
90
+ T||A.require?(T||A.require)([b.require],function(a){a&&"object"===typeof a&&a.Xd&&a["default"]&&(a=a["default"]);c(a)}):a("Uses require, but no AMD loader is present"):c(b)}function g(a){return function(b){throw Error("Component '"+a+"': "+b);}}var h={};a.j.register=function(b,c){if(!c)throw Error("Invalid configuration for "+b);if(a.j.tb(b))throw Error("Component "+b+" is already registered");h[b]=c};a.j.tb=function(a){return Object.prototype.hasOwnProperty.call(h,a)};a.j.unregister=function(b){delete h[b];
91
+ a.j.Bc(b)};a.j.Fc={getConfig:function(b,c){c(a.j.tb(b)?h[b]:null)},loadComponent:function(a,c,d){var e=g(a);f(e,c,function(c){b(a,e,c,d)})},loadTemplate:function(b,c,f){b=g(b);if("string"===typeof c)f(a.a.ua(c));else if(c instanceof Array)f(c);else if(e(c))f(a.a.la(c.childNodes));else if(c.element)if(c=c.element,A.HTMLElement?c instanceof HTMLElement:c&&c.tagName&&1===c.nodeType)f(d(c));else if("string"===typeof c){var h=w.getElementById(c);h?f(d(h)):b("Cannot find element with ID "+c)}else b("Unknown element type: "+
92
+ c);else b("Unknown template value: "+c)},loadViewModel:function(a,b,d){c(g(a),b,d)}};var m="createViewModel";a.b("components.register",a.j.register);a.b("components.isRegistered",a.j.tb);a.b("components.unregister",a.j.unregister);a.b("components.defaultLoader",a.j.Fc);a.j.loaders.push(a.j.Fc);a.j.dd=h})();(function(){function b(b,e){var f=b.getAttribute("params");if(f){var f=c.parseBindingsString(f,e,b,{valueAccessors:!0,bindingParams:!0}),f=a.a.Ga(f,function(c){return a.o(c,null,{l:b})}),g=a.a.Ga(f,
93
+ function(c){var e=c.v();return c.ja()?a.o({read:function(){return a.a.f(c())},write:a.Za(e)&&function(a){c()(a)},l:b}):e});Object.prototype.hasOwnProperty.call(g,"$raw")||(g.$raw=f);return g}return{$raw:{}}}a.j.getComponentNameForNode=function(b){var c=a.a.R(b);if(a.j.tb(c)&&(-1!=c.indexOf("-")||"[object HTMLUnknownElement]"==""+b||8>=a.a.W&&b.tagName===c))return c};a.j.tc=function(c,e,f,g){if(1===e.nodeType){var h=a.j.getComponentNameForNode(e);if(h){c=c||{};if(c.component)throw Error('Cannot use the "component" binding on a custom element matching a component');
94
+ var m={name:h,params:b(e,f)};c.component=g?function(){return m}:m}}return c};var c=new a.ga;9>a.a.W&&(a.j.register=function(a){return function(b){return a.apply(this,arguments)}}(a.j.register),w.createDocumentFragment=function(b){return function(){var c=b(),f=a.j.dd,g;for(g in f);return c}}(w.createDocumentFragment))})();(function(){function b(b,c,d){c=c.template;if(!c)throw Error("Component '"+b+"' has no template");b=a.a.Ca(c);a.h.va(d,b)}function c(a,b,c){var d=a.createViewModel;return d?d.call(a,
95
+ b,c):b}var d=0;a.c.component={init:function(e,f,g,h,m){function k(){var a=l&&l.dispose;"function"===typeof a&&a.call(l);q&&q.s();p=l=q=null}var l,p,q,t=a.a.la(a.h.childNodes(e));a.h.Ea(e);a.a.K.za(e,k);a.o(function(){var g=a.a.f(f()),h,u;"string"===typeof g?h=g:(h=a.a.f(g.name),u=a.a.f(g.params));if(!h)throw Error("No component name specified");var n=a.i.Cb(e,m),z=p=++d;a.j.get(h,function(d){if(p===z){k();if(!d)throw Error("Unknown component '"+h+"'");b(h,d,e);var f=c(d,u,{element:e,templateNodes:t});
96
+ d=n.createChildContext(f,{extend:function(a){a.$component=f;a.$componentTemplateNodes=t}});f&&f.koDescendantsComplete&&(q=a.i.subscribe(e,a.i.pa,f.koDescendantsComplete,f));l=f;a.Oa(d,e)}})},null,{l:e});return{controlsDescendantBindings:!0}}};a.h.ea.component=!0})();var V={"class":"className","for":"htmlFor"};a.c.attr={update:function(b,c){var d=a.a.f(c())||{};a.a.P(d,function(c,d){d=a.a.f(d);var g=c.indexOf(":"),g="lookupNamespaceURI"in b&&0<g&&b.lookupNamespaceURI(c.substr(0,g)),h=!1===d||null===
97
+ d||d===n;h?g?b.removeAttributeNS(g,c):b.removeAttribute(c):d=d.toString();8>=a.a.W&&c in V?(c=V[c],h?b.removeAttribute(c):b[c]=d):h||(g?b.setAttributeNS(g,c,d):b.setAttribute(c,d));"name"===c&&a.a.Yc(b,h?"":d)})}};(function(){a.c.checked={after:["value","attr"],init:function(b,c,d){function e(){var e=b.checked,f=g();if(!a.S.Ya()&&(e||!m&&!a.S.qa())){var k=a.u.G(c);if(l){var q=p?k.v():k,z=t;t=f;z!==f?e&&(a.a.Na(q,f,!0),a.a.Na(q,z,!1)):a.a.Na(q,f,e);p&&a.Za(k)&&k(q)}else h&&(f===n?f=e:e||(f=n)),a.m.eb(k,
98
+ d,"checked",f,!0)}}function f(){var d=a.a.f(c()),e=g();l?(b.checked=0<=a.a.A(d,e),t=e):b.checked=h&&e===n?!!d:g()===d}var g=a.xb(function(){if(d.has("checkedValue"))return a.a.f(d.get("checkedValue"));if(q)return d.has("value")?a.a.f(d.get("value")):b.value}),h="checkbox"==b.type,m="radio"==b.type;if(h||m){var k=c(),l=h&&a.a.f(k)instanceof Array,p=!(l&&k.push&&k.splice),q=m||l,t=l?g():n;m&&!b.name&&a.c.uniqueName.init(b,function(){return!0});a.o(e,null,{l:b});a.a.B(b,"click",e);a.o(f,null,{l:b});
99
+ k=n}}};a.m.wa.checked=!0;a.c.checkedValue={update:function(b,c){b.value=a.a.f(c())}}})();a.c["class"]={update:function(b,c){var d=a.a.Db(a.a.f(c()));a.a.Eb(b,b.__ko__cssValue,!1);b.__ko__cssValue=d;a.a.Eb(b,d,!0)}};a.c.css={update:function(b,c){var d=a.a.f(c());null!==d&&"object"==typeof d?a.a.P(d,function(c,d){d=a.a.f(d);a.a.Eb(b,c,d)}):a.c["class"].update(b,c)}};a.c.enable={update:function(b,c){var d=a.a.f(c());d&&b.disabled?b.removeAttribute("disabled"):d||b.disabled||(b.disabled=!0)}};a.c.disable=
100
+ {update:function(b,c){a.c.enable.update(b,function(){return!a.a.f(c())})}};a.c.event={init:function(b,c,d,e,f){var g=c()||{};a.a.P(g,function(g){"string"==typeof g&&a.a.B(b,g,function(b){var k,l=c()[g];if(l){try{var p=a.a.la(arguments);e=f.$data;p.unshift(e);k=l.apply(e,p)}finally{!0!==k&&(b.preventDefault?b.preventDefault():b.returnValue=!1)}!1===d.get(g+"Bubble")&&(b.cancelBubble=!0,b.stopPropagation&&b.stopPropagation())}})})}};a.c.foreach={Rc:function(b){return function(){var c=b(),d=a.a.bc(c);
101
+ if(!d||"number"==typeof d.length)return{foreach:c,templateEngine:a.ba.Ma};a.a.f(c);return{foreach:d.data,as:d.as,noChildContext:d.noChildContext,includeDestroyed:d.includeDestroyed,afterAdd:d.afterAdd,beforeRemove:d.beforeRemove,afterRender:d.afterRender,beforeMove:d.beforeMove,afterMove:d.afterMove,templateEngine:a.ba.Ma}}},init:function(b,c){return a.c.template.init(b,a.c.foreach.Rc(c))},update:function(b,c,d,e,f){return a.c.template.update(b,a.c.foreach.Rc(c),d,e,f)}};a.m.Ra.foreach=!1;a.h.ea.foreach=
102
+ !0;a.c.hasfocus={init:function(b,c,d){function e(e){b.__ko_hasfocusUpdating=!0;var f=b.ownerDocument;if("activeElement"in f){var g;try{g=f.activeElement}catch(l){g=f.body}e=g===b}f=c();a.m.eb(f,d,"hasfocus",e,!0);b.__ko_hasfocusLastValue=e;b.__ko_hasfocusUpdating=!1}var f=e.bind(null,!0),g=e.bind(null,!1);a.a.B(b,"focus",f);a.a.B(b,"focusin",f);a.a.B(b,"blur",g);a.a.B(b,"focusout",g);b.__ko_hasfocusLastValue=!1},update:function(b,c){var d=!!a.a.f(c());b.__ko_hasfocusUpdating||b.__ko_hasfocusLastValue===
103
+ d||(d?b.focus():b.blur(),!d&&b.__ko_hasfocusLastValue&&b.ownerDocument.body.focus(),a.u.G(a.a.Fb,null,[b,d?"focusin":"focusout"]))}};a.m.wa.hasfocus=!0;a.c.hasFocus=a.c.hasfocus;a.m.wa.hasFocus="hasfocus";a.c.html={init:function(){return{controlsDescendantBindings:!0}},update:function(b,c){a.a.fc(b,c())}};(function(){function b(b,d,e){a.c[b]={init:function(b,c,h,m,k){var l,p,q={},t,x,n;if(d){m=h.get("as");var u=h.get("noChildContext");n=!(m&&u);q={as:m,noChildContext:u,exportDependencies:n}}x=(t=
104
+ "render"==h.get("completeOn"))||h.has(a.i.pa);a.o(function(){var h=a.a.f(c()),m=!e!==!h,u=!p,r;if(n||m!==l){x&&(k=a.i.Cb(b,k));if(m){if(!d||n)q.dataDependency=a.S.o();r=d?k.createChildContext("function"==typeof h?h:c,q):a.S.qa()?k.extend(null,q):k}u&&a.S.qa()&&(p=a.a.Ca(a.h.childNodes(b),!0));m?(u||a.h.va(b,a.a.Ca(p)),a.Oa(r,b)):(a.h.Ea(b),t||a.i.ma(b,a.i.H));l=m}},null,{l:b});return{controlsDescendantBindings:!0}}};a.m.Ra[b]=!1;a.h.ea[b]=!0}b("if");b("ifnot",!1,!0);b("with",!0)})();a.c.let={init:function(b,
105
+ c,d,e,f){c=f.extend(c);a.Oa(c,b);return{controlsDescendantBindings:!0}}};a.h.ea.let=!0;var Q={};a.c.options={init:function(b){if("select"!==a.a.R(b))throw Error("options binding applies only to SELECT elements");for(;0<b.length;)b.remove(0);return{controlsDescendantBindings:!0}},update:function(b,c,d){function e(){return a.a.jb(b.options,function(a){return a.selected})}function f(a,b,c){var d=typeof b;return"function"==d?b(a):"string"==d?a[b]:c}function g(c,d){if(x&&l)a.i.ma(b,a.i.H);else if(t.length){var e=
106
+ 0<=a.a.A(t,a.w.M(d[0]));a.a.Zc(d[0],e);x&&!e&&a.u.G(a.a.Fb,null,[b,"change"])}}var h=b.multiple,m=0!=b.length&&h?b.scrollTop:null,k=a.a.f(c()),l=d.get("valueAllowUnset")&&d.has("value"),p=d.get("optionsIncludeDestroyed");c={};var q,t=[];l||(h?t=a.a.Mb(e(),a.w.M):0<=b.selectedIndex&&t.push(a.w.M(b.options[b.selectedIndex])));k&&("undefined"==typeof k.length&&(k=[k]),q=a.a.jb(k,function(b){return p||b===n||null===b||!a.a.f(b._destroy)}),d.has("optionsCaption")&&(k=a.a.f(d.get("optionsCaption")),null!==
107
+ k&&k!==n&&q.unshift(Q)));var x=!1;c.beforeRemove=function(a){b.removeChild(a)};k=g;d.has("optionsAfterRender")&&"function"==typeof d.get("optionsAfterRender")&&(k=function(b,c){g(0,c);a.u.G(d.get("optionsAfterRender"),null,[c[0],b!==Q?b:n])});a.a.ec(b,q,function(c,e,g){g.length&&(t=!l&&g[0].selected?[a.w.M(g[0])]:[],x=!0);e=b.ownerDocument.createElement("option");c===Q?(a.a.Bb(e,d.get("optionsCaption")),a.w.cb(e,n)):(g=f(c,d.get("optionsValue"),c),a.w.cb(e,a.a.f(g)),c=f(c,d.get("optionsText"),g),
108
+ a.a.Bb(e,c));return[e]},c,k);if(!l){var B;h?B=t.length&&e().length<t.length:B=t.length&&0<=b.selectedIndex?a.w.M(b.options[b.selectedIndex])!==t[0]:t.length||0<=b.selectedIndex;B&&a.u.G(a.a.Fb,null,[b,"change"])}(l||a.S.Ya())&&a.i.ma(b,a.i.H);a.a.wd(b);m&&20<Math.abs(m-b.scrollTop)&&(b.scrollTop=m)}};a.c.options.$b=a.a.g.Z();a.c.selectedOptions={init:function(b,c,d){function e(){var e=c(),f=[];a.a.D(b.getElementsByTagName("option"),function(b){b.selected&&f.push(a.w.M(b))});a.m.eb(e,d,"selectedOptions",
109
+ f)}function f(){var d=a.a.f(c()),e=b.scrollTop;d&&"number"==typeof d.length&&a.a.D(b.getElementsByTagName("option"),function(b){var c=0<=a.a.A(d,a.w.M(b));b.selected!=c&&a.a.Zc(b,c)});b.scrollTop=e}if("select"!=a.a.R(b))throw Error("selectedOptions binding applies only to SELECT elements");var g;a.i.subscribe(b,a.i.H,function(){g?e():(a.a.B(b,"change",e),g=a.o(f,null,{l:b}))},null,{notifyImmediately:!0})},update:function(){}};a.m.wa.selectedOptions=!0;a.c.style={update:function(b,c){var d=a.a.f(c()||
110
+ {});a.a.P(d,function(c,d){d=a.a.f(d);if(null===d||d===n||!1===d)d="";if(v)v(b).css(c,d);else if(/^--/.test(c))b.style.setProperty(c,d);else{c=c.replace(/-(\w)/g,function(a,b){return b.toUpperCase()});var g=b.style[c];b.style[c]=d;d===g||b.style[c]!=g||isNaN(d)||(b.style[c]=d+"px")}})}};a.c.submit={init:function(b,c,d,e,f){if("function"!=typeof c())throw Error("The value for a submit binding must be a function");a.a.B(b,"submit",function(a){var d,e=c();try{d=e.call(f.$data,b)}finally{!0!==d&&(a.preventDefault?
111
+ a.preventDefault():a.returnValue=!1)}})}};a.c.text={init:function(){return{controlsDescendantBindings:!0}},update:function(b,c){a.a.Bb(b,c())}};a.h.ea.text=!0;(function(){if(A&&A.navigator){var b=function(a){if(a)return parseFloat(a[1])},c=A.navigator.userAgent,d,e,f,g,h;(d=A.opera&&A.opera.version&&parseInt(A.opera.version()))||(h=b(c.match(/Edge\/([^ ]+)$/)))||b(c.match(/Chrome\/([^ ]+)/))||(e=b(c.match(/Version\/([^ ]+) Safari/)))||(f=b(c.match(/Firefox\/([^ ]+)/)))||(g=a.a.W||b(c.match(/MSIE ([^ ]+)/)))||
112
+ (g=b(c.match(/rv:([^ )]+)/)))}if(8<=g&&10>g)var m=a.a.g.Z(),k=a.a.g.Z(),l=function(b){var c=this.activeElement;(c=c&&a.a.g.get(c,k))&&c(b)},p=function(b,c){var d=b.ownerDocument;a.a.g.get(d,m)||(a.a.g.set(d,m,!0),a.a.B(d,"selectionchange",l));a.a.g.set(b,k,c)};a.c.textInput={init:function(b,c,k){function l(c,d){a.a.B(b,c,d)}function m(){var d=a.a.f(c());if(null===d||d===n)d="";L!==n&&d===L?a.a.setTimeout(m,4):b.value!==d&&(y=!0,b.value=d,y=!1,v=b.value)}function r(){w||(L=b.value,w=a.a.setTimeout(z,
113
+ 4))}function z(){clearTimeout(w);L=w=n;var d=b.value;v!==d&&(v=d,a.m.eb(c(),k,"textInput",d))}var v=b.value,w,L,A=9==a.a.W?r:z,y=!1;g&&l("keypress",z);11>g&&l("propertychange",function(a){y||"value"!==a.propertyName||A(a)});8==g&&(l("keyup",z),l("keydown",z));p&&(p(b,A),l("dragend",r));(!g||9<=g)&&l("input",A);5>e&&"textarea"===a.a.R(b)?(l("keydown",r),l("paste",r),l("cut",r)):11>d?l("keydown",r):4>f?(l("DOMAutoComplete",z),l("dragdrop",z),l("drop",z)):h&&"number"===b.type&&l("keydown",r);l("change",
114
+ z);l("blur",z);a.o(m,null,{l:b})}};a.m.wa.textInput=!0;a.c.textinput={preprocess:function(a,b,c){c("textInput",a)}}})();a.c.uniqueName={init:function(b,c){if(c()){var d="ko_unique_"+ ++a.c.uniqueName.rd;a.a.Yc(b,d)}}};a.c.uniqueName.rd=0;a.c.using={init:function(b,c,d,e,f){var g;d.has("as")&&(g={as:d.get("as"),noChildContext:d.get("noChildContext")});c=f.createChildContext(c,g);a.Oa(c,b);return{controlsDescendantBindings:!0}}};a.h.ea.using=!0;a.c.value={init:function(b,c,d){var e=a.a.R(b),f="input"==
115
+ e;if(!f||"checkbox"!=b.type&&"radio"!=b.type){var g=[],h=d.get("valueUpdate"),m=!1,k=null;h&&("string"==typeof h?g=[h]:g=a.a.wc(h),a.a.Pa(g,"change"));var l=function(){k=null;m=!1;var e=c(),f=a.w.M(b);a.m.eb(e,d,"value",f)};!a.a.W||!f||"text"!=b.type||"off"==b.autocomplete||b.form&&"off"==b.form.autocomplete||-1!=a.a.A(g,"propertychange")||(a.a.B(b,"propertychange",function(){m=!0}),a.a.B(b,"focus",function(){m=!1}),a.a.B(b,"blur",function(){m&&l()}));a.a.D(g,function(c){var d=l;a.a.Ud(c,"after")&&
116
+ (d=function(){k=a.w.M(b);a.a.setTimeout(l,0)},c=c.substring(5));a.a.B(b,c,d)});var p;p=f&&"file"==b.type?function(){var d=a.a.f(c());null===d||d===n||""===d?b.value="":a.u.G(l)}:function(){var f=a.a.f(c()),g=a.w.M(b);if(null!==k&&f===k)a.a.setTimeout(p,0);else if(f!==g||g===n)"select"===e?(g=d.get("valueAllowUnset"),a.w.cb(b,f,g),g||f===a.w.M(b)||a.u.G(l)):a.w.cb(b,f)};if("select"===e){var q;a.i.subscribe(b,a.i.H,function(){q?d.get("valueAllowUnset")?p():l():(a.a.B(b,"change",l),q=a.o(p,null,{l:b}))},
117
+ null,{notifyImmediately:!0})}else a.a.B(b,"change",l),a.o(p,null,{l:b})}else a.ib(b,{checkedValue:c})},update:function(){}};a.m.wa.value=!0;a.c.visible={update:function(b,c){var d=a.a.f(c()),e="none"!=b.style.display;d&&!e?b.style.display="":!d&&e&&(b.style.display="none")}};a.c.hidden={update:function(b,c){a.c.visible.update(b,function(){return!a.a.f(c())})}};(function(b){a.c[b]={init:function(c,d,e,f,g){return a.c.event.init.call(this,c,function(){var a={};a[b]=d();return a},e,f,g)}}})("click");
118
+ a.ca=function(){};a.ca.prototype.renderTemplateSource=function(){throw Error("Override renderTemplateSource");};a.ca.prototype.createJavaScriptEvaluatorBlock=function(){throw Error("Override createJavaScriptEvaluatorBlock");};a.ca.prototype.makeTemplateSource=function(b,c){if("string"==typeof b){c=c||w;var d=c.getElementById(b);if(!d)throw Error("Cannot find template with ID "+b);return new a.C.F(d)}if(1==b.nodeType||8==b.nodeType)return new a.C.ia(b);throw Error("Unknown template type: "+b);};a.ca.prototype.renderTemplate=
119
+ function(a,c,d,e){a=this.makeTemplateSource(a,e);return this.renderTemplateSource(a,c,d,e)};a.ca.prototype.isTemplateRewritten=function(a,c){return!1===this.allowTemplateRewriting?!0:this.makeTemplateSource(a,c).data("isRewritten")};a.ca.prototype.rewriteTemplate=function(a,c,d){a=this.makeTemplateSource(a,d);c=c(a.text());a.text(c);a.data("isRewritten",!0)};a.b("templateEngine",a.ca);a.kc=function(){function b(b,c,d,h){b=a.m.ac(b);for(var m=a.m.Ra,k=0;k<b.length;k++){var l=b[k].key;if(Object.prototype.hasOwnProperty.call(m,
120
+ l)){var p=m[l];if("function"===typeof p){if(l=p(b[k].value))throw Error(l);}else if(!p)throw Error("This template engine does not support the '"+l+"' binding within its templates");}}d="ko.__tr_ambtns(function($context,$element){return(function(){return{ "+a.m.vb(b,{valueAccessors:!0})+" } })()},'"+d.toLowerCase()+"')";return h.createJavaScriptEvaluatorBlock(d)+c}var c=/(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'|[^>]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi,
121
+ d=/\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;return{xd:function(b,c,d){c.isTemplateRewritten(b,d)||c.rewriteTemplate(b,function(b){return a.kc.Ld(b,c)},d)},Ld:function(a,f){return a.replace(c,function(a,c,d,e,l){return b(l,c,d,f)}).replace(d,function(a,c){return b(c,"\x3c!-- ko --\x3e","#comment",f)})},md:function(b,c){return a.aa.Xb(function(d,h){var m=d.nextSibling;m&&m.nodeName.toLowerCase()===c&&a.ib(m,b,h)})}}}();a.b("__tr_ambtns",a.kc.md);(function(){a.C={};a.C.F=function(b){if(this.F=b){var c=
122
+ a.a.R(b);this.ab="script"===c?1:"textarea"===c?2:"template"==c&&b.content&&11===b.content.nodeType?3:4}};a.C.F.prototype.text=function(){var b=1===this.ab?"text":2===this.ab?"value":"innerHTML";if(0==arguments.length)return this.F[b];var c=arguments[0];"innerHTML"===b?a.a.fc(this.F,c):this.F[b]=c};var b=a.a.g.Z()+"_";a.C.F.prototype.data=function(c){if(1===arguments.length)return a.a.g.get(this.F,b+c);a.a.g.set(this.F,b+c,arguments[1])};var c=a.a.g.Z();a.C.F.prototype.nodes=function(){var b=this.F;
123
+ if(0==arguments.length){var e=a.a.g.get(b,c)||{},f=e.lb||(3===this.ab?b.content:4===this.ab?b:n);if(!f||e.jd){var g=this.text();g&&g!==e.bb&&(f=a.a.Md(g,b.ownerDocument),a.a.g.set(b,c,{lb:f,bb:g,jd:!0}))}return f}e=arguments[0];this.ab!==n&&this.text("");a.a.g.set(b,c,{lb:e})};a.C.ia=function(a){this.F=a};a.C.ia.prototype=new a.C.F;a.C.ia.prototype.constructor=a.C.ia;a.C.ia.prototype.text=function(){if(0==arguments.length){var b=a.a.g.get(this.F,c)||{};b.bb===n&&b.lb&&(b.bb=b.lb.innerHTML);return b.bb}a.a.g.set(this.F,
124
+ c,{bb:arguments[0]})};a.b("templateSources",a.C);a.b("templateSources.domElement",a.C.F);a.b("templateSources.anonymousTemplate",a.C.ia)})();(function(){function b(b,c,d){var e;for(c=a.h.nextSibling(c);b&&(e=b)!==c;)b=a.h.nextSibling(e),d(e,b)}function c(c,d){if(c.length){var e=c[0],f=c[c.length-1],g=e.parentNode,h=a.ga.instance,m=h.preprocessNode;if(m){b(e,f,function(a,b){var c=a.previousSibling,d=m.call(h,a);d&&(a===e&&(e=d[0]||b),a===f&&(f=d[d.length-1]||c))});c.length=0;if(!e)return;e===f?c.push(e):
125
+ (c.push(e,f),a.a.Ua(c,g))}b(e,f,function(b){1!==b.nodeType&&8!==b.nodeType||a.vc(d,b)});b(e,f,function(b){1!==b.nodeType&&8!==b.nodeType||a.aa.cd(b,[d])});a.a.Ua(c,g)}}function d(a){return a.nodeType?a:0<a.length?a[0]:null}function e(b,e,f,h,m){m=m||{};var n=(b&&d(b)||f||{}).ownerDocument,B=m.templateEngine||g;a.kc.xd(f,B,n);f=B.renderTemplate(f,h,m,n);if("number"!=typeof f.length||0<f.length&&"number"!=typeof f[0].nodeType)throw Error("Template engine must return an array of DOM nodes");n=!1;switch(e){case "replaceChildren":a.h.va(b,
126
+ f);n=!0;break;case "replaceNode":a.a.Xc(b,f);n=!0;break;case "ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+e);}n&&(c(f,h),m.afterRender&&a.u.G(m.afterRender,null,[f,h[m.as||"$data"]]),"replaceChildren"==e&&a.i.ma(b,a.i.H));return f}function f(b,c,d){return a.O(b)?b():"function"===typeof b?b(c,d):b}var g;a.gc=function(b){if(b!=n&&!(b instanceof a.ca))throw Error("templateEngine must inherit from ko.templateEngine");g=b};a.dc=function(b,c,h,m,t){h=h||{};if((h.templateEngine||g)==
127
+ n)throw Error("Set a template engine before calling renderTemplate");t=t||"replaceChildren";if(m){var x=d(m);return a.$(function(){var g=c&&c instanceof a.fa?c:new a.fa(c,null,null,null,{exportDependencies:!0}),n=f(b,g.$data,g),g=e(m,t,n,g,h);"replaceNode"==t&&(m=g,x=d(m))},null,{Sa:function(){return!x||!a.a.Sb(x)},l:x&&"replaceNode"==t?x.parentNode:x})}return a.aa.Xb(function(d){a.dc(b,c,h,d,"replaceNode")})};a.Qd=function(b,d,g,h,m){function x(b,c){a.u.G(a.a.ec,null,[h,b,u,g,r,c]);a.i.ma(h,a.i.H)}
128
+ function r(a,b){c(b,v);g.afterRender&&g.afterRender(b,a);v=null}function u(a,c){v=m.createChildContext(a,{as:z,noChildContext:g.noChildContext,extend:function(a){a.$index=c;z&&(a[z+"Index"]=c)}});var d=f(b,a,v);return e(h,"ignoreTargetNode",d,v,g)}var v,z=g.as,w=!1===g.includeDestroyed||a.options.foreachHidesDestroyed&&!g.includeDestroyed;if(w||g.beforeRemove||!a.Pc(d))return a.$(function(){var b=a.a.f(d)||[];"undefined"==typeof b.length&&(b=[b]);w&&(b=a.a.jb(b,function(b){return b===n||null===b||
129
+ !a.a.f(b._destroy)}));x(b)},null,{l:h});x(d.v());var A=d.subscribe(function(a){x(d(),a)},null,"arrayChange");A.l(h);return A};var h=a.a.g.Z(),m=a.a.g.Z();a.c.template={init:function(b,c){var d=a.a.f(c());if("string"==typeof d||"name"in d)a.h.Ea(b);else if("nodes"in d){d=d.nodes||[];if(a.O(d))throw Error('The "nodes" option must be a plain, non-observable array.');var e=d[0]&&d[0].parentNode;e&&a.a.g.get(e,m)||(e=a.a.Yb(d),a.a.g.set(e,m,!0));(new a.C.ia(b)).nodes(e)}else if(d=a.h.childNodes(b),0<d.length)e=
130
+ a.a.Yb(d),(new a.C.ia(b)).nodes(e);else throw Error("Anonymous template defined, but no template content was provided");return{controlsDescendantBindings:!0}},update:function(b,c,d,e,f){var g=c();c=a.a.f(g);d=!0;e=null;"string"==typeof c?c={}:(g="name"in c?c.name:b,"if"in c&&(d=a.a.f(c["if"])),d&&"ifnot"in c&&(d=!a.a.f(c.ifnot)),d&&!g&&(d=!1));"foreach"in c?e=a.Qd(g,d&&c.foreach||[],c,b,f):d?(d=f,"data"in c&&(d=f.createChildContext(c.data,{as:c.as,noChildContext:c.noChildContext,exportDependencies:!0})),
131
+ e=a.dc(g,d,c,b)):a.h.Ea(b);f=e;(c=a.a.g.get(b,h))&&"function"==typeof c.s&&c.s();a.a.g.set(b,h,!f||f.ja&&!f.ja()?n:f)}};a.m.Ra.template=function(b){b=a.m.ac(b);return 1==b.length&&b[0].unknown||a.m.Id(b,"name")?null:"This template engine does not support anonymous templates nested within its templates"};a.h.ea.template=!0})();a.b("setTemplateEngine",a.gc);a.b("renderTemplate",a.dc);a.a.Kc=function(a,c,d){if(a.length&&c.length){var e,f,g,h,m;for(e=f=0;(!d||e<d)&&(h=a[f]);++f){for(g=0;m=c[g];++g)if(h.value===
132
+ m.value){h.moved=m.index;m.moved=h.index;c.splice(g,1);e=g=0;break}e+=g}}};a.a.Pb=function(){function b(b,d,e,f,g){var h=Math.min,m=Math.max,k=[],l,p=b.length,q,n=d.length,r=n-p||1,v=p+n+1,u,w,z;for(l=0;l<=p;l++)for(w=u,k.push(u=[]),z=h(n,l+r),q=m(0,l-1);q<=z;q++)u[q]=q?l?b[l-1]===d[q-1]?w[q-1]:h(w[q]||v,u[q-1]||v)+1:q+1:l+1;h=[];m=[];r=[];l=p;for(q=n;l||q;)n=k[l][q]-1,q&&n===k[l][q-1]?m.push(h[h.length]={status:e,value:d[--q],index:q}):l&&n===k[l-1][q]?r.push(h[h.length]={status:f,value:b[--l],index:l}):
133
+ (--q,--l,g.sparse||h.push({status:"retained",value:d[q]}));a.a.Kc(r,m,!g.dontLimitMoves&&10*p);return h.reverse()}return function(a,d,e){e="boolean"===typeof e?{dontLimitMoves:e}:e||{};a=a||[];d=d||[];return a.length<d.length?b(a,d,"added","deleted",e):b(d,a,"deleted","added",e)}}();a.b("utils.compareArrays",a.a.Pb);(function(){function b(b,c,d,h,m){var k=[],l=a.$(function(){var l=c(d,m,a.a.Ua(k,b))||[];0<k.length&&(a.a.Xc(k,l),h&&a.u.G(h,null,[d,l,m]));k.length=0;a.a.Nb(k,l)},null,{l:b,Sa:function(){return!a.a.kd(k)}});
134
+ return{Y:k,$:l.ja()?l:n}}var c=a.a.g.Z(),d=a.a.g.Z();a.a.ec=function(e,f,g,h,m,k){function l(b){y={Aa:b,pb:a.ta(w++)};v.push(y);r||F.push(y)}function p(b){y=t[b];w!==y.pb.v()&&D.push(y);y.pb(w++);a.a.Ua(y.Y,e);v.push(y)}function q(b,c){if(b)for(var d=0,e=c.length;d<e;d++)a.a.D(c[d].Y,function(a){b(a,d,c[d].Aa)})}f=f||[];"undefined"==typeof f.length&&(f=[f]);h=h||{};var t=a.a.g.get(e,c),r=!t,v=[],u=0,w=0,z=[],A=[],C=[],D=[],F=[],y,I=0;if(r)a.a.D(f,l);else{if(!k||t&&t._countWaitingForRemove){var E=
135
+ a.a.Mb(t,function(a){return a.Aa});k=a.a.Pb(E,f,{dontLimitMoves:h.dontLimitMoves,sparse:!0})}for(var E=0,G,H,K;G=k[E];E++)switch(H=G.moved,K=G.index,G.status){case "deleted":for(;u<K;)p(u++);H===n&&(y=t[u],y.$&&(y.$.s(),y.$=n),a.a.Ua(y.Y,e).length&&(h.beforeRemove&&(v.push(y),I++,y.Aa===d?y=null:C.push(y)),y&&z.push.apply(z,y.Y)));u++;break;case "added":for(;w<K;)p(u++);H!==n?(A.push(v.length),p(H)):l(G.value)}for(;w<f.length;)p(u++);v._countWaitingForRemove=I}a.a.g.set(e,c,v);q(h.beforeMove,D);a.a.D(z,
136
+ h.beforeRemove?a.oa:a.removeNode);var M,O,P;try{P=e.ownerDocument.activeElement}catch(N){}if(A.length)for(;(E=A.shift())!=n;){y=v[E];for(M=n;E;)if((O=v[--E].Y)&&O.length){M=O[O.length-1];break}for(f=0;u=y.Y[f];M=u,f++)a.h.Wb(e,u,M)}for(E=0;y=v[E];E++){y.Y||a.a.extend(y,b(e,g,y.Aa,m,y.pb));for(f=0;u=y.Y[f];M=u,f++)a.h.Wb(e,u,M);!y.Ed&&m&&(m(y.Aa,y.Y,y.pb),y.Ed=!0,M=y.Y[y.Y.length-1])}P&&e.ownerDocument.activeElement!=P&&P.focus();q(h.beforeRemove,C);for(E=0;E<C.length;++E)C[E].Aa=d;q(h.afterMove,D);
137
+ q(h.afterAdd,F)}})();a.b("utils.setDomNodeChildrenFromArrayMapping",a.a.ec);a.ba=function(){this.allowTemplateRewriting=!1};a.ba.prototype=new a.ca;a.ba.prototype.constructor=a.ba;a.ba.prototype.renderTemplateSource=function(b,c,d,e){if(c=(9>a.a.W?0:b.nodes)?b.nodes():null)return a.a.la(c.cloneNode(!0).childNodes);b=b.text();return a.a.ua(b,e)};a.ba.Ma=new a.ba;a.gc(a.ba.Ma);a.b("nativeTemplateEngine",a.ba);(function(){a.$a=function(){var a=this.Hd=function(){if(!v||!v.tmpl)return 0;try{if(0<=v.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch(a){}return 1}();
138
+ this.renderTemplateSource=function(b,e,f,g){g=g||w;f=f||{};if(2>a)throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");var h=b.data("precompiled");h||(h=b.text()||"",h=v.template(null,"{{ko_with $item.koBindingContext}}"+h+"{{/ko_with}}"),b.data("precompiled",h));b=[e.$data];e=v.extend({koBindingContext:e},f.templateOptions);e=v.tmpl(h,b,e);e.appendTo(g.createElement("div"));v.fragments={};return e};this.createJavaScriptEvaluatorBlock=function(a){return"{{ko_code ((function() { return "+
139
+ a+" })()) }}"};this.addTemplate=function(a,b){w.write("<script type='text/html' id='"+a+"'>"+b+"\x3c/script>")};0<a&&(v.tmpl.tag.ko_code={open:"__.push($1 || '');"},v.tmpl.tag.ko_with={open:"with($1) {",close:"} "})};a.$a.prototype=new a.ca;a.$a.prototype.constructor=a.$a;var b=new a.$a;0<b.Hd&&a.gc(b);a.b("jqueryTmplTemplateEngine",a.$a)})()})})();})();
js/menu-editor.js CHANGED
@@ -151,6 +151,8 @@ window.AmeEditorApi = AmeEditorApi;
151
 
152
  var actorSelectorWidget = new AmeActorSelector(AmeActors, wsEditorData.wsMenuEditorPro);
153
 
 
 
154
  var itemTemplates = {
155
  templates: wsEditorData.itemTemplates,
156
 
@@ -1381,6 +1383,9 @@ function updateItemEditor(containerNode) {
1381
  });
1382
  }
1383
 
 
 
 
1384
  function isEmptyObject(obj) {
1385
  for (var prop in obj) {
1386
  if (obj.hasOwnProperty(prop)) {
151
 
152
  var actorSelectorWidget = new AmeActorSelector(AmeActors, wsEditorData.wsMenuEditorPro);
153
 
154
+ AmeEditorApi.actorSelectorWidget = actorSelectorWidget;
155
+
156
  var itemTemplates = {
157
  templates: wsEditorData.itemTemplates,
158
 
1383
  });
1384
  }
1385
 
1386
+ AmeEditorApi.updateParentAccessUi = updateParentAccessUi;
1387
+ AmeEditorApi.updateItemEditor = updateItemEditor;
1388
+
1389
  function isEmptyObject(obj) {
1390
  for (var prop in obj) {
1391
  if (obj.hasOwnProperty(prop)) {
menu-editor.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Admin Menu Editor
4
  Plugin URI: http://w-shadow.com/blog/2008/12/20/admin-menu-editor-for-wordpress/
5
  Description: Lets you directly edit the WordPress admin menu. You can re-order, hide or rename existing menus, add custom menus and more.
6
- Version: 1.9.3
7
  Author: Janis Elsts
8
  Author URI: http://w-shadow.com/blog/
9
  */
3
  Plugin Name: Admin Menu Editor
4
  Plugin URI: http://w-shadow.com/blog/2008/12/20/admin-menu-editor-for-wordpress/
5
  Description: Lets you directly edit the WordPress admin menu. You can re-order, hide or rename existing menus, add custom menus and more.
6
+ Version: 1.9.4
7
  Author: Janis Elsts
8
  Author URI: http://w-shadow.com/blog/
9
  */
modules/plugin-visibility/plugin-visibility.js CHANGED
@@ -159,6 +159,7 @@ var AmePluginVisibilityModule = /** @class */ (function () {
159
  return this.grantAccessByDefault[actorId];
160
  };
161
  AmePluginVisibilityModule.prototype.getSettings = function () {
 
162
  var _ = AmePluginVisibilityModule._;
163
  var result = {};
164
  result.grantAccessByDefault = _.mapValues(this.grantAccessByDefault, function (allow) {
@@ -172,9 +173,24 @@ var AmePluginVisibilityModule = /** @class */ (function () {
172
  return allow();
173
  })
174
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  for (var i = 0; i < AmePlugin.editablePropertyNames.length; i++) {
176
- var key = AmePlugin.editablePropertyNames[i], upperKey = key.substring(0, 1).toUpperCase() + key.substring(1);
177
- result.plugins[plugin.fileName]['custom' + upperKey] = plugin.customProperties[key]();
 
 
178
  }
179
  });
180
  return result;
@@ -185,7 +201,13 @@ var AmePluginVisibilityModule = /** @class */ (function () {
185
  //Remove settings associated with roles and users that no longer exist or are not visible.
186
  var _ = AmePluginVisibilityModule._, visibleActorIds = _.pluck(this.actorSelector.getVisibleActors(), 'id');
187
  _.forEach(settings.plugins, function (plugin) {
188
- plugin.grantAccess = _.pick(plugin.grantAccess, visibleActorIds);
 
 
 
 
 
 
189
  });
190
  //Populate form field(s).
191
  this.settingsData(jQuery.toJSON(settings));
159
  return this.grantAccessByDefault[actorId];
160
  };
161
  AmePluginVisibilityModule.prototype.getSettings = function () {
162
+ var _this = this;
163
  var _ = AmePluginVisibilityModule._;
164
  var result = {};
165
  result.grantAccessByDefault = _.mapValues(this.grantAccessByDefault, function (allow) {
173
  return allow();
174
  })
175
  };
176
+ //Filter out grants that match the default settings.
177
+ result.plugins[plugin.fileName].grantAccess = _.pick(result.plugins[plugin.fileName].grantAccess, function (allowed, actorId) {
178
+ var defaultState = _this.getGrantAccessByDefault(actorId)() && plugin.isVisibleByDefault();
179
+ return (allowed !== defaultState);
180
+ });
181
+ //Don't store the "grantAccess" map if it's empty.
182
+ if (_.isEmpty(result.plugins[plugin.fileName].grantAccess)) {
183
+ delete result.plugins[plugin.fileName].grantAccess;
184
+ }
185
+ //All plugins are visible by default, so it's not necessary to store this flag if it's TRUE.
186
+ if (result.plugins[plugin.fileName].isVisibleByDefault) {
187
+ delete result.plugins[plugin.fileName].isVisibleByDefault;
188
+ }
189
  for (var i = 0; i < AmePlugin.editablePropertyNames.length; i++) {
190
+ var key = AmePlugin.editablePropertyNames[i], upperKey = key.substring(0, 1).toUpperCase() + key.substring(1), value = plugin.customProperties[key]();
191
+ if (value !== '') {
192
+ result.plugins[plugin.fileName]['custom' + upperKey] = value;
193
+ }
194
  }
195
  });
196
  return result;
201
  //Remove settings associated with roles and users that no longer exist or are not visible.
202
  var _ = AmePluginVisibilityModule._, visibleActorIds = _.pluck(this.actorSelector.getVisibleActors(), 'id');
203
  _.forEach(settings.plugins, function (plugin) {
204
+ if (plugin.grantAccess) {
205
+ plugin.grantAccess = _.pick(plugin.grantAccess, visibleActorIds);
206
+ }
207
+ });
208
+ //Remove plugins that don't have any custom settings.
209
+ settings.plugins = _.pick(settings.plugins, function (value) {
210
+ return !_.isEmpty(value);
211
  });
212
  //Populate form field(s).
213
  this.settingsData(jQuery.toJSON(settings));
modules/plugin-visibility/plugin-visibility.php CHANGED
@@ -76,8 +76,8 @@ class amePluginVisibility extends amePersistentModule {
76
 
77
  //Do we have custom settings for this plugin?
78
  if (isset($settings['plugins'][$pluginFileName])) {
79
- $isVisibleByDefault = $settings['plugins'][$pluginFileName]['isVisibleByDefault'];
80
- $grantAccess = $settings['plugins'][$pluginFileName]['grantAccess'];
81
 
82
  if ($isVisibleByDefault) {
83
  $grantAccess = array_merge($settings['grantAccessByDefault'], $grantAccess);
@@ -279,6 +279,7 @@ class amePluginVisibility extends amePersistentModule {
279
  if ( $action === 'save_plugin_visibility' ) {
280
  check_admin_referer($action);
281
 
 
282
  $this->settings = json_decode($post['settings'], true);
283
  $this->saveSettings();
284
 
76
 
77
  //Do we have custom settings for this plugin?
78
  if (isset($settings['plugins'][$pluginFileName])) {
79
+ $isVisibleByDefault = ameUtils::get($settings['plugins'][$pluginFileName], 'isVisibleByDefault', true);
80
+ $grantAccess = ameUtils::get($settings['plugins'][$pluginFileName], 'grantAccess', array());
81
 
82
  if ($isVisibleByDefault) {
83
  $grantAccess = array_merge($settings['grantAccessByDefault'], $grantAccess);
279
  if ( $action === 'save_plugin_visibility' ) {
280
  check_admin_referer($action);
281
 
282
+ /** @noinspection PhpComposerExtensionStubsInspection */
283
  $this->settings = json_decode($post['settings'], true);
284
  $this->saveSettings();
285
 
modules/plugin-visibility/plugin-visibility.ts CHANGED
@@ -21,8 +21,8 @@ interface PluginVisibilitySettings {
21
  grantAccessByDefault: GrantAccessMap,
22
  plugins: {
23
  [fileName : string] : {
24
- isVisibleByDefault: boolean,
25
- grantAccess: GrantAccessMap,
26
  customName?: string,
27
  customDescription?: string;
28
  customAuthor?: string;
@@ -251,10 +251,32 @@ class AmePluginVisibilityModule {
251
  })
252
  };
253
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
254
  for (let i = 0; i < AmePlugin.editablePropertyNames.length; i++) {
255
  let key = AmePlugin.editablePropertyNames[i],
256
- upperKey = key.substring(0, 1).toUpperCase() + key.substring(1);
257
- result.plugins[plugin.fileName]['custom' + upperKey] = plugin.customProperties[key]();
 
 
 
258
  }
259
  });
260
 
@@ -269,7 +291,14 @@ class AmePluginVisibilityModule {
269
  const _ = AmePluginVisibilityModule._,
270
  visibleActorIds = _.pluck(this.actorSelector.getVisibleActors(), 'id');
271
  _.forEach(settings.plugins, (plugin) => {
272
- plugin.grantAccess = _.pick<GrantAccessMap, GrantAccessMap>(plugin.grantAccess, visibleActorIds);
 
 
 
 
 
 
 
273
  });
274
 
275
  //Populate form field(s).
21
  grantAccessByDefault: GrantAccessMap,
22
  plugins: {
23
  [fileName : string] : {
24
+ isVisibleByDefault?: boolean,
25
+ grantAccess?: GrantAccessMap,
26
  customName?: string,
27
  customDescription?: string;
28
  customAuthor?: string;
251
  })
252
  };
253
 
254
+ //Filter out grants that match the default settings.
255
+ result.plugins[plugin.fileName].grantAccess = _.pick(
256
+ result.plugins[plugin.fileName].grantAccess,
257
+ (allowed, actorId) => {
258
+ const defaultState = this.getGrantAccessByDefault(actorId)() && plugin.isVisibleByDefault();
259
+ return (allowed !== defaultState);
260
+ }
261
+ );
262
+
263
+ //Don't store the "grantAccess" map if it's empty.
264
+ if (_.isEmpty(result.plugins[plugin.fileName].grantAccess)) {
265
+ delete result.plugins[plugin.fileName].grantAccess;
266
+ }
267
+
268
+ //All plugins are visible by default, so it's not necessary to store this flag if it's TRUE.
269
+ if (result.plugins[plugin.fileName].isVisibleByDefault) {
270
+ delete result.plugins[plugin.fileName].isVisibleByDefault;
271
+ }
272
+
273
  for (let i = 0; i < AmePlugin.editablePropertyNames.length; i++) {
274
  let key = AmePlugin.editablePropertyNames[i],
275
+ upperKey = key.substring(0, 1).toUpperCase() + key.substring(1),
276
+ value = plugin.customProperties[key]();
277
+ if (value !== '') {
278
+ result.plugins[plugin.fileName]['custom' + upperKey] = value;
279
+ }
280
  }
281
  });
282
 
291
  const _ = AmePluginVisibilityModule._,
292
  visibleActorIds = _.pluck(this.actorSelector.getVisibleActors(), 'id');
293
  _.forEach(settings.plugins, (plugin) => {
294
+ if (plugin.grantAccess) {
295
+ plugin.grantAccess = _.pick<GrantAccessMap, GrantAccessMap>(plugin.grantAccess, visibleActorIds);
296
+ }
297
+ });
298
+
299
+ //Remove plugins that don't have any custom settings.
300
+ settings.plugins = _.pick(settings.plugins, (value) => {
301
+ return !_.isEmpty(value);
302
  });
303
 
304
  //Populate form field(s).
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: admin, dashboard, menu, security, wpmu
5
  Requires at least: 4.1
6
  Tested up to: 5.3
7
- Stable tag: 1.9.3
8
 
9
  Lets you edit the WordPress admin menu. You can re-order, hide or rename menus, add custom menus and more.
10
 
@@ -63,6 +63,13 @@ Plugins installed in the `mu-plugins` directory are treated as "always on", so y
63
 
64
  == Changelog ==
65
 
 
 
 
 
 
 
 
66
  = 1.9.3 =
67
  * Fixed a warning about get_magic_quotes_gpc() being deprecated in PHP 7.4.
68
  * Fixed a conflict with plugins that use the "all_plugins" filter incorrectly.
4
  Tags: admin, dashboard, menu, security, wpmu
5
  Requires at least: 4.1
6
  Tested up to: 5.3
7
+ Stable tag: 1.9.4
8
 
9
  Lets you edit the WordPress admin menu. You can re-order, hide or rename menus, add custom menus and more.
10
 
63
 
64
  == Changelog ==
65
 
66
+ = 1.9.4 =
67
+ * Fixed another warning about get_magic_quotes_gpc() being deprecated in PHP 7.4. This instance was missed in the previous patch.
68
+ * Added a workaround for an issue with MailPoet 3 where some menu settings didn't work on MailPoet's admin pages.
69
+ * Added a workaround for an issue with Extended Widget Options where the "getting started" page that's added by that plugin showed up in the menu editor even though it was supposed to be hidden.
70
+ * Reduced the amount of space used by plugin visibility settings. This change will take effect the next time you save the settings.
71
+ * Extended the "compress menu configuration data" feature to use ZLIB compression in addition to menu data restructuring. This greatly decreases the amount of data stored in the database, but increases decompression overhead.
72
+
73
  = 1.9.3 =
74
  * Fixed a warning about get_magic_quotes_gpc() being deprecated in PHP 7.4.
75
  * Fixed a conflict with plugins that use the "all_plugins" filter incorrectly.