Media Cleaner - Version 6.0.1

Version Description

  • Update: Brings back errors management to the bulk actions (skip, skip all).
  • Update: Prompt before emptying the trash.
Download this release

Release Info

Developer TigrouMeow
Plugin Icon 128x128 Media Cleaner
Version 6.0.1
Comparing to
See all releases

Code changes from version 5.6.4 to 6.0.1

admin.php DELETED
@@ -1,474 +0,0 @@
1
- <?php
2
-
3
- include "common/admin.php";
4
-
5
- class Meow_WPMC_Admin extends MeowApps_Admin {
6
-
7
- public function __construct( $prefix, $mainfile, $domain ) {
8
- parent::__construct( $prefix, $mainfile, $domain );
9
- add_action( 'admin_menu', array( $this, 'app_menu' ) );
10
- add_action( 'admin_notices', array( $this, 'admin_notices' ) );
11
- add_filter( 'pre_update_option', array( $this, 'pre_update_option' ), 10, 3 );
12
- }
13
-
14
- /**
15
- * Filters and performs validation for certain options
16
- * @param mixed $value Option value
17
- * @param string $option Option name
18
- * @param mixed $old_value The current value of the option
19
- * @return mixed The actual value to be stored
20
- */
21
- function pre_update_option( $value, $option, $old_value ) {
22
- if ( strpos( $option, 'wpmc_' ) !== 0 ) return $value; // Never touch extraneous options
23
- $validated = $this->validate_option( $option, $value );
24
- if ( $validated instanceof WP_Error ) {
25
- // TODO: Show warning for invalid option value
26
- return $old_value;
27
- }
28
- return $validated;
29
- }
30
-
31
- /**
32
- * Validates certain option values
33
- * @param string $option Option name
34
- * @param mixed $value Option value
35
- * @return mixed|WP_Error Validated value if no problem
36
- */
37
- function validate_option( $option, $value ) {
38
- switch ( $option ) {
39
- case 'wpmc_dirs_filter':
40
- case 'wpmc_files_filter':
41
- if ( $value && @preg_match( $value, '' ) === false ) return new WP_Error( 'invalid_option', __( "Invalid Regular-Expression", 'media-cleaner' ) );
42
- break;
43
- }
44
- return $value;
45
- }
46
-
47
- function admin_notices() {
48
- $mediasBuffer = get_option( 'wpmc_medias_buffer', null );
49
- $postsBuffer = get_option( 'wpmc_posts_buffer', null );
50
- $analysisBuffer = get_option( 'wpmc_analysis_buffer', null );
51
- $delay = get_option( 'wpmc_delay', null );
52
-
53
- if ( !is_numeric( $mediasBuffer ) || $mediasBuffer < 1 )
54
- update_option( 'wpmc_medias_buffer', 100 );
55
- if ( !is_numeric( $postsBuffer ) || $postsBuffer < 1 )
56
- update_option( 'wpmc_posts_buffer', 5 );
57
- if ( !is_numeric( $analysisBuffer ) || $analysisBuffer < 1 )
58
- update_option( 'wpmc_analysis_buffer', 100 );
59
- if ( !is_numeric( $delay ) )
60
- update_option( 'wpmc_delay', 100 );
61
-
62
- $reset = isset ( $_GET[ 'reset' ] ) ? $_GET[ 'reset' ] : 0;
63
- if ( $reset ) {
64
- wpmc_reset();
65
- echo "<div class='notice notice-error'><p>";
66
- _e( "The Media Cleaner's database has been deleted. It will be re-created automatically next time you visit the Media Cleaner Dashboard.", 'media-cleaner' );
67
- echo "</p></div>";
68
- }
69
-
70
- if ( !$this->is_registered() && get_option( 'wpmc_method', 'media' ) == 'files' ) {
71
- echo "<div class='notice notice-error'><p>";
72
- _e( "The Pro version is required to scan files. You can <a target='_blank' href='http://meowapps.com/plugin/media-cleaner'>get a serial for the Pro version here</a>.", 'media-cleaner' );
73
- echo "</p></div>";
74
- }
75
- }
76
-
77
- function common_url( $file ) {
78
- return trailingslashit( plugin_dir_url( __FILE__ ) ) . 'common/' . $file;
79
- }
80
-
81
- function app_menu() {
82
-
83
- // SUBMENU > Settings
84
- add_submenu_page( 'meowapps-main-menu', 'Media Cleaner', 'Media Cleaner', 'manage_options',
85
- 'wpmc_settings-menu', array( $this, 'admin_settings' ) );
86
-
87
- // SUBMENU > Settings > Settings (Scanning)
88
- add_settings_section( 'wpmc_settings', null, null, 'wpmc_settings-menu' );
89
- add_settings_field( 'wpmc_method', __( 'Method', 'media-cleaner' ),
90
- array( $this, 'admin_method_callback' ),
91
- 'wpmc_settings-menu', 'wpmc_settings' );
92
- add_settings_field( 'wpmc_content', __( 'Content', 'media-cleaner' ),
93
- array( $this, 'admin_content_callback' ),
94
- 'wpmc_settings-menu', 'wpmc_settings' );
95
- add_settings_field( 'wpmc_media_library', __( 'Media Library', 'media-cleaner' ),
96
- array( $this, 'admin_media_library_callback' ),
97
- 'wpmc_settings-menu', 'wpmc_settings' );
98
- add_settings_field( 'wpmc_live_content', __( 'Live Content<br />(Pro)', 'media-cleaner' ),
99
- array( $this, 'admin_live_content_callback' ),
100
- 'wpmc_settings-menu', 'wpmc_settings' );
101
- add_settings_field( 'wpmc_debuglogs', __( 'Logs', 'media-cleaner' ),
102
- array( $this, 'admin_debuglogs_callback' ),
103
- 'wpmc_settings-menu', 'wpmc_settings', array( __( 'Enable', 'media-cleaner' ) ) );
104
-
105
- // SUBMENU > Settings > Filters
106
- add_settings_section( 'wpmc_filters_settings', null, null, 'wpmc_filters_settings-menu' );
107
- add_settings_field( 'wpmc_images_only', __( 'Images Only', 'media-cleaner' ),
108
- array( $this, 'admin_images_only_callback' ),
109
- 'wpmc_filters_settings-menu', 'wpmc_filters_settings' );
110
- add_settings_field( 'wpmc_thumbnails_only', __( 'Thumbnails Only', 'media-cleaner' ),
111
- array( $this, 'admin_thumbnails_only_callback' ),
112
- 'wpmc_filters_settings-menu', 'wpmc_filters_settings' );
113
-
114
- add_settings_field(
115
- 'wpmc_dirs_filter',
116
- __( 'Directories Filter', 'media-cleaner' ),
117
- array( $this, 'admin_dirs_filter_callback' ),
118
- 'wpmc_filters_settings-menu',
119
- 'wpmc_filters_settings'
120
- );
121
-
122
- add_settings_field(
123
- 'wpmc_files_filter',
124
- __( 'Files Filter', 'media-cleaner' ),
125
- array( $this, 'admin_files_filter_callback' ),
126
- 'wpmc_filters_settings-menu',
127
- 'wpmc_filters_settings'
128
- );
129
-
130
- // SUBMENU > Settings > UI
131
- add_settings_section( 'wpmc_ui_settings', null, null, 'wpmc_ui_settings-menu' );
132
- add_settings_field( 'wpmc_hide_thumbnails', __( 'Thumbnails', 'media-cleaner' ),
133
- array( $this, 'admin_hide_thumbnails_callback' ),
134
- 'wpmc_ui_settings-menu', 'wpmc_ui_settings' );
135
- add_settings_field( 'wpmc_hide_warning', __( 'Warning Message', 'media-cleaner' ),
136
- array( $this, 'admin_hide_warning_callback' ),
137
- 'wpmc_ui_settings-menu', 'wpmc_ui_settings' );
138
- add_settings_field( 'wpmc_results_per_page', __( 'Results Per Page', 'media-cleaner' ),
139
- array( $this, 'admin_results_per_page' ),
140
- 'wpmc_ui_settings-menu', 'wpmc_ui_settings' );
141
-
142
- // SUBMENU > Settings > Advanced
143
- add_settings_section( 'wpmc_advanced_settings', null, null, 'wpmc_advanced_settings-menu' );
144
- add_settings_field( 'wpmc_medias_buffer', __( 'Medias Buffer', 'media-cleaner' ),
145
- array( $this, 'admin_medias_buffer_callback' ),
146
- 'wpmc_advanced_settings-menu', 'wpmc_advanced_settings' );
147
- add_settings_field( 'wpmc_posts_buffer', __( 'Posts Buffer', 'media-cleaner' ),
148
- array( $this, 'admin_posts_buffer_callback' ),
149
- 'wpmc_advanced_settings-menu', 'wpmc_advanced_settings' );
150
- add_settings_field( 'wpmc_analysis_buffer', __( 'Analysis Buffer', 'media-cleaner' ),
151
- array( $this, 'admin_analysis_buffer_callback' ),
152
- 'wpmc_advanced_settings-menu', 'wpmc_advanced_settings' );
153
- add_settings_field( 'wpmc_delay', __( 'Delay (in ms)', 'media-cleaner' ),
154
- array( $this, 'admin_delay_callback' ),
155
- 'wpmc_advanced_settings-menu', 'wpmc_advanced_settings' );
156
- add_settings_field( 'wpmc_shortcodes_disabled', __( 'Shortcodes', 'media-cleaner' ),
157
- array( $this, 'admin_shortcodes_disabled_callback' ),
158
- 'wpmc_advanced_settings-menu', 'wpmc_advanced_settings' );
159
-
160
- // SETTINGS
161
- register_setting( 'wpmc_settings', 'wpmc_method' );
162
- register_setting( 'wpmc_settings', 'wpmc_content' );
163
- register_setting( 'wpmc_settings', 'wpmc_live_content' );
164
- register_setting( 'wpmc_settings', 'wpmc_media_library' );
165
- register_setting( 'wpmc_settings', 'wpmc_debuglogs' );
166
-
167
- register_setting( 'wpmc_filters_settings', 'wpmc_images_only' );
168
- register_setting( 'wpmc_filters_settings', 'wpmc_thumbnails_only' );
169
- register_setting( 'wpmc_filters_settings', 'wpmc_dirs_filter' );
170
- register_setting( 'wpmc_filters_settings', 'wpmc_files_filter' );
171
-
172
- register_setting( 'wpmc_ui_settings', 'wpmc_hide_thumbnails' );
173
- register_setting( 'wpmc_ui_settings', 'wpmc_hide_warning' );
174
- register_setting( 'wpmc_ui_settings', 'wpmc_results_per_page' );
175
-
176
- register_setting( 'wpmc_advanced_settings', 'wpmc_medias_buffer' );
177
- register_setting( 'wpmc_advanced_settings', 'wpmc_posts_buffer' );
178
- register_setting( 'wpmc_advanced_settings', 'wpmc_analysis_buffer' );
179
- register_setting( 'wpmc_advanced_settings', 'wpmc_delay' );
180
- register_setting( 'wpmc_advanced_settings', 'wpmc_shortcodes_disabled' );
181
- }
182
-
183
- function admin_medias_buffer_callback( $args ) {
184
- $value = get_option( 'wpmc_medias_buffer', 100 );
185
- $html = '<input type="number" style="width: 100%;" id="wpmc_medias_buffer" name="wpmc_medias_buffer" value="' . $value . '" />';
186
- $html .= '<br /><span class="description">' . __( 'The number of media entries to read at a time. This is fast, so the value should be between 50 and 1000.', 'media-cleaner' ) . '</span>';
187
- echo $html;
188
- }
189
-
190
- function admin_posts_buffer_callback( $args ) {
191
- $value = get_option( 'wpmc_posts_buffer', 5 );
192
- $html = '<input type="number" style="width: 100%;" id="wpmc_posts_buffer" name="wpmc_posts_buffer" value="' . $value . '" />';
193
- $html .= '<br /><span class="description">' . __( 'The number of posts (and any other post types) to analyze at a time. This is the most intense part of the process. Recommended value is between 1 (slow server) and 20 (excellent server).', 'media-cleaner' ) . '</span>';
194
- echo $html;
195
- }
196
-
197
- function admin_analysis_buffer_callback( $args ) {
198
- $value = get_option( 'wpmc_analysis_buffer', 100 );
199
- $html = '<input type="number" style="width: 100%;" id="wpmc_analysis_buffer" name="wpmc_analysis_buffer" value="' . $value . '" />';
200
- $html .= '<br /><span class="description">' . __( 'The number of media entries or files to analyze at a time. This is the main part of the process, but is is much faster than analyzing each post. Recommended value is between 20 (slow server) and 1000 (excellent server).', 'media-cleaner' ) . '</span>';
201
- echo $html;
202
- }
203
-
204
- function admin_delay_callback( $args ) {
205
- $value = get_option( 'wpmc_delay', 100 );
206
- $html = '<input type="number" style="width: 100%;" id="wpmc_delay" name="wpmc_delay" value="' . $value . '" />';
207
- $html .= '<br /><span class="description">' . __( 'Time to wait between each request (in milliseconds). The overall process is intensive so this gives the chance to your server to chill out a bit. A very good server doesn\'t need it, but a slow/shared hosting might even reject requests if they are too fast and frequent. Recommended value is actually 0, 100 for safety, 2000 or 5000 if your hosting is kind of cheap.', 'media-cleaner' ) . '</span>';
208
- echo $html;
209
- }
210
-
211
- function admin_settings() {
212
- ?>
213
- <div class="wrap wrap-media-cleaner">
214
- <?php
215
- echo $this->display_title( "Media Cleaner" );
216
- ?>
217
- <div class="meow-section meow-group">
218
- <div class="meow-box meow-col meow-span_2_of_2">
219
- <h3><?php _e('How to use', 'media-cleaner' ); ?></h3>
220
- <div class="inside">
221
- <?php _e( "You can choose two kind of methods. Usually, users like to analyze their Media Library for images which are not in used (Media Library Method + Content Check), and then, their Filesystem for images which aren't registered in the Media Library (Filesystem Method + Media Library Check). Check the <a target=\"_blank\" href=\"https://meowapps.com/media-cleaner-tutorial/\">tutorial</a> for more information.", 'media-cleaner' ); ?>
222
- <p class="submit">
223
- <a class="button button-primary" href="upload.php?page=media-cleaner"><?php echo _e( "Access Media Cleaner Dashboard", 'media-cleaner' ); ?></a>
224
- <a id='wpmc_reset' href='?page=wpmc_settings-menu&reset=1' class='button button-red exclusive' style='margin-left: 5px;'><span style="top: 4px; position: relative; left: -5px;" class="dashicons dashicons-sos"></span><?php _e('Delete Cleaner DB', 'media-cleaner'); ?></a>
225
- </p>
226
- </div>
227
- </div>
228
- </div>
229
-
230
- <div class="meow-section meow-group">
231
-
232
- <div class="meow-col meow-span_1_of_2">
233
-
234
- <div class="meow-box">
235
- <h3><?php _e('Scanning', 'media-cleaner' ); ?></h3>
236
- <div class="inside">
237
- <form method="post" action="options.php">
238
- <?php settings_fields( 'wpmc_settings' ); ?>
239
- <?php do_settings_sections( 'wpmc_settings-menu' ); ?>
240
- <?php submit_button(); ?>
241
- </form>
242
- </div>
243
- </div>
244
-
245
- <div class="meow-box">
246
- <h3><?php _e('Filters', 'media-cleaner' ); ?></h3>
247
- <div class="inside">
248
- <form method="post" action="options.php">
249
- <?php settings_fields( 'wpmc_filters_settings' ); ?>
250
- <?php do_settings_sections( 'wpmc_filters_settings-menu' ); ?>
251
- <?php submit_button(); ?>
252
- </form>
253
- </div>
254
-
255
- </div>
256
-
257
- </div>
258
-
259
- <div class="meow-col meow-span_1_of_2">
260
- <?php $this->display_serialkey_box( "https://meowapps.com/plugin/media-cleaner/" ); ?>
261
-
262
- <div class="meow-box">
263
- <h3><?php _e('UI', 'media-cleaner' ); ?></h3>
264
- <div class="inside">
265
- <form method="post" action="options.php">
266
- <?php settings_fields( 'wpmc_ui_settings' ); ?>
267
- <?php do_settings_sections( 'wpmc_ui_settings-menu' ); ?>
268
- <?php submit_button(); ?>
269
- </form>
270
- </div>
271
- </div>
272
-
273
- <div class="meow-box">
274
- <h3><?php _e('Advanced', 'media-cleaner' ); ?></h3>
275
- <div class="inside">
276
- <form method="post" action="options.php">
277
- <?php settings_fields( 'wpmc_advanced_settings' ); ?>
278
- <?php do_settings_sections( 'wpmc_advanced_settings-menu' ); ?>
279
- <?php submit_button(); ?>
280
- </form>
281
- </div>
282
- </div>
283
-
284
- <!--
285
- <?php if ( get_option( 'wpmc_shortcode', false ) ): ?>
286
- <div class="meow-box">
287
- <h3>Shortcodes</h3>
288
- <div class="inside"><small>
289
- <p>Here are the shortcodes registered in your WordPress by your theme and other plugins.</p>
290
- <?php
291
- global $shortcode_tags;
292
- try {
293
- if ( is_array( $shortcode_tags ) ) {
294
- $my_shortcodes = array();
295
- foreach ( $shortcode_tags as $sc )
296
- if ( $sc != '__return_false' ) {
297
- if ( is_string( $sc ) )
298
- array_push( $my_shortcodes, str_replace( '_shortcode', '', (string)$sc ) );
299
- }
300
- $my_shortcodes = implode( ', ', $my_shortcodes );
301
- }
302
- }
303
- catch (Exception $e) {
304
- $my_shortcodes = "";
305
- }
306
- echo $my_shortcodes;
307
- ?>
308
- </small></div>
309
- </div>
310
- <?php endif; ?>
311
- -->
312
-
313
- </div>
314
-
315
- </div>
316
- </div>
317
- <?php
318
- }
319
-
320
-
321
-
322
- /*
323
- OPTIONS CALLBACKS
324
- */
325
-
326
- function admin_method_callback( $args ) {
327
- $value = get_option( 'wpmc_method', 'media' );
328
- $html = '<select id="wpmc_method" name="wpmc_method">
329
- <option ' . selected( 'media', $value, false ) . 'value="media">' . __( 'Media Library', 'media-cleaner' ) .'</option>
330
- <option ' . disabled( $this->is_registered(), false, false ) . ' ' . selected( 'files', $value, false ) . 'value="files">' . __( 'Filesystem (Pro)', 'media-cleaner' ) .'</option>
331
- </select><br /><small>' . __( 'Check the <a target="_blank" href="https://meowapps.com/media-cleaner-tutorial/">tutorial</a> for more information.', 'media-cleaner' ) . '</small>';
332
- echo $html;
333
- }
334
-
335
- function admin_debuglogs_callback( $args ) {
336
- global $wpmc;
337
- $debuglogs = get_option( 'wpmc_debuglogs' );
338
- $clearlogs = isset ( $_GET[ 'clearlogs' ] ) ? $_GET[ 'clearlogs' ] : 0;
339
- if ( $clearlogs && file_exists( plugin_dir_path( __FILE__ ) . '/media-cleaner.log' ) ) {
340
- unlink( plugin_dir_path( __FILE__ ) . '/media-cleaner.log' );
341
- }
342
- $html = '<input type="checkbox" id="wpmc_debuglogs" name="wpmc_debuglogs" value="1" ' .
343
- checked( 1, $debuglogs, false ) . '/>';
344
- $html .= '<label for="wpmc_debuglogs"> ' . $args[0] . '</label><br>';
345
- $html .= '<small>' . __( 'Creates an internal log file, for debugging purposes.', 'media-cleaner' );
346
- if ( $debuglogs && !file_exists( plugin_dir_path( __FILE__ ) . '/media-cleaner.log' ) ) {
347
- if ( !$wpmc->log( "Testing the logging feature. It works!" ) ) {
348
- $html .= sprintf( __( '<br /><b>Cannot create the logging file. Logging will not work. The plugin as a whole might not be able to work neither.</b>', 'media-cleaner' ), plugin_dir_url( __FILE__ ) );
349
- }
350
- }
351
- if ( file_exists( plugin_dir_path( __FILE__ ) . '/media-cleaner.log' ) ) {
352
- $html .= sprintf(
353
- // translators: %s is a plugin directory url
354
- __( '<br />The <a target="_blank" href="%smedia-cleaner.log">log file</a> is available. You can also <a href="?page=wpmc_settings-menu&clearlogs=true">clear</a> it.', 'media-cleaner' ),
355
- plugin_dir_url( __FILE__ )
356
- );
357
- }
358
- $html .= '</small>';
359
- echo $html;
360
- }
361
-
362
- function admin_media_library_callback( $args ) {
363
- $value = get_option( 'wpmc_media_library', true );
364
- $html = '<input type="checkbox" id="wpmc_media_library" name="wpmc_media_library" value="1" ' .
365
- disabled( get_option( 'wpmc_method', 'media' ) == 'files', false, false ) . ' ' .
366
- checked( 1, $value, false ) . '/>';
367
- $html .= '<label>' . __( 'Check', 'media-cleaner' ) . '</label><br /><small>' . __( 'Checks if the file is linked to a media. <i>Only matters to the Filesystem Method.</i>', 'media-cleaner' ) . '</small>';
368
- echo $html;
369
- }
370
-
371
- function admin_content_callback( $args ) {
372
- $value = get_option( 'wpmc_content', true );
373
- $html = '<input type="checkbox" id="wpmc_content" name="wpmc_content" value="1" ' .
374
- checked( 1, $value, false ) . '/>';
375
- $html .= '<label>' . __( 'Check', 'media-cleaner' ) . '</label><br /><small>' . __( 'Check if the media/file is used in the content, such as Posts, Pages (and other Post Types), Metadata, Widgets, etc.', 'media-cleaner' ) . '</small>';
376
- echo $html;
377
- }
378
-
379
- function admin_live_content_callback( $args ) {
380
- $value = get_option( 'wpmc_live_content', false );
381
- $html = '<input ' . disabled( $this->is_registered(), false, false ) .
382
- ' type="checkbox" id="wpmc_content" name="wpmc_live_content" value="1" ' .
383
- checked( 1, $value, false ) . '/>';
384
- $html .= '<label>' . __( 'Check', 'media-cleaner' ) . '</label><br /><small>' . __( 'The live version of the website will be also analyzed (as if a visitor was loading it). <i>This will increase the accuracy of the results but slow down the analysis dramatically.</i>', 'media-cleaner' ) . '</small>';
385
- echo $html;
386
- }
387
-
388
- function admin_shortcodes_disabled_callback( $args ) {
389
- $value = get_option( 'wpmc_shortcodes_disabled', null );
390
- $html = '<input type="checkbox" id="wpmc_shortcodes_disabled" name="wpmc_shortcodes_disabled" value="1" ' .
391
- checked( 1, get_option( 'wpmc_shortcodes_disabled' ), false ) . '/>';
392
- $html .= '<label>' . __( 'Disable Analysis', 'media-cleaner' ) . '</label><br /><small>' . __( 'Resolving shortcodes increase accuracy, but makes the process slower and takes more memory.', 'media-cleaner' ) . '</small>';
393
- echo $html;
394
- }
395
-
396
- function admin_hide_thumbnails_callback( $args ) {
397
- $value = get_option( 'wpmc_hide_thumbnails', null );
398
- $html = '<input type="checkbox" id="wpmc_hide_thumbnails" name="wpmc_hide_thumbnails" value="1" ' .
399
- checked( 1, get_option( 'wpmc_hide_thumbnails' ), false ) . '/>';
400
- $html .= '<label>' . __( 'Hide', 'media-cleaner' ) . '</label><br /><small>' . __( 'If you prefer not to see the thumbnails.', 'media-cleaner' ) . '</small>';
401
- echo $html;
402
- }
403
-
404
- function admin_hide_warning_callback( $args ) {
405
- $value = get_option( 'wpmc_hide_warning', null );
406
- $html = '<input type="checkbox" id="wpmc_hide_warning" name="wpmc_hide_warning" value="1" ' .
407
- checked( 1, get_option( 'wpmc_hide_warning' ), false ) . '/>';
408
- $html .= '<label>' . __( 'Hide', 'media-cleaner' ) . '</label><br /><small>' . __( 'Have you read it twice? If yes, hide it :)', 'media-cleaner' ) . '</small>';
409
- echo $html;
410
- }
411
-
412
- function admin_results_per_page( $args ) {
413
- $value = get_option( 'wpmc_results_per_page', 20 );
414
- $html = <<< HTML
415
- <input step="1" min="1" max="999" name="wpmc_results_per_page" id="wpmc_results_per_page" maxlength="3" value="{$value}" type="number">
416
- HTML;
417
- echo $html;
418
- }
419
-
420
- function admin_images_only_callback( $args ) {
421
- $html = '<input type="checkbox" id="wpmc_images_only" name="wpmc_images_only" value="1" ' .
422
- disabled( get_option( 'wpmc_method', 'media' ) == 'media', false, false ) . ' ' .
423
- checked( 1, get_option( 'wpmc_images_only' ), false ) . '/>';
424
- $html .= '<label>' . __( 'Enable', 'media-cleaner' ) . '</label><br /><small>' . __( 'Restrict the Media Library scan to images. Therefore, no documents or anything else will be scanned.', 'media-cleaner' ) . '</small>';
425
- echo $html;
426
- }
427
-
428
- function admin_thumbnails_only_callback( $args ) {
429
- $html = '<input type="checkbox" id="wpmc_thumbnails_only" name="wpmc_thumbnails_only" value="1" ' .
430
- disabled( get_option( 'wpmc_method', 'media' ) == 'files', false, false ) . ' ' .
431
- checked( 1, get_option( 'wpmc_thumbnails_only' ), false ) . '/>';
432
- $html .= '<label>' . __( 'Enable', 'media-cleaner' ) . '</label><br /><small>' . __( 'Restrict the Filesystem scan to thumbnails (files containing the resolution). If none of the checks above are selected, you will get the list of all the images and be able to remove them.', 'media-cleaner' ) . '</small>';
433
- echo $html;
434
- }
435
-
436
- function admin_dirs_filter_callback( $args ) {
437
- $value = get_option( 'wpmc_dirs_filter', '' );
438
- $invalid = @preg_match( $value, '' ) === false;
439
- ?>
440
- <input type="text" id="wpmc_dirs_filter" name="wpmc_dirs_filter" value="<?php echo $value; ?>" placeholder="/regex/" autocomplete="off" data-needs-validation style="font-family: monospace;">
441
- <?php
442
- }
443
-
444
- function admin_files_filter_callback( $args ) {
445
- $value = get_option( 'wpmc_files_filter', '' );
446
- $invalid = @preg_match( $value, '' ) === false;
447
- ?>
448
- <input type="text" id="wpmc_files_filter" name="wpmc_files_filter" value="<?php echo $value; ?>" placeholder="/regex/" autocomplete="off" data-needs-validation style="font-family: monospace;">
449
- <?php
450
- }
451
-
452
- /**
453
- *
454
- * GET / SET OPTIONS (TO REMOVE)
455
- *
456
- */
457
-
458
- function old_getoption( $option, $section, $default = '' ) {
459
- $options = get_option( $section );
460
- if ( isset( $options[$option] ) ) {
461
- if ( $options[$option] == "off" ) {
462
- return false;
463
- }
464
- if ( $options[$option] == "on" ) {
465
- return true;
466
- }
467
- return $options[$option];
468
- }
469
- return $default;
470
- }
471
-
472
- }
473
-
474
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
api.php DELETED
@@ -1,433 +0,0 @@
1
- <?php
2
-
3
- class Meow_WPMC_API {
4
- private $core;
5
- private $admin;
6
- private $engine;
7
-
8
- // Error code enums
9
- // Should be able to referred from the JS client
10
- const E = array (
11
- 'INVALID_NONCE' => 1,
12
- 'INVALID_PARAMS' => 2,
13
- 'FILE_OPEN_FAILURE' => 10,
14
- 'FILE_WRITE_FAILURE' => 11
15
- );
16
-
17
- /**
18
- * @param Meow_WPMC_Core $core
19
- * @param Meow_WPMC_Admin $admin
20
- * @param Meow_WPMC_Engine $engine
21
- */
22
- function __construct( $core, $admin, $engine ) {
23
- $this->core = $core;
24
- $this->engine = $engine;
25
- $this->admin = $admin;
26
- add_action( 'wp_ajax_wpmc_define', array( $this, 'wp_ajax_wpmc_define' ) );
27
- add_action( 'wp_ajax_wpmc_get_num_posts', array( $this, 'wp_ajax_wpmc_get_num_posts' ) );
28
- add_action( 'wp_ajax_wpmc_extract_references', array( $this, 'wp_ajax_wpmc_extract_references' ) );
29
- add_action( 'wp_ajax_wpmc_retrieve_targets', array( $this, 'wp_ajax_wpmc_retrieve_targets' ) );
30
- add_action( 'wp_ajax_wpmc_check_targets', array( $this, 'wp_ajax_wpmc_check_targets' ) );
31
- add_action( 'wp_ajax_wpmc_get_all_issues', array( $this, 'wp_ajax_wpmc_get_all_issues' ) );
32
- add_action( 'wp_ajax_wpmc_get_all_deleted', array( $this, 'wp_ajax_wpmc_get_all_deleted' ) );
33
- add_action( 'wp_ajax_wpmc_delete_do', array( $this, 'wp_ajax_wpmc_delete_do' ) );
34
- add_action( 'wp_ajax_wpmc_ignore_do', array( $this, 'wp_ajax_wpmc_ignore_do' ) );
35
- add_action( 'wp_ajax_wpmc_recover_do', array( $this, 'wp_ajax_wpmc_recover_do' ) );
36
- add_action( 'wp_ajax_wpmc_validate_option', array( $this, 'wp_ajax_wpmc_validate_option' ) );
37
- }
38
-
39
- /*******************************************************************************
40
- * ASYNCHRONOUS AJAX FUNCTIONS
41
- ******************************************************************************/
42
-
43
- /**
44
- * Writes a constant definition on wp-config.php
45
- *
46
- * Method: POST
47
- * Params:
48
- * - nonce: Nonce
49
- * - name: Name of the constant to define
50
- * - value: Value of the constant
51
- * Return:
52
- * - data.action: 'wpmc_define'
53
- * - data.message: <string> (on failure)
54
- * - data.code: <int> (on failure)
55
- */
56
- function wp_ajax_wpmc_define() {
57
- try {
58
- $action = 'wpmc_define';
59
- $nonce = isset( $_POST['nonce'] ) ? $_POST['nonce'] : '';
60
- if ( !wp_verify_nonce( $nonce, $action ) ) throw new Exception( "Nonce check failed", self::E['INVALID_NONCE'] );
61
-
62
- $name = isset( $_POST['name'] ) ? $_POST['name'] : '';
63
- $value = isset( $_POST['value'] ) ? $_POST['value'] : '';
64
- $result = array (
65
- 'success' => false,
66
- 'data' => array ( 'action' => $action )
67
- );
68
-
69
- /* Check the constant name and type */
70
- $supported = false;
71
- $constants = array ( // Supported constants
72
- /* We can add more constants to support */
73
- 'MEDIA_TRASH' => array ( 'type' => 'boolean' )
74
- );
75
- foreach ( $constants as $i => $item ) {
76
- if ( $i != $name ) continue;
77
- $supported = true;
78
- /* Transform the value into a proper format */
79
- switch ( $item['type'] ) {
80
- case 'boolean':
81
- case 'bool':
82
- $value = boolval( $value ) ? 'true' : 'false';
83
- break;
84
- case 'integer':
85
- case 'int':
86
- $value = intval( $value );
87
- break;
88
- case 'string':
89
- $value = "'" . strval( $value ) . "'";
90
- break;
91
- }
92
- break;
93
- }
94
- if ( !$supported ) throw new Exception( "Invalid parameters", self::E['INVALID_PARAMS'] );
95
-
96
- /* Open wp-config.php */
97
- $conf = ABSPATH . 'wp-config.php';
98
- $stream = fopen( $conf, 'r+' );
99
- if ( $stream === false ) throw new Exception( "Failed to open the config file", self::E['FILE_OPEN_FAILURE'] );
100
-
101
- try {
102
- if ( !flock( $stream, LOCK_EX ) ) throw new Exception( "Failed to lock the config file", self::E['FILE_OPEN_FAILURE'] );
103
- $stat = fstat( $stream );
104
-
105
- /* Find out the ideal position to write on */
106
- $found = false;
107
- $patterns = array (
108
- array (
109
- 'regex' => '^\/\*\s*' . preg_quote( "That's all, stop editing!" ) . '.*?\s*\*\/',
110
- 'where' => 'above'
111
- )
112
- );
113
- $current = 0;
114
- while ( !feof( $stream ) ) {
115
- $line = fgets( $stream ); // Read line by line
116
- if ( $line === false ) break; // No more lines
117
- $prev = $current; // Previous position
118
- $current = ftell( $stream ); // Current position
119
-
120
- foreach ( $patterns as $item ) {
121
- if ( !preg_match( '/'.$item['regex'].'/', trim( $line ) ) ) continue;
122
- /* Found */
123
- $found = true;
124
- if ( $item['where'] == 'above' ) {
125
- fseek( $stream, $prev );
126
- $current = $prev;
127
- }
128
- break 2;
129
- }
130
- }
131
-
132
- /* Check if the position is found */
133
- if ( !$found ) throw new Exception( "Cannot determine the position to write on", self::E['FILE_WRITE_FAILURE'] );
134
-
135
- /* Write the constant definition line */
136
- $new = "define( '{$name}', {$value} );" . PHP_EOL;
137
- $rest = fread( $stream, $stat['size'] - $current );
138
- fseek( $stream, $current );
139
- $written = fwrite( $stream, $new . $rest );
140
-
141
- /* All done */
142
- if ( $written === false ) throw new Exception( "Failed to write on the config file", self::E['FILE_WRITE_FAILURE'] );
143
- fclose( $stream );
144
-
145
- } catch( Exception $e ) {
146
- fclose( $stream );
147
- throw $e;
148
- }
149
-
150
- } catch( Exception $e ) {
151
- $result['data']['message'] = $e->getMessage();
152
- $result['data']['code'] = $e->getCode();
153
- exit( json_encode( $result ) );
154
- }
155
-
156
- $result['success'] = true;
157
- exit( json_encode( $result ) );
158
- }
159
-
160
- /**
161
- * Method: POST
162
- * Params:
163
- * - source: 'content' | 'media'
164
- * Return:
165
- * - data.action: 'get_num_posts'
166
- * - data.num: A number of the posts
167
- */
168
- function wp_ajax_wpmc_get_num_posts() {
169
- $src = isset( $_POST['source'] ) ? $_POST['source'] : null;
170
- $num = 0;
171
-
172
- switch ($src) {
173
- case 'content':
174
- $num = count( $this->engine->get_posts_to_check() );
175
- break;
176
- case 'media':
177
- $num = count( $this->engine->get_media_entries() );
178
- break;
179
- }
180
-
181
- exit( json_encode( array (
182
- 'success' => true,
183
- 'data' => array (
184
- 'action' => 'get_num_posts',
185
- 'num' => $num
186
- )
187
- )));
188
- }
189
-
190
- // Analyze the posts to extract the references.
191
- function wp_ajax_wpmc_extract_references() {
192
- $limit = isset( $_POST['limit'] ) ? $_POST['limit'] : 0;
193
- $source = isset( $_POST['source'] ) ? $_POST['source'] : null;
194
- $limitsize = get_option( 'wpmc_posts_buffer', 5 );
195
-
196
- $finished = false;
197
- $message = ""; // will be filled by extractRefsFrom...
198
- if ( $source === 'content' )
199
- $finished = $this->engine->extractRefsFromContent( $limit, $limitsize, $message );
200
- else if ( $source === 'media' )
201
- $finished = $this->engine->extractRefsFromLibrary( $limit, $limitsize, $message );
202
- else {
203
- error_log('Media Cleaner: No source was mentioned while calling the extract_references action.');
204
- }
205
-
206
- $output = array(
207
- 'success' => true,
208
- 'action' => 'extract_references',
209
- 'source' => $source,
210
- 'limit' => $limit + $limitsize,
211
- 'finished' => $finished,
212
- 'message' => $message,
213
- );
214
- echo json_encode( $output );
215
- die();
216
- }
217
-
218
- // Retrieve either the the Media IDs or the files which need to be scanned.
219
- function wp_ajax_wpmc_retrieve_targets() {
220
- global $wpdb;
221
- $method = $this->core->current_method;
222
-
223
- if ( $method == 'files' ) {
224
- $output = null;
225
- $path = isset( $_POST['path'] ) ? $_POST['path'] : null;
226
- $files = $this->engine->get_files( $path );
227
- if ( $files === null ) {
228
- $output = array(
229
- 'success' => true,
230
- 'action' => 'retrieve_targets',
231
- 'method' => 'files',
232
- 'message' => __( "No files for this path ($path).", 'media-cleaner' ),
233
- 'results' => array(),
234
- );
235
- }
236
- else {
237
- // translators: %d is a count of files
238
- $message = sprintf( __( "Retrieved %d targets.", 'media-cleaner' ), count( $files ) );
239
- $output = array(
240
- 'success' => true,
241
- 'action' => 'retrieve_targets',
242
- 'method' => 'files',
243
- 'message' => $message,
244
- 'results' => $files,
245
- );
246
- }
247
- echo json_encode( $output );
248
- die();
249
- }
250
-
251
- if ( $method == 'media' ) {
252
- $limit = isset( $_POST['limit'] ) ? $_POST['limit'] : 0;
253
- $limitsize = get_option( 'wpmc_medias_buffer', 100 );
254
- $results = $this->engine->get_media_entries( $limit, $limitsize );
255
- $finished = count( $results ) < $limitsize;
256
- $message = sprintf( __( "Retrieved %d targets.", 'media-cleaner' ), count( $results ) );
257
- $output = array(
258
- 'success' => true,
259
- 'action' => 'retrieve_targets',
260
- 'method' => 'media',
261
- 'limit' => $limit + $limitsize,
262
- 'finished' => $finished,
263
- 'message' => $message,
264
- 'results' => $results,
265
- );
266
- echo json_encode( $output );
267
- die();
268
- }
269
-
270
- // No task.
271
- echo json_encode( array( 'success' => false, 'message' => __( "No task.", 'media-cleaner' ) ) );
272
- die();
273
- }
274
-
275
- // Actual scan (by giving a media ID or a file path)
276
- function wp_ajax_wpmc_check_targets() {
277
-
278
- // DEBUG: Simulate a timeout
279
- // $this->core->deepsleep(10); header("HTTP/1.0 408 Request Timeout"); exit;
280
-
281
- ob_start();
282
- $data = $_POST['data'];
283
- $method = $this->core->current_method;
284
-
285
- $this->core->timeout_check_start( count( $data ) );
286
- $success = 0;
287
- if ( $method == 'files' ) {
288
- do_action( 'wpmc_check_file_init' ); // Build_CroppedFile_Cache() in pro core.php
289
- }
290
- foreach ( $data as $piece ) {
291
- $this->core->timeout_check();
292
- if ( $method == 'files' ) {
293
- $this->core->log( "Check File: {$piece}" );
294
- $result = ( $this->engine->check_file( $piece ) ? 1 : 0 );
295
- if ( $result )
296
- $success += $result;
297
- }
298
- else if ( $method == 'media' ) {
299
- $this->core->log( "Checking Media #{$piece}" );
300
- $result = ( $this->engine->check_media( $piece ) ? 1 : 0 );
301
- if ( $result ) {
302
- $success += $result;
303
- }
304
- }
305
- $this->core->log();
306
- $this->core->timeout_check_additem();
307
- }
308
- ob_end_clean();
309
- $elapsed = $this->core->timeout_get_elapsed();
310
- $message = sprintf(
311
- // translators: %1$d is a number of targets, %2$d is a number of issues, %3$s is elapsed time in milliseconds
312
- __( 'Checked %1$d targets and found %2$d issues in %3$s.', 'media-cleaner' ),
313
- count( $data ), count( $data ) - $success, $elapsed
314
- );
315
- echo json_encode(
316
- array(
317
- 'success' => true,
318
- 'action' => 'check_targets',
319
- 'method' => $method,
320
- 'message' => $message,
321
- 'results' => $success,
322
- )
323
- );
324
- die();
325
- }
326
-
327
- function wp_ajax_wpmc_get_all_issues() {
328
- global $wpdb;
329
- $isTrash = ( isset( $_POST['isTrash'] ) && $_POST['isTrash'] == 1 ) ? true : false;
330
- $table_name = $wpdb->prefix . "mclean_scan";
331
- $q = "SELECT id FROM $table_name WHERE ignored = 0 AND deleted = " . ( $isTrash ? 1 : 0 );
332
- if ( isset( $_POST['filter'] ) && !empty( $_POST['filter'] ) ) {
333
- $filter = sanitize_text_field( $_POST['filter']['filter'] );
334
- $search = sanitize_text_field( $_POST['filter']['search'] );
335
- }
336
- if ( !empty( $search ) )
337
- $q = $wpdb->prepare( $q . ' AND path LIKE %s', '%' . $wpdb->esc_like( $search ) . '%' );
338
- if ( !empty( $filter ) )
339
- $q = $wpdb->prepare( $q . ' AND issue = %s', $filter );
340
- $ids = $wpdb->get_col( $q );
341
- echo json_encode(
342
- array(
343
- 'results' => array( 'ids' => $ids ),
344
- 'success' => true,
345
- 'message' => __( "List generated.", 'media-cleaner' )
346
- )
347
- );
348
- die;
349
- }
350
-
351
- function wp_ajax_wpmc_get_all_deleted() {
352
- global $wpdb;
353
- $table_name = $wpdb->prefix . "mclean_scan";
354
- $ids = $wpdb->get_col( "SELECT id FROM $table_name WHERE ignored = 0 AND deleted = 1" );
355
- echo json_encode(
356
- array(
357
- 'results' => array( 'ids' => $ids ),
358
- 'success' => true,
359
- 'message' => __( "List generated.", 'media-cleaner' )
360
- )
361
- );
362
- die;
363
- }
364
-
365
- function wp_ajax_wpmc_delete_do() {
366
- ob_start();
367
- $data = $_POST['data'];
368
- $success = 0;
369
- foreach ( $data as $piece ) {
370
- $success += ( $this->core->delete( $piece ) ? 1 : 0 );
371
- }
372
- ob_end_clean();
373
- echo json_encode(
374
- array(
375
- 'success' => true,
376
- 'result' => array( 'data' => $data, 'success' => $success ),
377
- 'message' => __( "Status unknown.", 'media-cleaner' )
378
- )
379
- );
380
- die();
381
- }
382
-
383
- function wp_ajax_wpmc_ignore_do() {
384
- ob_start();
385
- $data = $_POST['data'];
386
- $success = 0;
387
- foreach ( $data as $piece ) {
388
- $success += ( $this->core->ignore( $piece ) ? 1 : 0 );
389
- }
390
- ob_end_clean();
391
- echo json_encode(
392
- array(
393
- 'success' => true,
394
- 'result' => array( 'data' => $data, 'success' => $success ),
395
- 'message' => __( "Status unknown.", 'media-cleaner' )
396
- )
397
- );
398
- die();
399
- }
400
-
401
- function wp_ajax_wpmc_recover_do() {
402
- ob_start();
403
- $data = $_POST['data'];
404
- $success = 0;
405
- foreach ( $data as $piece ) {
406
- $success += ( $this->core->recover( $piece ) ? 1 : 0 );
407
- }
408
- ob_end_clean();
409
- echo json_encode(
410
- array(
411
- 'success' => true,
412
- 'result' => array( 'data' => $data, 'success' => $success ),
413
- 'message' => __( "Status unknown.", 'media-cleaner' )
414
- )
415
- );
416
- die();
417
- }
418
-
419
- function wp_ajax_wpmc_validate_option() {
420
- $name = $_POST['name']; // Option Name
421
- $value = $_POST['value']; // Option Value
422
- $value = wp_unslash( $value ); // Unescape backslashes
423
- $validated = $this->admin->validate_option( $name, $value );
424
- if ( $validated instanceof WP_Error ) { // Invalid value
425
- $error = array (
426
- 'code' => $validated->get_error_code() ?: 'invalid_option',
427
- 'message' => $validated->get_error_message() ?: __( "Invalid Option Value", 'media-cleaner' )
428
- );
429
- wp_send_json_error( $error );
430
- }
431
- wp_send_json_success();
432
- }
433
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/index.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ !function(e){function n(n){for(var r,i,c=n[0],l=n[1],u=n[2],f=0,d=[];f<c.length;f++)i=c[f],Object.prototype.hasOwnProperty.call(a,i)&&a[i]&&d.push(a[i][0]),a[i]=0;for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r]);for(s&&s(n);d.length;)d.shift()();return o.push.apply(o,u||[]),t()}function t(){for(var e,n=0;n<o.length;n++){for(var t=o[n],r=!0,c=1;c<t.length;c++){var l=t[c];0!==a[l]&&(r=!1)}r&&(o.splice(n--,1),e=i(i.s=t[0]))}return e}var r={},a={0:0},o=[];function i(n){if(r[n])return r[n].exports;var t=r[n]={i:n,l:!1,exports:{}};return e[n].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.m=e,i.c=r,i.d=function(e,n,t){i.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,n){if(1&n&&(e=i(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var r in e)i.d(t,r,function(n){return e[n]}.bind(null,r));return t},i.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(n,"a",n),n},i.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},i.p="";var c=window.wpJsonWpmc=window.wpJsonWpmc||[],l=c.push.bind(c);c.push=n,c=c.slice();for(var u=0;u<c.length;u++)n(c[u]);var s=l;o.push([78,1]),t()}({0:function(e,n){e.exports=React},78:function(e,n,t){"use strict";t.r(n);var r=t(0),a=t.n(r),o=t(9),i=t.n(o),c=t(6),l=t(1),u=t.n(l);function s(){return(s=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function f(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function d(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?f(Object(t),!0).forEach((function(n){m(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):f(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function m(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function p(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw o}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return h(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return h(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var b=function(e){var n=e.spinner,t=void 0===n||n,o=e.busy,i=void 0!==o&&o,c=e.overlayStyle,l=p(Object(r.useState)(!0),2),u=l[0],f=l[1];Object(r.useEffect)((function(){var e;return i?f(!0):e=setTimeout((function(){f(!1),e=null}),250),function(){e&&clearTimeout(e)}}),[i]);var m=u?a.a.createElement(a.a.Fragment,null,a.a.createElement("div",{className:"overlay "+(i?"":"overlayHidden"),style:c},Boolean(t)&&a.a.createElement("div",{className:"lds-ellipsis "+(i?"":"spinnerHidden")},a.a.createElement("div",null),a.a.createElement("div",null),a.a.createElement("div",null),a.a.createElement("div",null))),a.a.createElement("style",{jsx:!0},"\n .overlay {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n width: 100%;\n height: 100%;\n background: rgb(30 124 186 / 85%);\n transition: opacity 1s ease-out;\n z-index: 10;\n display: flex;\n align-items: center;\n flex-direction: column;\n justify-content: center;\n overflow: hidden;\n }\n\n .overlayHidden {\n opacity: 0;\n transition: opacity 0.25s ease-out;\n }\n .spinnerHidden {\n opacity: 0;\n transition: opacity 0.25s ease-out;\n }\n .lds-ellipsis {\n position: relative;\n width: 80px;\n height: 80px;\n display: flex;\n justify-items: center;\n align-items: center;\n }\n .lds-ellipsis div {\n position: absolute;\n width: 13px;\n height: 13px;\n border-radius: 50%;\n background: white;\n animation-timing-function: cubic-bezier(0, 1, 1, 0);\n }\n .lds-ellipsis div:nth-child(1) {\n left: 8px;\n animation: lds-ellipsis1 0.6s infinite;\n }\n .lds-ellipsis div:nth-child(2) {\n left: 8px;\n animation: lds-ellipsis2 0.6s infinite;\n }\n .lds-ellipsis div:nth-child(3) {\n left: 32px;\n animation: lds-ellipsis2 0.6s infinite;\n }\n .lds-ellipsis div:nth-child(4) {\n left: 56px;\n animation: lds-ellipsis3 0.6s infinite;\n }\n @keyframes lds-ellipsis1 {\n 0% {\n transform: scale(0);\n }\n 100% {\n transform: scale(1);\n }\n }\n @keyframes lds-ellipsis3 {\n 0% {\n transform: scale(1);\n }\n 100% {\n transform: scale(0);\n }\n }\n @keyframes lds-ellipsis2 {\n 0% {\n transform: translate(0, 0);\n }\n 100% {\n transform: translate(24px, 0);\n }\n } \n ")):null,h=d(d({},e),{},{busy:void 0,spinner:void 0});return a.a.createElement("div",s({style:{position:"relative"}},h),m,e.children)};b.propTypes={busy:u.a.bool.isRequired,spinner:u.a.bool,children:u.a.oneOfType([u.a.arrayOf(u.a.node),u.a.node]).isRequired};var y,g=b,v=t(2),w=t(5),E={black:"black",blackRGB:"0, 0, 0",blue:"#007cba",blueRGB:"0, 124, 186",deepBlue:"#134575",finderBorder:"#DEDEDE",lightBlue:"#EBF3FF",lightGray:"#F1F1F1",gray:"#E8E8E8",green:"#0EA480",darkGray:"#A0A0A0",disabledForm:"#828282",orange:"#daa827",overlay:"rgba(16, 16, 16, 0.92)",red:"#ba4300",header:"#134675",proGray:"#7F8EA0",progress:"#8414a8",tableGray:"#FAFAFA",yellow:"#e4b42b",yellowRGB:"224, 156, 54",white:"white",fontFamily:"Lato",fontSizeH1:"24px",fontSizeH2:"18px",fontSizeText:"13px",fontSizeSmall:"12px",lightShadow:"0px 0px 10px rgba(0,0,0,0.1)"},k=t(3),R=t(29),O=t.n(R),j=t(30),C=t.n(j),S=t(31),P=t.n(S),_=t(10),A=t.n(_),T=t(11),N=t.n(T),z=t(12),I=t.n(z),M=t(7),F=t.n(M),B=t(4),L=t.n(B),D=t(8),q=t.n(D),U=t(13),H=t.n(U),G=t(14),W=t.n(G),$=t(32),J=t.n($),V=t(33),Y=t.n(V),K=t(15),Z=t.n(K),X=t(34),Q=t.n(X),ee=t(35),ne=t.n(ee),te=t(36),re=t.n(te),ae=t(37),oe=t.n(ae),ie=t(38),ce=t.n(ie),le=t(39),ue=t.n(le),se=t(40),fe=t.n(se),de=t(41),me=t.n(de),pe=t(42),he=t.n(pe),be=t(43),ye=t.n(be),ge=t(44),ve=t.n(ge),we=t(45),xe=t.n(we),Ee=t(46),ke=t.n(Ee),Re=t(47),Oe=t.n(Re);function je(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var Ce=(je(y={lock:O.a,"lock-open":C.a,"file-undo":P.a,"chevron-double-left":A.a,"chevron-double-right":N.a,"chevron-left":I.a,"chevron-right":F.a,"chevron-down":L.a,"chevron-up":q.a,pause:H.a,play:W.a,replay:J.a,check:Y.a,stop:Z.a,delete:Q.a,undo:ne.a,alert:re.a,database:oe.a,pencil:ce.a,tools:ue.a,cog:fe.a,close:me.a,cat:he.a,upload:ye.a,trash:ve.a},"pencil",xe.a),je(y,"dashboard",ke.a),je(y,"search",Oe.a),y);function Se(){return(Se=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function Pe(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function _e(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n display: inline-block;\n box-sizing: border-box;\n height: 30px;\n min-width: 6em;\n border: none;\n border-radius: 4px;\n text-align: center;\n font-family: ",";\n font-size: ",";\n padding: 0 15px;\n\n background-color: ",";\n color: white;\n transition: background-color .10s, opacity .25s;\n\n :not([disabled]):hover {\n cursor: pointer;\n background-color: ",";\n }\n\n :disabled {\n opacity: 0.35;\n }\n\n :focus {\n outline: none;\n }\n\n &.has-icon {\n align-items: center;\n display: inline-flex;\n padding: 2.5px 6px 2.5px 4px;\n }\n\n &.secondary {\n background-color: ",";\n border: 1px solid ",";\n color: ",";\n\n &:hover {\n background-color: ",";\n }\n }\n\n &.danger {\n background-color: ",";\n border-color: ",";\n\n\t &:hover {\n\t\t background-color: ",";\n\t }\n }\n\n &.success {\n background-color: ",";\n border-color: ",";\n\n\t &:hover {\n\t\t background-color: ",";\n\t }\n }\n\n & + button {\n margin-left: .25rem;\n }\n\n ","\n"]);return _e=function(){return e},e}var Ae=Object(v.a)((function(e){var n=e.className,t=e.icon,r=void 0===t?null:t,o=e.onClick,i=e.disabled,c=void 0!==i&&i,l=e.color,u=void 0===l?null:l,s=e.children,f=Pe(e,["className","icon","onClick","disabled","color","children"]),d=!!r,m="".concat(n||"").concat(d?" has-icon":""," ").concat(u?"custom-color":"");return a.a.createElement("button",Se({type:"button",className:m,onClick:o,disabled:c},f),d&&a.a.createElement(k.Icon,{icon:"string"==typeof r?Ce[r]||null:r,width:"24",height:"24",style:{marginRight:"4px"}}),a.a.createElement("span",null,s))}))(_e(),E.fontFamily,E.fontSizeText,E.blue,Object(w.a)(.1,E.blue),E.lightBlue,E.blue,E.blue,Object(w.a)(.1,E.lightBlue),E.red,E.red,Object(w.a)(.1,E.red),E.green,E.green,Object(w.a)(.1,E.green),(function(e){return Te(e.color)})),Te=function(e){if(e)return"\n &.custom-color {\n background-color: ".concat(e,";\n border: 1px solid ").concat(e,";\n\n &:hover {\n background-color: ").concat(Object(w.a)(.1,e),";\n }\n }\n ")},Ne=function(e){return a.a.createElement(Ae,e)};function ze(){return(ze=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function Ie(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function Me(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n background-color: ",";\n position: relative;\n border-radius: 10px;\n color: ",";\n font-family: ",";\n font-size: 9px;\n line-height: 10px;\n padding: 5px 8px;\n text-transform: uppercase;\n\n &.inline {\n display: inline;\n margin-left: 5px;\n vertical-align: middle;\n }\n"]);return Me=function(){return e},e}Ne.propTypes={className:u.a.oneOf(["primary","secondary","danger","success"]),disabled:u.a.bool,icon:u.a.oneOfType([u.a.instanceOf(k.IconifyIcon),u.a.oneOf(["setting","edit","trash"])]),color:u.a.string,onClick:u.a.func.isRequired},Ne.defaultProps={className:"primary",disabled:!1,icon:null,color:null,onClick:function(){}};var Fe=v.a.div(Me(),E.yellow,E.white,E.fontFamily),Be=function(e){var n=e.show,t=void 0===n||n,r=e.className,o=Ie(e,["show","className"]);return t?a.a.createElement(Fe,ze({className:"".concat(r||"")},o),"Pro Only"):null},Le=function(e){return a.a.createElement(Be,e)};Le.propTypes={show:u.a.bool,className:u.a.string},Le.defaultProps={show:!0,className:void 0};var De=t(51);function qe(e,n){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=We(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,c=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return i=e.done,e},e:function(e){c=!0,o=e},f:function(){try{i||null==t.return||t.return()}finally{if(c)throw o}}}}function Ue(e,n,t,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void t(e)}c.done?n(l):Promise.resolve(l).then(r,a)}function He(e){return function(){var n=this,t=arguments;return new Promise((function(r,a){var o=e.apply(n,t);function i(e){Ue(o,r,a,i,c,"next",e)}function c(e){Ue(o,r,a,i,c,"throw",e)}i(void 0)}))}}function Ge(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw o}}return t}(e,n)||We(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function We(e,n){if(e){if("string"==typeof e)return $e(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?$e(e,n):void 0}}function $e(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var Je=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=Object(r.useState)(n),o=Ge(a,2),i=o[0],c=o[1],l=Object(r.useState)(null),u=Ge(l,2),s=u[0],f=u[1],d=Object(r.useState)(t),m=Ge(d,2),p=m[0],h=m[1],b=Object(r.useState)(0),y=Ge(b,2),g=y[0],v=y[1];return Object(r.useEffect)((function(){void 0!==e&&(e.success?(f(null),c(e.data),v(e.total?e.total:0)):f(e.error)),h(void 0===e)}),[e]),{busy:p,data:i,total:g,error:s}},Ve=function(){var e=Object(r.useRef)(),n=Ge(Object(r.useState)({}),2),t=n[0],a=n[1];return Object(r.useEffect)((function(){if(e&&e.current){var n=new ResizeObserver((function(e){var n=e[0];n.contentRect&&a({width:n.contentRect.left+n.contentRect.right,height:n.contentRect.top+n.contentRect.bottom})}));return n.observe(e.current),function(){n.unobserve(e.current)}}}),[]),{ref:e,width:t.width?t.width:0,height:t.height?t.height:0}},Ye=function(e){var n=Object(r.useRef)(),t=function(t){e&&!n.current.contains(t.target)&&e()};return Object(r.useEffect)((function(){return document.addEventListener("mousedown",t),function(){document.removeEventListener("mousedown",t)}})),n},Ke=new(t.n(De).a)({concurrency:1,autoStart:!1});function Ze(){var e=rn(["\n align-items: center;\n background-color: ",";\n border: none;\n box-sizing: border-box;\n color: white;\n display: flex;\n font-family: ",";\n font-size: ",";\n width: 100%;\n padding: 8px 15px 8px 15px;\n text-align: center;\n transition: background-color .10s, opacity .25s;\n\n :not([disabled]):hover {\n cursor: pointer;\n background-color: ",";\n }\n\n :disabled:not(.is-pro) {\n opacity: 0.35;\n }\n\n :focus {\n outline: none;\n }\n\n &.is-pro {\n background-color: ",";\n justify-content: space-between;\n }\n"]);return Ze=function(){return e},e}function Xe(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw o}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return Qe(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Qe(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qe(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function en(){var e=rn(["\n position: relative;\n display: block;\n margin-top: 18px;\n background-color: ",";\n position: absolute;\n z-index: 10;\n box-shadow: ",';\n\n &:before {\n content: "";\n position: absolute;\n top: -18px;\n left: 50%;\n margin-left: -8px;\n border: 8px solid transparent;\n border-bottom: 10px solid ',";\n }\n"]);return en=function(){return e},e}function nn(){var e=rn(["\n align-items: center;\n background-color: ",";\n border: none;\n border-radius: 4px;\n box-sizing: border-box;\n color: white;\n display: inline-flex;\n font-family: ",";\n font-size: ",";\n height: 30px;\n min-width: 6em;\n padding: 0px 10px;\n text-align: center;\n transition: background-color .10s, opacity .25s;\n\n :not([disabled]):hover {\n cursor: pointer;\n background-color: ",";\n }\n\n :disabled {\n opacity: 0.35;\n }\n\n :focus {\n outline: none;\n }\n\n & + button {\n margin-left: .25rem;\n }\n"]);return nn=function(){return e},e}function tn(){var e=rn(["\n display: inline-block;\n"]);return tn=function(){return e},e}function rn(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}var an=v.a.div(tn()),on=v.a.button(nn(),E.blue,E.fontFamily,E.fontSizeText,Object(w.a)(.1,E.blue)),cn=v.a.div(en(),E.blue,E.lightShadow,E.blue),ln=function(e){var n=e.title,t=e.disabled,r=void 0!==t&&t,o=e.isPro,i=void 0!==o&&o,c=Xe(a.a.useState(!1),2),l=c[0],u=c[1],s=Ye((function(){u(!1)})),f=Ve(),d=f.ref,m=f.width,p=function(){u(!l)},h=a.a.Children.map(e.children,(function(e){return a.a.cloneElement(e,{isPro:i,disabled:e.props.disabled||r,onClick:function(){e.props.onClick&&e.props.onClick(),p()}})}));return a.a.createElement(an,{ref:s},a.a.createElement(on,{ref:d,type:"button",disabled:r,onClick:p},a.a.createElement("span",null,n),a.a.createElement(k.Icon,{icon:L.a,width:"24",height:"24",style:{marginLeft:"4px"}})),l&&a.a.createElement(cn,{style:{transform:"translateX(calc(-50% + ".concat(m/2,"px))")}},h))},un=v.a.button(Ze(),E.blue,E.fontFamily,E.fontSizeText,Object(w.a)(.1,E.blue),E.proGray),sn=function(e){var n=e.onClick,t=e.children,r=e.isPro,o=e.requirePro,i=void 0!==o&&o,c=e.disabled,l=i&&!r;return a.a.createElement(un,{type:"button",className:l?"is-pro":"",onClick:n,disabled:c||l},a.a.createElement("span",null,t),l&&!r&&a.a.createElement(Le,null))},fn=function(e){return a.a.createElement(ln,e)},dn=function(e){return a.a.createElement(sn,e)};function mn(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw o}}return t}(e,n)||pn(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pn(e,n){if(e){if("string"==typeof e)return hn(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?hn(e,n):void 0}}function hn(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function bn(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n position: relative;\n background: #f1f1f1;\n margin-left: -20px;\n background-color: rgb(30 124 186 / 10%);\n padding-bottom: 50px;\n margin-bottom: -26px;\n\n .neko-rest-error {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: #1e232deb;\n z-index: 100;\n\n .container {\n color: white;\n padding: 5px 20px 15px 20px;\n min-width: 480px;\n max-width: 600px;\n border-radius: 20px;\n background: #883131;\n margin-left: 50%;\n transform: translateX(-50%);\n margin-top: 100px;\n\n h3 {\n color: white;\n }\n\n .neko-debug {\n padding: 5px 10px;\n background: #692426;\n border-radius: 10px;\n\n * {\n margin: 0px;\n padding: 0px;\n } \n }\n }\n }\n"]);return bn=function(){return e},e}fn.propTypes={title:u.a.string,disabled:u.a.bool,isPro:u.a.bool},fn.defaultProps={title:void 0,disabled:!1,isPro:!1},dn.propTypes={onClick:u.a.func.isRequired,requirePro:u.a.bool},dn.defaultProps={onClick:function(){},requirePro:!1};var yn=v.a.div(bn()),gn=function(e){var n=e.className,t=e.children,o=e.nekoErrors,i=void 0===o?[]:o,c=e.style,l=void 0===c?{}:c,u=mn(Object(r.useState)(!1),2),s=u[0],f=u[1],d=mn(Object(r.useState)(!1),2),m=d[0],p=d[1];if(i&&!s){var h,b=function(e,n){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=pn(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,c=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return i=e.done,e},e:function(e){c=!0,o=e},f:function(){try{i||null==t.return||t.return()}finally{if(c)throw o}}}}(i);try{for(b.s();!(h=b.n()).done;){var y=h.value;if(y){f(y);break}}}catch(e){b.e(e)}finally{b.f()}}return a.a.createElement(yn,{className:n||"",style:l},s&&a.a.createElement("div",{className:"neko-rest-error"},a.a.createElement("div",{className:"container"},!m&&a.a.createElement(a.a.Fragment,null,a.a.createElement("h3",null,"The Rest API is disabled or broken 😢"),a.a.createElement("p",null,"The Rest API is required for this plugin to work. It is enabled in WordPress by default since December 2016 and used by the Gutenberg Editor since 2019. In short, it allows more robustness and a much cleaner infrastructure. Soon, Wordpress will entirely depends on it, so it is important to keep it enabled."),a.a.createElement("p",null,a.a.createElement("i",null,"Last but not least: check your PHP Error Logs and your Debugging Console.")),a.a.createElement("p",{className:"neko-debug"},a.a.createElement("small",null,"URL: ",s.url,a.a.createElement("br",null),"CODE: ",s.code,a.a.createElement("br",null),"MESSAGE: ",s.message,a.a.createElement("br",null)))),s.body&&m&&a.a.createElement("p",{className:"neko-debug"},a.a.createElement("div",{dangerouslySetInnerHTML:{__html:s.body}})),s.body&&a.a.createElement(Ne,{color:"#a94242",onClick:function(){return p(!m)}},m?"Hide":"Display"," response from server"),a.a.createElement(Ne,{color:"#a94242",onClick:function(){window.open("https://meowapps.com/debugging-wordpress/","_blank")}},"Learn about WordPress Debugging"))),t)},vn=function(e){return a.a.createElement(gn,e)};function wn(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function xn(){var e=On(["\n font-family: ",";\n font-size: ",";\n line-height: normal;\n margin: 0;\n padding: 0;\n"]);return xn=function(){return e},e}function En(){var e=On(["\n font-family: ",";\n font-size: ",";\n line-height: normal;\n margin: 16px 0 24px;\n padding: 0;\n"]);return En=function(){return e},e}function kn(){var e=On(["\n font-family: ",";\n font-size: ",";\n font-weight: normal;\n line-height: normal;\n margin-top: 0;\n margin-bottom: 16px;\n padding: 0;\n"]);return kn=function(){return e},e}function Rn(){var e=On(["\n font-family: ",";\n font-weight: normal;\n font-size: ",";\n line-height: normal;\n margin-top: 0;\n margin-bottom: 16px;\n padding: 0;\n"]);return Rn=function(){return e},e}function On(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}vn.propTypes={className:u.a.string,style:u.a.object,nekoErrors:u.a.bool},vn.defaultProps={className:void 0,style:{},nekoErrors:!1};var jn=v.a.h1(Rn(),E.fontFamily,E.fontSizeH1),Cn=v.a.h2(kn(),E.fontFamily,E.fontSizeH2),Sn=v.a.p(En(),E.fontFamily,E.fontSizeText),Pn=v.a.span(xn(),E.fontFamily,E.fontSizeText),_n=function(e){var n=e.children,t=wn(e,["children"]);return e.h1?a.a.createElement(jn,t,n):e.h2?a.a.createElement(Cn,t,n):e.p?a.a.createElement(Sn,t,n):a.a.createElement(Pn,t,n)},An=function(e){return a.a.createElement(_n,e)};function Tn(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n font-size: ",";\n margin-bottom: 15px;\n \n .nui-block-title {\n color: ",";\n padding: 5px 10px;\n margin-bottom: 5px;\n }\n\n .nui-block-content {\n background-color: #f1f1f1;\n padding: 26px;\n box-shadow: 0px 2px 5px 0px #0000004a;\n border-radius: 10px;\n\n p:first-child {\n margin-top: 0;\n }\n\n p:last-child {\n margin-bottom: 0;\n }\n }\n\n &.primary {\n padding: 8px;\n background-color: ",";\n\n .nui-block-title {\n color: ",";\n }\n\n .nui-block-content {\n background-color: ",";\n }\n }\n"]);return Tn=function(){return e},e}An.propTypes={h1:u.a.any,h2:u.a.any,p:u.a.any},An.defaultProps={h1:void 0,h2:void 0,p:void 0};var Nn=v.a.div(Tn(),E.fontSizeText,E.blue,E.blue,E.white,E.white),zn=function(e){var n=e.title,t=e.children,r=e.className,o=e.busy,i=void 0!==o&&o,c=e.style,l=void 0===c?{}:c;return a.a.createElement(Nn,{className:"nui-block "+(r||""),style:l},a.a.createElement(g,{busy:i},a.a.createElement(An,{h2:!0,className:"nui-block-title"},n),a.a.createElement("div",{className:"nui-block-content"},t)))},In=function(e){return a.a.createElement(zn,e)};function Mn(){var e=Bn(["\n justify-content: flex-start;\n background-color: ",";\n display: flex;\n align-items: center;\n padding: 8px 10px;\n\n &.align-right {\n justify-content: flex-end;\n }\n"]);return Mn=function(){return e},e}function Fn(){var e=Bn(["\n font-size: ",";\n font-family: ",";\n background-color: ",";\n box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.25);\n margin-bottom: 25px;\n\n &.primary {\n background-color: ",";\n }\n\n p:first-child {\n margin-top: 0px;\n }\n\n p:last-child {\n margin-bottom: 0px;\n }\n\n .content {\n padding: 20px 20px;\n }\n"]);return Fn=function(){return e},e}function Bn(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}In.propTypes={title:u.a.string,className:u.a.oneOf(["","primary"]),style:u.a.object},In.defaultProps={title:void 0,className:"",style:{}};var Ln=v.a.div(Fn(),E.fontSizeText,E.fontFamily,E.white,E.blue),Dn=v.a.div(Mn(),E.lightGray),qn=function(e){var n=e.children,t=e.header,r=e.headerAlign,o=void 0===r?"left":r,i=e.footer,c=e.footerAlign,l=void 0===c?"right":c,u=e.className,s=e.style,f=void 0===s?{}:s;return a.a.createElement(Ln,{className:u||"",style:f},t&&a.a.createElement(Dn,{className:"align-".concat(o)},t),a.a.createElement("div",{className:"content"},n),i&&a.a.createElement(Dn,{className:"align-".concat(l)},i))},Un=function(e){return a.a.createElement(qn,e)};function Hn(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n display: flex;\n font-family: ",";\n\n > .nui-settings-head {\n font-family: ",";\n font-size: 14px;\n line-height: 17px;\n width: 120px;\n margin-right: 16px;\n }\n\n /* Select, Checkbox, Input need to be a bit higher to be in front of the settings title */\n\n .nui-settings-content > .nui-select:first-child {\n position: relative;\n margin-top: -5px;\n }\n \n .nui-settings-content > .nui-checkbox:first-child {\n position: relative;\n margin-top: -5px;\n }\n\n .nui-settings-content > div:first-child > .neko-input {\n position: relative;\n margin-top: -5px;\n }\n\n > .nui-settings-content {\n flex: 1;\n\n &.nui-settings-content-align-right {\n flex: none;\n margin-left: auto;\n }\n\n input[type=text] {\n width: 100%;\n }\n\n\n }\n\n & + div {\n margin-top: 15px;\n }\n"]);return Hn=function(){return e},e}Un.propTypes={header:u.a.element,headerAlign:u.a.oneOf(["left","right"]),footer:u.a.element,footerAlign:u.a.oneOf(["left","right"]),className:u.a.string,style:u.a.object},Un.defaultProps={header:void 0,headerAlign:"left",footer:void 0,footerAlign:"right",className:void 0,style:{}};var Gn=Object(v.a)((function(e){var n=e.title,t=void 0===n?"":n,r=e.contentAlign,o=void 0===r?"left":r;return a.a.createElement("div",{className:e.className||""},t?a.a.createElement("div",{className:"nui-settings-head"},t):null,a.a.createElement("div",{className:"nui-settings-content nui-settings-content-align-".concat(o)},e.children))}))(Hn(),E.fontFamily,E.fontFamily),Wn=function(e){return a.a.createElement(Gn,e)};function $n(){var e=Vn(["\n background-color: ",";\n color: white;\n"]);return $n=function(){return e},e}function Jn(){var e=Vn(["\n margin: 20px;\n padding: 14px;\n background-color: white;\n box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);\n\n > * + * {\n /* Base margin between child elements */\n margin-top: 14px;\n }\n"]);return Jn=function(){return e},e}function Vn(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}Wn.propTypes={title:u.a.string,className:u.a.string,contentAlign:u.a.string},Wn.defaultProps={title:"",className:void 0,contentAlign:"left"};var Yn=v.a.div(Jn()),Kn=Object(v.a)((function(e){return e.children?a.a.createElement("div",{className:e.className},e.children):null}))($n(),E.blue),Zn=function(e){return a.a.createElement(Yn,{className:"window"},a.a.createElement(Kn,null,e.title),e.children)},Xn=function(e){return a.a.createElement(Zn,e)};function Qn(){return(Qn=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function et(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function nt(){var e=rt(["\n flex: 1;\n padding: 32px 30px;\n\n .nui-block:not(:first-child) {\n margin-top: -20px;\n }\n\n .nui-block:last-child {\n margin-bottom: 0px;\n }\n\n &.minimal {\n padding: 0;\n }\n\n &.full {\n flex-basis: 100%;\n padding-bottom: 0;\n }\n\n & + .full {\n padding-bottom: 32px;\n padding-top: 0;\n }\n\n &:not(.full) + div:not(.full) {\n padding-left: 0;\n }\n"]);return nt=function(){return e},e}function tt(){var e=rt(["\n display: flex;\n flex-wrap: wrap;\n"]);return tt=function(){return e},e}function rt(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}Xn.propTypes={title:u.a.string},Xn.defaultProps={title:void 0};var at=v.a.div(tt()),ot=v.a.div(nt()),it=function(e){return a.a.createElement(at,null,e.children)},ct=function(e){var n=e.full,t=e.minimal,r=et(e,["full","minimal"]),o=n?"full":"";return o+=t?" minimal":"",a.a.createElement(ot,Qn({className:o},r),e.children)},lt=function(e){return a.a.createElement(it,e)},ut=function(e){return a.a.createElement(ct,e)};lt.propTypes={},lt.defaultProps={},ut.propTypes={full:u.a.any},ut.defaultProps={full:void 0};var st=t(17),ft=t.n(st),dt=t(18),mt=t.n(dt);function pt(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n font-family: ",";\n\n &.disabled {\n color: ",";\n\n label {\n cursor: default;\n }\n }\n\n input {\n display: none;\n }\n\n label {\n cursor: pointer;\n display: flex;\n }\n .nui-checkbox-check-container {\n flex-basis: 30px;\n }\n .nui-checkbox-inner-container {\n margin-top: 1.5px;\n margin-left: 4px;\n\n .label {\n display: block;\n font-size: 14px;\n line-height: 17px;\n padding-top: 4.5px;\n padding-bottom: 4px;\n }\n \n .description {\n display: block;\n font-size: 13px;\n line-height: 14px;\n color: #8a8a8a;\n\n * {\n font-size: 13px;\n line-height: inherit;\n margin: 0;\n }\n }\n }\n"]);return pt=function(){return e},e}var ht=Object(v.a)((function(e){var n=e.id,t=e.name,r=e.checked,o=void 0!==r&&r,i=e.onChange,c=e.label,l=e.description,u=e.isPro,s=e.requirePro,f=void 0!==s&&s&&!u,d=f?"disabled":"";return a.a.createElement("div",{className:["nui-checkbox",e.className,d].join(" ")},a.a.createElement("input",{id:n,name:t,type:"checkbox",defaultChecked:!1,onClick:function(){i?i(!o,n):console.log("The onChange handler it not set for this checkbox.",e)},disabled:f}),a.a.createElement("label",{htmlFor:n},a.a.createElement("div",{className:"nui-checkbox-check-container"},a.a.createElement(k.Icon,{icon:o?mt.a:ft.a,width:"30px",height:"30px",color:f?E.disabledForm:E.blue})),a.a.createElement("div",{className:"nui-checkbox-inner-container"},a.a.createElement("span",{className:"label"},c,a.a.createElement(Le,{className:"inline",show:f})),l?a.a.createElement("small",{className:"description"},l):null)))}))(pt(),E.fontFamily,E.disabledForm),bt=function(e){return a.a.createElement(ht,e)};function yt(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n"]);return yt=function(){return e},e}bt.propTypes={id:u.a.string,name:u.a.string,checked:u.a.bool,label:u.a.string,description:u.a.string,isPro:u.a.bool,requirePro:u.a.bool},bt.defaultProps={id:void 0,name:void 0,checked:!1,label:void 0,description:void 0,isPro:!1,requirePro:!1};var gt=Object(v.a)((function(e){var n=e.name,t=(e.max,e.isPro),r=void 0!==t&&t;return a.a.Children.map(e.children,(function(e){return e.props.name?e:a.a.cloneElement(e,{name:n,isPro:r})}))}))(yt()),vt=function(e){return a.a.createElement(gt,e)};function wt(){return(wt=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function xt(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw o}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return Et(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Et(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Et(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function kt(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function Rt(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n .neko-input {\n font-family: ",";\n font-size: ",";\n border: 2px solid ",";\n box-sizing: border-box;\n height: 30px;\n background: rgb(0 124 186 / 10%);\n padding: 0 10px;\n width: 100%;\n\n &::placeholder {\n color: rgba(0, 0, 0, 0.25);\n }\n\n :focus {\n background-color: white;\n }\n\n :read-only {\n background-color: ",";\n }\n }\n\n .neko-input-description {\n font-family: ",";\n font-size: ",";\n line-height: 14px;\n margin-top: 8px;\n margin-bottom: 0;\n }\n"]);return Rt=function(){return e},e}vt.propTypes={name:u.a.string,mas:u.a.number,isPro:u.a.bool},vt.defaultProps={name:void 0,mas:-1,isPro:!1};var Ot=Object(v.a)((function(e){var n=e.id,t=e.name,o=e.value,i=void 0===o?"":o,c=e.description,l=e.placeholder,u=void 0===l?"":l,s=e.onEnter,f=void 0===s?null:s,d=e.readOnly,m=void 0!==d&&d,p=e.type,h=void 0===p?"text":p,b=e.step,y=void 0===b?1:b,g=e.min,v=void 0===g?1:g,w=e.max,x=void 0===w?999:w,E=e.maxLength,k=void 0===E?3:E,R=e.className,O=e.style,j=kt(e,["id","name","value","description","placeholder","onEnter","readOnly","type","step","min","max","maxLength","className","style"]),C=xt(Object(r.useState)(i),2),S=C[0],P=C[1],_=!!e.onChange;Object(r.useEffect)((function(){_||P(i)}),[i]);var A=function(t){_?e.onChange(t.target.value,n):P(t.target.value,n)},T=function(t){f&&"Enter"===event.key&&(t.preventDefault(),e.onEnter(t.target.value,n))},N=function(t){e.onBlur&&i!==t.target.value&&e.onBlur(t.target.value,n)};return a.a.createElement("div",{className:[R].join(" "),style:O},"number"===h?a.a.createElement("input",wt({className:"neko-input"},j,{id:n,name:t,value:_?i:S,type:h,step:y,min:v,max:x,maxlength:k,placeholder:u,onChange:A,onKeyPress:T,onBlur:N,readOnly:m})):a.a.createElement("input",wt({className:"neko-input"},j,{id:n,name:t,value:_?i:S,type:h,spellcheck:"false",placeholder:u,onChange:A,onKeyPress:T,onBlur:N,readOnly:m})),c&&a.a.createElement("p",{className:"neko-input-description"},c))}))(Rt(),E.fontFamily,E.fontSizeText,E.blue,E.gray,E.fontFamily,E.fontSizeSmall),jt=function(e){return a.a.createElement(Ot,e)};jt.propTypes={id:u.a.string,type:u.a.oneOf(["number","text"]),name:u.a.string,value:u.a.string,description:u.a.string,placeholder:u.a.string,onChange:u.a.func,onEnter:u.a.func,onBlur:u.a.func,readOnly:u.a.bool,step:u.a.number,min:u.a.number,max:u.a.number,maxLength:u.a.number},jt.defaultProps={id:void 0,type:"text",name:void 0,value:"",description:void 0,placeholder:"",onChange:void 0,onEnter:void 0,onBlur:void 0,readOnly:!1,step:1,min:1,max:999,maxLength:3};var Ct=t(52),St=t.n(Ct),Pt=t(53),_t=t.n(Pt);function At(){var e=Ut(["\n background-color: ",";\n cursor: pointer;\n font-family: ",";\n padding: 8px 12px;\n\n &:hover {\n filter: brightness(80%);\n }\n\n input {\n display: none;\n }\n\n .option {\n align-items: center;\n color: ",";\n display: flex;\n justify-content: space-between;\n font-family: ",";\n font-size: 14px;\n line-height: 17px;\n }\n\n &.disabled {\n background-color: rgb(224 156 54);\n pointer-events: none;\n\n .option {\n color: rgb(255 255 255 / 35%);\n }\n }\n"]);return At=function(){return e},e}function Tt(){var e=Ut(["\n font-family: ",";\n margin-bottom: 6px;\n\n input {\n display: none;\n }\n\n label {\n cursor: pointer;\n display: flex;\n }\n\n .inner-container {\n margin-left: 4px;\n\n .label {\n display: block;\n font-size: 14px;\n line-height: 17px;\n padding-top: 4.5px;\n padding-bottom: 4px;\n }\n .description {\n display: block;\n font-size: 12px;\n }\n }\n\n &.disabled {\n color: ",";\n\n label {\n cursor: default;\n }\n }\n"]);return Tt=function(){return e},e}function Nt(){return(Nt=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function zt(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw o}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return It(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return It(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function It(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function Mt(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function Ft(){var e=Ut(["\n background-color: ",";\n"]);return Ft=function(){return e},e}function Bt(){var e=Ut(["\n border-radius: 8px;\n overflow: hidden;\n padding-top: 28px;\n position: absolute;\n top: 0;\n z-index: 10;\n width: 100%;\n transition: all 0.2s ease-in;\n\n &.hidden {\n opacity: 0;\n }\n"]);return Bt=function(){return e},e}function Lt(){var e=Ut(["\n display: block;\n margin-top: 5px;\n font-size: 13px;\n line-height: 14px;\n color: #8a8a8a;\n\n * {\n font-size: 13px;\n line-height: inherit;\n margin: 0;\n }\n"]);return Lt=function(){return e},e}function Dt(){var e=Ut(["\n align-items: center;\n background-color: ",";\n border: 2px solid ",";\n border-radius: 8px;\n display: flex;\n font-family: ",";\n font-size: 14px;\n padding: 0 5px 0 10px;\n box-sizing: border-box;\n height: 30px;\n\n .rightContent {\n align-items: center;\n display: flex;\n margin-left: auto;\n }\n"]);return Dt=function(){return e},e}function qt(){var e=Ut(["\n border-radius: 8px;\n position: relative;\n user-select: none;\n cursor: pointer;\n\n &.show-options {\n background-color: ",";\n border-radius: 8px 8px 0 0;\n }\n"]);return qt=function(){return e},e}function Ut(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}var Ht=v.a.div(qt(),E.blue),Gt=v.a.div(Dt(),E.white,E.blue,E.fontFamily),Wt=v.a.div(Lt()),$t=v.a.div(Bt()),Jt=v.a.div(Ft(),E.white),Vt=function(e){var n,t=e.name,o=e.value,i=e.scrolldown,c=void 0!==i&&i,l=e.isPro,u=void 0!==l&&l,s=e.onChange,f=Mt(e,["name","value","scrolldown","isPro","onChange"]),d=null===(n=a.a.Children.toArray(e.children).find((function(e){return e.props.value===o})))||void 0===n?void 0:n.props,m=(null==d?void 0:d.label)||"Select",p=(null==d?void 0:d.description)||e.description,h=(null==d?void 0:d.requirePro)||!1,b=c?e.id:null==d?void 0:d.id,y=zt(Object(r.useState)(!1),2),g=y[0],v=y[1],w=Ye((function(){v(!1)})),x=h&&!u,E=function(n){if(n!==o){if(!s)return void console.log("The onChange handler it not set for this checkbox.",e);s(n,b)}c&&v(!1)},R=a.a.Children.map(e.children,(function(e){return a.a.cloneElement(e,{name:e.props.name||t,checked:e.props.value===o,onClick:E,scrolldown:c,isPro:u})}));return c?a.a.createElement(Ht,Nt({id:b,ref:w},f,{onClick:function(){return v(!g)},className:["nui-select",g?"show-options":""],childrenLength:R.length}),a.a.createElement(Gt,null,m,a.a.createElement("div",{className:"rightContent"},x&&a.a.createElement(Le,null),a.a.createElement(k.Icon,{icon:g?q.a:L.a,width:"24"}))),p&&a.a.createElement(Wt,null,p),g&&a.a.createElement($t,{className:g?"":"hidden"},a.a.createElement(Jt,null,[R]))):R},Yt=v.a.div(Tt(),E.fontFamily,E.disabledForm),Kt=v.a.div(At(),E.blue,E.fontFamily,E.white,E.fontFamily),Zt=function(e){var n=e.id,t=e.name,r=e.value,o=e.checked,i=e.label,c=e.description,l=e.onClick,u=e.scrolldown,s=e.isPro,f=void 0!==s&&s,d=e.requirePro,m=void 0!==d&&d&&!f,p=m?"disabled":"",h=a.a.createElement(Yt,{className:"nui-select ".concat(e.className||""," ").concat(p)},a.a.createElement("input",{id:n,name:t,type:"radio",value:r,defaultChecked:o,onClick:function(e){return l(e.target.value)},disabled:m}),a.a.createElement("label",{htmlFor:n},a.a.createElement(k.Icon,{icon:o?_t.a:St.a,width:"24px",color:m?E.disabledForm:E.blue}),a.a.createElement("div",{className:"inner-container"},a.a.createElement("span",{className:"label"},i,a.a.createElement(Le,{className:"inline",style:{top:-1},show:m})),c?a.a.createElement("small",{className:"description"},c):null))),b=a.a.createElement(Kt,{className:"nui-select ".concat(e.className||""," ").concat(p)},a.a.createElement("input",{id:n,name:t,type:"radio",value:r,defaultChecked:o,disabled:m}),a.a.createElement("div",{className:"option",onClick:function(){return l(r)}},i,a.a.createElement(Le,{show:m})));return u?b:h},Xt=function(e){return a.a.createElement(Vt,e)};Xt.propTypes={id:u.a.string,name:u.a.string,description:u.a.string,scrolldown:u.a.bool,isPro:u.a.bool,onChange:u.a.func},Xt.propTypes={id:void 0,name:void 0,description:void 0,scrolldown:!1,isPro:!1,onChange:void 0};var Qt=function(e){return a.a.createElement(Zt,e)};Qt.propTypes={id:u.a.string,name:u.a.string,value:u.a.string,checked:u.a.bool,label:u.a.string,description:u.a.string,onClick:u.a.func,scrolldown:u.a.bool,isPro:u.a.bool,requirePro:u.a.bool},Qt.defaultProps={id:void 0,name:void 0,value:void 0,checked:!1,label:void 0,description:void 0,onClick:void 0,scrolldown:!1,isPro:!1,requirePro:!1};var er=t(19),nr=t.n(er),tr=t(54),rr=t.n(tr),ar=t(55),or=t.n(ar);function ir(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw o}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return cr(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return cr(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function cr(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function lr(){var e=fr(["\n border-left: 1px solid ",";\n margin-left: 12px;\n padding-left: 6px;\n\n &.no-line {\n border-left: 0;\n padding-left: 12px;\n }\n\n &.no-chevron {\n border-left: 0;\n margin-left: 0;\n padding-left: 0;\n }\n"]);return lr=function(){return e},e}function ur(){var e=fr(["\n height: 24px;\n width: 24px;\n"]);return ur=function(){return e},e}function sr(){var e=fr(["\n align-items: center;\n display: flex;\n margin-bottom: 8px;\n\n &.can-expand {\n cursor: pointer;\n }\n\n p {\n margin: 0 0 0 8px;\n }\n"]);return sr=function(){return e},e}function fr(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}var dr=function(e){var n=e.chevron,t=void 0===n||n;return a.a.Children.map(e.children,(function(e){return a.a.cloneElement(e,{chevron:t})}))},mr=v.a.div(sr()),pr=v.a.div(ur()),hr=v.a.div(lr(),E.finderBorder),br=function(e){var n={gallery:or.a},t=e.title,r=e.chevron,o=!e.icon,i=!!e.icon,c=!!e.children,l=ir(a.a.useState(!1),2),u=l[0],s=l[1],f=ir(a.a.useState((function(){return"string"==typeof e.icon&&Object.keys(n).includes(e.icon)?n[e.icon]:e.icon?e.icon:nr.a})),2),d=f[0],m=f[1],p=a.a.Children.map(e.children,(function(e){return a.a.cloneElement(e,{chevron:r})}));return a.a.createElement("div",null,a.a.createElement(mr,{onClick:function(){(o||c)&&(i||m(u?nr.a:rr.a),s(!u))},className:"".concat(o||p?"can-expand":"")},r?o||p?a.a.createElement(k.Icon,{icon:u?L.a:F.a,width:"1.5rem",height:"1.5rem"}):a.a.createElement(pr,null):null,a.a.createElement(k.Icon,{icon:d,color:E.blue,width:"1.5rem",height:"1.5rem"}),a.a.createElement("p",null,t)),u&&a.a.createElement(hr,{className:"".concat(o?"":"no-line"," ").concat(r?"":"no-chevron")},p))},yr=function(e){return a.a.createElement(dr,e)};yr.propTypes={chevron:u.a.bool},yr.defaultProps={chevron:!0};var gr=function(e){return a.a.createElement(br,e)};function vr(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n display: flex;\n width: 100%;\n height: 100%;\n max-width: 128px;\n max-height: 128px;\n\n & > * {\n width: 100%;\n height: auto;\n object-fit: contain;\n }\n"]);return vr=function(){return e},e}gr.propTypes={icon:u.a.oneOfType([u.a.instanceOf(k.IconifyIcon),u.a.oneOf(["gallery"])]),title:u.a.string},gr.defaultProps={icon:nr.a,title:void 0};var wr=v.a.div(vr()),xr=function(){return a.a.createElement(wr,null,a.a.createElement("svg",{width:"54",height:"38",viewBox:"0 0 54 38",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a.a.createElement("path",{d:"M11.3663 9.40518C9.2981 -3.25522 -0.310763 2.76769 2.5163 9.40518C2.5163 9.40518 8.29338 29.9322 22.3059 26.3677C36.3184 22.8031 23.9038 19.1156 23.9038 19.1156C23.9038 19.1156 13.4345 22.0656 11.3663 9.40518Z",fill:"#724024",stroke:"black",strokeWidth:"2.1869"}),a.a.createElement("path",{d:"M10.7517 8.0531C10.0142 10.7573 6.32673 12.1093 3.99131 11.2489C1.65589 10.3885 2.63923 13.8302 5.09756 14.9364C7.55589 16.0427 11.2434 14.1989 12.1038 12.4781C12.9642 10.7573 11.4892 5.34893 10.7517 8.0531Z",fill:"#B7782E"}),a.a.createElement("path",{d:"M14.0705 17.2718C13.8246 19.2385 9.64547 19.976 7.55589 19.8531C5.46631 19.7302 9.76839 23.5406 11.3663 23.5406C12.9642 23.5406 17.3892 21.2052 17.1434 19.2385C16.8976 17.2718 14.3163 15.3052 14.0705 17.2718Z",fill:"#B7782E"}),a.a.createElement("path",{d:"M17.5121 26.2448C18.6184 25.3843 20.9538 21.8198 19.8476 19.8531C18.7413 17.8864 22.4288 20.9593 22.4288 20.9593L21.6913 26.2448C21.6913 26.2448 16.4059 27.1052 17.5121 26.2448Z",fill:"#B7782E"}),a.a.createElement("path",{d:"M10.7517 8.0531C10.0142 10.7573 6.32673 12.1093 3.99131 11.2489C1.65589 10.3885 2.63923 13.8302 5.09756 14.9364C7.55589 16.0427 11.2434 14.1989 12.1038 12.4781C12.9642 10.7573 11.4892 5.34893 10.7517 8.0531Z",stroke:"black"}),a.a.createElement("path",{d:"M14.0705 17.2718C13.8246 19.2385 9.64547 19.976 7.55589 19.8531C5.46631 19.7302 9.76839 23.5406 11.3663 23.5406C12.9642 23.5406 17.3892 21.2052 17.1434 19.2385C16.8976 17.2718 14.3163 15.3052 14.0705 17.2718Z",stroke:"black"}),a.a.createElement("path",{d:"M17.5121 26.2448C18.6184 25.3843 20.9538 21.8198 19.8476 19.8531C18.7413 17.8864 22.4288 20.9593 22.4288 20.9593L21.6913 26.2448C21.6913 26.2448 16.4059 27.1052 17.5121 26.2448Z",stroke:"black"}),a.a.createElement("path",{d:"M11.3663 9.40518C9.2981 -3.25522 -0.310763 2.76769 2.5163 9.40518C2.5163 9.40518 8.29338 29.9322 22.3059 26.3677C36.3184 22.8031 23.658 19.4843 23.658 19.4843C23.658 19.4843 13.4345 22.0656 11.3663 9.40518Z",stroke:"black",strokeWidth:"2.1869"}),a.a.createElement("path",{d:"M25.3788 9.89685C25.3788 9.89685 21.3225 35.0947 21.9371 35.7093C22.5517 36.3239 27.4684 36.3239 28.083 35.7093C28.6975 35.0947 29.6523 22.5858 30.2955 21.9427C30.9386 21.2995 35.7226 33.1281 36.81 33.1281C37.8975 33.1281 43.2303 21.3567 43.8163 21.9427C44.4023 22.5287 45.2913 35.0947 45.9059 35.7093C46.5204 36.3239 51.3142 36.3239 51.9288 35.7093C52.5434 35.0947 48.9788 9.89685 48.9788 9.89685H42.9559C42.9559 9.89685 37.7934 21.9427 36.81 21.9427C35.8267 21.9427 31.4017 9.89685 31.4017 9.89685H25.3788Z",fill:"white",stroke:"black",strokeWidth:"2.1869"})))},Er=function(e){return a.a.createElement(xr,e)};function kr(e){return(kr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Rr(){var e=jr(["\n position: absolute;\n overflow: hidden;\n top: 0; left: 0;\n height: 100%;\n background-color: ",";\n border-radius: 12px;\n text-align: center;\n padding: 0 10px;\n vertical-align: middle;\n color: white;\n font-family: ",";\n font-size: 13px;\n display: flex;\n justify-content: center;\n align-items: center;\n transition: min-width .2s ease-out;\n\n background-size: 30px 30px;\n background-image: linear-gradient(135deg, rgba(255, 255, 255, .15) 25%,\n transparent 25%,\n transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%,\n transparent 75%, transparent);\n animation: ",";\n\n @keyframes animate-stripes {\n 0% { background-position: 0 0; }\n 100% { background-position: 60px 0; }\n }\n"]);return Rr=function(){return e},e}function Or(){var e=jr(["\n position: relative;\n box-sizing: border-box;\n height: 30px;\n background: linear-gradient(\n 180deg,\n rgba(0, 0, 0, 0.06) 0%,\n rgba(0, 0, 0, 0.02) 50%,\n rgba(0, 0, 0, 0.10) 100%\n );\n border-radius: 12px;\n\n .nui-progress-buttons {\n position: absolute;\n height: 100%;\n right: 0px;\n display: flex;\n align-items: center;\n padding-right: 5px;\n\n .nui-progress-button {\n border: none;\n display: flex;\n justify-content: center;\n align-items: center;\n margin-left: 2px;\n border-radius: 100%;\n color: white;\n padding: 2px;\n width: 18px;\n height: 18px;\n background-color: ",";\n\n &:hover {\n background-color: ",";\n }\n\n &.stop {\n background: ",";\n\n &:hover {\n background-color: ",";\n }\n }\n }\n }\n"]);return Or=function(){return e},e}function jr(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}Er.propTypes={},Er.defaultProps={};var Cr=Object(v.a)((function(e){var n=e.value,t=void 0===n?0:n,r=e.max,o=void 0===r?100:r,i=e.busy,c=void 0!==i&&i,l=e.status;t=Math.min(t,o);var u=parseFloat(t)/parseFloat(o);return a.a.createElement("div",{className:e.className},a.a.createElement(Sr,{ratio:u,busy:e.busy,status:l}),a.a.createElement("div",{className:"nui-progress-buttons"},c&&e.onPauseClick&&a.a.createElement("div",{className:"nui-progress-button pause",onClick:e.onPauseClick},e.paused?a.a.createElement(k.InlineIcon,{icon:W.a}):a.a.createElement(k.InlineIcon,{icon:H.a})),c&&e.onStopClick&&a.a.createElement("div",{className:"nui-progress-button stop",onClick:e.onStopClick},a.a.createElement(k.InlineIcon,{icon:Z.a}))))}))(Or(),E.blue,Object(w.a)(.1,E.blue),E.red,Object(w.a)(.1,E.red)),Sr=Object(v.a)((function(e){var n,t,r,o=isNaN(e.ratio)?0:parseInt(Math.round(100*e.ratio)),i=kr(e.status),c="undefined"!==i?"string"===i?e.status:e.status(o):"".concat(o,"%");return a.a.createElement("div",{className:e.className,style:(n={minWidth:28},t="minWidth",r=o+"%",t in n?Object.defineProperty(n,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[t]=r,n)},a.a.createElement("div",null,c))}))(Rr(),E.progress,E.fontFamily,(function(e){return e.busy?"animate-stripes 1.6s linear infinite":"none"})),Pr=function(e){return a.a.createElement(Cr,e)};function _r(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw o}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return Ar(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ar(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ar(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function Tr(){var e=zr(["\n\tbackground-color: rgba(",", 0.8);\n\tborder-radius: 4px;\n\tcolor: ",";\n\tfont-family: ",";\n\tfont-weight: normal;\n\tmin-width: 180px;\n\tmax-width: 280px;\n\tfont-size: ",";\n\tpadding: 8px 12px;\n\tposition: absolute;\n \tmax-width: 280px;\n\tdisplay: ",';\n\tz-index: 100;\n\n\t&:before {\n\t\tcontent: "";\n\t\tposition: absolute;\n\t\tborder: 4px solid transparent;\n\t}\n\n\t&.top {\n\t\t&:before {\n\t\t\tmargin-left: -4px;\n\t\t\ttop: 100%;\n\t\t\tleft: 50%;\n\t\t\tborder-top: 4px solid rgba(',", 0.8);\n\t\t}\n\t}\n\n\t&.left {\n\t\t&:before {\n\t\t\tmargin-top: -4px;\n\t\t\ttop: 50%;\n\t\t\tright: -8px;\n\t\t\tborder-left: 4px solid rgba(",", 0.8);\n\t\t}\n\t}\n\n\t&.right {\n\t\t&:before {\n\t\t\tmargin-top: -4px;\n\t\t\ttop: 50%;\n\t\t\tleft: -8px;\n\t\t\tborder-right: 4px solid rgba(",", 0.8);\n\t\t}\n\t}\n\n\t&.bottom {\n\t\t&:before {\n\t\t\tmargin-left: -4px;\n\t\t\ttop: -8px;\n\t\t\tleft: 50%;\n\t\t\tborder-bottom: 4px solid rgba(",", 0.8);\n\t\t}\n\t}\n\n\t","\n"]);return Tr=function(){return e},e}function Nr(){var e=zr(["\n\tdisplay: flex;\n"]);return Nr=function(){return e},e}function zr(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}Pr.propTypes={value:u.a.number,max:u.a.number,busy:u.a.bool,paused:u.a.bool,onPauseClick:u.a.func,onStopClick:u.a.func,status:u.a.oneOf([u.a.string,u.a.func])},Pr.defaultProps={value:0,max:100,busy:!1,paused:!1,onPauseClick:void 0,onStopClick:void 0,status:void 0};var Ir=v.a.div(Nr()),Mr=v.a.div(Tr(),E.blackRGB,E.white,E.fontFamily,E.fontSizeText,(function(e){return e.visible?"inline-block":"none"}),E.blackRGB,E.blackRGB,E.blackRGB,E.blackRGB,(function(e){return e.style})),Fr=function(e){var n=e.text,t=void 0===n?"Hello world!":n,o=e.position,i=void 0===o?"top":o,c=_r(Object(r.useState)(!1),2),l=c[0],u=c[1],s=Ve(),f=s.ref,d=s.width,m=s.height,p=Ve(),h=p.ref,b=p.width,y=p.height,g=Object(r.useMemo)((function(){var e=0,n=0;if("top"===i)e=-1*m-5,n=d/2*-1+b/2;else if("bottom"===i)e=y+5,n=d/2*-1+b/2;else if("left"===i){e=(m-y)/2*-1,n=-1*d-5}else if("right"===i){e=(m-y)/2*-1,n=b+5}return{transform:"translateX(".concat(n,"px) translateY(").concat(e,"px)")}}),[i,d,m,b,y]);return a.a.createElement(Ir,null,a.a.createElement(Mr,{ref:f,visible:l,className:i,style:g},t),a.a.createElement("div",{ref:h,onMouseEnter:function(){return u(!0)},onMouseLeave:function(){return u(!1)}},e.children))},Br=function(e){return a.a.createElement(Fr,e)};function Lr(){return(Lr=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function Dr(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function qr(){var e=Hr(["\n\n &.nui-clickable {\n cursor: pointer;\n }\n\n &.spin {\n animation-name: spin;\n animation-duration: 700ms;\n animation-iteration-count: infinite;\n animation-timing-function: linear;\n\n @keyframes spin {\n 0% {\n transform: rotate(360deg);\n }\n 100% {\n transform: rotate(0deg);\n }\n }\n }\n"]);return qr=function(){return e},e}function Ur(){var e=Hr(["\n display: flex;\n align-items: center;\n"]);return Ur=function(){return e},e}function Hr(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}Br.propTypes={text:u.a.string,position:u.a.oneOf(["top","right","bottom","left"])},Br.defaultProps={text:"Hello world!",position:"top"};var Gr=v.a.div(Ur()),Wr=Object(v.a)(k.Icon)(qr()),$r=function(e){var n=e.icon,t=e.spinning,r=void 0!==t&&t,o=e.className,i=void 0===o?"":o,c=e.tooltip,l=e.containerStyle,u=Dr(e,["icon","spinning","className","tooltip","containerStyle"]);u.width||u.height||(u.width=u.height=30);var s=function(){return"string"==typeof n?Ce[n]||null:n},f="nui-icon ".concat(i).concat(u.onClick?" nui-clickable":"").concat(r?" spin":"");return c?a.a.createElement(Br,{text:c.text,position:c.position||"top"},a.a.createElement(Gr,{style:l},a.a.createElement(Wr,Lr({icon:s(),className:f},u)))):a.a.createElement(Gr,{style:l},a.a.createElement(Wr,Lr({icon:s(),className:f},u)),c?a.a.createElement(Br,null,c):null)},Jr=function(e){return a.a.createElement($r,e)};Jr.propTypes={icon:u.a.oneOfType([u.a.instanceOf(k.IconifyIcon),u.a.oneOf(["lock","lock-open","file-undo","chevron-double-left","chevron-double-right","chevron-left","chevron-right","chevron-down","chevron-up","pause","play","replay","check","stop","delete","undo","alert","database","pencil","tools","cog","close","cat","upload"])]),spinning:u.a.bool,className:u.a.string,tooltip:u.a.string},Jr.defaultProps={icon:void 0,spinning:!1,className:"",tooltip:void 0};var Vr=t(56),Yr=t.n(Vr);function Kr(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n position: relative;\n color: white;\n font-family: ",";\n font-size: ",";\n display: flex;\n align-items: center;\n padding: 15px 20px;\n background-color: ",";\n border-bottom: 5px #2981b5 solid;\n display: flex;\n\n .nui-header-logo-container {\n width: 55px;\n height: 55px;\n padding: 10px;\n margin-right: 20px;\n background: #3D5D8D;\n border-radius: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .nui-header-title-container {\n flex-direction: column;\n display: flex;\n\n .nui-header-title {\n color: white;\n font-family: ",";\n font-size: 23px;\n line-height: normal;\n margin: 0;\n }\n\n .nui-header-subtitle {\n color: white;\n font-family: ",";\n line-height: normal;\n font-size: ",";\n }\n }\n\n .nui-header-extra-content {\n flex: 1;\n margin: 0 20px;\n }\n"]);return Kr=function(){return e},e}var Zr=v.a.div(Kr(),E.fontFamily,E.fontSizeText,E.header,E.fontFamily,E.fontFamily,E.fontSizeText),Xr=function(e){var n=e.title,t=void 0===n?"NekoUI":n,r=e.subtitle,o=void 0===r?"By Jordy Meow":r,i=e.children,c=e.saving,l=void 0!==c&&c;return a.a.createElement(Zr,null,a.a.createElement("div",{className:"nui-header-logo-container"},a.a.createElement(Er,null)),a.a.createElement("div",{className:"nui-header-title-container"},a.a.createElement("h1",{className:"nui-header-title"},t),a.a.createElement("small",{className:"nui-header-subtitle"},a.a.createElement("a",{target:"_blank",href:"https://meowapps.com",style:{color:"white",textDecoration:"none"}},o))),a.a.createElement("div",{className:"nui-header-extra-content"},i),l&&a.a.createElement(Jr,{icon:Yr.a,width:"36",height:"36"}))},Qr=function(e){return a.a.createElement(Xr,e)};function ea(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n align-items: center;\n display: flex;\n\n .neko-paging-text {\n font-family: ",";\n font-style: normal;\n font-weight: normal;\n font-size: 15px;\n line-height: 14px;\n }\n\n .neko-paging-controller {\n box-sizing: border-box;\n height: 30px;\n align-items: center;\n background-color: rgba(",", 0.8);\n border-radius: 15px;\n display: flex;\n margin-left: 15px;\n padding: 3px 5px;\n\n .nako-paging-controller-icon {\n background-color: ",";\n border-radius: 100%;\n cursor: pointer;\n margin-right: 2px;\n height: 22px;\n width: 22px;\n box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.25);\n transition: transform 0.1s ease-in;\n box-sizing: border-box;\n\n :last-child {\n margin-right: 0;\n }\n\n &.disabled {\n color: ",";\n cursor: default;\n pointer-events: none;\n }\n\n &:hover {\n transform: scale(1.2) !important;\n z-index: 10;\n position: relative;\n }\n }\n\n .nako-paging-controller-text {\n color: ",";\n font-family: ",";\n font-style: normal;\n font-weight: normal;\n font-size: 13px;\n margin: 0 40px;\n user-select: none;\n }\n }\n"]);return ea=function(){return e},e}Qr.propTypes={title:u.a.string,subtitle:u.a.string,saving:u.a.bool},Qr.defaultProps={title:"NekoUI",subtitle:"By Jordy Meow",saving:!1};var na=v.a.div(ea(),E.fontFamily,E.blueRGB,E.white,E.darkGray,E.white,E.fontFamily),ta=function(e){var n=e.currentPage,t=e.limit,r=e.onClick,o=e.total,i=Math.ceil(0===o?1:t>0?o/t:1),c="nako-paging-controller-icon ".concat(1===n?"disabled":""),l="nako-paging-controller-icon ".concat(n===i?"disabled":""),u=function(e){r(e)};return a.a.createElement(na,null,a.a.createElement("span",{className:"neko-paging-text"},o," result",o>0?"s":""),a.a.createElement("div",{className:"neko-paging-controller"},a.a.createElement(k.Icon,{icon:A.a,className:c,onClick:function(){return u(1)}}),a.a.createElement(k.Icon,{icon:I.a,className:c,onClick:function(){return u(n-1)}}),a.a.createElement("p",{className:"nako-paging-controller-text"},"Page ",n," of ",i),a.a.createElement(k.Icon,{icon:F.a,className:l,onClick:function(){return u(n+1)}}),a.a.createElement(k.Icon,{icon:N.a,className:l,onClick:function(){return u(i)}})))},ra=function(e){return a.a.createElement(ta,e)};function aa(){var e=ia(["\n color: ",";\n cursor: pointer;\n font-family: ",";\n font-style: normal;\n font-weight: normal;\n font-size: 14px;\n line-height: 17px;\n\n &.is-active {\n cursor: default;\n color: ",';\n font-weight: bold;\n }\n\n &::after {\n content: "|";\n color: ',";\n padding: 0 4px;\n }\n\n &:last-child::after {\n content: none;\n }\n\n span {\n color: ",";\n font-weight: normal;\n margin-left: 4px;\n }\n"]);return aa=function(){return e},e}function oa(){var e=ia(["\n display: flex;\n align-items: center;\n"]);return oa=function(){return e},e}function ia(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}ra.propTypes={currentPage:u.a.number,limit:u.a.number,total:u.a.number,onClick:u.a.func},ra.defaultProps={currentPage:void 0,limit:void 0,total:void 0,onClick:void 0};var ca=v.a.div(oa()),la=v.a.span(aa(),E.blue,E.fontFamily,E.black,E.darkGray,E.darkGray),ua=function(e){var n=e.id,t=e.value,r=e.onChange,o=e.busy,i=void 0!==o&&o,c=a.a.Children.map(e.children,(function(e,o){return a.a.cloneElement(e,{busy:i,isActive:e.props.value===t,onClick:function(e){e!==t&&r(e,n)}})}));return a.a.createElement(ca,null,c)},sa=function(e){var n=e.title,t=e.value,r=void 0===t?0:t,o=e.count,i=e.onClick,c=e.busy,l=e.isActive;return a.a.createElement(la,{onClick:function(){return i(r)},className:"".concat(l?"is-active":"")},n,a.a.createElement("span",null,"(",c?a.a.createElement(Jr,{icon:"replay",spinning:!0,width:12,containerStyle:{display:"inline"}}):o,")"))},fa=function(e){return a.a.createElement(ua,e)};fa.propTypes={id:u.a.string,value:u.a.string,onChange:u.a.func},fa.defaultProps={id:void 0,value:void 0,onChange:void 0};var da=function(e){return a.a.createElement(sa,e)};function ma(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n .mask {\n position: absolute;\n overflow: hidden;\n display: block;\n width: ","px;\n height: ","px;\n }\n\n .semi-circle {\n position: relative;\n display: block;\n width: ","px;\n height: ",'px;\n background: linear-gradient(to right, #27b775 0%, #f3f32c 50%, #f71b1b 100%);\n border-radius: 50% 50% 50% 50% / 100% 100% 0% 0% ;\n\n &::before {\n content: "";\n position: absolute;\n bottom: 0;\n left: 50%;\n z-index: 2;\n display: block;\n width: 140px;\n height: 70px;\n margin-left: -70px;\n background: ',";\n border-radius: 50% 50% 50% 50% / 100% 100% 0% 0% ;\n } \n }\n\n .semi-circle--mask {\n position: absolute;\n top: 0;\n left: 0;\n width: ","px;\n height: ",'px;\n background: transparent;\n transform-origin: center center;\n backface-visibility: hidden;\n transition: all .3s ease-in-out;\n\n &::before {\n content: "";\n position: absolute;\n top: 0;\n left: 0%;\n z-index: 2;\n display: block;\n width: ',"px;\n height: ","px;\n margin-top: -1px;\n margin-left: -1px;\n background: #5396c1d6;\n border-radius: 50% 50% 50% 50% / 100% 100% 0% 0% ;\n } \n }\n\n .gauge { \n width: ","px;\n height: ","px;\n \n .semi-circle--mask {\n transform: rotate(","deg) translate3d(0,0,0);\n }\n }\n\n .child-container {\n position: absolute;\n font-size: 16px;\n display: flex;\n width: ","px;\n height: ","px;\n z-index: 10;\n\n .spacing {\n flex: auto;\n }\n\n .child {\n color: white;\n flex: 1;\n display: flex;\n flex-direction: column;\n align-items: center;\n }\n }\n"]);return ma=function(){return e},e}da.propTypes={title:u.a.string,value:u.a.string,count:u.a.number,onClick:u.a.func,isActive:u.a.bool},da.defaultProps={title:void 0,value:"default",count:0,onClick:void 0,isActive:!1};var pa=v.a.section(ma(),(function(e){return e.width}),(function(e){return e.width/2}),(function(e){return e.width}),(function(e){return e.width/2}),(function(e){return e.backgroundColor}),(function(e){return e.width}),(function(e){return e.width}),(function(e){return e.width+2}),(function(e){return e.width/2+2}),(function(e){return e.width}),(function(e){return e.width/2}),(function(e){return e.degrees}),(function(e){return e.width+2}),(function(e){return e.width/2})),ha=function(e){var n=e.value,t=void 0===n?1e3:n,r=(e.min,e.max),o=void 0===r?2500:r,i=e.width,c=void 0===i?200:i,l=e.background,u=void 0===l?"#007cba":l,s=e.children,f=180*(t<=o?t:o)/o;return a.a.createElement(pa,{backgroundColor:u,degrees:f,width:c},a.a.createElement("div",{class:"gauge"},a.a.createElement("div",{class:"mask"},a.a.createElement("div",{class:"semi-circle"}),a.a.createElement("div",{class:"semi-circle--mask"})),a.a.createElement("div",{class:"child-container"},a.a.createElement("div",{class:"child"},a.a.createElement("div",{class:"spacing"}),s))))};function ba(){var e=ga(["\n background: #1eba96;\n padding: 20px;\n color: white;\n border-radius: 10px;\n font-size: 15px;\n text-align: center;\n\n a {\n color: white;\n font-weight: bold;\n }\n"]);return ba=function(){return e},e}function ya(){var e=ga(["\n background: #ba341e;\n padding: 20px;\n color: white;\n border-radius: 10px;\n font-size: 15px;\n\n a {\n color: white;\n font-weight: bold;\n }\n"]);return ya=function(){return e},e}function ga(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}var va=v.a.p(ya()),wa=v.a.p(ba()),xa=t(57),Ea=t.n(xa);function ka(){return(ka=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function Ra(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function Oa(){var e=Ca(["\n width: 518px;\n\n p {\n margin: 0;\n }\n .title {\n font-family: ",";\n font-style: normal;\n font-weight: normal;\n font-size: 18px;\n line-height: 22px;\n }\n .content {\n font-family: ",";\n font-style: normal;\n font-weight: normal;\n font-size: 13px;\n line-height: 14px;\n margin-top: 15px;\n margin-bottom: 30px;\n }\n .button-group {\n align-items: center;\n display: flex;\n justify-content: flex-end;\n margin-top: 15px;\n }\n"]);return Oa=function(){return e},e}function ja(){var e=Ca(["\n\n .ReactModal__Overlay {\n z-index: 100;\n display: flex;\n justify-content: center;\n flex-direction: column;\n align-items: center;\n background: "," !important;\n }\n .ReactModal__Overlay {\n opacity: 0;\n transition: opacity 200ms ease-in-out;\n }\n .ReactModal__Overlay--after-open {\n opacity: 1;\n }\n .ReactModal__Overlay--before-close {\n opacity: 0;\n }\n .ReactModal__Overlay .neko-modal {\n opacity: 0;\n transform: scale(0.85);\n transition: all 200ms ease-in-out;\n }\n .ReactModal__Overlay--after-open .neko-modal {\n transform: scale(1);\n opacity: 1;\n }\n .ReactModal__Overlay--before-close .neko-modal {\n transform: scale(0.85);\n opacity: 0;\n }\n .neko-modal {\n background: ",";\n position: relative;\n box-shadow: 2px 2px 15px 2px rgba(0, 0, 0, 0.8);\n outline: none;\n padding: 15px;\n max-width: 820px;\n }\n"]);return ja=function(){return e},e}function Ca(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}var Sa=v.a.div(ja(),E.overlay,E.white),Pa=v.a.div(Oa(),E.fontFamily,E.fontFamily),_a=function(e){var n=e.children,t=e.className,r=e.style,o=e.ok,i=void 0===o?"OK":o,c=e.cancel,l=void 0===c?"Cancel":c,u=e.customButtons,s=void 0===u?null:u,f=e.title,d=void 0===f?"":f,m=e.content,p=void 0===m?"":m,h=e.onOkClick,b=e.onCancelClick,y=Ra(e,["children","className","style","ok","cancel","customButtons","title","content","onOkClick","onCancelClick"]),g=r?"custom-modal":"",v=n||a.a.createElement(Pa,null,d&&a.a.createElement("p",{className:"title"},d),p&&a.a.createElement("p",{className:"content"},p),a.a.createElement("div",{className:"button-group"},b&&a.a.createElement(Ne,{className:"danger",onClick:b},l),h&&a.a.createElement(Ne,{onClick:h},i),s));return a.a.createElement(a.a.Fragment,null,a.a.createElement(Sa,{id:"neko-modal-parent"}),a.a.createElement(Ea.a,ka({ariaHideApp:!1,parentSelector:function(){return document.getElementById("neko-modal-parent")},closeTimeoutMS:200,className:"neko-modal ".concat(t||""," ").concat(g)},y),v))},Aa=function(e){return a.a.createElement(_a,e)};Aa.propTypes={className:u.a.string,style:u.a.object,ok:u.a.string,cancel:u.a.string,title:u.a.string,content:u.a.string,onOkClick:u.a.func,onCancelClick:u.a.func,customButtons:u.a.object},Aa.defaultProps={className:void 0,style:void 0,ok:"OK",cancel:"Cancel",title:"",content:"",onOkClick:void 0,onCancelClick:void 0,customButtons:null};var Ta=t(58),Na=t.n(Ta);function za(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function Ia(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n background-color: ",";\n font-family: ",";\n border-spacing: 0;\n width: 100%;\n\n th, td {\n margin: 0;\n padding: 5px;\n border-bottom: 1px solid rgba(",", 0.1);\n border-right: 1px solid rgba(",", 0.1);\n\n a {\n text-decoration: none;\n }\n\n :last-child {\n border-right: 0;\n }\n }\n\n th, tfoot td {\n height: 30px;\n background-color: ",";\n color: ",";\n font-style: normal;\n font-weight: normal;\n font-size: 13px;\n line-height: 16px;\n text-align: left;\n\n div {\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n &.sortable {\n cursor: pointer;\n }\n }\n }\n\n tbody {\n tr {\n :nth-child(even) {\n background-color: ",";\n }\n &.selected {\n background-color: rgba(",", 0.8);\n color: ",";\n\n a {\n color: #81e8ff;\n }\n }\n }\n img {\n vertical-align: bottom;\n }\n }\n\n tfoot tr:last-child {\n td {\n border-bottom: 0;\n }\n }\n\n .table-checkbox-cell {\n width: 35px;\n text-align: center;\n\n svg {\n padding: 5px;\n cursor: pointer;\n }\n }\n"]);return Ia=function(){return e},e}var Ma=v.a.table(Ia(),E.white,E.fontFamily,E.blackRGB,E.blackRGB,E.blue,E.white,E.tableGray,E.blueRGB,E.white),Fa=function(e){var n=e.checked,t=e.intermediate,r=void 0!==t&&t,o=e.onSelect,i=void 0===o?function(){}:o,c=e.onUnselect,l=void 0===c?function(){}:c;za(e,["checked","intermediate","onSelect","onUnselect"]);return a.a.createElement(k.Icon,{icon:r?Na.a:n?mt.a:ft.a,width:"24px",height:"24px",onClick:function(){n?l():i()}})},Ba=function(e){var n=e.columns,t=e.data,r=e.busy,o=void 0!==r&&r,i=e.onSelect,c=e.onUnselect,l=e.selectedItems,u=e.sort,s=e.onSortChange,f=n.length+(i?1:0),d=t.map((function(e){var t=n.map((function(n){return{value:e[n.accessor],style:n.style||{}}}));return{id:e.id,cells:t}})),m=d.map((function(e){return e.id})),p=m.filter((function(e){return l.includes(e)})).length===m.length,h=!p&&l.length>0,b=a.a.createElement("tr",null,i&&a.a.createElement("th",{className:"table-checkbox-cell"},a.a.createElement(Fa,{checked:p,intermediate:h,onSelect:function(){return i(m)},onUnselect:function(){c(h?l:m)}})),n.map((function(e){var n=u&&u.accessor===e.accessor,t=u&&"asc"===u.by,r=e.style||{};return a.a.createElement("th",{style:r,key:e.accessor},a.a.createElement("div",{className:e.sortable?"sortable":"",onClick:e.sortable?function(){s(e.accessor,n&&t?"desc":"asc")}:void 0},a.a.createElement("div",null,e.title),a.a.createElement("div",null,e.sortable&&a.a.createElement(k.Icon,{icon:n?t?L.a:q.a:L.a,color:n?E.white:"rgba(".concat(E.blackRGB,", 0.1)"),width:"1.6rem",height:"1.6rem"}))))})));return a.a.createElement(g,{busy:o,overlayStyle:{top:"36px",height:"calc(100% - 76px)"}},a.a.createElement(Ma,null,a.a.createElement("thead",null,b),a.a.createElement("tbody",null,!d.length&&a.a.createElement("tr",null,a.a.createElement("td",{colspan:f,style:{textAlign:"center",height:40,color:"gray"}},"Empty.")),d.map((function(e){return a.a.createElement("tr",{className:l.includes(e.id)?"selected":""},i&&a.a.createElement("td",{className:"table-checkbox-cell"},a.a.createElement(Fa,{checked:l.includes(e.id),onSelect:function(){return i([e.id])},onUnselect:function(){return c([e.id])}})),e.cells.map((function(e){return a.a.createElement("td",{style:e.style},e.value)})))}))),a.a.createElement("tfoot",null,b)))},La=function(e){return a.a.createElement(Ba,e)};function Da(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw o}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return qa(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return qa(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qa(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function Ua(){var e=$a(["\n background-color: ",";\n display: none;\n padding: 10px;\n\n &.active {\n display: block;\n }\n"]);return Ua=function(){return e},e}function Ha(){var e=$a(["\n font-family: ",";\n font-size: ",";\n border-radius: 8px 8px 0px 0px;\n border: 0;\n background-color: #459ad2;\n color: rgb(255 255 255 / 35%);\n\n cursor: pointer;\n line-height: 17px;\n margin-right: 5px;\n text-align: left;\n padding: 10px 15px 10px 15px;\n\n &:focus {\n outline: none;\n }\n\n &.active {\n background-color: ",";\n color: ",";\n }\n\n &.disabled {\n background-color: rgb(224 156 54);\n cursor: default;\n display: inline-flex;\n padding-bottom: 7px;\n }\n"]);return Ha=function(){return e},e}function Ga(){var e=$a(["\n"]);return Ga=function(){return e},e}function Wa(){var e=$a(["\n"]);return Wa=function(){return e},e}function $a(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}La.propTypes={columns:u.a.arrayOf(u.a.any),data:u.a.arrayOf(u.a.any),busy:u.a.arrayOf(u.a.bool),onSelect:u.a.func,onUnselect:u.a.func,selectedItems:u.a.arrayOf(u.a.object),onSortChange:u.a.func},La.defaultProps={columns:void 0,data:void 0,busy:!1,onSelect:void 0,onUnselect:void 0,selectedItems:void 0,onSortChange:void 0};var Ja=v.a.div(Wa()),Va=v.a.div(Ga()),Ya=v.a.button(Ha(),E.fontFamily,E.fontSizeText,E.blue,E.white),Ka=v.a.div(Ua(),E.blue),Za=function(e){var n=Da(a.a.useState(0),2),t=n[0],r=n[1],o=a.a.Children.map(e.children,(function(n,t){var r=n.props.title||"Untitled Tab "+(t+1);return{key:n.props.key||"neko-tab-"+r.toLowerCase(),title:r,onClick:n.props.onClick?n.props.onClick:null,requirePro:!e.isPro&&(n.props.requirePro||!1)}})),i=a.a.Children.map(e.children,(function(e,n){return a.a.cloneElement(e,{isActive:n===t})}));return a.a.createElement(Ja,null,a.a.createElement(Va,null,o.map((function(n,o){return a.a.createElement(Ya,{key:n.key,className:"neko-tab-title ".concat(o===t?"active":""," ").concat(n.requirePro?"disabled":""),onClick:function(t){!function(n,t,a){t.requirePro||(r(n),e.onChange&&e.onChange(n,t,a))}(o,n,t)}},n.title,a.a.createElement(Le,{className:"inline",style:{marginLeft:10,marginRight:-5,top:-1},show:n.requirePro}))}))),i)},Xa=function(e){var n=e.children,t=e.isActive;return a.a.createElement(Ka,{className:"".concat(t?"active":"")},n)},Qa=function(e){return a.a.createElement(Za,e)};Qa.propTypes={isPro:u.a.bool,onChange:u.a.func},Qa.defaultProps={isPro:!1,onChange:void 0};var eo=function(e){return a.a.createElement(Xa,e)};function no(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw o}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return to(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return to(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function to(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function ro(){var e=io(["\n background-color: ",";\n display: none;\n\n &.active {\n display: block;\n }\n"]);return ro=function(){return e},e}function ao(){var e=io(["\n align-items: center;\n background-color: ",";\n border: 0;\n cursor: pointer;\n display: flex;\n padding: 2px 3px 2px 19px;\n\n &.disabled {\n background-color: rgba(",", 0.25);\n cursor: default;\n }\n\n p {\n color: ",";\n font-family: ",";\n font-size: 14px;\n line-height: 17px;\n margin: 0;\n }\n\n .neko-side-tab-icon {\n color: ",";\n margin-left: auto;\n height: 36px;\n width: 36px;\n }\n"]);return ao=function(){return e},e}function oo(){var e=io(["\n"]);return oo=function(){return e},e}function io(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}eo.propTypes={isActive:u.a.bool,requirePro:u.a.bool,title:u.a.string},eo.defaultProps={isActive:!1,requirePro:!1,title:void 0};var co=v.a.div(oo()),lo=v.a.div(ao(),E.blue,E.yellowRGB,E.white,E.fontFamily,E.white),uo=v.a.div(ro(),E.white),so=function(e){var n=no(a.a.useState(),2),t=n[0],r=n[1],o=a.a.Children.map(e.children,(function(n,t){var r=n.props.title||"Untitled Tab "+(t+1);return{key:n.props.key||"neko-tab-"+r.toLowerCase(),title:r,onClick:n.props.onClick?n.props.onClick:null,requirePro:!e.isPro&&(n.props.requirePro||!1)}})),i=a.a.Children.map(e.children,(function(e,n){return a.a.cloneElement(e,{isActive:n===t})}));return a.a.createElement(co,null,o.map((function(n,o){return a.a.createElement(a.a.Fragment,null,a.a.createElement(lo,{key:n.key,className:"".concat(o===t?"active":""," ").concat(n.requirePro?"disabled":""),onClick:function(a){!function(n,a,o){if(!a.requirePro){var i=n===t?null:n;r(i),e.onChange&&e.onChange(i,a,o)}}(o,n,a)}},a.a.createElement("p",null,n.title,a.a.createElement(Le,{className:"inline",show:n.requirePro})),a.a.createElement(k.Icon,{icon:o===t?L.a:F.a,className:"neko-side-tab-icon"})),i[o])})))},fo=function(e){var n=e.children,t=e.isActive;return a.a.createElement(uo,{className:"".concat(t?"active":"")},n)},mo=function(e){return a.a.createElement(so,e)};mo.propTypes={isPro:u.a.bool,onChange:u.a.func},mo.defaultProps={isPro:!1,onChange:void 0};var po=function(e){return a.a.createElement(fo,e)};function ho(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n box-sizing: border-box;\n display: flex;\n width: 100%;\n padding: 10px 10px;\n background: ",";\n border-radius: 10px;\n box-shadow: 0px 0px 10px rgba(",", 0.1);\n\n &.left {\n justify-content: flex-start;\n }\n\n &.right {\n justify-content: flex-end;\n }\n\n > *:not(:last-child) {\n margin-right: 5px;\n }\n"]);return ho=function(){return e},e}po.propTypes={isActive:u.a.bool,requirePro:u.a.bool,title:u.a.string},po.defaultProps={isActive:!1,requirePro:!1,title:void 0};var bo=v.a.div(ho(),E.white,E.blackRGB),yo=function(e){var n=e.align,t=void 0===n?"left":n;return a.a.createElement(bo,{className:t},e.children)},go=function(e){return a.a.createElement(yo,e)};go.propTypes={align:u.a.oneOf(["left","right"])},go.defaultProps={align:"left"};t(22);function vo(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}var wo=function e(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};vo(this,e),this.url=r,this.message=n,this.code=t,this.body=a,this.debug=o};function xo(e,n,t,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void t(e)}c.done?n(l):Promise.resolve(l).then(r,a)}function Eo(e){return function(){var n=this,t=arguments;return new Promise((function(r,a){var o=e.apply(n,t);function i(e){xo(o,r,a,i,c,"next",e)}function c(e){xo(o,r,a,i,c,"throw",e)}i(void 0)}))}}function ko(e,n){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=function(e,n){if(!e)return;if("string"==typeof e)return Ro(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ro(e,n)}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,c=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return i=e.done,e},e:function(e){c=!0,o=e},f:function(){try{i||null==t.return||t.return()}finally{if(c)throw o}}}}function Ro(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function Oo(e,n){for(var t=[],r=0;r<e.length;r+=n)t.push(e.slice(r,r+n));return t}var jo=function(e){if(!e.data)return e;if(e.data.length>0&&e.data[0].meta){var n,t=ko(e.data);try{for(t.s();!(n=t.n()).done;){var r=n.value;try{r.meta=JSON.parse(r.meta)}catch(e){console.error("[JsonFetcher]","Could not decode meta.",r.meta)}}}catch(e){t.e(e)}finally{t.f()}}else if(e.data.meta)try{e.data.meta=JSON.parse(e.data.meta)}catch(e){console.error("[JsonFetcher]","Could not decode meta.",x.meta)}return e},Co=function(){var e=Eo(regeneratorRuntime.mark((function e(n){var t,r,a,o,i,c,l,u,s,f=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=f.length>1&&void 0!==f[1]?f[1]:{},r=null,a={},o=null,i=null,e.prev=5,e.next=8,fetch("".concat(n),t);case 8:return i=e.sent,e.next=11,i.text();case 11:r=e.sent,(a=JSON.parse(r)).success||(c=!1===a.success?"NOT-SUCCESS":"N/A",l=a.message?a.message:"Unknown error. Check your Console Logs.","rest_no_route"===a.code?(l="The API can't be accessed. Is Rest API enabled?",c="NO-ROUTE"):"internal_server_error"===a.code&&(l="Server error. Please check your PHP Error Logs.",c="SERVER-ERROR"),o=new wo(l,c,n,r||i)),e.next=22;break;case 16:e.prev=16,e.t0=e.catch(5),u="BROKEN-REPLY",s="The reply sent by the server is broken.",i&&i.status&&408===i.status&&(u="REQUEST-TIMEOUT",s="The request generated a timeout."),o=new wo(s,u,n,r||i,e.t0);case 22:return o&&(console.error("[NekoError] JsonFetcher",o.url,{code:o.code,error:o.error,body:o.body}),a.success=!1,a.error=o),e.abrupt("return",jo(a));case 24:case"end":return e.stop()}}),e,null,[[5,16]])})));return function(n){return e.apply(this,arguments)}}(),So=function(){var e=Eo(regeneratorRuntime.mark((function e(n,t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Co(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:r}));case 1:case"end":return e.stop()}}),e)})));return function(n,t,r){return e.apply(this,arguments)}}(),Po=wpmc_media_cleaner.prefix,_o=wpmc_media_cleaner.domain,Ao=wpmc_media_cleaner.rest_url.replace(/\/+$/,""),To=wpmc_media_cleaner.api_url.replace(/\/+$/,""),No=wpmc_media_cleaner.plugin_url.replace(/\/+$/,""),zo="1"===wpmc_media_cleaner.is_pro,Io=zo&&"1"===wpmc_media_cleaner.is_registered;function Mo(){var e=qo(["\n color: white;\n margin: 0px 15px 15px 15px;\n\n .fatal {\n padding: 8px 12px;\n border-radius: 10px;\n background: #ab3014;\n margin: 0 0 10px 0;\n border: 0;\n }\n\n .warning {\n padding: 8px 12px;\n border-radius: 10px;\n background: #b98c0e;\n margin: 0 0 10px 0;\n border: 0;\n }\n\n .notice {\n padding: 8px 12px;\n border-radius: 10px;\n background: #23ad74;\n margin: 0 0 10px 0;\n border: 0;\n }\n"]);return Mo=function(){return e},e}function Fo(){var e=qo(["\n\n margin: 15px;\n\n .center {\n background: white;\n border-radius: 10px;\n padding: 10px;\n font-family: Lato;\n max-width: 100%\n overflow: none;\n\n h2 {\n font-size: 26px;\n }\n\n table {\n width: 100%;\n\n tr td:first-child {\n width: 220px;\n font-weight: bold;\n color: #1e7cba;\n }\n\n * {\n overflow-wrap: anywhere;\n }\n }\n }\n\n hr {\n border-color: #1e7cba;\n }\n"]);return Fo=function(){return e},e}function Bo(){var e=qo(["\n width: 85px;\n height: 85px;\n padding-right: 10px;\n"]);return Bo=function(){return e},e}function Lo(){var e=qo(["\n\n .nui-block-title {\n display: none;\n }\n\n .nui-block-content {\n display: flex;\n padding: 10px;\n\n h2 {\n color: #055082;\n font-size: 16px;\n margin: 5px 0 5px 0;\n\n a {\n text-decoration: none;\n }\n }\n\n p {\n margin: 0px;\n line-height: 18px;\n }\n }\n"]);return Lo=function(){return e},e}function Do(){var e=qo(["\n color: white;\n padding: 15px;\n margin-bottom: -15px;\n\n a {\n color: #7dedff;\n text-decoration: none;\n }\n\n p {\n font-size: 15px;\n }\n"]);return Do=function(){return e},e}function qo(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}var Uo=v.a.div(Do()),Ho=Object(v.a)(In)(Lo()),Go=v.a.img(Bo()),Wo=v.a.div(Fo()),$o=v.a.div(Mo());function Jo(e){return function(e){if(Array.isArray(e))return Xo(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||Zo(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Vo(e,n,t,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void t(e)}c.done?n(l):Promise.resolve(l).then(r,a)}function Yo(e){return function(){var n=this,t=arguments;return new Promise((function(r,a){var o=e.apply(n,t);function i(e){Vo(o,r,a,i,c,"next",e)}function c(e){Vo(o,r,a,i,c,"throw",e)}i(void 0)}))}}function Ko(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw o}}return t}(e,n)||Zo(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Zo(e,n){if(e){if("string"==typeof e)return Xo(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Xo(e,n):void 0}}function Xo(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var Qo=wp.element,ei=Qo.useState,ni=Qo.useEffect,ti="".concat(Ao,"/meow-common/v1"),ri=function(e){var n=e.request,t=e.title,r=e.max,a=Ko(ei(!1),2),o=a[0],i=a[1],c=Ko(ei([]),2),l=c[0],u=c[1],s=l.length>0?l.reduce((function(e,n){return e+n})):0,f=l.length>0?Math.ceil(s/l.length):0,d=!l.length&&o;ni((function(){o&&setTimeout(Yo(regeneratorRuntime.mark((function e(){var t,r,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=(new Date).getTime(),e.next=3,So("".concat(ti,"/").concat(n));case 3:r=(new Date).getTime(),a=r-t,u((function(e){return[].concat(Jo(e),[a])}));case 6:case"end":return e.stop()}}),e)}))),1e3)}),[l]);return React.createElement(Uo,{style:{width:200,textAlign:"center"}},React.createElement(An,{h2:!0,style:{color:"white"}},t),React.createElement(ha,{size:200,value:d?r:f,max:r},React.createElement("span",{style:{fontSize:20}},d?"START":f+" ms"),React.createElement("span",{style:{fontSize:12}},d?"YOUR ENGINE":l.length+" requests")),React.createElement(Ne,{style:{width:"100%",marginTop:10},color:o?"#cc3627":"#ccb027",onClick:function(){o||u([]),i(!o)}},o?"Stop":"Start"))};function ai(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function oi(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ai(Object(t),!0).forEach((function(n){ii(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ai(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function ii(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function ci(e,n,t,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void t(e)}c.done?n(l):Promise.resolve(l).then(r,a)}function li(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw o}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return ui(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ui(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ui(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var si=wp.element,fi=si.useState,di=si.useEffect;To&&Ao&&No||console.error("[@common/dashboard] apiUrl, restUrl and pluginUrl are mandatory.");var mi="".concat(Ao,"/meow-common/v1"),pi=React.createElement(Uo,null,React.createElement(An,{p:!0},"Meow Apps is run by Jordy Meow, a photographer and software developer living in Japan (and taking ",React.createElement("a",{target:"_blank",href:"https://offbeatjapan.org"},"a lot of photos"),"). Meow Apps proposes a suite of plugins focusing on photography, imaging, optimization and SEO. The ultimate goal is to make your website better, faster, while making it easy. Meow Apps also teams up with the best players in the community. For more information, please check ",React.createElement("a",{href:"http://meowapps.com",target:"_blank"},"Meow Apps"),".")),hi=React.createElement(Uo,null,React.createElement(An,{p:!0},"The ",React.createElement("b",null,"Empty Request Time")," helps you analyzing the raw performance of your install by giving you the average time it takes to run an empty request to your server. You can try to disable some plugins (or change their options) then Start this again to see how it influences the results. An excellent install would have an Empty Request Time of less than 500 ms. Keep it absolutely under 2,000 ms! For more information, ",React.createElement("a",{href:"https://meowapps.com/clean-optimize-wordpress/#Optimize_your_Empty_Request_Time",target:"_blank"},"click here"),"."),React.createElement(An,{p:!0},React.createElement("b",null,"File Operation Time")," creates a temporary size of 10MB every time. ",React.createElement("b",null,"SQL Request Time")," counts the number of posts. Those two should be very fast, and almost the same as the ",React.createElement("b",null,"Empty Request Time"),".")),bi=React.createElement(Uo,null,React.createElement(An,{p:!0},"Too many WordPress installs are blown-up with useless and/or heavy plugins, and not aware of best practices. That's not the fault of the users; WordPress pretends to be simple but it is in fact very complex, and the immensity and diversity of the community around it makes it a real jungle where everything is possible."),React.createElement(An,{p:!0},"A rule of thumb is to keep your WordPress install as simple as possible, with the least number of plugins installed (run away from the heavy ones) and an excellent hosting service. Avoid VPS or self-hosted solutions; you must be a professional to actually set them up so that they are actually performant."),React.createElement(An,{p:!0},"On the Meow Apps website, you will find articles which are always updated with the latest recommendations.",React.createElement("ul",null,React.createElement("li",null,"☘️  ",React.createElement("a",{href:"https://meowapps.com/debugging-wordpress/",target:"_blank"},"How To Debug")),React.createElement("li",null,"☘️  ",React.createElement("a",{href:"https://meowapps.com/seo-optimization/",target:"_blank"},"SEO Checklist & Optimization")),React.createElement("li",null,"☘️  ",React.createElement("a",{href:"https://meowapps.com/clean-optimize-wordpress/",target:"_blank"},"Clean Up and Optimize")),React.createElement("li",null,"☘️  ",React.createElement("a",{href:"https://meowapps.com/optimize-images-cdn/",target:"_blank"},"Optimize Images")),React.createElement("li",null,"☘️  ",React.createElement("a",{href:"https://meowapps.com/best-hosting-services-wordpress/",target:"_blank"},"Best Hosting Services"))))),yi=React.createElement(Uo,null,React.createElement(An,{p:!0},"A summarized version of your PHP Error Logs will be displayed here, with the latest errors at the top. After it, you will find information about your PHP, so make sure your scroll down.")),gi=function(){var e=li(fi(!1),2),n=e[0],t=e[1],r=Object(c.a)("".concat(mi,"/all_settings/"),Co),a=r.data,o=r.mutate,i=r.error,l=null==a?void 0:a.data,u=null==l?void 0:l.meowapps_hide_meowapps,s=null==l?void 0:l.force_sslverify,f=li(fi(!1),2),d=f[0],m=f[1],p=li(fi(""),2),h=p[0],b=p[1],y=li(fi(""),2),g=y[0],v=y[1];di((function(){i&&!n&&(t(!0),console.error("Error from UseSWR",i.message))}),[i]),di((function(){var e=document.getElementById("meow-common-phperrorlogs"),n=document.getElementById("meow-common-phpinfo");b(e.innerHTML),v(n.innerHTML)}),[]);var w=function(){var e,n=(e=regeneratorRuntime.mark((function e(n,t){var r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=oi({},a.data))[t]=n,o(oi(oi({},a),{},{data:r}),!1),m(!0),e.next=6,So("".concat(mi,"/update_option"),{name:t,value:n});case 6:i=e.sent,m(!1),i.success||alert(i.message),o();case 10:case"end":return e.stop()}}),e)})),function(){var n=this,t=arguments;return new Promise((function(r,a){var o=e.apply(n,t);function i(e){ci(o,r,a,i,c,"next",e)}function c(e){ci(o,r,a,i,c,"throw",e)}i(void 0)}))});return function(e,t){return n.apply(this,arguments)}}(),x=React.createElement(Wn,{title:"Main Menu"},React.createElement(vt,{max:"1"},React.createElement(bt,{id:"meowapps_hide_meowapps",label:"Hide (Not Recommended)",description:React.createElement(An,{p:!0},"This will hide the Meow Apps Menu (on the left side) and everything it contains. You can re-enable it through though an option that will be added in Settings → General."),value:"1",disabled:d,checked:u,onChange:w}))),E=React.createElement(Wn,{title:"SSL Verify"},React.createElement(vt,{max:"1"},React.createElement(bt,{id:"force_sslverify",label:"Force (Not Recommended)",description:React.createElement(An,{p:!0},"This will enforce the usage of SSL when checking the license or updating the plugin."),value:"1",disabled:d,checked:s,onChange:w})));return React.createElement(vn,{showRestError:n},React.createElement(Qr,{title:"The Dashboard"}),React.createElement(lt,null,React.createElement(ut,{full:!0},React.createElement(Qa,null,React.createElement(eo,{title:"Meow Apps"},pi,React.createElement(lt,null,React.createElement(ut,{minimal:!0},React.createElement(Ho,{title:"Media Cleaner",className:"primary"},React.createElement(Go,{src:"".concat(No,"/common/img/media-cleaner.jpg")}),React.createElement("div",null,React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/media-cleaner/"},"Media Cleaner")),React.createElement("p",null,"The Cleaner analyzes your WordPress entirely to find out which files are not used. You can trash them, before deleting them permanently. Your WordPress will breath again :)"))),React.createElement(Ho,{title:"Media File Renamer",className:"primary"},React.createElement(Go,{src:"".concat(No,"/common/img/media-file-renamer.jpg")}),React.createElement("div",null,React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/media-file-renamer/"},"Media File Renamer")),React.createElement("p",null,"The Renamer will help you in getting nicer filenames for an improved SEO and a tidier filesystem. It's mostly automatic and very fun to use."))),React.createElement(Ho,{title:"Contact Form Block",className:"primary"},React.createElement(Go,{src:"".concat(No,"/common/img/default.png")}),React.createElement("div",null,React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/contact-form-block/"},"Contact Form Block")),React.createElement("p",null,"A simple, pretty and superlight contact form. If you simply want your visitors to get in touch with you, this contact form will be perfect for you and your WordPress."))),React.createElement(Ho,{title:"Meow Analytics",className:"primary"},React.createElement(Go,{src:"".concat(No,"/common/img/default.png")}),React.createElement("div",null,React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/meow-analytics/"},"Meow Analytics")),React.createElement("p",null,"Are you tired of those heavy plugins, accessing your Google Analytics deliberately? Switch to Meow Analytics!")))),React.createElement(ut,{minimal:!0},React.createElement(Ho,{title:"Meow Gallery",className:"primary"},React.createElement(Go,{src:"".concat(No,"/common/img/meow-gallery.jpg")}),React.createElement("div",null,React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/meow-gallery/"},"Meow Gallery")),React.createElement("p",null,"This is the fastest gallery system... and it is pretty as well! It is 100% compatible with the native WordPress galleries and therefore, works right away."))),React.createElement(Ho,{title:"Meow Lightbox",className:"primary"},React.createElement(Go,{src:"".concat(No,"/common/img/meow-lightbox.jpg")}),React.createElement("div",null,React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/meow-lightbox/"},"Meow Lightbox")),React.createElement("p",null,"A very sleek and performant Lightbox which will also display your EXIF data (camera, lens, aperture...). Photographers love it."))),React.createElement(Ho,{title:"WP/LR Sync",className:"primary"},React.createElement(Go,{src:"".concat(No,"/common/img/wplr-sync.jpg")}),React.createElement("div",null,React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/wplr-sync/"},"WP/LR Sync")),React.createElement("p",null,"Are you using Lightroom? So you know WP/LR Sync already. Wait, you don't? You must try it! This plugin will be your favorite very soon."))),React.createElement(Ho,{title:"WP Retina 2x",className:"primary"},React.createElement(Go,{src:"".concat(No,"/common/img/wp-retina-2x.jpg")}),React.createElement("div",null,React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/wp-retina-2x/"},"WP Retina 2x")),React.createElement("p",null,"The first and best High-DPI plugin! It enforces high-quality image support and best-practices.")))))),React.createElement(eo,{title:"Performance"},hi,React.createElement("div",{style:{display:"flex",justifyContent:"space-around",marginBottom:25}},React.createElement(ri,{title:"Empty Request Time",request:"empty_request",max:2500}),React.createElement(ri,{title:"File Operation Time",request:"file_operation",max:2600}),React.createElement(ri,{title:"SQL Request Time",request:"sql_request",max:2800}))),React.createElement(eo,{title:"Recommendations"},bi),React.createElement(eo,{title:"PHP Errors & Info"},yi,React.createElement($o,{dangerouslySetInnerHTML:{__html:h}}),React.createElement(Wo,{dangerouslySetInnerHTML:{__html:g}})),React.createElement(eo,{title:"Settings"},React.createElement(In,{title:"Settings",className:"primary"},x,E))))))};function vi(e,n,t,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void t(e)}c.done?n(l):Promise.resolve(l).then(r,a)}function wi(e){return function(){var n=this,t=arguments;return new Promise((function(r,a){var o=e.apply(n,t);function i(e){vi(o,r,a,i,c,"next",e)}function c(e){vi(o,r,a,i,c,"throw",e)}i(void 0)}))}}function xi(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw o}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return Ei(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ei(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ei(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var ki=wp.element,Ri=ki.useState,Oi=ki.useEffect,ji="".concat(Ao,"/meow-licenser/").concat(Po,"/v1"),Ci=function(){var e=xi(Ri(!1),2),n=e[0],t=e[1],r=xi(Ri(null),2),a=r[0],o=r[1],i=xi(Ri(null),2),c=i[0],l=i[1],u=xi(Ri(""),2),s=u[0],f=u[1],d=Io&&(!c||"valid"!==c.license),m=function(){var e=wi(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(zo){e.next=2;break}return e.abrupt("return");case 2:return t(!0),e.next=5,So("".concat(ji,"/get_license"));case 5:n=e.sent,l(n.data),n.data.key&&f(n.data.key),t(!1);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),p=function(){var e=wi(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t(!0),e.next=3,So("".concat(ji,"/set_license"),{serialKey:null});case 3:e.sent.success&&(f(""),l(null),o("licenseRemoved")),t(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),h=function(){var e=wi(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t(!0),e.next=3,So("".concat(ji,"/set_license"),{serialKey:s});case 3:(n=e.sent).success&&(l(n.data),o("licenseAdded")),t(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();Oi((function(){m()}),[]);var b=d?"Forced License":Io?"Enabled":"Disabled",y=c&&"valid"===c.license,g="Your license is active. Thanks a lot for your support :)";y||(c?"no_activations_left"===c.issue?g=React.createElement("span",null,"There are no activations left for this license. You can visit your account at the ",React.createElement("a",{target:"_blank",href:"https://store.meowapps.com"},"Meow Apps Store"),", unregister a site, and click on ",React.createElement("i",null,"Retry to validate"),"."):"expired"===c.issue?g=React.createElement("span",null,"Your license has expired. You can get another license or renew the current one by visiting your account at the ",React.createElement("a",{target:"_blank",href:"https://store.meowapps.com"},"Meow Apps Store"),"."):"missing"===c.issue?g="This license does not exist.":"disabled"===c.issue?g="This license has been disabled.":"item_name_mismatch"===c.issue?g="This license seems to be for a different plugin... isn't it? :)":(g=React.createElement("span",null,"There is an unknown error related to this serial key. Really sorry about this! Please ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/contact/"},"contact us"),"."),console.log({license:c})):g="Unknown error :(");var v=React.createElement(In,{title:"Pro Version (Not Installed)",className:"primary"},"You will find more information about the Pro Version ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/plugin/".concat(_o,"/")},"here"),". If you actually bought the Pro Version already, please remove the current plugin and download the Pro Version from your account at the ",React.createElement("a",{target:"_blank",href:"https://store.meowapps.com/"},"Meow Apps Store"),"."),w=React.createElement(In,{title:"Pro Version (".concat(b,")"),busy:n,className:"primary"},React.createElement(Wn,{title:"Serial Key",style:{fontWeight:"bold"}},React.createElement(jt,{id:"mfrh_pro_serial",name:"mfrh_pro_serial",disabled:n,value:s,onChange:function(e){return f(e)},placeholder:""})),c&&!y&&React.createElement(va,null,g),c&&y&&React.createElement(wa,null,g),!c&&React.createElement(An,{p:!0},"Insert your serial key above. If you don't have one yet, you can get one ",React.createElement("a",{href:"/plugin/media-file-renamer/"},"here"),". If there was an error during the validation, try the ",React.createElement("i",null,"Retry")," to ",React.createElement("i",null,"validate")," button."),React.createElement(Wn,{contentAlign:"right"},c&&!y&&React.createElement(Ne,{className:"secondary",disabled:n||!s,onClick:h},"Retry to validate"),c&&c.key===s&&React.createElement(Ne,{className:"secondary",disabled:n||!s,onClick:p},"Remove License"),React.createElement(Ne,{disabled:n||!s||c&&c.key===s,onClick:h},"Validate License")),React.createElement(Aa,{isOpen:"licenseAdded"===a,title:"Thank you :)",content:"The Pro features have been enabled. This page should be now reloaded.",ok:"Reload",onOkClick:function(){return location.reload()}}),React.createElement(Aa,{isOpen:"licenseRemoved"===a,title:"Goodbye :(",content:"The Pro features have been disabled. This page should be now reloaded.",ok:"Reload",onOkClick:function(){return location.reload()}}));return zo?w:v},Si=wp.element.render;function Pi(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function _i(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Pi(Object(t),!0).forEach((function(n){Ai(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Pi(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function Ai(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Ti(e,n,t,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void t(e)}c.done?n(l):Promise.resolve(l).then(r,a)}function Ni(e){return function(){var n=this,t=arguments;return new Promise((function(r,a){var o=e.apply(n,t);function i(e){Ti(o,r,a,i,c,"next",e)}function c(e){Ti(o,r,a,i,c,"throw",e)}i(void 0)}))}}function zi(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw o}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return Ii(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ii(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ii(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}document.addEventListener("DOMContentLoaded",(function(e){var n=document.getElementById("meow-common-dashboard");n&&Si(React.createElement(gi,null),n)}));var Mi=wp.element,Fi=Mi.useState,Bi=(Mi.useEffect,{marginTop:10,background:"rgb(0, 72, 88)",padding:10,color:"rgb(58, 212, 58)",maxHeight:600,minHeight:200,display:"block",fontFamily:"monospace",fontSize:12,whiteSpace:"pre",overflowX:"auto",width:"calc(100vw - 276px)"}),Li=function(){var e=Object(c.a)("".concat(To,"/all_settings/"),Co),n=e.data,t=e.mutate,r=Je(n,{},!0),a=r.busy,o=r.data,i=r.error,l=zi(Fi(!1),2),u=l[0],s=l[1],f=zi(Fi(""),2),d=f[0],m=f[1],p=zi(Fi(),2),h=p[0],b=p[1],y=a||u,g=null==o?void 0:o.wpmc_method,v=null==o?void 0:o.wpmc_content,w=null==o?void 0:o.wpmc_filesystem_content,x=null==o?void 0:o.wpmc_media_library,E=null==o?void 0:o.wpmc_live_content,k=null==o?void 0:o.wpmc_debuglogs,R=null==o?void 0:o.wpmc_images_only,O=null==o?void 0:o.wpmc_thumbnails_only,j=null==o?void 0:o.wpmc_dirs_filter,C=null==o?void 0:o.wpmc_files_filter,S=null==o?void 0:o.wpmc_hide_thumbnails,P=null==o?void 0:o.wpmc_hide_warning,_=null==o?void 0:o.wpmc_medias_buffer,A=null==o?void 0:o.wpmc_posts_buffer,T=null==o?void 0:o.wpmc_analysis_buffer,N=null==o?void 0:o.wpmc_file_op_buffer,z=null==o?void 0:o.wpmc_delay,I=null==o?void 0:o.wpmc_shortcodes_disabled,M="files"===g,F=function(){var e=Ni(regeneratorRuntime.mark((function e(r,a){var o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(o=_i({},n.data))[a]=r,t(_i(_i({},n),{},{data:o}),!1),s(!0),e.prev=4,e.next=7,So("".concat(To,"/update_option"),{name:a,value:r});case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(4),alert(e.t0.message);case 12:return e.prev=12,s(!1),t(),e.finish(12);case 16:case"end":return e.stop()}}),e,null,[[4,9,12,16]])})));return function(n,t){return e.apply(this,arguments)}}(),B=function(){var e=Ni(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s(!0),e.next=3,So("".concat(To,"/reset_db"),{});case 3:b("resetDb"),s(!1);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),L=function(){var e=Ni(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s(!0),e.next=3,So("".concat(To,"/refresh_logs"));case 3:(n=e.sent).success&&m(n.data),s(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),D=function(){var e=Ni(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s(!0),e.next=3,So("".concat(To,"/clear_logs"));case 3:(n=e.sent).success&&m(n.data),s(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),q=React.createElement(Wn,{title:"Content"},React.createElement(vt,{max:"1"},React.createElement(bt,{id:"wpmc_content",label:"Check",description:"Checks if the media entries are used by the content (Posts, Pages and other Post Types, Metadata, Widgets, etc). Pagebuilders are only supported in the Pro Version.",value:"1",checked:v,onChange:F}))),U=React.createElement(Wn,{title:"Content"},React.createElement(vt,{max:"1"},React.createElement(bt,{id:"wpmc_filesystem_content",label:"Check",description:"Checks if the files are used by the content (Posts, Pages and other Post Types, Metadata, Widgets, etc).",value:"1",checked:w,onChange:F}))),H=React.createElement(Wn,{title:"Media Library"},React.createElement(vt,{max:"1"},React.createElement(bt,{id:"wpmc_media_library",label:"Check",description:"Checks if the files are properly registered in the Media Library.",value:"1",checked:x,onChange:F,disabled:!M}))),G=React.createElement(Wn,{title:"Live Content"},React.createElement(vt,{max:"1"},React.createElement(bt,{id:"wpmc_live_content",label:"Check",description:"The live version of the site will be also analyzed (as if a visitor was loading it). It increases the accuracy of the results but slows down the speed dramatically.",value:"1",requirePro:!Io,checked:E,onChange:F}))),W=React.createElement(Wn,{title:"Images Only"},React.createElement(vt,{max:"1"},React.createElement(bt,{id:"wpmc_images_only",label:"Enable",description:"Restricts the scan to images. Nothing else will be scanned.",value:"1",checked:R,onChange:F,disabled:M}))),$=React.createElement(Wn,{title:"Thumbnails Only"},React.createElement(vt,{max:"1"},React.createElement(bt,{id:"wpmc_thumbnails_only",label:"Enable",description:"Restricts Media Cleaner to scan thumbnails. With WordPress, those filenames contain the resolution.",value:"1",checked:O,onChange:F,disabled:!M}))),J=React.createElement(Wn,{title:"Directories Filter"},React.createElement(jt,{id:"wpmc_dirs_filter",name:"wpmc_dirs_filter",value:j,placeholder:"/regex/",onEnter:F,onBlur:F})),V=React.createElement(Wn,{title:"Files Filter"},React.createElement(jt,{id:"wpmc_files_filter",name:"wpmc_files_filter",value:C,placeholder:"/regex/",onEnter:F,onBlur:F})),Y=React.createElement(Wn,{title:"Thumbnails"},React.createElement(vt,{max:"1"},React.createElement(bt,{id:"wpmc_hide_thumbnails",label:"Hide",description:"If you prefer not to see the thumbnails.",value:"1",checked:S,onChange:F}))),K=React.createElement(Wn,{title:"Warning Message"},React.createElement(vt,{max:"1"},React.createElement(bt,{id:"wpmc_hide_warning",label:"Hide",description:"Have you read it twice? If yes, hide it :)",requirePro:!Io,value:"1",checked:P,onChange:F}))),Z=React.createElement(Wn,{title:"Medias Buffer"},React.createElement(jt,{id:"wpmc_medias_buffer",type:"number",value:_,min:"1",max:"1000",onEnter:F,onBlur:F,description:"The number of media entries to read at a time. This is fast, so the value should be between 50 and 1000."})),X=React.createElement(Wn,{title:"Posts Buffer"},React.createElement(jt,{id:"wpmc_posts_buffer",type:"number",value:A,min:"1",max:"100",onEnter:F,onBlur:F,description:"The number of posts (and any other post types) to analyze at a time. This is the most intense part of the process. Recommended value is between 1 (slow server) and 20 (excellent server)."})),Q=React.createElement(Wn,{title:"Analysis Buffer"},React.createElement(jt,{id:"wpmc_analysis_buffer",type:"number",value:T,min:"1",max:"1000",onEnter:F,onBlur:F,description:"The number of media entries or files to analyze at a time. This is the main part of the process, but is is much faster than analyzing each post. Recommended value is between 20 (slow server) and 1000 (excellent server)."})),ee=React.createElement(Wn,{title:"File Operation Buffer"},React.createElement(jt,{id:"wpmc_file_op_buffer",type:"number",value:N,min:"1",max:"100",onEnter:F,onBlur:F,description:"The number of media entries or files to delete at a time. This highly depends on your server, it is normally quite fast. Recommended value is between 5 (slow server) and 100 (excellent server). "})),ne=React.createElement(Wn,{title:"Delay (in ms)"},React.createElement(jt,{id:"wpmc_delay",type:"number",value:z,min:"0",max:"20000",onEnter:F,onBlur:F,description:"Time to wait between each request (in milliseconds). The overall process is intensive so this gives the chance to your server to chill out a bit. A very good server doesn't need it, but a slow/shared hosting might even reject requests if they are too fast and frequent. Recommended value is actually 0, 100 for safety, 2000 or 5000 if your hosting is kind of cheap."})),te=React.createElement(Wn,{title:"Shortcodes"},React.createElement(vt,{max:"1"},React.createElement(bt,{id:"wpmc_shortcodes_disabled",label:"Disable Analysis",description:"Resolving shortcodes increase accuracy, but makes the process slower and takes more memory.",value:"1",checked:I,onChange:F}))),re=React.createElement(Wn,{title:"Logs"},React.createElement(vt,{max:"1"},React.createElement(bt,{id:"wpmc_debuglogs",label:"Enable",description:React.createElement(An,{p:!0},"Simple logging that explains which actions has been run."),value:"1",checked:k,onChange:F}),React.createElement("div",{style:{marginTop:20}},React.createElement(Ne,{onClick:L},"Refresh Logs"),React.createElement(Ne,{className:"danger",onClick:D},"Clear Logs"))));return React.createElement(vn,{nekoErrors:[i]},React.createElement(Aa,{isOpen:"resetDb"===h,onRequestClose:function(){b(null)},title:"Done!",content:"The Media Cleaner's database has been deleted. It will be re-created automatically next time you visit the Media Cleaner Dashboard.",onOkClick:function(){b(null)}}),React.createElement(Qr,{title:"Media Cleaner | Settings",subtitle:"By Jordy Meow"},React.createElement("div",{style:{display:"flex",justifyContent:"flex-end"}},React.createElement(Ne,{className:"primary",onClick:function(){return window.open("https://meowapps.com/media-cleaner-tutorial/","_blank")}},"Tutorial"),React.createElement(Ne,{className:"primary",icon:"dashboard",color:"#8554bb",onClick:function(){return location.href="upload.php?page=wpmc_dashboard"}},"Dashboard"))),React.createElement(lt,null,React.createElement(ut,{full:!0},React.createElement(Un,{footer:React.createElement(React.Fragment,null,React.createElement(Ne,{className:"primary",onClick:function(){return location.href="upload.php?page=wpmc_dashboard"}},"Access Media Cleaner Dashboard"),React.createElement(Ne,{className:"danger",onClick:B},"Delete Cleaner DB"))},React.createElement(An,{p:!0},"There are two kinds of scan. Usually, the Media Library should be scanned first for images which are not used (Content = Check). Then, the filesystem should be scanned for images which aren't registered in the Media Library (Media Library = Check). Check the ",React.createElement("a",{href:"https://meowapps.com/media-cleaner-tutorial/"},"tutorial")," tutorial for more information. ")),React.createElement(Qa,null,React.createElement(eo,{title:"Media Library Scan"},React.createElement(lt,null,React.createElement(ut,{minimal:!0},React.createElement(In,{busy:y,title:"Scanning",className:"primary"},q,G,(v||E)&&React.createElement(An,{p:!0},"If you would like Media Cleaner to analyze your Media Library for broken entries, uncheck everything above."),!v&&!E&&React.createElement(An,{p:!0},React.createElement("b",null,"Since Content and Live Content are not checked, Media Cleaner will analyze your Media Library for ",React.createElement("u",null,"broken entries"),".")))),React.createElement(ut,{minimal:!0},React.createElement(In,{busy:y,title:"Filters",className:"primary"},W)))),React.createElement(eo,{title:"Filesystem Scan",requirePro:!Io},React.createElement(lt,null,React.createElement(ut,{minimal:!0},React.createElement(In,{busy:y,title:"Scanning",className:"primary"},H,U,G,React.createElement(An,{p:!0},"If none of the checks above are selected, you will get the list of all your files."))),React.createElement(ut,{minimal:!0},React.createElement(In,{busy:y,title:"Filters",className:"primary"},$,J,V)))),React.createElement(eo,{title:"Advanced"},React.createElement(lt,null,React.createElement(ut,{minimal:!0},React.createElement(In,{busy:y,title:"UI & Logs",className:"primary"},Y,K)),React.createElement(ut,{minimal:!0},React.createElement(In,{busy:y,title:"Advanced Settings",className:"primary"},Z,X,Q,ee,ne,te)))),React.createElement(eo,{title:"Pro Version"},React.createElement(Ci,{domain:_o,prefix:Po,isPro:zo,isRegistered:Io})),React.createElement(eo,{title:"Logs & Debug"},React.createElement(In,{busy:y,className:"primary"},re),React.createElement("div",{style:Bi},d))))))},Di=wp.i18n.__,qi={};qi.PENDING=Di("Pending","media-cleaner"),qi.RENAME=Di("Rename","media-cleaner"),qi.TITLE=Di("Title","media-cleaner");function Ui(e,n,t,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void t(e)}c.done?n(l):Promise.resolve(l).then(r,a)}function Hi(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw o}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return Gi(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Gi(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Gi(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var Wi=wp.element.useState,$i={borderLeft:"4px solid #007bba"},Ji={borderLeft:"4px solid #f1ad31"},Vi={borderLeft:"4px solid #d85960"},Yi=function(){var e=Hi(Wi(!1),2),n=e[0],t=e[1],r=Object(c.a)("".concat(To,"/all_settings/"),Co).data,a=Je(r,{},!0).data,o=a.wpmc_method,i="files"===a.wpmc_method?a.wpmc_filesystem_content:a.wpmc_content,l="files"===a.wpmc_method&&(null==a?void 0:a.wpmc_media_library),u=a.wpmc_hide_warning,s=a.incompatible_plugins,f=a.media_trash,d=function(){var e,n=(e=regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t(!0),e.prev=1,e.next=4,So("".concat(To,"/enable_trash_media"));case 4:alert("Done! Please reload/refresh :)"),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(1),alert(e.t0.message);case 10:t(!1);case 11:case"end":return e.stop()}}),e,null,[[1,7]])})),function(){var n=this,t=arguments;return new Promise((function(r,a){var o=e.apply(n,t);function i(e){Ui(o,r,a,i,c,"next",e)}function c(e){Ui(o,r,a,i,c,"throw",e)}i(void 0)}))});return function(){return n.apply(this,arguments)}}();return React.createElement(React.Fragment,null,"media"===o&&!i&&React.createElement(Un,{style:$i},React.createElement(An,{p:!0,style:{fontSize:15}},"Media Cleaner will scan your Media Library for broken entries.")),"media"===o&&i&&React.createElement(Un,{style:$i},React.createElement(An,{p:!0,style:{fontSize:15}},"Media Cleaner will scan your Media Library for entries which aren't used in your content.")),"files"===o&&i&&l&&React.createElement(Un,{style:$i},React.createElement(An,{p:!0,style:{fontSize:15}},"Media Cleaner will scan your physical directories for files which are not registered in the Media Library or not used directly in your content.")),"files"===o&&!i&&l&&React.createElement(Un,{style:$i},React.createElement(An,{p:!0,style:{fontSize:15}},"Media Cleaner will scan your physical directories for files which are not registered in the Media Library.")),!u&&React.createElement(Un,{style:Ji},React.createElement(An,{p:!0},React.createElement("p",null,React.createElement("b",null,React.createElement("span",{style:{color:"red"}},"This is important.")," Backup your DB and your /uploads directory before using Media Cleaner.")," The deleted files will be temporarily moved to the ",React.createElement("i",null,"uploads/wpmc-trash")," directory. After testing your site, you can check the ",React.createElement("i",null,"Trash")," in order to empty it or to recover your files. That said, you still must have a backup! If you don't know how, give a try to this: ",React.createElement("a",{href:"http://meow.click/blogvault",target:"_blank"},"BlogVault"),"."),React.createElement("p",null,React.createElement("b",null,React.createElement("span",{style:{color:"red"}},"Please be considerate.")," Don't blame Media Cleaner if it deleted too many (or not enough) of your files.")," WordPress being a very dynamic and pluggable system, it is impossible to predict all the situations in which your files are used. Please do not post a bad review because it broke your install; if you have a proper backup, there is no risk! You can disable this big warning in the options if you have the Pro Version. Read this warning twice. Media Cleaner is awesome and constantly gets better so I sincerely hope you will enjoy it. Thank you :)"))),s&&s.length>0&&React.createElement(Un,{style:Vi},React.createElement(An,{p:!0,style:{fontSize:15}},React.createElement("p",null,"Important note about the following plugin(s) which you are using:"),React.createElement("ul",null,s.map((function(e){return React.createElement("li",null,"- ",e)}))),React.createElement("p",null,"They require additional checks which are only implemented in ",React.createElement("a",{target:"_blank",href:"//meowapps.com/plugin/media-cleaner"},"Media Cleaner Pro"),"."))),"media"===o&&!f&&React.createElement(Un,{style:Vi,footer:React.createElement(React.Fragment,null,React.createElement(Ne,{disabled:n,className:"primary",onClick:d},"Automatically write this line"))},React.createElement(An,{p:!0},"The trash for the Media Library is disabled. Any media entries removed by the plugin will be ",React.createElement("b",null,"permanently deleted"),". To enable it, you must modify your ",React.createElement("i",null,"wp-config.php")," file. Just before the line that says ",React.createElement("i",null,'"That\'s all, stop editing!"'),", add this line: ",React.createElement("b",null,"define( 'MEDIA_TRASH', true );"))))};function Ki(e,n){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=ac(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,c=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return i=e.done,e},e:function(e){c=!0,o=e},f:function(){try{i||null==t.return||t.return()}finally{if(c)throw o}}}}function Zi(e){return function(e){if(Array.isArray(e))return oc(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||ac(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Xi(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function Qi(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Xi(Object(t),!0).forEach((function(n){ec(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Xi(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function ec(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function nc(e,n,t,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void t(e)}c.done?n(l):Promise.resolve(l).then(r,a)}function tc(e){return function(){var n=this,t=arguments;return new Promise((function(r,a){var o=e.apply(n,t);function i(e){nc(o,r,a,i,c,"next",e)}function c(e){nc(o,r,a,i,c,"throw",e)}i(void 0)}))}}function rc(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw o}}return t}(e,n)||ac(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ac(e,n){if(e){if("string"==typeof e)return oc(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?oc(e,n):void 0}}function oc(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var ic=wp.element,cc=ic.useState,lc=ic.useEffect,uc=ic.useMemo,sc=[{id:"media",value:"media",label:"Media Library",requirePro:!1},{id:"files",value:"files",label:"Filesystem",requirePro:!Io}],fc={width:40,height:40,objectFit:"cover"};function dc(e){return new Promise((function(n){return setTimeout(n,e)}))}var mc={NO_CONTENT:"Seems not in use",ORPHAN_MEDIA:"Not attached file",ORPHAN_FILE:"Not in Library",ORPHAN_RETINA:"Orphan Retina",ORPHAN_WEBP:"Orphan WebP"},pc={accessor:"size",by:"desc"},hc=function(){var e,n=rc(cc("issues"),2),t=n[0],a=n[1],o=rc(cc(),2),i=o[0],l=o[1],u=rc(cc(),2),s=(u[0],u[1],rc(cc([]),2)),f=s[0],d=s[1],m=rc(cc(!1),2),p=m[0],h=m[1],b=rc(cc(""),2),y=b[0],g=b[1],v=rc(cc(1),2),w=v[0],x=v[1],k=rc(cc(1),2),R=k[0],O=k[1],j=rc(cc(""),2),C=j[0],S=j[1],P=rc(cc(""),2),_=P[0],A=P[1],T=rc(cc(pc),2),N=T[0],z=T[1],I=rc(cc(1),2),M=I[0],F=I[1],B=rc(cc(10),2),L=B[0],D=B[1],q=function(){var e=Ge(Object(r.useState)(new AbortController),2),n=e[0],t=e[1],a=Object(r.useRef)(!1),o=Object(r.useRef)(0),i=Ge(Object(r.useState)(null),2),c=i[0],l=i[1],u=Ge(Object(r.useState)(!1),2),s=u[0],f=u[1],d=Ge(Object(r.useState)(0),2),m=d[0],p=d[1],h=Ge(Object(r.useState)(!1),2),b=h[0],y=h[1],g=Ge(Object(r.useState)(!1),2),v=g[0],w=g[1],x=Ge(Object(r.useState)(0),2),E=x[0],k=x[1],R=function(){var e=He(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=new AbortController,t(n),y(!1),o.current=0,a.current=!1,f(!1),w(!1),k(0),p(0);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),O=function(){var e=He(regeneratorRuntime.mark((function e(n){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new Promise((function(e,t){y(!1),o.current=0,a.current=!1,f(!1),w(!1),A(n),l(!0),Ke.start(),Ke.onIdle().then((function(){P(),e()}))})),e.abrupt("return",t);case 2:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),j=function(){var e=He(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:0,Ke.pause(),f(!0);case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),C=function(){var e=He(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:0,y(!1),f(!1),Ke.start();case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),S=function(){var e=He(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:0,Ke.pause(),n.abort(),l(!1),y(!1),w(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),P=function(){var e=He(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:0,w(!0),l(!1);case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),_=function(){var e=He(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Ke.add(He(regeneratorRuntime.mark((function e(){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t(n.signal);case 3:(r=e.sent).success||(o.current++,a.current||(y(r.error),j())),e.next=16;break;case 7:if(e.prev=7,e.t0=e.catch(0),"AbortError"!==e.t0.name){e.next=14;break}return console.log("Aborted"),e.abrupt("return");case 14:o.current++,a.current||(y("An error was caught (more information in the console)."),j());case 16:return e.prev=16,k((function(e){return e+1})),e.finish(16);case 19:case"end":return e.stop()}}),e,null,[[0,7,16,19]])})))),p((function(e){return e+1}));case 2:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),A=function(){var e=He(regeneratorRuntime.mark((function e(n){var t,r,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Ke.clear(),t=qe(n);try{for(t.s();!(r=t.n()).done;)a=r.value,_(a)}catch(e){t.e(e)}finally{t.f()}k(0);case 4:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),T=Object(r.useCallback)((function(){a.current=!0}),[]),N=Object(r.useCallback)((function(){return o.current}),[]);return{start:O,stop:S,pause:j,resume:C,reset:R,addTask:_,setAlwaysSkip:T,getErrorCount:N,error:b,success:v,busy:c,paused:s,value:E,max:m}}(),U=(M-1)*L,H=Object(c.a)("".concat(To,"/stats"),Co),G=H.data,W=H.mutate,$=Object(c.a)("".concat(To,"/all_settings/"),Co),J=$.data,V=$.mutate,Y=Object(c.a)("".concat(To,"/entries?limit=").concat(L,"&skip=").concat(U,"&filterBy=").concat(t,"&orderBy=").concat(N.accessor)+"&order=".concat(N.by,"&search=").concat(y),Co),K=Y.data,Z=Y.mutate,X=Je(J,{},!0),Q=X.busy,ee=X.data,ne=X.error,te=Je(G,{},!0),re=te.busy,ae=te.data,oe=te.error,ie=Je(K,[],!0),ce=ie.busy,le=ie.data,ue=ie.total,se=ie.error,fe=ce||re||p||Q,de=uc((function(){return le.map((function(e){return{id:e.id,thumbnail_url:React.createElement(React.Fragment,null,"ORPHAN_MEDIA"!==e.issue&&React.createElement("img",{src:e.thumbnail_url,style:fc})),type:React.createElement("span",null,0==e.type&&"Filesystem",1==e.type&&React.createElement("a",{href:"/wp-admin/post.php?post=".concat(e.postId,"&action=edit")},"ID ",e.postId)),path:React.createElement("span",null,e.path),issue:React.createElement("span",null,mc[e.issue]?mc[e.issue]:e.issue),size:React.createElement("span",null,(e.size/1e3).toFixed(2)," KB")}}))}),[le]),me=ee.wpmc_method,pe="files"===ee.wpmc_method?ee.wpmc_filesystem_content:ee.wpmc_content,he="files"===ee.wpmc_method&&(null==ee?void 0:ee.wpmc_media_library),be=ee.wpmc_hide_thumbnails,ye=ee.wpmc_posts_buffer?parseInt(ee.wpmc_posts_buffer):5,ge=ee.wpmc_medias_buffer?parseInt(ee.wpmc_medias_buffer):100,ve=ee.wpmc_analysis_buffer?parseInt(ee.wpmc_analysis_buffer):100,we=ee.wpmc_file_op_buffer?parseInt(ee.wpmc_file_op_buffer):20,xe=ee.wpmc_delay?parseInt(ee.wpmc_delay):0,Ee=[{accessor:"type",title:"Origin",sortable:!0},{accessor:"path",title:"Path",sortable:!0},{accessor:"issue",title:"Issue",sortable:!0},{accessor:"size",title:"Size",sortable:!0}];be||Ee.unshift({accessor:"thumbnail_url",title:"Thumb",style:{width:16}});var ke=function(){var e=tc(regeneratorRuntime.mark((function e(n,t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=Qi({},J.data))[t]=n,V(Qi(Qi({},J),{},{data:r}),!1),h(!0),e.prev=4,e.next=7,So("".concat(To,"/update_option"),{name:t,value:n});case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(4),alert(e.t0.message);case 12:h(!1),V();case 14:case"end":return e.stop()}}),e,null,[[4,9]])})));return function(n,t){return e.apply(this,arguments)}}();lc((function(){d([]),z(pc),F(1)}),[t]);var Re=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;(e=null!==e?e:q.getErrorCount())>0&&A("The process has finished, but ".concat(e," error(s) occurred.")),q.reset(),d([]),Z(),W()},Oe=function(){var e=tc(regeneratorRuntime.mark((function e(n){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,So("".concat(To,"/all_ids"),{source:n});case 2:if((t=e.sent).success){e.next=6;break}return alert(t.message),e.abrupt("return",[]);case 6:return e.abrupt("return",t.data);case 7:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),je=function(){var e=tc(regeneratorRuntime.mark((function e(n){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,dc(xe);case 2:return e.next=4,So("".concat(To,"/count"),{source:n});case 4:return t=e.sent,e.abrupt("return",t.data);case 6:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),Ce=function(){var e=tc(regeneratorRuntime.mark((function e(){var n,t,r,a,o,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=i.length>0&&void 0!==i[0]?i[0]:null,t=i.length>1&&void 0!==i[1]&&i[1],S("Getting IDs..."),h(!0),!n){e.next=8;break}e.t0=n,e.next=11;break;case 8:return e.next=10,Oe(t?"trash":"issues");case 10:e.t0=e.sent;case 11:if(!(r=e.t0)){e.next=19;break}return S(t?"Emptying...":"Deleting..."),a=Oo(r,we),o=a.map((function(e){return function(){var n=tc(regeneratorRuntime.mark((function n(t){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,dc(xe);case 2:return n.next=4,So("".concat(To,"/delete"),{entryIds:e},t);case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}()})),e.next=18,q.start(o);case 18:Re();case 19:h(!1),S();case 21:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Se=function(){var e=tc(regeneratorRuntime.mark((function e(){var n,t,r,a,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=o.length>0&&void 0!==o[0]?o[0]:null,S("Getting IDs..."),h(!0),!n){e.next=7;break}e.t0=n,e.next=10;break;case 7:return e.next=9,Oe("trash");case 9:e.t0=e.sent;case 10:if(!(t=e.t0)){e.next=17;break}return r=Oo(t,we),a=r.map((function(e){return function(){var n=tc(regeneratorRuntime.mark((function n(t){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return S("Recovering..."),n.next=3,dc(xe);case 3:return n.next=5,So("".concat(To,"/recover"),{entryIds:e},t);case 5:return n.abrupt("return",n.sent);case 6:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}()})),e.next=16,q.start(a);case 16:Re();case 17:h(!1),S();case 19:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Pe=function(){var e=tc(regeneratorRuntime.mark((function e(){var n,t,r,a,o,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!(i.length>0&&void 0!==i[0])||i[0],t=i.length>1&&void 0!==i[1]?i[1]:null,S("Getting IDs..."),h(!0),!t){e.next=8;break}e.t0=t,e.next=11;break;case 8:return e.next=10,Oe("issues");case 10:e.t0=e.sent;case 11:if(!(r=e.t0)){e.next=19;break}return S("".concat(n?"Ignoring...":"Undoing...")),a=Oo(r,ve),o=a.map((function(e){return function(){var t=tc(regeneratorRuntime.mark((function t(r){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,dc(xe);case 2:return t.next=4,So("".concat(To,"/set_ignore"),{entryIds:e,ignore:n},r);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()})),e.next=18,q.start(o);case 18:Re();case 19:h(!1),S();case 21:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),_e=function(){var e=tc(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:q.stop();case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ae=function(){_e(),Re(),h(!1),S()},Te=function(){var e=tc(regeneratorRuntime.mark((function e(){var n,t,r,a,o,i,c,l,u,s,f,m,p,b,y,g,v;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=0,d([]),x(1),O(3+(pe?1:0)+("files"===me&&he?1:0)),S("Resetting issues..."),e.next=7,So("".concat(To,"/reset_issues"));case 7:if(x((function(e){return e+1})),!pe){e.next=21;break}return S("Extract from content..."),e.next=12,je("posts");case 12:for(t=e.sent,r=[],a=0;a<t;a+=ye)r.push(a);return o=r.map((function(e){return function(){var n=tc(regeneratorRuntime.mark((function n(t){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,dc(xe);case 2:return n.next=4,So("".concat(To,"/extract_references"),{source:"content",limit:e},t);case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}()})),e.next=18,q.start(o);case 18:n+=q.getErrorCount(),q.reset(),x((function(e){return e+1}));case 21:if("files"!==me||!he){e.next=34;break}return S("Extract from library..."),e.next=25,je("medias");case 25:for(i=e.sent,c=[],l=0;l<i;l+=ye)c.push(l);return u=c.map((function(e){return function(){var n=tc(regeneratorRuntime.mark((function n(t){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,dc(xe);case 2:return n.next=4,So("".concat(To,"/extract_references"),{source:"media",limit:e},t);case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}()})),e.next=31,q.start(u);case 31:q.reset(),n+=q.getErrorCount(),x((function(e){return e+1}));case 34:if(s=[],"media"!==me){e.next=50;break}return S("Listing media..."),e.next=39,je("medias");case 39:for(f=e.sent,m=[],p=0;p<f;p+=ge)m.push(p);return b=m.map((function(e){return function(){var n=tc(regeneratorRuntime.mark((function n(t){var r;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,dc(xe);case 2:return n.next=4,So("".concat(To,"/retrieve_medias"),{limit:e},t);case 4:return(r=n.sent).data&&(s=[].concat(Zi(s),Zi(r.data.results))),n.abrupt("return",r);case 7:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}()})),e.next=45,q.start(b);case 45:q.reset(),n+=q.getErrorCount(),x((function(e){return e+1})),e.next=61;break;case 50:if("files"!==me){e.next=60;break}return S("Listing files..."),y=function(){var e=tc(regeneratorRuntime.mark((function e(n,t){var r,a,o,i,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,So("".concat(To,"/retrieve_files"),{path:n},t);case 2:r=e.sent,a=r.data,o=Ki(a.results);try{for(c=function(){var e=i.value;"dir"===e.type?q.addTask(tc(regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,y(e.path,t);case 2:return n.abrupt("return",n.sent);case 3:case"end":return n.stop()}}),n)})))):s.push(e.path)},o.s();!(i=o.n()).done;)c()}catch(e){o.e(e)}finally{o.f()}return e.abrupt("return",r);case 7:case"end":return e.stop()}}),e)})));return function(n,t){return e.apply(this,arguments)}}(),e.next=55,q.start([function(){var e=tc(regeneratorRuntime.mark((function e(n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,y("",n);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}()]);case 55:q.reset(),n+=q.getErrorCount(),x((function(e){return e+1})),e.next=61;break;case 60:alert("This method is not known!");case 61:if(!s){e.next=68;break}return S("Matching with content..."),g=Oo(s,ve),v=g.map((function(e){return function(){var n=tc(regeneratorRuntime.mark((function n(t){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,dc(xe);case 2:return n.next=4,So("".concat(To,"/check_targets"),{method:me,targets:e},t);case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}()})),e.next=67,q.start(v);case 67:n+=q.getErrorCount();case 68:Re(n),h(!1),S();case 71:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ze=React.createElement(React.Fragment,null,React.createElement(Ne,{className:"secondary",onClick:function(){return window.open("https://meowapps.com/plugin/media-cleaner/","_blank")}},"Get the Pro Version"),React.createElement(Ne,{className:"primary",onClick:function(){return window.open("https://meowapps.com/media-cleaner-tutorial/","_blank")}},"Read the tutorial"));return React.createElement(vn,{nekoErrors:[oe,ne,se]},React.createElement(Qr,{title:"Media Cleaner | Dashboard",subtitle:"By Jordy Meow"},React.createElement("div",{style:{display:"flex",justifyContent:"flex-end"}},React.createElement(Ne,{className:"primary",onClick:function(){return window.open("https://meowapps.com/media-cleaner-tutorial/","_blank")}},"Tutorial"),React.createElement(Ne,{icon:"cog",color:"#8554bb",onClick:function(){return location.href="admin.php?page=wpmc_settings"}},"Settings"))),React.createElement(lt,null,React.createElement(ut,{full:!0},React.createElement(Yi,null),!Io&&React.createElement(Un,{footer:ze},React.createElement(An,{p:!0},"You must ",React.createElement("b",null,"backup the uploads folder and DB")," before using the Renamer. If you don't know how, give a try to ",React.createElement("a",{target:"_blank",href:"https://meow.click/blogvault"},"BlogVault"),". It is also highly recommanded to read the tutorial. Last but not least, check the ",React.createElement("b",null,"Pro Version"),", as it adds many features and also supports the development. This message is only displayed in the free version. Thank you!")),React.createElement(go,null,!f.length&&React.createElement(React.Fragment,null,React.createElement(Ne,{icon:"play",disabled:fe,onClick:function(){return Te()}},"Scan"),!C&&React.createElement(Xt,{id:"wpmc_method",scrolldown:!0,disabled:fe,name:"wpmc_method",style:{width:200},onChange:ke,value:me},sc.map((function(e){return React.createElement(Qt,{key:e.id,id:e.id,value:e.value,label:e.label,requirePro:e.requirePro})})))),f.length>0&&React.createElement(Ne,{disabled:fe,onClick:function(){return d([])}},"Unselect All"),C&&React.createElement("div",{style:(e={display:"flex",fontFamily:"Lato",padding:"0 10px",flexDirection:"column",fontWeight:600,width:200},ec(e,"flexDirection","column"),ec(e,"height",30),ec(e,"lineHeight","16px"),ec(e,"justifyContent","center"),ec(e,"textTransform","uppercase"),e)},React.createElement("div",{style:{color:"#144675",fontSize:17}},"STEP ".concat(w,"/").concat(R)),React.createElement("div",{style:{color:"#007bba"}},C)),!fe&&"issues"===t&&f.length>0&&React.createElement(React.Fragment,null,React.createElement(Ne,{className:"secondary",onClick:function(){return Pe(!0,f)}},"Ignore ",React.createElement("strong",null,f.length)," entries"),React.createElement(Ne,{className:"danger",onClick:function(){return Ce(f)}},"Delete ",React.createElement("strong",null,f.length)," entries")),!fe&&"ignored"===t&&f.length>0&&React.createElement(React.Fragment,null,React.createElement(Ne,{className:"secondary",onClick:function(){return Pe(!1,f)}},"Undo ",React.createElement("strong",null,f.length)," entries")),!fe&&"trash"===t&&f.length>0&&React.createElement(React.Fragment,null,React.createElement(Ne,{icon:"delete",className:"secondary",onClick:function(){return Se(f)}},"Recover ",React.createElement("strong",null,f.length)," entries")),React.createElement("div",{style:{flex:1}},C&&React.createElement(Pr,{status:function(e){return"".concat(q.max?"".concat(e,"%"):"+=")},busy:q.busy,value:q.value,max:q.max,onStopClick:q.stop})),!fe&&React.createElement(React.Fragment,null,React.createElement(jt,{onBlur:function(e){g(e)},value:y,onEnter:function(e){g(e)}}),!y&&React.createElement(Jr,{icon:"search",width:24,style:{position:"relative",left:-34,marginRight:-22},color:"#5a5a5a82"}),y&&React.createElement(Jr,{icon:"close",width:24,style:{position:"relative",left:-34,marginRight:-22},color:E.blue,onClick:function(){g("")}})),!fe&&"issues"===t&&ae.issues>0&&React.createElement(React.Fragment,null,React.createElement(Ne,{icon:"delete",className:"danger",onClick:function(){return l("deleteAll")}},"Delete ",React.createElement("strong",null,"All"))),!fe&&"trash"===t&&ae.trash>0&&React.createElement(React.Fragment,null,React.createElement(Ne,{className:"primary",onClick:function(){return l("recoverAll")}},"Recover ",React.createElement("strong",null,"All")),React.createElement(Ne,{icon:"delete",className:"danger",onClick:function(){return l("trashAll")}},"Empty Trash"))),React.createElement("p",null,"There are ",React.createElement("b",null,ae.issues," issue",ae.issues>1?"s":"")," with your files, accounting for ",React.createElement("b",null,(ae.issues_size/1e6).toFixed(2)," MB"),". Your trash contains ",React.createElement("b",null,(ae.trash_size/1e6).toFixed(2)," MB"),"."),React.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginTop:10,marginBottom:10}},React.createElement(fa,{value:t,busy:re,onChange:function(e){a(e),F(1)}},React.createElement(da,{title:"Issues",value:"issues",count:ae.issues}),React.createElement(da,{title:"Ignored",value:"ignored",count:ae.ignored}),React.createElement(da,{title:"Trash",value:"trash",count:ae.trash})),React.createElement(ra,{currentPage:M,limit:L,total:ue,onClick:function(e){return F(e)}})),React.createElement(La,{busy:fe,data:de,columns:Ee,sort:N,onSortChange:function(e,n){z({accessor:e,by:n})},onSelect:function(e){d([].concat(Zi(f),Zi(e)))},onUnselect:function(e){d(Zi(f.filter((function(n){return!e.includes(n)}))))},selectedItems:f}),React.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginTop:10}},React.createElement(Xt,{scrolldown:!0,value:L,onChange:function(e){D(e),F(1)}},React.createElement(Qt,{value:5,label:"5 items per page"}),React.createElement(Qt,{value:10,label:"10 items per page"}),React.createElement(Qt,{value:25,label:"25 items per page"}),React.createElement(Qt,{value:50,label:"50 items per page"})),React.createElement(ra,{currentPage:M,limit:L,total:ue,onClick:function(e){return F(e)}}))),React.createElement(Aa,{isOpen:"deleteAll"===i,onRequestClose:function(){return l()},title:"Delete All",content:React.createElement("span",null,"If you continue, ",React.createElement("b",null,"all the issues will be deleted"),". Make absolutely sure you have a backup of your site."),onOkClick:function(){l(),Ce()},onCancelClick:function(){l()}}),React.createElement(Aa,{isOpen:"trashAll"===i,onRequestClose:function(){return l()},title:"Delete All",content:React.createElement("span",null,"If you continue, ",React.createElement("b",null,"the trash will be entirely emptied"),". Make absolutely sure you have a backup of your site."),onOkClick:function(){l(),Ce(null,!0)},onCancelClick:function(){l()}}),React.createElement(Aa,{isOpen:"recoverAll"===i,onRequestClose:function(){return l()},title:"Recover All",content:"Are you sure you really want to recover all the files from the trash?",onOkClick:function(){l(),Se()},onCancelClick:function(){l()}}),React.createElement(Aa,{isOpen:q.error,onRequestClose:Ae,title:"Error",content:q.error?q.error.message:"N/A",customButtons:React.createElement(React.Fragment,null,React.createElement(Ne,{className:"primary",onClick:function(){q.resume()}},"Skip"),React.createElement(Ne,{className:"primary",onClick:function(){q.setAlwaysSkip(),q.resume()}},"Always Skip"),React.createElement(Ne,{className:"danger",onClick:Ae},"Stop"))}),React.createElement(Aa,{isOpen:_,title:"Finished",ok:"Close",content:_,onOkClick:function(){A(""),q.reset()}})))};document.addEventListener("DOMContentLoaded",(function(e){var n=document.getElementById("wpmc-admin-settings");n&&i.a.render(a.a.createElement(Li,null),n),(n=document.getElementById("wpmc-dashboard"))&&i.a.render(a.a.createElement(hc,null),n)}))},9:function(e,n){e.exports=ReactDOM}});
2
+ //# sourceMappingURL=index.js.map
app/vendor.js ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (window.wpJsonWpmc=window.wpJsonWpmc||[]).push([[1],[,function(e,t,n){e.exports=n(60)()},function(e,t,n){"use strict";(function(e){var r=n(16),o=n(0),i=n.n(o),a=(n(48),n(49)),u=n(50),s=n(23),l=n(21),c=n.n(l);function f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var d=function(e,t){for(var n=[e[0]],r=0,o=t.length;r<o;r+=1)n.push(t[r],e[r+1]);return n},p=function(e){return null!==e&&"object"==typeof e&&"[object Object]"===(e.toString?e.toString():Object.prototype.toString.call(e))&&!Object(r.typeOf)(e)},h=Object.freeze([]),v=Object.freeze({});function y(e){return"function"==typeof e}function b(e){return e.displayName||e.name||"Component"}function m(e){return e&&"string"==typeof e.styledComponentId}var g=void 0!==e&&(e.env.REACT_APP_SC_ATTR||e.env.SC_ATTR)||"data-styled",w="undefined"!=typeof window&&"HTMLElement"in window,_="boolean"==typeof SC_DISABLE_SPEEDY&&SC_DISABLE_SPEEDY||void 0!==e&&(e.env.REACT_APP_SC_DISABLE_SPEEDY||e.env.SC_DISABLE_SPEEDY)||!1,C=function(){return n.nc};function O(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/master/packages/styled-components/src/utils/errors.md#"+e+" for more information."+(n.length>0?" Additional arguments: "+n.join(", "):""))}var k=function(e){var t=document.head,n=e||t,r=document.createElement("style"),o=function(e){for(var t=e.childNodes,n=t.length;n>=0;n--){var r=t[n];if(r&&1===r.nodeType&&r.hasAttribute(g))return r}}(n),i=void 0!==o?o.nextSibling:null;r.setAttribute(g,"active"),r.setAttribute("data-styled-version","5.1.1");var a=C();return a&&r.setAttribute("nonce",a),n.insertBefore(r,i),r},S=function(){function e(e){var t=this.element=k(e);t.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,r=t.length;n<r;n++){var o=t[n];if(o.ownerNode===e)return o}O(17)}(t),this.length=0}var t=e.prototype;return t.insertRule=function(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(e){return!1}},t.deleteRule=function(e){this.sheet.deleteRule(e),this.length--},t.getRule=function(e){var t=this.sheet.cssRules[e];return void 0!==t&&"string"==typeof t.cssText?t.cssText:""},e}(),x=function(){function e(e){var t=this.element=k(e);this.nodes=t.childNodes,this.length=0}var t=e.prototype;return t.insertRule=function(e,t){if(e<=this.length&&e>=0){var n=document.createTextNode(t),r=this.nodes[e];return this.element.insertBefore(n,r||null),this.length++,!0}return!1},t.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},t.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},e}(),A=function(){function e(e){this.rules=[],this.length=0}var t=e.prototype;return t.insertRule=function(e,t){return e<=this.length&&(this.rules.splice(e,0,t),this.length++,!0)},t.deleteRule=function(e){this.rules.splice(e,1),this.length--},t.getRule=function(e){return e<this.length?this.rules[e]:""},e}(),M=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}var t=e.prototype;return t.indexOfGroup=function(e){for(var t=0,n=0;n<e;n++)t+=this.groupSizes[n];return t},t.insertRules=function(e,t){if(e>=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,o=r;e>=o;)(o<<=1)<0&&O(16,""+e);this.groupSizes=new Uint32Array(o),this.groupSizes.set(n),this.length=o;for(var i=r;i<o;i++)this.groupSizes[i]=0}for(var a=this.indexOfGroup(e+1),u=0,s=t.length;u<s;u++)this.tag.insertRule(a,t[u])&&(this.groupSizes[e]++,a++)},t.clearGroup=function(e){if(e<this.length){var t=this.groupSizes[e],n=this.indexOfGroup(e),r=n+t;this.groupSizes[e]=0;for(var o=n;o<r;o++)this.tag.deleteRule(n)}},t.getGroup=function(e){var t="";if(e>=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],r=this.indexOfGroup(e),o=r+n,i=r;i<o;i++)t+=this.tag.getRule(i)+"/*!sc*/\n";return t},e}(),j=new Map,E=new Map,P=1,I=function(e){if(j.has(e))return j.get(e);var t=P++;return j.set(e,t),E.set(t,e),t},R=function(e){return E.get(e)},T=function(e,t){t>=P&&(P=t+1),j.set(e,t),E.set(t,e)},L="style["+g+'][data-styled-version="5.1.1"]',F=new RegExp("^"+g+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),z=function(e,t,n){for(var r,o=n.split(","),i=0,a=o.length;i<a;i++)(r=o[i])&&e.registerName(t,r)},N=function(e,t){for(var n=t.innerHTML.split("/*!sc*/\n"),r=[],o=0,i=n.length;o<i;o++){var a=n[o].trim();if(a){var u=a.match(F);if(u){var s=0|parseInt(u[1],10),l=u[2];0!==s&&(T(l,s),z(e,l,u[3]),e.getTag().insertRules(s,r)),r.length=0}else r.push(a)}}},D=w,H={isServer:!w,useCSSOMInjection:!_},q=function(){function e(e,t,n){void 0===e&&(e=H),void 0===t&&(t={}),this.options=f({},H,{},e),this.gs=t,this.names=new Map(n),!this.options.isServer&&w&&D&&(D=!1,function(e){for(var t=document.querySelectorAll(L),n=0,r=t.length;n<r;n++){var o=t[n];o&&"active"!==o.getAttribute(g)&&(N(e,o),o.parentNode&&o.parentNode.removeChild(o))}}(this))}e.registerId=function(e){return I(e)};var t=e.prototype;return t.reconstructWithOptions=function(t){return new e(f({},this.options,{},t),this.gs,this.names)},t.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},t.getTag=function(){return this.tag||(this.tag=(t=this.options,n=t.isServer,r=t.useCSSOMInjection,o=t.target,e=n?new A(o):r?new S(o):new x(o),new M(e)));var e,t,n,r,o},t.hasNameForId=function(e,t){return this.names.has(e)&&this.names.get(e).has(t)},t.registerName=function(e,t){if(I(e),this.names.has(e))this.names.get(e).add(t);else{var n=new Set;n.add(t),this.names.set(e,n)}},t.insertRules=function(e,t,n){this.registerName(e,t),this.getTag().insertRules(I(e),n)},t.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},t.clearRules=function(e){this.getTag().clearGroup(I(e)),this.clearNames(e)},t.clearTag=function(){this.tag=void 0},t.toString=function(){return function(e){for(var t=e.getTag(),n=t.length,r="",o=0;o<n;o++){var i=R(o);if(void 0!==i){var a=e.names.get(i),u=t.getGroup(o);if(void 0!==a&&0!==u.length){var s=g+".g"+o+'[id="'+i+'"]',l="";void 0!==a&&a.forEach((function(e){e.length>0&&(l+=e+",")})),r+=""+u+s+'{content:"'+l+'"}/*!sc*/\n'}}}return r}(this)},e}(),$=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},V=function(e){return $(5381,e)};var W=/^\s*\/\/.*$/gm;function U(e){var t,n,r,o=void 0===e?v:e,i=o.options,u=void 0===i?v:i,s=o.plugins,l=void 0===s?h:s,c=new a.a(u),f=[],d=function(e){function t(t){if(t)try{e(t+"}")}catch(e){}}return function(n,r,o,i,a,u,s,l,c,f){switch(n){case 1:if(0===c&&64===r.charCodeAt(0))return e(r+";"),"";break;case 2:if(0===l)return r+"/*|*/";break;case 3:switch(l){case 102:case 112:return e(o[0]+r),"";default:return r+(0===f?"/*|*/":"")}case-2:r.split("/*|*/}").forEach(t)}}}((function(e){f.push(e)})),p=function(e,r,o){return r>0&&-1!==o.slice(0,r).indexOf(n)&&o.slice(r-n.length,r)!==n?"."+t:e};function y(e,o,i,a){void 0===a&&(a="&");var u=e.replace(W,""),s=o&&i?i+" "+o+" { "+u+" }":u;return t=a,n=o,r=new RegExp("\\"+n+"\\b","g"),c(i||!o?"":o,s)}return c.use([].concat(l,[function(e,t,o){2===e&&o.length&&o[0].lastIndexOf(n)>0&&(o[0]=o[0].replace(r,p))},d,function(e){if(-2===e){var t=f;return f=[],t}}])),y.hash=l.length?l.reduce((function(e,t){return t.name||O(15),$(e,t.name)}),5381).toString():"",y}var B=i.a.createContext(),G=(B.Consumer,i.a.createContext()),K=(G.Consumer,new q),Y=U();function X(){return Object(o.useContext)(B)||K}function Q(){return Object(o.useContext)(G)||Y}var J=function(){function e(e,t){var n=this;this.inject=function(e){e.hasNameForId(n.id,n.name)||e.insertRules(n.id,n.name,Y.apply(void 0,n.stringifyArgs))},this.toString=function(){return O(12,String(n.name))},this.name=e,this.id="sc-keyframes-"+e,this.stringifyArgs=t}return e.prototype.getName=function(){return this.name},e}(),Z=/([A-Z])/g,ee=/^ms-/;function te(e){return e.replace(Z,"-$1").toLowerCase().replace(ee,"-ms-")}var ne=function(e){return null==e||!1===e||""===e},re=function e(t,n){var r=[];return Object.keys(t).forEach((function(n){if(!ne(t[n])){if(p(t[n]))return r.push.apply(r,e(t[n],n)),r;if(y(t[n]))return r.push(te(n)+":",t[n],";"),r;r.push(te(n)+": "+(o=n,(null==(i=t[n])||"boolean"==typeof i||""===i?"":"number"!=typeof i||0===i||o in u.a?String(i).trim():i+"px")+";"))}var o,i;return r})),n?[n+" {"].concat(r,["}"]):r};function oe(e,t,n){if(Array.isArray(e)){for(var r,o=[],i=0,a=e.length;i<a;i+=1)""!==(r=oe(e[i],t,n))&&(Array.isArray(r)?o.push.apply(o,r):o.push(r));return o}return ne(e)?"":m(e)?"."+e.styledComponentId:y(e)?"function"!=typeof(u=e)||u.prototype&&u.prototype.isReactComponent||!t?e:oe(e(t),t,n):e instanceof J?n?(e.inject(n),e.getName()):e:p(e)?re(e):e.toString();var u}function ie(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return y(e)||p(e)?oe(d(h,[e].concat(n))):0===n.length&&1===e.length&&"string"==typeof e[0]?e:oe(d(e,n))}var ae=function(e){return"function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)},ue=function(e){return"__proto__"!==e&&"constructor"!==e&&"prototype"!==e};function se(e,t,n){var r=e[n];ae(t)&&ae(r)?le(r,t):e[n]=t}function le(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];for(var o=0,i=n;o<i.length;o++){var a=i[o];if(ae(a))for(var u in a)ue(u)&&se(e,a[u],u)}return e}var ce=/(a)(d)/gi,fe=function(e){return String.fromCharCode(e+(e>25?39:97))};function de(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=fe(t%52)+n;return(fe(t%52)+n).replace(ce,"$1-$2")}function pe(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(y(n)&&!m(n))return!1}return!0}var he=function(){function e(e,t){this.rules=e,this.staticRulesId="",this.isStatic=pe(e),this.componentId=t,this.baseHash=V(t),q.registerId(t)}return e.prototype.generateAndInjectStyles=function(e,t,n){var r=this.componentId;if(this.isStatic&&!n.hash){if(this.staticRulesId&&t.hasNameForId(r,this.staticRulesId))return this.staticRulesId;var o=oe(this.rules,e,t).join(""),i=de($(this.baseHash,o.length)>>>0);if(!t.hasNameForId(r,i)){var a=n(o,"."+i,void 0,r);t.insertRules(r,i,a)}return this.staticRulesId=i,i}for(var u=this.rules.length,s=$(this.baseHash,n.hash),l="",c=0;c<u;c++){var f=this.rules[c];if("string"==typeof f)l+=f;else{var d=oe(f,e,t),p=Array.isArray(d)?d.join(""):d;s=$(s,p+c),l+=p}}var h=de(s>>>0);if(!t.hasNameForId(r,h)){var v=n(l,"."+h,void 0,r);t.insertRules(r,h,v)}return h},e}(),ve=(new Set,function(e,t,n){return void 0===n&&(n=v),e.theme!==n.theme&&e.theme||t||n.theme}),ye=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,be=/(^-|-$)/g;function me(e){return e.replace(ye,"-").replace(be,"")}function ge(e){return"string"==typeof e&&!0}var we=function(e){return de(V(e)>>>0)};var _e=i.a.createContext();_e.Consumer;var Ce={};function Oe(e,t,n){var r=e.attrs,i=e.componentStyle,a=e.defaultProps,u=e.foldedComponentIds,l=e.shouldForwardProp,c=e.styledComponentId,d=e.target;Object(o.useDebugValue)(c);var p=function(e,t,n){void 0===e&&(e=v);var r=f({},t,{theme:e}),o={};return n.forEach((function(e){var t,n,i,a=e;for(t in y(a)&&(a=a(r)),a)r[t]=o[t]="className"===t?(n=o[t],i=a[t],n&&i?n+" "+i:n||i):a[t]})),[r,o]}(ve(t,Object(o.useContext)(_e),a)||v,t,r),h=p[0],b=p[1],m=function(e,t,n,r){var i=X(),a=Q(),u=e.isStatic&&!t?e.generateAndInjectStyles(v,i,a):e.generateAndInjectStyles(n,i,a);return Object(o.useDebugValue)(u),u}(i,r.length>0,h),g=n,w=b.$as||t.$as||b.as||t.as||d,_=ge(w),C=b!==t?f({},t,{},b):t,O=l||_&&s.a,k={};for(var S in C)"$"!==S[0]&&"as"!==S&&("forwardedAs"===S?k.as=C[S]:O&&!O(S,s.a)||(k[S]=C[S]));return t.style&&b.style!==t.style&&(k.style=f({},t.style,{},b.style)),k.className=Array.prototype.concat(u,c,m!==c?m:null,t.className,b.className).filter(Boolean).join(" "),k.ref=g,Object(o.createElement)(w,k)}function ke(e,t,n){var r=m(e),o=!ge(e),a=t.displayName,u=void 0===a?function(e){return ge(e)?"styled."+e:"Styled("+b(e)+")"}(e):a,s=t.componentId,l=void 0===s?function(e,t){var n="string"!=typeof e?"sc":me(e);Ce[n]=(Ce[n]||0)+1;var r=n+"-"+we(n+Ce[n]);return t?t+"-"+r:r}(t.displayName,t.parentComponentId):s,d=t.attrs,p=void 0===d?h:d,v=t.displayName&&t.componentId?me(t.displayName)+"-"+t.componentId:t.componentId||l,y=r&&e.attrs?Array.prototype.concat(e.attrs,p).filter(Boolean):p,g=t.shouldForwardProp;r&&e.shouldForwardProp&&(g=g?function(n,r){return e.shouldForwardProp(n,r)&&t.shouldForwardProp(n,r)}:e.shouldForwardProp);var w,_=new he(r?e.componentStyle.rules.concat(n):n,v),C=function(e,t){return Oe(w,e,t)};return C.displayName=u,(w=i.a.forwardRef(C)).attrs=y,w.componentStyle=_,w.displayName=u,w.shouldForwardProp=g,w.foldedComponentIds=r?Array.prototype.concat(e.foldedComponentIds,e.styledComponentId):h,w.styledComponentId=v,w.target=r?e.target:e,w.withComponent=function(e){var r=t.componentId,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(t,["componentId"]),i=r&&r+"-"+(ge(e)?e:me(b(e)));return ke(e,f({},o,{attrs:y,componentId:i}),n)},Object.defineProperty(w,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(t){this._foldedDefaultProps=r?le({},e.defaultProps,t):t}}),w.toString=function(){return"."+w.styledComponentId},o&&c()(w,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,self:!0,styledComponentId:!0,target:!0,withComponent:!0}),w}var Se=function(e){return function e(t,n,o){if(void 0===o&&(o=v),!Object(r.isValidElementType)(n))return O(1,String(n));var i=function(){return t(n,o,ie.apply(void 0,arguments))};return i.withConfig=function(r){return e(t,n,f({},o,{},r))},i.attrs=function(r){return e(t,n,f({},o,{attrs:Array.prototype.concat(o.attrs,r).filter(Boolean)}))},i}(ke,e)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].forEach((function(e){Se[e]=Se(e)}));t.a=Se}).call(this,n(62))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.InlineIcon=t.Icon=void 0;var r,o=(r=n(0))&&r.__esModule?r:{default:r};function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var u=0,s=/(-?[0-9.]*[0-9]+[0-9.]*)/g,l=/^-?[0-9.]*[0-9]+[0-9.]*$/g,c=["width","height","inline","hFlip","vFlip","flip","rotate","align","color","box"],f={left:0,top:0,width:16,height:16,rotate:0,hFlip:!1,vFlip:!1};var d=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._item=t}var t,n,r;return t=e,r=[{key:"splitAttributes",value:function(e){var t={icon:Object.create(null),node:Object.create(null)};return Object.keys(e).forEach((function(n){t[-1===c.indexOf(n)?"node":"icon"][n]=e[n]})),t}},{key:"calculateDimension",value:function(e,t,n){if(1===t)return e;if(n=void 0===n?100:n,"number"==typeof e)return Math.ceil(e*t*n)/n;var r=e.split(s);if(null===r||!r.length)return null;for(var o,i=[],a=r.shift(),u=l.test(a);;){if(u?(o=parseFloat(a),isNaN(o)?i.push(a):i.push(Math.ceil(o*t*n)/n)):i.push(a),void 0===(a=r.shift()))return i.join("");u=!u}}},{key:"replaceIDs",value:function(e){var t,n,r=/\sid="(\S+)"/g,o=[];function i(e,t,n){for(var r=0;-1!==(r=n.indexOf(e,r));)n=n.slice(0,r)+t+n.slice(r+e.length),r+=t.length;return n}for(;t=r.exec(e);)o.push(t[1]);return o.length?(n="IconifyId-"+Date.now().toString(16)+"-"+(16777216*Math.random()|0).toString(16)+"-",o.forEach((function(t){var r=n+u;u++,e=i('="'+t+'"','="'+r+'"',e),e=i('="#'+t+'"','="#'+r+'"',e),e=i("(#"+t+")","(#"+r+")",e)})),e):e}}],(n=[{key:"getAttributes",value:function(t){var n=this._item;"object"!==i(t)&&(t=Object.create(null));var r={horizontal:"center",vertical:"middle",slice:!1},o={rotate:n.rotate,hFlip:n.hFlip,vFlip:n.vFlip},a=Object.create(null),u=Object.create(null),s=!0===t.inline||"true"===t.inline||"1"===t.inline,l={left:n.left,top:s?n.inlineTop:n.top,width:n.width,height:s?n.inlineHeight:n.height};if(["hFlip","vFlip"].forEach((function(e){void 0===t[e]||!0!==t[e]&&"true"!==t[e]&&"1"!==t[e]||(o[e]=!o[e])})),void 0!==t.flip&&t.flip.toLowerCase().split(/[\s,]+/).forEach((function(e){switch(e){case"horizontal":o.hFlip=!o.hFlip;break;case"vertical":o.vFlip=!o.vFlip}})),void 0!==t.rotate){var c=t.rotate;if("number"==typeof c)o.rotate+=c;else if("string"==typeof c){var f=c.replace(/^-?[0-9.]*/,"");if(""===f)c=parseInt(c),isNaN(c)||(o.rotate+=c);else if(f!==c){var d=!1;switch(f){case"%":d=25;break;case"deg":d=90}d&&(c=parseInt(c.slice(0,c.length-f.length)),isNaN(c)||(o.rotate+=Math.round(c/d)))}}}var p,h=[];switch(o.hFlip?o.vFlip?o.rotate+=2:(h.push("translate("+(l.width+l.left)+" "+(0-l.top)+")"),h.push("scale(-1 1)"),l.top=l.left=0):o.vFlip&&(h.push("translate("+(0-l.left)+" "+(l.height+l.top)+")"),h.push("scale(1 -1)"),l.top=l.left=0),o.rotate%4){case 1:p=l.height/2+l.top,h.unshift("rotate(90 "+p+" "+p+")"),0===l.left&&0===l.top||(p=l.left,l.left=l.top,l.top=p),l.width!==l.height&&(p=l.width,l.width=l.height,l.height=p);break;case 2:h.unshift("rotate(180 "+(l.width/2+l.left)+" "+(l.height/2+l.top)+")");break;case 3:p=l.width/2+l.left,h.unshift("rotate(-90 "+p+" "+p+")"),0===l.left&&0===l.top||(p=l.left,l.left=l.top,l.top=p),l.width!==l.height&&(p=l.width,l.width=l.height,l.height=p)}var v,y,b=t.width?t.width:null,m=t.height?t.height:null;null===b&&null===m&&(m="1em"),null!==b&&null!==m?(v=b,y=m):null!==b?(v=b,y=e.calculateDimension(v,l.height/l.width)):(y=m,v=e.calculateDimension(y,l.width/l.height)),!1!==v&&(u.width="auto"===v?l.width:v),!1!==y&&(u.height="auto"===y?l.height:y),s&&0!==n.verticalAlign&&(a["vertical-align"]=n.verticalAlign+"em"),void 0!==t.align&&t.align.toLowerCase().split(/[\s,]+/).forEach((function(e){switch(e){case"left":case"right":case"center":r.horizontal=e;break;case"top":case"bottom":case"middle":r.vertical=e;break;case"crop":r.slice=!0;break;case"meet":r.slice=!1}})),u.preserveAspectRatio=function(e){var t;switch(e.horizontal){case"left":t="xMin";break;case"right":t="xMax";break;default:t="xMid"}switch(e.vertical){case"top":t+="YMin";break;case"bottom":t+="YMax";break;default:t+="YMid"}return t+=e.slice?" slice":" meet"}(r),u.viewBox=l.left+" "+l.top+" "+l.width+" "+l.height;var g=e.replaceIDs(n.body);return void 0!==t.color&&(g=g.replace(/currentColor/g,t.color)),h.length&&(g='<g transform="'+h.join(" ")+'">'+g+"</g>"),!0!==t.box&&"true"!==t.box&&"1"!==t.box||(g+='<rect x="'+l.left+'" y="'+l.top+'" width="'+l.width+'" height="'+l.height+'" fill="rgba(0, 0, 0, 0)" />'),{attributes:u,body:g,style:a}}},{key:"getSVG",value:function(t,n){var r=e.splitAttributes(t),o=this.getAttributes(r.icon),i='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"';return n&&Object.keys(r.node).forEach((function(e){i+=" "+e+'="'+r.node[e]+'"'})),Object.keys(o.attributes).forEach((function(e){i+=" "+e+'="'+o.attributes[e]+'"'})),i+=' style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);',Object.keys(o.style).forEach((function(e){i+=" "+e+": "+o.style[e]+";"})),t&&void 0!==t.style&&(i+=t.style),i+='">',i+=o.body+"</svg>"}}])&&a(t.prototype,n),r&&a(t,r),e}();function p(e,t){if("object"!==i(e.icon))return null;var n=d.splitAttributes(e),r=n.icon,a=n.node;delete a.icon,void 0===r.inline&&(r.inline=t);var u=new d(function(e){var t,n=Object.create(null);for(t in f)n[t]=f[t];for(t in e)n[t]=e[t];return void 0===n.inlineTop&&(n.inlineTop=n.top),void 0===n.inlineHeight&&(n.inlineHeight=n.height),void 0===n.verticalAlign&&(n.verticalAlign=n.height%7==0&&n.height%8!=0?-.143:-.125),n}(e.icon)).getAttributes(r),s={transform:"rotate(360deg)"};if(void 0!==u.style["vertical-align"]&&(s.verticalAlign=u.style["vertical-align"]),void 0!==e.style)for(var l in e.style)s[l]=e.style[l];var c,p={xmlns:"http://www.w3.org/2000/svg",focusable:!1,style:s};for(c in a)p[c]=a[c];for(c in u.attributes)p[c]=u.attributes[c];return p.dangerouslySetInnerHTML={__html:u.body},o.default.createElement("svg",p,null)}var h=function(e){return p(e,!1)};t.Icon=h;t.InlineIcon=function(e){return p(e,!0)};var v=h;t.default=v},function(e,t){t.__esModule=!0,t.default={body:'<path d="M7.41 8.58L12 13.17l4.59-4.59L18 10l-6 6l-6-6l1.41-1.42z" fill="currentColor"/>',width:24,height:24}},function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function u(e,t,n){return(u=a()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&i(o,n.prototype),o}).apply(null,arguments)}function s(e){var t="function"==typeof Map?new Map:void 0;return(s=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return u(e,arguments,o(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),i(r,e)})(e)}function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}n.d(t,"a",(function(){return N}));var c=function(e){var t,n;function r(t){return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e.call(this,"An error occurred. See https://github.com/styled-components/polished/blob/master/src/internalHelpers/errors.md#"+t+" for more information.")||this)}return n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,r}(s(Error));function f(e){return Math.round(255*e)}function d(e,t,n){return f(e)+","+f(t)+","+f(n)}function p(e,t,n,r){if(void 0===r&&(r=d),0===t)return r(n,n,n);var o=(e%360+360)%360/60,i=(1-Math.abs(2*n-1))*t,a=i*(1-Math.abs(o%2-1)),u=0,s=0,l=0;o>=0&&o<1?(u=i,s=a):o>=1&&o<2?(u=a,s=i):o>=2&&o<3?(s=i,l=a):o>=3&&o<4?(s=a,l=i):o>=4&&o<5?(u=a,l=i):o>=5&&o<6&&(u=i,l=a);var c=n-i/2;return r(u+c,s+c,l+c)}var h={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};var v=/^#[a-fA-F0-9]{6}$/,y=/^#[a-fA-F0-9]{8}$/,b=/^#[a-fA-F0-9]{3}$/,m=/^#[a-fA-F0-9]{4}$/,g=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i,w=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i,_=/^hsl\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,C=/^hsla\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i;function O(e){if("string"!=typeof e)throw new c(3);var t=function(e){if("string"!=typeof e)return e;var t=e.toLowerCase();return h[t]?"#"+h[t]:e}(e);if(t.match(v))return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16)};if(t.match(y)){var n=parseFloat((parseInt(""+t[7]+t[8],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16),alpha:n}}if(t.match(b))return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16)};if(t.match(m)){var r=parseFloat((parseInt(""+t[4]+t[4],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16),alpha:r}}var o=g.exec(t);if(o)return{red:parseInt(""+o[1],10),green:parseInt(""+o[2],10),blue:parseInt(""+o[3],10)};var i=w.exec(t);if(i)return{red:parseInt(""+i[1],10),green:parseInt(""+i[2],10),blue:parseInt(""+i[3],10),alpha:parseFloat(""+i[4])};var a=_.exec(t);if(a){var u="rgb("+p(parseInt(""+a[1],10),parseInt(""+a[2],10)/100,parseInt(""+a[3],10)/100)+")",s=g.exec(u);if(!s)throw new c(4,t,u);return{red:parseInt(""+s[1],10),green:parseInt(""+s[2],10),blue:parseInt(""+s[3],10)}}var l=C.exec(t);if(l){var f="rgb("+p(parseInt(""+l[1],10),parseInt(""+l[2],10)/100,parseInt(""+l[3],10)/100)+")",d=g.exec(f);if(!d)throw new c(4,t,f);return{red:parseInt(""+d[1],10),green:parseInt(""+d[2],10),blue:parseInt(""+d[3],10),alpha:parseFloat(""+l[4])}}throw new c(5)}function k(e){return function(e){var t,n=e.red/255,r=e.green/255,o=e.blue/255,i=Math.max(n,r,o),a=Math.min(n,r,o),u=(i+a)/2;if(i===a)return void 0!==e.alpha?{hue:0,saturation:0,lightness:u,alpha:e.alpha}:{hue:0,saturation:0,lightness:u};var s=i-a,l=u>.5?s/(2-i-a):s/(i+a);switch(i){case n:t=(r-o)/s+(r<o?6:0);break;case r:t=(o-n)/s+2;break;default:t=(n-r)/s+4}return t*=60,void 0!==e.alpha?{hue:t,saturation:l,lightness:u,alpha:e.alpha}:{hue:t,saturation:l,lightness:u}}(O(e))}var S=function(e){return 7===e.length&&e[1]===e[2]&&e[3]===e[4]&&e[5]===e[6]?"#"+e[1]+e[3]+e[5]:e};function x(e){var t=e.toString(16);return 1===t.length?"0"+t:t}function A(e){return x(Math.round(255*e))}function M(e,t,n){return S("#"+A(e)+A(t)+A(n))}function j(e,t,n){return p(e,t,n,M)}function E(e,t,n){if("number"==typeof e&&"number"==typeof t&&"number"==typeof n)return j(e,t,n);if("object"===l(e)&&void 0===t&&void 0===n)return j(e.hue,e.saturation,e.lightness);throw new c(1)}function P(e,t,n,r){if("number"==typeof e&&"number"==typeof t&&"number"==typeof n&&"number"==typeof r)return r>=1?j(e,t,n):"rgba("+p(e,t,n)+","+r+")";if("object"===l(e)&&void 0===t&&void 0===n&&void 0===r)return e.alpha>=1?j(e.hue,e.saturation,e.lightness):"rgba("+p(e.hue,e.saturation,e.lightness)+","+e.alpha+")";throw new c(2)}function I(e,t,n){if("number"==typeof e&&"number"==typeof t&&"number"==typeof n)return S("#"+x(e)+x(t)+x(n));if("object"===l(e)&&void 0===t&&void 0===n)return S("#"+x(e.red)+x(e.green)+x(e.blue));throw new c(6)}function R(e,t,n,r){if("string"==typeof e&&"number"==typeof t){var o=O(e);return"rgba("+o.red+","+o.green+","+o.blue+","+t+")"}if("number"==typeof e&&"number"==typeof t&&"number"==typeof n&&"number"==typeof r)return r>=1?I(e,t,n):"rgba("+e+","+t+","+n+","+r+")";if("object"===l(e)&&void 0===t&&void 0===n&&void 0===r)return e.alpha>=1?I(e.red,e.green,e.blue):"rgba("+e.red+","+e.green+","+e.blue+","+e.alpha+")";throw new c(7)}function T(e){if("object"!==l(e))throw new c(8);if(function(e){return"number"==typeof e.red&&"number"==typeof e.green&&"number"==typeof e.blue&&"number"==typeof e.alpha}(e))return R(e);if(function(e){return"number"==typeof e.red&&"number"==typeof e.green&&"number"==typeof e.blue&&("number"!=typeof e.alpha||void 0===e.alpha)}(e))return I(e);if(function(e){return"number"==typeof e.hue&&"number"==typeof e.saturation&&"number"==typeof e.lightness&&"number"==typeof e.alpha}(e))return P(e);if(function(e){return"number"==typeof e.hue&&"number"==typeof e.saturation&&"number"==typeof e.lightness&&("number"!=typeof e.alpha||void 0===e.alpha)}(e))return E(e);throw new c(8)}function L(e){return function e(t,n,r){return function(){var o=r.concat(Array.prototype.slice.call(arguments));return o.length>=n?t.apply(this,o):e(t,n,o)}}(e,e.length,[])}function F(e,t,n){return Math.max(e,Math.min(t,n))}function z(e,t){if("transparent"===t)return t;var n=k(t);return T(r({},n,{lightness:F(0,1,n.lightness+parseFloat(e))}))}var N=L(z)},function(e,t,n){"use strict";var r=n(0),o=n(28),i=n.n(o);function a(){return"undefined"==typeof document||void 0===document.visibilityState||"hidden"!==document.visibilityState}function u(){return void 0===navigator.onLine||navigator.onLine}var s=new WeakMap,l=0;var c=new(function(){function e(e){void 0===e&&(e={}),this.__cache=new Map(Object.entries(e)),this.__listeners=[]}return e.prototype.get=function(e){var t=this.serializeKey(e)[0];return this.__cache.get(t)},e.prototype.set=function(e,t,n){void 0===n&&(n=!0);var r=this.serializeKey(e)[0];this.__cache.set(r,t),n&&E(e,t,!1),this.notify()},e.prototype.keys=function(){return Array.from(this.__cache.keys())},e.prototype.has=function(e){var t=this.serializeKey(e)[0];return this.__cache.has(t)},e.prototype.clear=function(e){void 0===e&&(e=!0),e&&this.__cache.forEach((function(e){return E(e,null,!1)})),this.__cache.clear(),this.notify()},e.prototype.delete=function(e,t){void 0===t&&(t=!0);var n=this.serializeKey(e)[0];t&&E(e,null,!1),this.__cache.delete(n),this.notify()},e.prototype.serializeKey=function(e){var t=null;if("function"==typeof e)try{e=e()}catch(t){e=""}return Array.isArray(e)?(t=e,e=function(e){if(!e.length)return"";for(var t="arg",n=0;n<e.length;++n){var r=void 0;null===e[n]||"object"!=typeof e[n]?r="string"==typeof e[n]?'"'+e[n]+'"':String(e[n]):s.has(e[n])?r=s.get(e[n]):(r=l,s.set(e[n],l++)),t+="@"+r}return t}(e)):e=String(e||""),[e,t,e?"err@"+e:""]},e.prototype.subscribe=function(e){var t=this;if("function"!=typeof e)throw new Error("Expected the listener to be a function.");var n=!0;return this.__listeners.push(e),function(){if(n){n=!1;var r=t.__listeners.indexOf(e);r>-1&&(t.__listeners[r]=t.__listeners[t.__listeners.length-1],t.__listeners.length--)}}},e.prototype.notify=function(){for(var e=0,t=this.__listeners;e<t.length;e++){(0,t[e])()}},e}()),f={},d={},p={},h={},v={};var y="undefined"!=typeof window&&navigator.connection&&-1!==["slow-2g","2g"].indexOf(navigator.connection.effectiveType),b={onLoadingSlow:function(){},onSuccess:function(){},onError:function(){},onErrorRetry:function(e,t,n,r,o){if(a()&&!(n.errorRetryCount&&o.retryCount>n.errorRetryCount)){var i=Math.min(o.retryCount||0,8),u=~~((Math.random()+.5)*(1<<i))*n.errorRetryInterval;setTimeout(r,u,o)}},errorRetryInterval:1e3*(y?10:5),focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:1e3*(y?5:3),refreshInterval:0,revalidateOnFocus:!0,revalidateOnReconnect:!0,refreshWhenHidden:!1,refreshWhenOffline:!1,shouldRetryOnError:!0,suspense:!1,compare:i.a},m=!1;if("undefined"!=typeof window&&window.addEventListener&&!m){var g=function(){if(a()&&u())for(var e in p)p[e][0]&&p[e][0]()};window.addEventListener("visibilitychange",g,!1),window.addEventListener("focus",g,!1),m=!0}var w=b;function _(e,t){var n=!1;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=!0,e.apply(void 0,r),setTimeout((function(){return n=!1}),t))}}var C=Object(r.createContext)({});C.displayName="SWRConfigContext";var O=C,k=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function u(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,u)}s((r=r.apply(e,t||[])).next())}))},S=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},x="undefined"==typeof window,A=x?r.useEffect:r.useLayoutEffect,M=function(e,t){void 0===t&&(t=!0);var n=c.serializeKey(e),r=n[0],o=n[2];if(!r)return Promise.resolve();var i=h[r];if(r&&i){for(var a=c.get(r),u=c.get(o),s=[],l=0;l<i.length;++l)s.push(i[l](t,a,u,l>0));return Promise.all(s).then((function(){return c.get(r)}))}return Promise.resolve(c.get(r))},j=function(e,t,n){var r=h[e];if(e&&r)for(var o=0;o<r.length;++o)r[o](!1,t,n)},E=function(e,t,n){return void 0===n&&(n=!0),k(void 0,void 0,void 0,(function(){var r,o,i,a,u,s,l,f,p,y;return S(this,(function(b){switch(b.label){case 0:if(!(r=c.serializeKey(e)[0]))return[2];if(void 0===t)return[2,M(e,n)];if(v[r]=Date.now()-1,a=v[r],u=d[r],!t||"function"!=typeof t)return[3,5];b.label=1;case 1:return b.trys.push([1,3,,4]),[4,t(c.get(r))];case 2:return o=b.sent(),[3,4];case 3:return s=b.sent(),i=s,[3,4];case 4:return[3,11];case 5:if(!t||"function"!=typeof t.then)return[3,10];b.label=6;case 6:return b.trys.push([6,8,,9]),[4,t];case 7:return o=b.sent(),[3,9];case 8:return l=b.sent(),i=l,[3,9];case 9:return[3,11];case 10:o=t,b.label=11;case 11:if(a!==v[r]||u!==d[r]){if(i)throw i;return[2,o]}if(void 0!==o&&c.set(r,o,!1),f=h[r]){for(p=[],y=0;y<f.length;++y)p.push(f[y](!!n,o,i,y>0));return[2,Promise.all(p).then((function(){return c.get(r)}))]}if(i)throw i;return[2,o]}}))}))};O.Provider;var P=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o,i,s={};t.length>=1&&(o=t[0]),t.length>2?(i=t[1],s=t[2]):"function"==typeof t[1]?i=t[1]:"object"==typeof t[1]&&(s=t[1]);var l=c.serializeKey(o),y=l[0],b=l[1],m=l[2];s=Object.assign({},w,Object(r.useContext)(O),s),void 0===i&&(i=s.fetcher);var g=c.get(y)||s.initialData,C=c.get(m),M=Object(r.useRef)({data:!1,error:!1,isValidating:!1}),P=Object(r.useRef)({data:g,error:C,isValidating:!1}),I=Object(r.useState)(null)[1],R=Object(r.useCallback)((function(e){var t=!1;for(var n in e)P.current[n]=e[n],M.current[n]&&(t=!0);(t||s.suspense)&&I({})}),[]),T=Object(r.useRef)(!1),L=Object(r.useRef)(y),F=Object(r.useRef)({emit:function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];T.current||s[e].apply(s,t)}}),z=Object(r.useCallback)((function(e,t){return E(y,e,t)}),[y]),N=Object(r.useCallback)((function(t){return void 0===t&&(t={}),k(e,void 0,void 0,(function(){var e,n,r,o,a,u,l;return S(this,(function(p){switch(p.label){case 0:if(!y||!i)return[2,!1];if(T.current)return[2,!1];t=Object.assign({dedupe:!1},t),e=!0,n=void 0!==f[y]&&t.dedupe,p.label=1;case 1:return p.trys.push([1,6,,7]),R({isValidating:!0}),r=void 0,o=void 0,n?(o=d[y],[4,f[y]]):[3,3];case 2:return r=p.sent(),[3,5];case 3:return f[y]&&(v[y]=Date.now()-1),s.loadingTimeout&&!c.get(y)&&setTimeout((function(){e&&F.current.emit("onLoadingSlow",y,s)}),s.loadingTimeout),f[y]=null!==b?i.apply(void 0,b):i(y),d[y]=o=Date.now(),[4,f[y]];case 4:r=p.sent(),setTimeout((function(){delete f[y],delete d[y]}),s.dedupingInterval),F.current.emit("onSuccess",r,y,s),p.label=5;case 5:return v[y]&&o<=v[y]?(R({isValidating:!1}),[2,!1]):(c.set(y,r,!1),c.set(m,void 0,!1),a={isValidating:!1},void 0!==P.current.error&&(a.error=void 0),s.compare(P.current.data,r)||(a.data=r),R(a),n||j(y,r,void 0),[3,7]);case 6:return u=p.sent(),delete f[y],delete d[y],c.set(m,u,!1),P.current.error!==u&&(R({isValidating:!1,error:u}),n||j(y,void 0,u)),F.current.emit("onError",u,y,s),s.shouldRetryOnError&&(l=(t.retryCount||0)+1,F.current.emit("onErrorRetry",u,y,s,N,Object.assign({dedupe:!0},t,{retryCount:l}))),[3,7];case 7:return e=!1,[2,!0]}}))}))}),[y]);if(A((function(){if(y){T.current=!1;var e=P.current.data,t=c.get(y)||s.initialData;L.current===y&&s.compare(e,t)||(R({data:t}),L.current=y);var n,r=function(){return N({dedupe:!0})};(s.revalidateOnMount||!s.initialData&&void 0===s.revalidateOnMount)&&(void 0!==t&&!x&&window.requestIdleCallback?window.requestIdleCallback(r):r()),s.revalidateOnFocus&&(n=_(r,s.focusThrottleInterval),p[y]?p[y].push(n):p[y]=[n]);var o=function(e,t,n,o){void 0===e&&(e=!0),void 0===o&&(o=!0);var i={},a=!1;return void 0===t||s.compare(P.current.data,t)||(i.data=t,a=!0),P.current.error!==n&&(i.error=n,a=!0),a&&R(i),!!e&&(o?r():N())};h[y]?h[y].push(o):h[y]=[o];var i=null;return!x&&window.addEventListener&&s.revalidateOnReconnect&&window.addEventListener("online",i=r),function(){var e,t;(R=function(){return null},T.current=!0,n&&p[y])&&((t=(e=p[y]).indexOf(n))>=0&&(e[t]=e[e.length-1],e.pop()));h[y]&&((t=(e=h[y]).indexOf(o))>=0&&(e[t]=e[e.length-1],e.pop()));!x&&window.removeEventListener&&null!==i&&window.removeEventListener("online",i)}}}),[y,N]),A((function(){var t=null,n=function(){return k(e,void 0,void 0,(function(){return S(this,(function(e){switch(e.label){case 0:return P.current.error||!s.refreshWhenHidden&&!a()||!s.refreshWhenOffline&&!u()?[3,2]:[4,N({dedupe:!0})];case 1:e.sent(),e.label=2;case 2:return s.refreshInterval&&(t=setTimeout(n,s.refreshInterval)),[2]}}))}))};return s.refreshInterval&&(t=setTimeout(n,s.refreshInterval)),function(){t&&clearTimeout(t)}}),[s.refreshInterval,s.refreshWhenHidden,s.refreshWhenOffline,N]),s.suspense){var D=c.get(y)||g,H=c.get(m)||C;if(void 0===D&&void 0===H){if(f[y]||N(),f[y]&&"function"==typeof f[y].then)throw f[y];D=f[y]}if(void 0===D&&H)throw H;return{error:H,data:D,revalidate:N,mutate:z,isValidating:P.current.isValidating}}return Object(r.useMemo)((function(){var e={revalidate:N,mutate:z};return Object.defineProperties(e,{error:{get:function(){return M.current.error=!0,L.current===y?P.current.error:C},enumerable:!0},data:{get:function(){return M.current.data=!0,L.current===y?P.current.data:g},enumerable:!0},isValidating:{get:function(){return M.current.isValidating=!0,P.current.isValidating},enumerable:!0}}),e}),[N])};new Map;t.a=P},function(e,t){t.__esModule=!0,t.default={body:'<path d="M8.59 16.58L13.17 12L8.59 7.41L10 6l6 6l-6 6l-1.41-1.42z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6l-6 6l1.41 1.41z" fill="currentColor"/>',width:24,height:24}},,function(e,t){t.__esModule=!0,t.default={body:'<path d="M18.41 7.41L17 6l-6 6l6 6l1.41-1.41L13.83 12l4.58-4.59m-6 0L11 6l-6 6l6 6l1.41-1.41L7.83 12l4.58-4.59z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M5.59 7.41L7 6l6 6l-6 6l-1.41-1.41L10.17 12L5.59 7.41m6 0L13 6l6 6l-6 6l-1.41-1.41L16.17 12l-4.58-4.59z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M15.41 16.58L10.83 12l4.58-4.59L14 6l-6 6l6 6l1.41-1.42z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M14 19h4V5h-4M6 19h4V5H6v14z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M8 5.14v14l11-7l-11-7z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M18 18H6V6h12v12z" fill="currentColor"/>',width:24,height:24}},function(e,t,n){"use strict";e.exports=n(63)},function(e,t){t.__esModule=!0,t.default={body:'<path d="M19 3H5c-1.11 0-2 .89-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2m0 2v14H5V5h14z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M10 17l-5-5l1.41-1.42L10 14.17l7.59-7.59L19 8m0-5H5c-1.11 0-2 .89-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M10 4H4c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-8l-2-2z" fill="currentColor"/>',width:24,height:24}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.canUseDOM=void 0;var r,o=n(74);var i=((r=o)&&r.__esModule?r:{default:r}).default,a=i.canUseDOM?window.HTMLElement:{};t.canUseDOM=i.canUseDOM;t.default=a},function(e,t,n){"use strict";var r=n(16),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},i={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},a={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},u={};function s(e){return r.isMemo(e)?a:u[e.$$typeof]||o}u[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},u[r.Memo]=a;var l=Object.defineProperty,c=Object.getOwnPropertyNames,f=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,p=Object.getPrototypeOf,h=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(h){var o=p(n);o&&o!==h&&e(t,o,r)}var a=c(n);f&&(a=a.concat(f(n)));for(var u=s(t),v=s(n),y=0;y<a.length;++y){var b=a[y];if(!(i[b]||r&&r[b]||v&&v[b]||u&&u[b])){var m=d(n,b);try{l(t,b,m)}catch(e){}}}}return t}},function(e,t,n){"use strict";n.d(t,"b",(function(){return S})),n.d(t,"a",(function(){return f}));var r=n(0),o=n(59),i=n.n(o);function a(){return"undefined"==typeof document||void 0===document.visibilityState||"hidden"!==document.visibilityState}function u(){return void 0===navigator.onLine||navigator.onLine}function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var l=new WeakMap,c=0;var f=new(function(){function e(e){void 0===e&&(e={}),this.__cache=new Map(Object.entries(e)),this.__listeners=[]}return e.prototype.get=function(e){var t=this.serializeKey(e)[0];return this.__cache.get(t)},e.prototype.set=function(e,t,n){void 0===n&&(n=!0);var r=this.serializeKey(e)[0];this.__cache.set(r,t),n&&S(e,t,!1),this.notify()},e.prototype.keys=function(){return Array.from(this.__cache.keys())},e.prototype.has=function(e){var t=this.serializeKey(e)[0];return this.__cache.has(t)},e.prototype.clear=function(e){void 0===e&&(e=!0),e&&this.__cache.forEach((function(e){return S(e,null,!1)})),this.__cache.clear(),this.notify()},e.prototype.delete=function(e,t){void 0===t&&(t=!0);var n=this.serializeKey(e)[0];t&&S(e,null,!1),this.__cache.delete(n),this.notify()},e.prototype.serializeKey=function(e){var t=null;if("function"==typeof e)try{e=e()}catch(t){e=""}return Array.isArray(e)?(t=e,e=function(e){if(!e.length)return"";for(var t="arg",n=0;n<e.length;++n){var r=void 0;null===e[n]||"object"!==s(e[n])?r="string"==typeof e[n]?'"'+e[n]+'"':String(e[n]):l.has(e[n])?r=l.get(e[n]):(r=c,l.set(e[n],c++)),t+="@"+r}return t}(e)):e=String(e||""),[e,t,e?"err@"+e:""]},e.prototype.subscribe=function(e){var t=this;if("function"!=typeof e)throw new Error("Expected the listener to be a function.");var n=!0;return this.__listeners.push(e),function(){if(n){n=!1;var r=t.__listeners.indexOf(e);r>-1&&(t.__listeners[r]=t.__listeners[t.__listeners.length-1],t.__listeners.length--)}}},e.prototype.notify=function(){for(var e=0,t=this.__listeners;e<t.length;e++){(0,t[e])()}},e}()),d={},p={},h={},v={};var y="undefined"!=typeof window&&navigator.connection&&-1!==["slow-2g","2g"].indexOf(navigator.connection.effectiveType),b=(i.a,!1);if("undefined"!=typeof window&&window.addEventListener&&!b){var m=function(){if(a()&&u())for(var e in p)p[e][0]&&p[e][0]()};window.addEventListener("visibilitychange",m,!1),window.addEventListener("focus",m,!1),b=!0}var g=Object(r.createContext)({});g.displayName="SWRConfigContext";var w=g;var _=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function u(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,u)}s((r=r.apply(e,t||[])).next())}))},C=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},O="undefined"==typeof window,k=(O?r.useEffect:r.useLayoutEffect,function(e,t){void 0===t&&(t=!0);var n=f.serializeKey(e),r=n[0],o=n[2];if(!r)return Promise.resolve();var i=h[r];if(r&&i){for(var a=f.get(r),u=f.get(o),s=[],l=0;l<i.length;++l)s.push(i[l](t,a,u,l>0));return Promise.all(s).then((function(){return f.get(r)}))}return Promise.resolve(f.get(r))}),S=function(e,t,n){return void 0===n&&(n=!0),_(void 0,void 0,void 0,(function(){var r,o,i,a,u,s,l,c,p,y;return C(this,(function(b){switch(b.label){case 0:if(!(r=f.serializeKey(e)[0]))return[2];if(void 0===t)return[2,k(e,n)];if(v[r]=Date.now()-1,a=v[r],u=d[r],!t||"function"!=typeof t)return[3,5];b.label=1;case 1:return b.trys.push([1,3,,4]),[4,t(f.get(r))];case 2:return o=b.sent(),[3,4];case 3:return s=b.sent(),i=s,[3,4];case 4:return[3,11];case 5:if(!t||"function"!=typeof t.then)return[3,10];b.label=6;case 6:return b.trys.push([6,8,,9]),[4,t];case 7:return o=b.sent(),[3,9];case 8:return l=b.sent(),i=l,[3,9];case 9:return[3,11];case 10:o=t,b.label=11;case 11:if(a!==v[r]||u!==d[r]){if(i)throw i;return[2,o]}if(void 0!==o&&f.set(r,o,!1),c=h[r]){for(p=[],y=0;y<c.length;++y)p.push(c[y](!!n,o,i,y>0));return[2,Promise.all(p).then((function(){return f.get(r)}))]}if(i)throw i;return[2,o]}}))}))};w.Provider,new Map},function(e,t,n){"use strict";var r=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|inert|itemProp|itemScope|itemType|itemID|itemRef|on|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,o=function(e){var t={};return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}((function(e){return r.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91}));t.a=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return[].slice.call(e.querySelectorAll("*"),0).filter(a)};
2
+ /*!
3
+ * Adapted from jQuery UI core
4
+ *
5
+ * http://jqueryui.com
6
+ *
7
+ * Copyright 2014 jQuery Foundation and other contributors
8
+ * Released under the MIT license.
9
+ * http://jquery.org/license
10
+ *
11
+ * http://api.jqueryui.com/category/ui-core/
12
+ */
13
+ var r=/input|select|textarea|button|object/;function o(e){var t=e.offsetWidth<=0&&e.offsetHeight<=0;if(t&&!e.innerHTML)return!0;var n=window.getComputedStyle(e);return t?"visible"!==n.getPropertyValue("overflow")||e.scrollWidth<=0&&e.scrollHeight<=0:"none"==n.getPropertyValue("display")}function i(e,t){var n=e.nodeName.toLowerCase();return(r.test(n)&&!e.disabled||"a"===n&&e.href||t)&&function(e){for(var t=e;t&&t!==document.body;){if(o(t))return!1;t=t.parentNode}return!0}(e)}function a(e){var t=e.getAttribute("tabindex");null===t&&(t=void 0);var n=isNaN(t);return(n||t>=0)&&i(e,!n)}e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assertNodeList=s,t.setElement=function(e){var t=e;if("string"==typeof t&&a.canUseDOM){var n=document.querySelectorAll(t);s(n,t),t="length"in n?n[0]:n}return u=t||u},t.validateElement=l,t.hide=function(e){l(e)&&(e||u).setAttribute("aria-hidden","true")},t.show=function(e){l(e)&&(e||u).removeAttribute("aria-hidden")},t.documentNotReadyOrSSRTesting=function(){u=null},t.resetForTesting=function(){u=null};var r,o=n(73),i=(r=o)&&r.__esModule?r:{default:r},a=n(20);var u=null;function s(e,t){if(!e||!e.length)throw new Error("react-modal: No elements were found for selector "+t+".")}function l(e){return!(!e&&!u)||((0,i.default)(!1,["react-modal: App element is not defined.","Please use `Modal.setAppElement(el)` or set `appElement={el}`.","This is needed so screen readers don't see main content","when modal is opened. It is not recommended, but you can opt-out","by setting `ariaHideApp={false}`."].join(" ")),!1)}},function(e,t){(function(t){e.exports=t}).call(this,{})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=new function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.register=function(e){-1===t.openInstances.indexOf(e)&&(t.openInstances.push(e),t.emit("register"))},this.deregister=function(e){var n=t.openInstances.indexOf(e);-1!==n&&(t.openInstances.splice(n,1),t.emit("deregister"))},this.subscribe=function(e){t.subscribers.push(e)},this.emit=function(e){t.subscribers.forEach((function(n){return n(e,t.openInstances.slice())}))},this.openInstances=[],this.subscribers=[]};t.default=r,e.exports=t.default},function(e,t,n){"use strict";var r=Array.isArray,o=Object.keys,i=Object.prototype.hasOwnProperty;e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){var a,u,s,l=r(t),c=r(n);if(l&&c){if((u=t.length)!=n.length)return!1;for(a=u;0!=a--;)if(!e(t[a],n[a]))return!1;return!0}if(l!=c)return!1;var f=t instanceof Date,d=n instanceof Date;if(f!=d)return!1;if(f&&d)return t.getTime()==n.getTime();var p=t instanceof RegExp,h=n instanceof RegExp;if(p!=h)return!1;if(p&&h)return t.toString()==n.toString();var v=o(t);if((u=v.length)!==o(n).length)return!1;for(a=u;0!=a--;)if(!i.call(n,v[a]))return!1;for(a=u;0!=a--;)if(!e(t[s=v[a]],n[s]))return!1;return!0}return t!=t&&n!=n}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M18 8a2 2 0 0 1 2 2v10c0 1.1-.9 2-2 2H6a2 2 0 0 1-2-2V10c0-1.11.89-2 2-2h1V6C7 3.24 9.24.998 12 .998S17 3.24 17 6v2h1m-6-5c-1.66 0-3 1.34-3 3v2h6V6c0-1.66-1.34-3-3-3m-1 16l6.25-6.24l-1.41-1.41L11 16.18L8.41 13.6L7 15l4 4z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M18 1c-2.76 0-5 2.24-5 5v2H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12c1.11 0 2-.89 2-2V10a2 2 0 0 0-2-2h-1V6c0-1.66 1.34-3 3-3s3 1.34 3 3v2h2V6c0-2.76-2.24-5-5-5m-8 12a2 2 0 0 1 2 2c0 1.11-.89 2-2 2a2 2 0 1 1 0-4z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M13 9h5.5L13 3.5V9M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4c0-1.11.89-2 2-2m6.16 12.31c-1.56 0-2.97.58-4.05 1.52L6 13.72V19h5.28l-2.13-2.12c.82-.68 1.85-1.1 3.01-1.1c2.07 0 3.84 1.35 4.45 3.22l1.39-.46c-.81-2.45-3.12-4.23-5.84-4.23z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M12 5V1L7 6l5 5V7a6 6 0 0 1 6 6a6 6 0 0 1-6 6a6 6 0 0 1-6-6H4a8 8 0 0 0 8 8a8 8 0 0 0 8-8a8 8 0 0 0-8-8z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M21 7L9 19l-5.5-5.5l1.41-1.41L9 16.17L19.59 5.59L21 7z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M19 4h-3.5l-1-1h-5l-1 1H5v2h14M6 19a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7H6v12z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88c3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M12 3C7.58 3 4 4.79 4 7s3.58 4 8 4s8-1.79 8-4s-3.58-4-8-4M4 9v3c0 2.21 3.58 4 8 4s8-1.79 8-4V9c0 2.21-3.58 4-8 4s-8-1.79-8-4m0 5v3c0 2.21 3.58 4 8 4s8-1.79 8-4v-3c0 2.21-3.58 4-8 4s-8-1.79-8-4z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83l3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M21.71 20.29l-1.42 1.42a1 1 0 0 1-1.41 0L7 9.85A3.81 3.81 0 0 1 6 10a4 4 0 0 1-3.78-5.3l2.54 2.54l.53-.53l1.42-1.42l.53-.53L4.7 2.22A4 4 0 0 1 10 6a3.81 3.81 0 0 1-.15 1l11.86 11.88a1 1 0 0 1 0 1.41M2.29 18.88a1 1 0 0 0 0 1.41l1.42 1.42a1 1 0 0 0 1.41 0l5.47-5.46l-2.83-2.83M20 2l-4 2v2l-2.17 2.17l2 2L18 8h2l2-4z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M12 15.5A3.5 3.5 0 0 1 8.5 12A3.5 3.5 0 0 1 12 8.5a3.5 3.5 0 0 1 3.5 3.5a3.5 3.5 0 0 1-3.5 3.5m7.43-2.53c.04-.32.07-.64.07-.97c0-.33-.03-.66-.07-1l2.11-1.63c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.31-.61-.22l-2.49 1c-.52-.39-1.06-.73-1.69-.98l-.37-2.65A.506.506 0 0 0 14 2h-4c-.25 0-.46.18-.5.42l-.37 2.65c-.63.25-1.17.59-1.69.98l-2.49-1c-.22-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64L4.57 11c-.04.34-.07.67-.07 1c0 .33.03.65.07.97l-2.11 1.66c-.19.15-.25.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1.01c.52.4 1.06.74 1.69.99l.37 2.65c.04.24.25.42.5.42h4c.25 0 .46-.18.5-.42l.37-2.65c.63-.26 1.17-.59 1.69-.99l2.49 1.01c.22.08.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.66z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12L19 6.41z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M12 8l-1.33.09C9.81 7.07 7.4 4.5 5 4.5c0 0-1.97 2.96-.04 6.91c-.55.83-.89 1.26-.96 2.25l-1.93.29l.21.98l1.76-.26l.14.71l-1.57.94l.47.89l1.45-.89C5.68 18.76 8.59 20 12 20s6.32-1.24 7.47-3.68l1.45.89l.47-.89l-1.57-.94l.14-.71l1.76.26l.21-.98l-1.93-.29c-.07-.99-.41-1.42-.96-2.25C20.97 7.46 19 4.5 19 4.5c-2.4 0-4.81 2.57-5.67 3.59L12 8m-3 3a1 1 0 0 1 1 1a1 1 0 0 1-1 1a1 1 0 0 1-1-1a1 1 0 0 1 1-1m6 0a1 1 0 0 1 1 1a1 1 0 0 1-1 1a1 1 0 0 1-1-1a1 1 0 0 1 1-1m-4 3h2l-.7 1.39c.2.64.76 1.11 1.45 1.11a1.5 1.5 0 0 0 1.5-1.5h.5a2 2 0 0 1-2 2c-.75 0-1.4-.41-1.75-1c-.35.59-1 1-1.75 1a2 2 0 0 1-2-2h.5a1.5 1.5 0 0 0 1.5 1.5c.69 0 1.25-.47 1.45-1.11L11 14z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M9 16v-6H5l7-7l7 7h-4v6H9m-4 4v-2h14v2H5z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M9 3v1H4v2h1v13a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6h1V4h-5V3H9m0 5h2v9H9V8m4 0h2v9h-2V8z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M16.84 2.73c-.39 0-.77.15-1.07.44l-2.12 2.12l5.3 5.31l2.12-2.1c.6-.61.6-1.56 0-2.14L17.9 3.17c-.3-.29-.68-.44-1.06-.44M12.94 6l-8.1 8.11l2.56.28l.18 2.29l2.28.17l.29 2.56l8.1-8.11m-14 3.74L2.5 21.73l6.7-1.79l-.24-2.16l-2.31-.17l-.18-2.32" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M13 3v6h8V3m-8 18h8V11h-8M3 21h8v-6H3m0-2h8V3H3v10z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M18.68 12.32a4.49 4.49 0 0 0-6.36.01a4.49 4.49 0 0 0 0 6.36a4.508 4.508 0 0 0 5.57.63L21 22.39L22.39 21l-3.09-3.11c1.13-1.77.87-4.09-.62-5.57m-1.41 4.95c-.98.98-2.56.97-3.54 0c-.97-.98-.97-2.56.01-3.54c.97-.97 2.55-.97 3.53 0c.97.98.97 2.56 0 3.54M10.9 20.1a6.527 6.527 0 0 1-1.48-2.32C6.27 17.25 4 15.76 4 14v3c0 2.21 3.58 4 8 4c-.4-.26-.77-.56-1.1-.9M4 9v3c0 1.68 2.07 3.12 5 3.7v-.2c0-.93.2-1.85.58-2.69C6.34 12.3 4 10.79 4 9m8-6C7.58 3 4 4.79 4 7c0 2 3 3.68 6.85 4h.05c1.2-1.26 2.86-2 4.6-2c.91 0 1.81.19 2.64.56A3.215 3.215 0 0 0 20 7c0-2.21-3.58-4-8-4z" fill="currentColor"/>',width:24,height:24}},function(e,t){e.exports=function(e,t,n,r){var o=n?n.call(r,e,t):void 0;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(var u=Object.prototype.hasOwnProperty.bind(t),s=0;s<i.length;s++){var l=i[s];if(!u(l))return!1;var c=e[l],f=t[l];if(!1===(o=n?n.call(r,c,f,l):void 0)||void 0===o&&c!==f)return!1}return!0}},function(e,t,n){"use strict";t.a=function(e){function t(e,t,r){var o=t.trim().split(h);t=o;var i=o.length,a=e.length;switch(a){case 0:case 1:var u=0;for(e=0===a?"":e[0]+" ";u<i;++u)t[u]=n(e,t[u],r).trim();break;default:var s=u=0;for(t=[];u<i;++u)for(var l=0;l<a;++l)t[s++]=n(e[l]+" ",o[u],r).trim()}return t}function n(e,t,n){var r=t.charCodeAt(0);switch(33>r&&(r=(t=t.trim()).charCodeAt(0)),r){case 38:return t.replace(v,"$1"+e.trim());case 58:return e.trim()+t.replace(v,"$1"+e.trim());default:if(0<1*n&&0<t.indexOf("\f"))return t.replace(v,(58===e.charCodeAt(0)?"":"$1")+e.trim())}return e+t}function r(e,t,n,i){var a=e+";",u=2*t+3*n+4*i;if(944===u){e=a.indexOf(":",9)+1;var s=a.substring(e,a.length-1).trim();return s=a.substring(0,e).trim()+s+";",1===j||2===j&&o(s,1)?"-webkit-"+s+s:s}if(0===j||2===j&&!o(a,1))return a;switch(u){case 1015:return 97===a.charCodeAt(10)?"-webkit-"+a+a:a;case 951:return 116===a.charCodeAt(3)?"-webkit-"+a+a:a;case 963:return 110===a.charCodeAt(5)?"-webkit-"+a+a:a;case 1009:if(100!==a.charCodeAt(4))break;case 969:case 942:return"-webkit-"+a+a;case 978:return"-webkit-"+a+"-moz-"+a+a;case 1019:case 983:return"-webkit-"+a+"-moz-"+a+"-ms-"+a+a;case 883:if(45===a.charCodeAt(8))return"-webkit-"+a+a;if(0<a.indexOf("image-set(",11))return a.replace(S,"$1-webkit-$2")+a;break;case 932:if(45===a.charCodeAt(4))switch(a.charCodeAt(5)){case 103:return"-webkit-box-"+a.replace("-grow","")+"-webkit-"+a+"-ms-"+a.replace("grow","positive")+a;case 115:return"-webkit-"+a+"-ms-"+a.replace("shrink","negative")+a;case 98:return"-webkit-"+a+"-ms-"+a.replace("basis","preferred-size")+a}return"-webkit-"+a+"-ms-"+a+a;case 964:return"-webkit-"+a+"-ms-flex-"+a+a;case 1023:if(99!==a.charCodeAt(8))break;return"-webkit-box-pack"+(s=a.substring(a.indexOf(":",15)).replace("flex-","").replace("space-between","justify"))+"-webkit-"+a+"-ms-flex-pack"+s+a;case 1005:return d.test(a)?a.replace(f,":-webkit-")+a.replace(f,":-moz-")+a:a;case 1e3:switch(t=(s=a.substring(13).trim()).indexOf("-")+1,s.charCodeAt(0)+s.charCodeAt(t)){case 226:s=a.replace(g,"tb");break;case 232:s=a.replace(g,"tb-rl");break;case 220:s=a.replace(g,"lr");break;default:return a}return"-webkit-"+a+"-ms-"+s+a;case 1017:if(-1===a.indexOf("sticky",9))break;case 975:switch(t=(a=e).length-10,u=(s=(33===a.charCodeAt(t)?a.substring(0,t):a).substring(e.indexOf(":",7)+1).trim()).charCodeAt(0)+(0|s.charCodeAt(7))){case 203:if(111>s.charCodeAt(8))break;case 115:a=a.replace(s,"-webkit-"+s)+";"+a;break;case 207:case 102:a=a.replace(s,"-webkit-"+(102<u?"inline-":"")+"box")+";"+a.replace(s,"-webkit-"+s)+";"+a.replace(s,"-ms-"+s+"box")+";"+a}return a+";";case 938:if(45===a.charCodeAt(5))switch(a.charCodeAt(6)){case 105:return s=a.replace("-items",""),"-webkit-"+a+"-webkit-box-"+s+"-ms-flex-"+s+a;case 115:return"-webkit-"+a+"-ms-flex-item-"+a.replace(C,"")+a;default:return"-webkit-"+a+"-ms-flex-line-pack"+a.replace("align-content","").replace(C,"")+a}break;case 973:case 989:if(45!==a.charCodeAt(3)||122===a.charCodeAt(4))break;case 931:case 953:if(!0===k.test(e))return 115===(s=e.substring(e.indexOf(":")+1)).charCodeAt(0)?r(e.replace("stretch","fill-available"),t,n,i).replace(":fill-available",":stretch"):a.replace(s,"-webkit-"+s)+a.replace(s,"-moz-"+s.replace("fill-",""))+a;break;case 962:if(a="-webkit-"+a+(102===a.charCodeAt(5)?"-ms-"+a:"")+a,211===n+i&&105===a.charCodeAt(13)&&0<a.indexOf("transform",10))return a.substring(0,a.indexOf(";",27)+1).replace(p,"$1-webkit-$2")+a}return a}function o(e,t){var n=e.indexOf(1===t?":":"{"),r=e.substring(0,3!==t?n:10);return n=e.substring(n+1,e.length-1),R(2!==t?r:r.replace(O,"$1"),n,t)}function i(e,t){var n=r(t,t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2));return n!==t+";"?n.replace(_," or ($1)").substring(4):"("+t+")"}function a(e,t,n,r,o,i,a,u,l,c){for(var f,d=0,p=t;d<I;++d)switch(f=P[d].call(s,e,p,n,r,o,i,a,u,l,c)){case void 0:case!1:case!0:case null:break;default:p=f}if(p!==t)return p}function u(e){return void 0!==(e=e.prefix)&&(R=null,e?"function"!=typeof e?j=1:(j=2,R=e):j=0),u}function s(e,n){var u=e;if(33>u.charCodeAt(0)&&(u=u.trim()),u=[u],0<I){var s=a(-1,n,u,u,A,x,0,0,0,0);void 0!==s&&"string"==typeof s&&(n=s)}var f=function e(n,u,s,f,d){for(var p,h,v,g,_,C=0,O=0,k=0,S=0,P=0,R=0,L=v=p=0,F=0,z=0,N=0,D=0,H=s.length,q=H-1,$="",V="",W="",U="";F<H;){if(h=s.charCodeAt(F),F===q&&0!==O+S+k+C&&(0!==O&&(h=47===O?10:47),S=k=C=0,H++,q++),0===O+S+k+C){if(F===q&&(0<z&&($=$.replace(c,"")),0<$.trim().length)){switch(h){case 32:case 9:case 59:case 13:case 10:break;default:$+=s.charAt(F)}h=59}switch(h){case 123:for(p=($=$.trim()).charCodeAt(0),v=1,D=++F;F<H;){switch(h=s.charCodeAt(F)){case 123:v++;break;case 125:v--;break;case 47:switch(h=s.charCodeAt(F+1)){case 42:case 47:e:{for(L=F+1;L<q;++L)switch(s.charCodeAt(L)){case 47:if(42===h&&42===s.charCodeAt(L-1)&&F+2!==L){F=L+1;break e}break;case 10:if(47===h){F=L+1;break e}}F=L}}break;case 91:h++;case 40:h++;case 34:case 39:for(;F++<q&&s.charCodeAt(F)!==h;);}if(0===v)break;F++}switch(v=s.substring(D,F),0===p&&(p=($=$.replace(l,"").trim()).charCodeAt(0)),p){case 64:switch(0<z&&($=$.replace(c,"")),h=$.charCodeAt(1)){case 100:case 109:case 115:case 45:z=u;break;default:z=E}if(D=(v=e(u,z,v,h,d+1)).length,0<I&&(_=a(3,v,z=t(E,$,N),u,A,x,D,h,d,f),$=z.join(""),void 0!==_&&0===(D=(v=_.trim()).length)&&(h=0,v="")),0<D)switch(h){case 115:$=$.replace(w,i);case 100:case 109:case 45:v=$+"{"+v+"}";break;case 107:v=($=$.replace(y,"$1 $2"))+"{"+v+"}",v=1===j||2===j&&o("@"+v,3)?"@-webkit-"+v+"@"+v:"@"+v;break;default:v=$+v,112===f&&(V+=v,v="")}else v="";break;default:v=e(u,t(u,$,N),v,f,d+1)}W+=v,v=N=z=L=p=0,$="",h=s.charCodeAt(++F);break;case 125:case 59:if(1<(D=($=(0<z?$.replace(c,""):$).trim()).length))switch(0===L&&(p=$.charCodeAt(0),45===p||96<p&&123>p)&&(D=($=$.replace(" ",":")).length),0<I&&void 0!==(_=a(1,$,u,n,A,x,V.length,f,d,f))&&0===(D=($=_.trim()).length)&&($="\0\0"),p=$.charCodeAt(0),h=$.charCodeAt(1),p){case 0:break;case 64:if(105===h||99===h){U+=$+s.charAt(F);break}default:58!==$.charCodeAt(D-1)&&(V+=r($,p,h,$.charCodeAt(2)))}N=z=L=p=0,$="",h=s.charCodeAt(++F)}}switch(h){case 13:case 10:47===O?O=0:0===1+p&&107!==f&&0<$.length&&(z=1,$+="\0"),0<I*T&&a(0,$,u,n,A,x,V.length,f,d,f),x=1,A++;break;case 59:case 125:if(0===O+S+k+C){x++;break}default:switch(x++,g=s.charAt(F),h){case 9:case 32:if(0===S+C+O)switch(P){case 44:case 58:case 9:case 32:g="";break;default:32!==h&&(g=" ")}break;case 0:g="\\0";break;case 12:g="\\f";break;case 11:g="\\v";break;case 38:0===S+O+C&&(z=N=1,g="\f"+g);break;case 108:if(0===S+O+C+M&&0<L)switch(F-L){case 2:112===P&&58===s.charCodeAt(F-3)&&(M=P);case 8:111===R&&(M=R)}break;case 58:0===S+O+C&&(L=F);break;case 44:0===O+k+S+C&&(z=1,g+="\r");break;case 34:case 39:0===O&&(S=S===h?0:0===S?h:S);break;case 91:0===S+O+k&&C++;break;case 93:0===S+O+k&&C--;break;case 41:0===S+O+C&&k--;break;case 40:if(0===S+O+C){if(0===p)switch(2*P+3*R){case 533:break;default:p=1}k++}break;case 64:0===O+k+S+C+L+v&&(v=1);break;case 42:case 47:if(!(0<S+C+k))switch(O){case 0:switch(2*h+3*s.charCodeAt(F+1)){case 235:O=47;break;case 220:D=F,O=42}break;case 42:47===h&&42===P&&D+2!==F&&(33===s.charCodeAt(D+2)&&(V+=s.substring(D,F+1)),g="",O=0)}}0===O&&($+=g)}R=P,P=h,F++}if(0<(D=V.length)){if(z=u,0<I&&(void 0!==(_=a(2,V,z,n,A,x,D,f,d,f))&&0===(V=_).length))return U+V+W;if(V=z.join(",")+"{"+V+"}",0!=j*M){switch(2!==j||o(V,2)||(M=0),M){case 111:V=V.replace(m,":-moz-$1")+V;break;case 112:V=V.replace(b,"::-webkit-input-$1")+V.replace(b,"::-moz-$1")+V.replace(b,":-ms-input-$1")+V}M=0}}return U+V+W}(E,u,n,0,0);return 0<I&&(void 0!==(s=a(-2,f,u,u,A,x,f.length,0,0,0))&&(f=s)),"",M=0,x=A=1,f}var l=/^\0+/g,c=/[\0\r\f]/g,f=/: */g,d=/zoo|gra/,p=/([,: ])(transform)/g,h=/,\r+?/g,v=/([\t\r\n ])*\f?&/g,y=/@(k\w+)\s*(\S*)\s*/,b=/::(place)/g,m=/:(read-only)/g,g=/[svh]\w+-[tblr]{2}/,w=/\(\s*(.*)\s*\)/g,_=/([\s\S]*?);/g,C=/-self|flex-/g,O=/[^]*?(:[rp][el]a[\w-]+)[^]*/,k=/stretch|:\s*\w+\-(?:conte|avail)/,S=/([^-])(image-set\()/,x=1,A=1,M=0,j=1,E=[],P=[],I=0,R=null,T=0;return s.use=function e(t){switch(t){case void 0:case null:I=P.length=0;break;default:if("function"==typeof t)P[I++]=t;else if("object"==typeof t)for(var n=0,r=t.length;n<r;++n)e(t[n]);else T=0|!!t}return e},s.set=u,void 0!==e&&u(e),s}},function(e,t,n){"use strict";t.a={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1}},function(e,t,n){"use strict";function r(e,t,n,r,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,o)}function o(e){return function(){var t=this,n=arguments;return new Promise((function(o,i){var a=e.apply(t,n);function u(e){r(a,o,i,u,s,"next",e)}function s(e){r(a,o,i,u,s,"throw",e)}u(void 0)}))}}function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=f(e);if(t){var o=f(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return l(this,n)}}function l(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?c(e):t}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Object.defineProperty(t,"__esModule",{value:!0});var d=n(64),p=n(65),h=n(67),v=function(){},y=new p.TimeoutError,b=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}(g,e);var t,n,r,l,f,d,b,m=s(g);function g(e){var t,n,r,o,a;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,g),t=m.call(this),Object.defineProperty(c(t),"_carryoverConcurrencyCount",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c(t),"_isIntervalIgnored",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c(t),"_intervalCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(c(t),"_intervalCap",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c(t),"_interval",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c(t),"_intervalEnd",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(c(t),"_intervalId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c(t),"_timeoutId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c(t),"_queue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c(t),"_queueClass",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c(t),"_pendingCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(c(t),"_concurrency",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c(t),"_isPaused",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c(t),"_resolveEmpty",{enumerable:!0,configurable:!0,writable:!0,value:v}),Object.defineProperty(c(t),"_resolveIdle",{enumerable:!0,configurable:!0,writable:!0,value:v}),Object.defineProperty(c(t),"_timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c(t),"_throwOnTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),!("number"==typeof(e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:h.default},e)).intervalCap&&e.intervalCap>=1))throw new TypeError("Expected `intervalCap` to be a number from 1 and up, got `".concat(null!==(r=null===(n=e.intervalCap)||void 0===n?void 0:n.toString())&&void 0!==r?r:"","` (").concat(i(e.intervalCap),")"));if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError("Expected `interval` to be a finite number >= 0, got `".concat(null!==(a=null===(o=e.interval)||void 0===o?void 0:o.toString())&&void 0!==a?a:"","` (").concat(i(e.interval),")"));return t._carryoverConcurrencyCount=e.carryoverConcurrencyCount,t._isIntervalIgnored=e.intervalCap===1/0||0===e.interval,t._intervalCap=e.intervalCap,t._interval=e.interval,t._queue=new e.queueClass,t._queueClass=e.queueClass,t.concurrency=e.concurrency,t._timeout=e.timeout,t._throwOnTimeout=!0===e.throwOnTimeout,t._isPaused=!1===e.autoStart,t}return t=g,(n=[{key:"_next",value:function(){this._pendingCount--,this._tryToStartAnother()}},{key:"_resolvePromises",value:function(){this._resolveEmpty(),this._resolveEmpty=v,0===this._pendingCount&&(this._resolveIdle(),this._resolveIdle=v,this.emit("idle"))}},{key:"_onResumeInterval",value:function(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}},{key:"_isIntervalPaused",value:function(){var e=this,t=Date.now();if(void 0===this._intervalId){var n=this._intervalEnd-t;if(!(n<0))return void 0===this._timeoutId&&(this._timeoutId=setTimeout((function(){e._onResumeInterval()}),n)),!0;this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0}return!1}},{key:"_tryToStartAnother",value:function(){if(0===this._queue.size)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){var e=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother)return this.emit("active"),this._queue.dequeue()(),e&&this._initializeIntervalIfNeeded(),!0}return!1}},{key:"_initializeIntervalIfNeeded",value:function(){var e=this;this._isIntervalIgnored||void 0!==this._intervalId||(this._intervalId=setInterval((function(){e._onInterval()}),this._interval),this._intervalEnd=Date.now()+this._interval)}},{key:"_onInterval",value:function(){0===this._intervalCount&&0===this._pendingCount&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}},{key:"_processQueue",value:function(){for(;this._tryToStartAnother(););}},{key:"add",value:(b=o(regeneratorRuntime.mark((function e(t){var n,r=this,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=i.length>1&&void 0!==i[1]?i[1]:{},e.abrupt("return",new Promise((function(e,i){var a=function(){var a=o(regeneratorRuntime.mark((function o(){var a;return regeneratorRuntime.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return r._pendingCount++,r._intervalCount++,o.prev=2,a=void 0===r._timeout&&void 0===n.timeout?t():p.default(Promise.resolve(t()),void 0===n.timeout?r._timeout:n.timeout,(function(){(void 0===n.throwOnTimeout?r._throwOnTimeout:n.throwOnTimeout)&&i(y)})),o.t0=e,o.next=7,a;case 7:o.t1=o.sent,(0,o.t0)(o.t1),o.next=14;break;case 11:o.prev=11,o.t2=o.catch(2),i(o.t2);case 14:r._next();case 15:case"end":return o.stop()}}),o,null,[[2,11]])})));return function(){return a.apply(this,arguments)}}();r._queue.enqueue(a,n),r._tryToStartAnother()})));case 2:case"end":return e.stop()}}),e)}))),function(e){return b.apply(this,arguments)})},{key:"addAll",value:(d=o(regeneratorRuntime.mark((function e(t,n){var r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Promise.all(t.map(function(){var e=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",r.add(t,n));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())));case 1:case"end":return e.stop()}}),e)}))),function(e,t){return d.apply(this,arguments)})},{key:"start",value:function(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}},{key:"pause",value:function(){this._isPaused=!0}},{key:"clear",value:function(){this._queue=new this._queueClass}},{key:"onEmpty",value:(f=o(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==this._queue.size){e.next=2;break}return e.abrupt("return");case 2:return e.abrupt("return",new Promise((function(e){var n=t._resolveEmpty;t._resolveEmpty=function(){n(),e()}})));case 3:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"onIdle",value:(l=o(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==this._pendingCount||0!==this._queue.size){e.next=2;break}return e.abrupt("return");case 2:return e.abrupt("return",new Promise((function(e){var n=t._resolveIdle;t._resolveIdle=function(){n(),e()}})));case 3:case"end":return e.stop()}}),e,this)}))),function(){return l.apply(this,arguments)})},{key:"sizeBy",value:function(e){return this._queue.filter(e).length}},{key:"_doesIntervalAllowAnother",get:function(){return this._isIntervalIgnored||this._intervalCount<this._intervalCap}},{key:"_doesConcurrentAllowAnother",get:function(){return this._pendingCount<this._concurrency}},{key:"concurrency",get:function(){return this._concurrency},set:function(e){if(!("number"==typeof e&&e>=1))throw new TypeError("Expected `concurrency` to be a number from 1 and up, got `".concat(e,"` (").concat(i(e),")"));this._concurrency=e,this._processQueue()}},{key:"size",get:function(){return this._queue.size}},{key:"pending",get:function(){return this._pendingCount}},{key:"isPaused",get:function(){return this._isPaused}},{key:"timeout",get:function(){return this._timeout},set:function(e){this._timeout=e}}])&&a(t.prototype,n),r&&a(t,r),g}(d);t.default=b},function(e,t){t.__esModule=!0,t.default={body:'<path d="M12 20a8 8 0 0 1-8-8a8 8 0 0 1 8-8a8 8 0 0 1 8 8a8 8 0 0 1-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2m0 7a3 3 0 0 1 3 3a3 3 0 0 1-3 3a3 3 0 0 1-3-3a3 3 0 0 1 3-3z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M19 20H4a2 2 0 0 1-2-2V6c0-1.11.89-2 2-2h6l2 2h7a2 2 0 0 1 2 2H4v10l2.14-8h17.07l-2.28 8.5c-.23.87-1.01 1.5-1.93 1.5z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M21 17H7V3h14m0-2H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2M3 5H1v16a2 2 0 0 0 2 2h16v-2H3m12.96-10.71l-2.75 3.54l-1.96-2.36L8.5 15h11l-3.54-4.71z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M15 9H5V5h10m-3 14a3 3 0 0 1-3-3a3 3 0 0 1 3-3a3 3 0 0 1 3 3a3 3 0 0 1-3 3m5-16H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V7l-4-4z" fill="currentColor"/>',width:24,height:24}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(69),i=(r=o)&&r.__esModule?r:{default:r};t.default=i.default,e.exports=t.default},function(e,t){t.__esModule=!0,t.default={body:'<path d="M22 16a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2V4c0-1.11.89-2 2-2h12a2 2 0 0 1 2 2v12m-6 4v2H4a2 2 0 0 1-2-2V7h2v13h12m-3-6l7-7l-1.41-1.41L13 11.17L9.91 8.09L8.5 9.5L13 14z" fill="currentColor"/>',width:24,height:24}},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o=Array.isArray,i=Object.keys,a=Object.prototype.hasOwnProperty;e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==r(t)&&"object"==r(n)){var u,s,l,c=o(t),f=o(n);if(c&&f){if((s=t.length)!=n.length)return!1;for(u=s;0!=u--;)if(!e(t[u],n[u]))return!1;return!0}if(c!=f)return!1;var d=t instanceof Date,p=n instanceof Date;if(d!=p)return!1;if(d&&p)return t.getTime()==n.getTime();var h=t instanceof RegExp,v=n instanceof RegExp;if(h!=v)return!1;if(h&&v)return t.toString()==n.toString();var y=i(t);if((s=y.length)!==i(n).length)return!1;for(u=s;0!=u--;)if(!a.call(n,y[u]))return!1;for(u=s;0!=u--;)if(!e(t[l=y[u]],n[l]))return!1;return!0}return t!=t&&n!=n}},function(e,t,n){"use strict";var r=n(61);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,i,a){if(a!==r){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var s,l=[],c=!1,f=-1;function d(){c&&s&&(c=!1,s.length?l=s.concat(l):f=-1,l.length&&p())}function p(){if(!c){var e=u(d);c=!0;for(var t=l.length;t;){for(s=l,l=[];++f<t;)s&&s[f].run();f=-1,t=l.length}s=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function v(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new h(e,t)),1!==l.length||c||u(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,n){"use strict";
14
+ /** @license React v16.13.1
15
+ * react-is.production.min.js
16
+ *
17
+ * Copyright (c) Facebook, Inc. and its affiliates.
18
+ *
19
+ * This source code is licensed under the MIT license found in the
20
+ * LICENSE file in the root directory of this source tree.
21
+ */var r="function"==typeof Symbol&&Symbol.for,o=r?Symbol.for("react.element"):60103,i=r?Symbol.for("react.portal"):60106,a=r?Symbol.for("react.fragment"):60107,u=r?Symbol.for("react.strict_mode"):60108,s=r?Symbol.for("react.profiler"):60114,l=r?Symbol.for("react.provider"):60109,c=r?Symbol.for("react.context"):60110,f=r?Symbol.for("react.async_mode"):60111,d=r?Symbol.for("react.concurrent_mode"):60111,p=r?Symbol.for("react.forward_ref"):60112,h=r?Symbol.for("react.suspense"):60113,v=r?Symbol.for("react.suspense_list"):60120,y=r?Symbol.for("react.memo"):60115,b=r?Symbol.for("react.lazy"):60116,m=r?Symbol.for("react.block"):60121,g=r?Symbol.for("react.fundamental"):60117,w=r?Symbol.for("react.responder"):60118,_=r?Symbol.for("react.scope"):60119;function C(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case o:switch(e=e.type){case f:case d:case a:case s:case u:case h:return e;default:switch(e=e&&e.$$typeof){case c:case p:case b:case y:case l:return e;default:return t}}case i:return t}}}function O(e){return C(e)===d}t.AsyncMode=f,t.ConcurrentMode=d,t.ContextConsumer=c,t.ContextProvider=l,t.Element=o,t.ForwardRef=p,t.Fragment=a,t.Lazy=b,t.Memo=y,t.Portal=i,t.Profiler=s,t.StrictMode=u,t.Suspense=h,t.isAsyncMode=function(e){return O(e)||C(e)===f},t.isConcurrentMode=O,t.isContextConsumer=function(e){return C(e)===c},t.isContextProvider=function(e){return C(e)===l},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===o},t.isForwardRef=function(e){return C(e)===p},t.isFragment=function(e){return C(e)===a},t.isLazy=function(e){return C(e)===b},t.isMemo=function(e){return C(e)===y},t.isPortal=function(e){return C(e)===i},t.isProfiler=function(e){return C(e)===s},t.isStrictMode=function(e){return C(e)===u},t.isSuspense=function(e){return C(e)===h},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===d||e===s||e===u||e===h||e===v||"object"==typeof e&&null!==e&&(e.$$typeof===b||e.$$typeof===y||e.$$typeof===l||e.$$typeof===c||e.$$typeof===p||e.$$typeof===g||e.$$typeof===w||e.$$typeof===_||e.$$typeof===m)},t.typeOf=C},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,o="~";function i(){}function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function u(e,t,n,r,i){if("function"!=typeof n)throw new TypeError("The listener must be a function");var u=new a(n,r||e,i),s=o?o+t:t;return e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],u]:e._events[s].push(u):(e._events[s]=u,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function l(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(o=!1)),l.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)r.call(e,t)&&n.push(o?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},l.prototype.listeners=function(e){var t=o?o+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,i=n.length,a=new Array(i);r<i;r++)a[r]=n[r].fn;return a},l.prototype.listenerCount=function(e){var t=o?o+e:e,n=this._events[t];return n?n.fn?1:n.length:0},l.prototype.emit=function(e,t,n,r,i,a){var u=o?o+e:e;if(!this._events[u])return!1;var s,l,c=this._events[u],f=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),f){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,r),!0;case 5:return c.fn.call(c.context,t,n,r,i),!0;case 6:return c.fn.call(c.context,t,n,r,i,a),!0}for(l=1,s=new Array(f-1);l<f;l++)s[l-1]=arguments[l];c.fn.apply(c.context,s)}else{var d,p=c.length;for(l=0;l<p;l++)switch(c[l].once&&this.removeListener(e,c[l].fn,void 0,!0),f){case 1:c[l].fn.call(c[l].context);break;case 2:c[l].fn.call(c[l].context,t);break;case 3:c[l].fn.call(c[l].context,t,n);break;case 4:c[l].fn.call(c[l].context,t,n,r);break;default:if(!s)for(d=1,s=new Array(f-1);d<f;d++)s[d-1]=arguments[d];c[l].fn.apply(c[l].context,s)}}return!0},l.prototype.on=function(e,t,n){return u(this,e,t,n,!1)},l.prototype.once=function(e,t,n){return u(this,e,t,n,!0)},l.prototype.removeListener=function(e,t,n,r){var i=o?o+e:e;if(!this._events[i])return this;if(!t)return s(this,i),this;var a=this._events[i];if(a.fn)a.fn!==t||r&&!a.once||n&&a.context!==n||s(this,i);else{for(var u=0,l=[],c=a.length;u<c;u++)(a[u].fn!==t||r&&!a[u].once||n&&a[u].context!==n)&&l.push(a[u]);l.length?this._events[i]=1===l.length?l[0]:l:s(this,i)}return this},l.prototype.removeAllListeners=function(e){var t;return e?(t=o?o+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=o,l.EventEmitter=l,e.exports=l},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function i(e){var t="function"==typeof Map?new Map:void 0;return(i=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return a(e,arguments,l(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),s(r,e)})(e)}function a(e,t,n){return(a=u()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&s(o,n.prototype),o}).apply(null,arguments)}function u(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=n(66),f=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}(i,e);var t,n,r=(t=i,n=u(),function(){var e,r=l(t);if(n){var i=l(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return o(this,e)});function i(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(t=r.call(this,e)).name="TimeoutError",t}return i}(i(Error)),d=function(e,t,n){return new Promise((function(r,o){if("number"!=typeof t||t<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(t!==1/0){var i=setTimeout((function(){if("function"!=typeof n){var i="string"==typeof n?n:"Promise timed out after ".concat(t," milliseconds"),a=n instanceof Error?n:new f(i);"function"==typeof e.cancel&&e.cancel(),o(a)}else try{r(n())}catch(e){o(e)}}),t);c(e.then(r,o),(function(){clearTimeout(i)}))}else r(e)}))};e.exports=d,e.exports.default=d,e.exports.TimeoutError=f},function(e,t,n){"use strict";e.exports=function(e,t){return t=t||function(){},e.then((function(e){return new Promise((function(e){e(t())})).then((function(){return e}))}),(function(e){return new Promise((function(e){e(t())})).then((function(){throw e}))}))}},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(68),i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object.defineProperty(this,"_queue",{enumerable:!0,configurable:!0,writable:!0,value:[]})}var t,n,i;return t=e,(n=[{key:"enqueue",value:function(e,t){var n={priority:(t=Object.assign({priority:0},t)).priority,run:e};if(this.size&&this._queue[this.size-1].priority>=t.priority)this._queue.push(n);else{var r=o.default(this._queue,n,(function(e,t){return t.priority-e.priority}));this._queue.splice(r,0,n)}}},{key:"dequeue",value:function(){var e=this._queue.shift();return null==e?void 0:e.run}},{key:"filter",value:function(e){return this._queue.filter((function(t){return t.priority===e.priority})).map((function(e){return e.run}))}},{key:"size",get:function(){return this._queue.length}}])&&r(t.prototype,n),i&&r(t,i),e}();t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){for(var r=0,o=e.length;o>0;){var i=o/2|0,a=r+i;n(e[a],t)<=0?(r=++a,o-=i+1):o=i}return r}},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.bodyOpenClassName=t.portalClassName=void 0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(0),u=v(a),s=v(n(9)),l=v(n(1)),c=v(n(70)),f=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(25)),d=n(20),p=v(d),h=n(77);function v(e){return e&&e.__esModule?e:{default:e}}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==r(t)&&"function"!=typeof t?e:t}var m=t.portalClassName="ReactModalPortal",g=t.bodyOpenClassName="ReactModal__Body--open",w=void 0!==s.default.createPortal,_=function(){return w?s.default.createPortal:s.default.unstable_renderSubtreeIntoContainer};function C(e){return e()}var O=function(e){function t(){var e,n,r;y(this,t);for(var i=arguments.length,a=Array(i),l=0;l<i;l++)a[l]=arguments[l];return n=r=b(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.removePortal=function(){!w&&s.default.unmountComponentAtNode(r.node);var e=C(r.props.parentSelector);e?e.removeChild(r.node):console.warn('React-Modal: "parentSelector" prop did not returned any DOM element. Make sure that the parent element is unmounted to avoid any memory leaks.')},r.portalRef=function(e){r.portal=e},r.renderPortal=function(e){var n=_()(r,u.default.createElement(c.default,o({defaultStyles:t.defaultStyles},e)),r.node);r.portalRef(n)},b(r,n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+r(t));e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"componentDidMount",value:function(){d.canUseDOM&&(w||(this.node=document.createElement("div")),this.node.className=this.props.portalClassName,C(this.props.parentSelector).appendChild(this.node),!w&&this.renderPortal(this.props))}},{key:"getSnapshotBeforeUpdate",value:function(e){return{prevParent:C(e.parentSelector),nextParent:C(this.props.parentSelector)}}},{key:"componentDidUpdate",value:function(e,t,n){if(d.canUseDOM){var r=this.props,o=r.isOpen,i=r.portalClassName;e.portalClassName!==i&&(this.node.className=i);var a=n.prevParent,u=n.nextParent;u!==a&&(a.removeChild(this.node),u.appendChild(this.node)),(e.isOpen||o)&&!w&&this.renderPortal(this.props)}}},{key:"componentWillUnmount",value:function(){if(d.canUseDOM&&this.node&&this.portal){var e=this.portal.state,t=Date.now(),n=e.isOpen&&this.props.closeTimeoutMS&&(e.closesAt||t+this.props.closeTimeoutMS);n?(e.beforeClose||this.portal.closeWithTimeout(),setTimeout(this.removePortal,n-t)):this.removePortal()}}},{key:"render",value:function(){return d.canUseDOM&&w?(!this.node&&w&&(this.node=document.createElement("div")),_()(u.default.createElement(c.default,o({ref:this.portalRef,defaultStyles:t.defaultStyles},this.props)),this.node)):null}}],[{key:"setAppElement",value:function(e){f.setElement(e)}}]),t}(a.Component);O.propTypes={isOpen:l.default.bool.isRequired,style:l.default.shape({content:l.default.object,overlay:l.default.object}),portalClassName:l.default.string,bodyOpenClassName:l.default.string,htmlOpenClassName:l.default.string,className:l.default.oneOfType([l.default.string,l.default.shape({base:l.default.string.isRequired,afterOpen:l.default.string.isRequired,beforeClose:l.default.string.isRequired})]),overlayClassName:l.default.oneOfType([l.default.string,l.default.shape({base:l.default.string.isRequired,afterOpen:l.default.string.isRequired,beforeClose:l.default.string.isRequired})]),appElement:l.default.instanceOf(p.default),onAfterOpen:l.default.func,onRequestClose:l.default.func,closeTimeoutMS:l.default.number,ariaHideApp:l.default.bool,shouldFocusAfterRender:l.default.bool,shouldCloseOnOverlayClick:l.default.bool,shouldReturnFocusAfterClose:l.default.bool,parentSelector:l.default.func,aria:l.default.object,data:l.default.object,role:l.default.string,contentLabel:l.default.string,shouldCloseOnEsc:l.default.bool,overlayRef:l.default.func,contentRef:l.default.func},O.defaultProps={isOpen:!1,portalClassName:m,bodyOpenClassName:g,role:"dialog",ariaHideApp:!0,closeTimeoutMS:0,shouldFocusAfterRender:!0,shouldCloseOnEsc:!0,shouldCloseOnOverlayClick:!0,shouldReturnFocusAfterClose:!0,parentSelector:function(){return document.body}},O.defaultStyles={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(255, 255, 255, 0.75)"},content:{position:"absolute",top:"40px",left:"40px",right:"40px",bottom:"40px",border:"1px solid #ccc",background:"#fff",overflow:"auto",WebkitOverflowScrolling:"touch",borderRadius:"4px",outline:"none",padding:"20px"}},(0,h.polyfill)(O),t.default=O},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i="function"==typeof Symbol&&"symbol"===r(Symbol.iterator)?function(e){return r(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":r(e)},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(0),s=b(u),l=b(n(1)),c=y(n(71)),f=b(n(72)),d=y(n(25)),p=y(n(75)),h=b(n(20)),v=b(n(27));function y(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function b(e){return e&&e.__esModule?e:{default:e}}n(76);var m={overlay:"ReactModal__Overlay",content:"ReactModal__Content"},g=0,w=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==r(t)&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.setOverlayRef=function(e){n.overlay=e,n.props.overlayRef&&n.props.overlayRef(e)},n.setContentRef=function(e){n.content=e,n.props.contentRef&&n.props.contentRef(e)},n.afterClose=function(){var e=n.props,t=e.appElement,r=e.ariaHideApp,o=e.htmlOpenClassName,i=e.bodyOpenClassName;i&&p.remove(document.body,i),o&&p.remove(document.getElementsByTagName("html")[0],o),r&&g>0&&0===(g-=1)&&d.show(t),n.props.shouldFocusAfterRender&&(n.props.shouldReturnFocusAfterClose?(c.returnFocus(),c.teardownScopedFocus()):c.popWithoutFocus()),n.props.onAfterClose&&n.props.onAfterClose(),v.default.deregister(n)},n.open=function(){n.beforeOpen(),n.state.afterOpen&&n.state.beforeClose?(clearTimeout(n.closeTimer),n.setState({beforeClose:!1})):(n.props.shouldFocusAfterRender&&(c.setupScopedFocus(n.node),c.markForFocusLater()),n.setState({isOpen:!0},(function(){n.setState({afterOpen:!0}),n.props.isOpen&&n.props.onAfterOpen&&n.props.onAfterOpen({overlayEl:n.overlay,contentEl:n.content})})))},n.close=function(){n.props.closeTimeoutMS>0?n.closeWithTimeout():n.closeWithoutTimeout()},n.focusContent=function(){return n.content&&!n.contentHasFocus()&&n.content.focus()},n.closeWithTimeout=function(){var e=Date.now()+n.props.closeTimeoutMS;n.setState({beforeClose:!0,closesAt:e},(function(){n.closeTimer=setTimeout(n.closeWithoutTimeout,n.state.closesAt-Date.now())}))},n.closeWithoutTimeout=function(){n.setState({beforeClose:!1,isOpen:!1,afterOpen:!1,closesAt:null},n.afterClose)},n.handleKeyDown=function(e){9===e.keyCode&&(0,f.default)(n.content,e),n.props.shouldCloseOnEsc&&27===e.keyCode&&(e.stopPropagation(),n.requestClose(e))},n.handleOverlayOnClick=function(e){null===n.shouldClose&&(n.shouldClose=!0),n.shouldClose&&n.props.shouldCloseOnOverlayClick&&(n.ownerHandlesClose()?n.requestClose(e):n.focusContent()),n.shouldClose=null},n.handleContentOnMouseUp=function(){n.shouldClose=!1},n.handleOverlayOnMouseDown=function(e){n.props.shouldCloseOnOverlayClick||e.target!=n.overlay||e.preventDefault()},n.handleContentOnClick=function(){n.shouldClose=!1},n.handleContentOnMouseDown=function(){n.shouldClose=!1},n.requestClose=function(e){return n.ownerHandlesClose()&&n.props.onRequestClose(e)},n.ownerHandlesClose=function(){return n.props.onRequestClose},n.shouldBeClosed=function(){return!n.state.isOpen&&!n.state.beforeClose},n.contentHasFocus=function(){return document.activeElement===n.content||n.content.contains(document.activeElement)},n.buildClassName=function(e,t){var r="object"===(void 0===t?"undefined":i(t))?t:{base:m[e],afterOpen:m[e]+"--after-open",beforeClose:m[e]+"--before-close"},o=r.base;return n.state.afterOpen&&(o=o+" "+r.afterOpen),n.state.beforeClose&&(o=o+" "+r.beforeClose),"string"==typeof t&&t?o+" "+t:o},n.attributesFromObject=function(e,t){return Object.keys(t).reduce((function(n,r){return n[e+"-"+r]=t[r],n}),{})},n.state={afterOpen:!1,beforeClose:!1},n.shouldClose=null,n.moveFromContentToOverlay=null,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+r(t));e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),a(t,[{key:"componentDidMount",value:function(){this.props.isOpen&&this.open()}},{key:"componentDidUpdate",value:function(e,t){this.props.isOpen&&!e.isOpen?this.open():!this.props.isOpen&&e.isOpen&&this.close(),this.props.shouldFocusAfterRender&&this.state.isOpen&&!t.isOpen&&this.focusContent()}},{key:"componentWillUnmount",value:function(){this.state.isOpen&&this.afterClose(),clearTimeout(this.closeTimer)}},{key:"beforeOpen",value:function(){var e=this.props,t=e.appElement,n=e.ariaHideApp,r=e.htmlOpenClassName,o=e.bodyOpenClassName;o&&p.add(document.body,o),r&&p.add(document.getElementsByTagName("html")[0],r),n&&(g+=1,d.hide(t)),v.default.register(this)}},{key:"render",value:function(){var e=this.props,t=e.id,n=e.className,r=e.overlayClassName,i=e.defaultStyles,a=n?{}:i.content,u=r?{}:i.overlay;return this.shouldBeClosed()?null:s.default.createElement("div",{ref:this.setOverlayRef,className:this.buildClassName("overlay",r),style:o({},u,this.props.style.overlay),onClick:this.handleOverlayOnClick,onMouseDown:this.handleOverlayOnMouseDown},s.default.createElement("div",o({id:t,ref:this.setContentRef,style:o({},a,this.props.style.content),className:this.buildClassName("content",n),tabIndex:"-1",onKeyDown:this.handleKeyDown,onMouseDown:this.handleContentOnMouseDown,onMouseUp:this.handleContentOnMouseUp,onClick:this.handleContentOnClick,role:this.props.role,"aria-label":this.props.contentLabel},this.attributesFromObject("aria",this.props.aria||{}),this.attributesFromObject("data",this.props.data||{}),{"data-testid":this.props.testId}),this.props.children))}}]),t}(u.Component);w.defaultProps={style:{overlay:{},content:{}},defaultStyles:{}},w.propTypes={isOpen:l.default.bool.isRequired,defaultStyles:l.default.shape({content:l.default.object,overlay:l.default.object}),style:l.default.shape({content:l.default.object,overlay:l.default.object}),className:l.default.oneOfType([l.default.string,l.default.object]),overlayClassName:l.default.oneOfType([l.default.string,l.default.object]),bodyOpenClassName:l.default.string,htmlOpenClassName:l.default.string,ariaHideApp:l.default.bool,appElement:l.default.instanceOf(h.default),onAfterOpen:l.default.func,onAfterClose:l.default.func,onRequestClose:l.default.func,closeTimeoutMS:l.default.number,shouldFocusAfterRender:l.default.bool,shouldCloseOnOverlayClick:l.default.bool,shouldReturnFocusAfterClose:l.default.bool,role:l.default.string,contentLabel:l.default.string,aria:l.default.object,data:l.default.object,children:l.default.node,shouldCloseOnEsc:l.default.bool,overlayRef:l.default.func,contentRef:l.default.func,id:l.default.string,testId:l.default.string},t.default=w,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.handleBlur=l,t.handleFocus=c,t.markForFocusLater=function(){a.push(document.activeElement)},t.returnFocus=function(){var e=null;try{return void(0!==a.length&&(e=a.pop()).focus())}catch(t){console.warn(["You tried to return focus to",e,"but it is not in the DOM anymore"].join(" "))}},t.popWithoutFocus=function(){a.length>0&&a.pop()},t.setupScopedFocus=function(e){u=e,window.addEventListener?(window.addEventListener("blur",l,!1),document.addEventListener("focus",c,!0)):(window.attachEvent("onBlur",l),document.attachEvent("onFocus",c))},t.teardownScopedFocus=function(){u=null,window.addEventListener?(window.removeEventListener("blur",l),document.removeEventListener("focus",c)):(window.detachEvent("onBlur",l),document.detachEvent("onFocus",c))};var r,o=n(24),i=(r=o)&&r.__esModule?r:{default:r};var a=[],u=null,s=!1;function l(){s=!0}function c(){if(s){if(s=!1,!u)return;setTimeout((function(){u.contains(document.activeElement)||((0,i.default)(u)[0]||u).focus()}),0)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=(0,i.default)(e);if(!n.length)return void t.preventDefault();var r=void 0,o=t.shiftKey,a=n[0],u=n[n.length-1];if(e===document.activeElement){if(!o)return;r=u}u!==document.activeElement||o||(r=a);a===document.activeElement&&o&&(r=u);if(r)return t.preventDefault(),void r.focus();var s=/(\bChrome\b|\bSafari\b)\//.exec(navigator.userAgent);if(null==s||"Chrome"==s[1]||null!=/\biPod\b|\biPad\b/g.exec(navigator.userAgent))return;var l=n.indexOf(document.activeElement);l>-1&&(l+=o?-1:1);if(void 0===(r=n[l]))return t.preventDefault(),void(r=o?u:a).focus();t.preventDefault(),r.focus()};var r,o=n(24),i=(r=o)&&r.__esModule?r:{default:r};e.exports=t.default},function(e,t,n){"use strict";var r=function(){};e.exports=r},function(e,t,n){var r;function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}
22
+ /*!
23
+ Copyright (c) 2015 Jed Watson.
24
+ Based on code that is Copyright 2013-2015, Facebook, Inc.
25
+ All rights reserved.
26
+ */!function(){"use strict";var i=!("undefined"==typeof window||!window.document||!window.document.createElement),a={canUseDOM:i,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:i&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:i&&!!window.screen};"object"===o(n(26))&&n(26)?void 0===(r=function(){return a}.call(t,n,t,e))||(e.exports=r):e.exports?e.exports=a:window.ExecutionEnvironment=a}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dumpClassLists=function(){0};var r={},o={};t.add=function(e,t){return n=e.classList,i="html"==e.nodeName.toLowerCase()?r:o,void t.split(" ").forEach((function(e){!function(e,t){e[t]||(e[t]=0),e[t]+=1}(i,e),n.add(e)}));var n,i},t.remove=function(e,t){return n=e.classList,i="html"==e.nodeName.toLowerCase()?r:o,void t.split(" ").forEach((function(e){!function(e,t){e[t]&&(e[t]-=1)}(i,e),0===i[e]&&n.remove(e)}));var n,i}},function(e,t,n){"use strict";var r,o=n(27),i=(r=o)&&r.__esModule?r:{default:r};var a=void 0,u=void 0,s=[];function l(){0!==s.length&&s[s.length-1].focusContent()}i.default.subscribe((function(e,t){a&&u||((a=document.createElement("div")).setAttribute("data-react-modal-body-trap",""),a.style.position="absolute",a.style.opacity="0",a.setAttribute("tabindex","0"),a.addEventListener("focus",l),(u=a.cloneNode()).addEventListener("focus",l)),(s=t).length>0?(document.body.firstChild!==a&&document.body.insertBefore(a,document.body.firstChild),document.body.lastChild!==u&&document.body.appendChild(u)):(a.parentElement&&a.parentElement.removeChild(a),u.parentElement&&u.parentElement.removeChild(u))}))},function(e,t,n){"use strict";function r(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);null!=e&&this.setState(e)}function o(e){this.setState(function(t){var n=this.constructor.getDerivedStateFromProps(e,t);return null!=n?n:null}.bind(this))}function i(e,t){try{var n=this.props,r=this.state;this.props=e,this.state=t,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,r)}finally{this.props=n,this.state=r}}function a(e){var t=e.prototype;if(!t||!t.isReactComponent)throw new Error("Can only polyfill class components");if("function"!=typeof e.getDerivedStateFromProps&&"function"!=typeof t.getSnapshotBeforeUpdate)return e;var n=null,a=null,u=null;if("function"==typeof t.componentWillMount?n="componentWillMount":"function"==typeof t.UNSAFE_componentWillMount&&(n="UNSAFE_componentWillMount"),"function"==typeof t.componentWillReceiveProps?a="componentWillReceiveProps":"function"==typeof t.UNSAFE_componentWillReceiveProps&&(a="UNSAFE_componentWillReceiveProps"),"function"==typeof t.componentWillUpdate?u="componentWillUpdate":"function"==typeof t.UNSAFE_componentWillUpdate&&(u="UNSAFE_componentWillUpdate"),null!==n||null!==a||null!==u){var s=e.displayName||e.name,l="function"==typeof e.getDerivedStateFromProps?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()";throw Error("Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n"+s+" uses "+l+" but also contains the following legacy lifecycles:"+(null!==n?"\n "+n:"")+(null!==a?"\n "+a:"")+(null!==u?"\n "+u:"")+"\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://fb.me/react-async-component-lifecycle-hooks")}if("function"==typeof e.getDerivedStateFromProps&&(t.componentWillMount=r,t.componentWillReceiveProps=o),"function"==typeof t.getSnapshotBeforeUpdate){if("function"!=typeof t.componentDidUpdate)throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");t.componentWillUpdate=i;var c=t.componentDidUpdate;t.componentDidUpdate=function(e,t,n){var r=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:n;c.call(this,e,t,r)}}return e}n.r(t),n.d(t,"polyfill",(function(){return a})),r.__suppressDeprecationWarning=!0,o.__suppressDeprecationWarning=!0,i.__suppressDeprecationWarning=!0}]]);
27
+ //# sourceMappingURL=vendor.js.map
classes/admin.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Meow_WPMC_Admin extends MeowCommon_Admin {
4
+
5
+ public function __construct() {
6
+ parent::__construct( WPMC_PREFIX, WPMC_ENTRY, WPMC_DOMAIN, class_exists( 'MeowPro_WPMC_Core' ) );
7
+ add_action( 'admin_menu', array( $this, 'app_menu' ) );
8
+ add_filter( 'pre_update_option', array( $this, 'pre_update_option' ), 10, 3 );
9
+
10
+ // Load the scripts only if they are needed by the current screen
11
+ $page = isset( $_GET["page"] ) ? $_GET["page"] : null;
12
+ $is_wpmc_screen = in_array( $page, [ 'wpmc_dashboard', 'wpmc_settings' ] );
13
+ $is_meowapps_dashboard = $page === 'meowapps-main-menu';
14
+ if ( $is_meowapps_dashboard || $is_wpmc_screen ) {
15
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
16
+ }
17
+ }
18
+
19
+ function admin_enqueue_scripts() {
20
+
21
+ // Load the scripts
22
+ $physical_file = WPMC_PATH . '/app/index.js';
23
+ $cache_buster = file_exists( $physical_file ) ? filemtime( $physical_file ) : WPMC_VERSION;
24
+ wp_register_script( 'wpmc_media_cleaner-vendor', WPMC_URL . 'app/vendor.js',
25
+ ['wp-element', 'wp-i18n'], $cache_buster
26
+ );
27
+ wp_register_script( 'wpmc_media_cleaner', WPMC_URL . 'app/index.js',
28
+ ['wpmc_media_cleaner-vendor', 'wp-i18n'], $cache_buster
29
+ );
30
+ wp_set_script_translations( 'wpmc_media_cleaner', 'media-file-renamer' );
31
+ wp_enqueue_script('wpmc_media_cleaner' );
32
+
33
+ // Load the fonts
34
+ wp_register_style( 'meow-neko-ui-lato-font', '//fonts.googleapis.com/css2?family=Lato:wght@100;300;400;700;900&display=swap');
35
+ wp_enqueue_style( 'meow-neko-ui-lato-font' );
36
+
37
+ // Localize and options
38
+ wp_localize_script( 'wpmc_media_cleaner', 'wpmc_media_cleaner', array_merge( [
39
+ 'api_url' => site_url('/wp-json/media-cleaner/v1/'),
40
+ 'rest_url' => site_url('/wp-json/'),
41
+ 'plugin_url' => WPMC_URL,
42
+ 'prefix' => WPMC_PREFIX,
43
+ 'domain' => WPMC_DOMAIN,
44
+ 'is_pro' => class_exists( 'MeowPro_WPMC_Core' ),
45
+ 'is_registered' => !!$this->is_registered(),
46
+ ], $this->get_all_options() ) );
47
+ }
48
+
49
+ /**
50
+ * Filters and performs validation for certain options
51
+ * @param mixed $value Option value
52
+ * @param string $option Option name
53
+ * @param mixed $old_value The current value of the option
54
+ * @return mixed The actual value to be stored
55
+ */
56
+ function pre_update_option( $value, $option, $old_value ) {
57
+ if ( strpos( $option, 'wpmc_' ) !== 0 ) return $value; // Never touch extraneous options
58
+ $validated = $this->validate_option( $option, $value );
59
+ if ( $validated instanceof WP_Error ) {
60
+ // TODO: Show warning for invalid option value
61
+ return $old_value;
62
+ }
63
+ return $validated;
64
+ }
65
+
66
+ /**
67
+ * Validates certain option values
68
+ * @param string $option Option name
69
+ * @param mixed $value Option value
70
+ * @return mixed|WP_Error Validated value if no problem
71
+ */
72
+ function validate_option( $option, $value ) {
73
+ switch ( $option ) {
74
+ case 'wpmc_dirs_filter':
75
+ case 'wpmc_files_filter':
76
+ if ( $value && @preg_match( $value, '' ) === false ) return new WP_Error( 'invalid_option', __( "Invalid Regular-Expression", 'media-cleaner' ) );
77
+ break;
78
+ }
79
+ return $value;
80
+ }
81
+
82
+ function app_menu() {
83
+ add_submenu_page( 'meowapps-main-menu', 'Cleaner', 'Cleaner', 'manage_options', 'wpmc_settings',
84
+ array( $this, 'admin_settings' )
85
+ );
86
+ }
87
+
88
+ public function admin_settings() {
89
+ echo '<div id="wpmc-admin-settings"></div>';
90
+ }
91
+
92
+ function get_all_options() {
93
+ return [
94
+ 'wpmc_method' => get_option( 'wpmc_method', 'media' ),
95
+ 'wpmc_content' => get_option( 'wpmc_content', true ),
96
+ 'wpmc_media_library' => get_option( 'wpmc_media_library'),
97
+ 'wpmc_live_content' => get_option( 'wpmc_live_content', false ),
98
+ 'wpmc_debuglogs' => get_option( 'wpmc_debuglogs', false ),
99
+ 'wpmc_images_only' => get_option( 'wpmc_images_only' ),
100
+ 'wpmc_thumbnails_only' => get_option( 'wpmc_thumbnails_only' ),
101
+ 'wpmc_dirs_filter' => get_option( 'wpmc_dirs_filter', '' ),
102
+ 'wpmc_files_filter' => get_option( 'wpmc_files_filter', '' ),
103
+ 'wpmc_hide_thumbnails' => get_option( 'wpmc_hide_thumbnails' ),
104
+ 'wpmc_hide_warning' => get_option( 'wpmc_hide_warning' ),
105
+ 'wpmc_medias_buffer' => get_option( 'wpmc_medias_buffer', 100 ),
106
+ 'wpmc_posts_buffer' => get_option( 'wpmc_posts_buffer', 5 ),
107
+ 'wpmc_analysis_buffer' => get_option( 'wpmc_analysis_buffer', 100 ),
108
+ 'wpmc_delay' => get_option( 'wpmc_delay', 100 ),
109
+ 'wpmc_shortcodes_disabled' => get_option( 'wpmc_shortcodes_disabled' ),
110
+ ];
111
+ }
112
+
113
+ }
114
+
115
+ ?>
core.php → classes/core.php RENAMED
@@ -3,44 +3,69 @@
3
  class Meow_WPMC_Core {
4
 
5
  public $admin = null;
 
 
 
6
  public $engine = null;
7
  public $catch_timeout = true; // This will halt the plugin before reaching the PHP timeout.
8
  private $regex_file = '/[A-Za-z0-9-_,.\(\)\s]+[.]{1}(MIMETYPES)/';
9
  public $types = "jpg|jpeg|jpe|gif|png|tiff|bmp|csv|pdf|xls|xlsx|doc|docx|odt|wpd|rtf|tiff|mp3|mp4|mov|wav|lua";
10
  public $current_method = 'media';
11
  private $refcache = array();
12
- public $servername = null;
13
- public $upload_folder = null;
14
- public $contentDir = null; // becomes 'wp-content/uploads'
 
15
  private $check_content = null;
16
  private $debug_logs = null;
17
- public $site_url = null;
18
 
19
- public function __construct( $admin ) {
20
- $this->admin = $admin;
21
  $this->site_url = get_site_url();
22
  $this->current_method = get_option( 'wpmc_method', 'media' );
23
  $this->regex_file = str_replace( "MIMETYPES", $this->types, $this->regex_file );
24
  $this->servername = str_replace( 'http://', '', str_replace( 'https://', '', $this->site_url ) );
25
- $this->upload_folder = wp_upload_dir();
26
- $this->contentDir = substr( $this->upload_folder['baseurl'], 1 + strlen( $this->site_url ) );
 
27
  $this->check_content = get_option( 'wpmc_content', true );
28
  $this->debug_logs = get_option( 'wpmc_debuglogs', false );
 
 
29
 
30
- add_action( 'wpmc_initialize_parsers', array( $this, 'initialize_parsers' ), 10, 0 );
31
- add_filter( 'wp_unique_filename', array( $this, 'wp_unique_filename' ), 10, 3 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
- require __DIR__ . '/engine.php';
34
- require __DIR__ . '/ui.php';
35
- require __DIR__ . '/api.php';
36
- $this->engine = new Meow_WPMC_Engine( $this, $admin );
37
- new Meow_WPMC_UI( $this, $admin );
38
- new Meow_WPMC_API( $this, $admin, $this->engine );
39
  }
40
 
41
  function initialize_parsers() {
42
  include_once( 'parsers.php' );
43
- new MeowApps_WPMC_Parsers();
44
  }
45
 
46
  function deepsleep( $seconds ) {
@@ -88,12 +113,12 @@ class Meow_WPMC_Core {
88
  if ( $this->catch_timeout ) {
89
  if ( $this->time_remaining - $this->item_scan_avg_time < 0 ) {
90
  error_log("Media Cleaner Timeout! Check the Media Cleaner logs for more info.");
91
- $this->log( "Timeout! Some info for debug:" );
92
- $this->log( "Elapsed time: $this->time_elapsed" );
93
- $this->log( "WP init time: $this->wordpress_init_time" );
94
- $this->log( "Remaining time: $this->time_remaining" );
95
- $this->log( "Scan time per item: $this->item_scan_avg_time" );
96
- $this->log( "PHP max_execution_time: $this->max_execution_time" );
97
  header("HTTP/1.0 408 Request Timeout");
98
  exit;
99
  }
@@ -220,9 +245,7 @@ class Meow_WPMC_Core {
220
  }
221
  }
222
  else {
223
- $err = 'ERROR: Failed to load iframe: ' . $iframe_src;
224
- //error_log( $err );
225
- $this->log( $err );
226
  }
227
  }
228
  }
@@ -369,10 +392,17 @@ class Meow_WPMC_Core {
369
  }
370
  }
371
 
 
 
 
 
 
 
372
  function log( $data = null, $force = false ) {
373
  if ( !$this->debug_logs && !$force )
374
  return;
375
- $fh = @fopen( trailingslashit( dirname(__FILE__) ) . '/media-cleaner.log', 'a' );
 
376
  if ( !$fh )
377
  return false;
378
  $date = date( "Y-m-d H:i:s" );
@@ -391,7 +421,11 @@ class Meow_WPMC_Core {
391
  */
392
 
393
  function get_trashdir() {
394
- return trailingslashit( $this->upload_folder['basedir'] ) . 'wpmc-trash';
 
 
 
 
395
  }
396
 
397
  /**
@@ -422,10 +456,10 @@ class Meow_WPMC_Core {
422
  */
423
 
424
  function recover_file( $path ) {
425
- $originalPath = trailingslashit( $this->upload_folder['basedir'] ) . $path;
426
  $trashPath = trailingslashit( $this->get_trashdir() ) . $path;
427
  if ( !file_exists( $trashPath ) ) {
428
- $this->log( "The file $originalPath actually does not exist in the trash." );
429
  return true;
430
  }
431
  $path_parts = pathinfo( $originalPath );
@@ -463,7 +497,7 @@ class Meow_WPMC_Core {
463
  $paths = $this->get_paths_from_attachment( $issue->postId );
464
  foreach ( $paths as $path ) {
465
  if ( !$this->recover_file( $path ) ) {
466
- $this->log( "Could not recover $path." );
467
  error_log( "Media Cleaner: Could not recover $path." );
468
  }
469
  }
@@ -476,24 +510,24 @@ class Meow_WPMC_Core {
476
  }
477
 
478
  function trash_file( $fileIssuePath ) {
479
- $originalPath = trailingslashit( $this->upload_folder['basedir'] ) . $fileIssuePath;
480
  $trashPath = trailingslashit( $this->get_trashdir() ) . $fileIssuePath;
481
  $path_parts = pathinfo( $trashPath );
482
 
483
  try {
484
  if ( !file_exists( $path_parts['dirname'] ) && !wp_mkdir_p( $path_parts['dirname'] ) ) {
485
- $this->log( "Could not create the trash directory for Media Cleaner." );
486
  error_log( "Media Cleaner: Could not create the trash directory." );
487
  return false;
488
  }
489
  // Rename the file (move). 'is_dir' is just there for security (no way we should move a whole directory)
490
  if ( is_dir( $originalPath ) ) {
491
- $this->log( "Attempted to delete a directory instead of a file ($originalPath). Can't do that." );
492
  error_log( "Media Cleaner: Attempted to delete a directory instead of a file ($originalPath). Can't do that." );
493
  return false;
494
  }
495
  if ( !file_exists( $originalPath ) ) {
496
- $this->log( "The file $originalPath actually does not exist." );
497
  return true;
498
  }
499
  if ( !@rename( $originalPath, $trashPath ) ) {
@@ -507,11 +541,11 @@ class Meow_WPMC_Core {
507
  return true;
508
  }
509
 
510
- function ignore( $id ) {
511
  global $wpdb;
512
  $table_name = $wpdb->prefix . "mclean_scan";
513
  $issue = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table_name WHERE id = %d", $id ), OBJECT );
514
- if ( (int) $issue->ignored )
515
  $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET ignored = 0 WHERE id = %d", $id ) );
516
  else {
517
  if ( (int) $issue->deleted ) // If it is in trash, recover it
@@ -553,7 +587,7 @@ class Meow_WPMC_Core {
553
  if ( $issue->type == 0 ) {
554
  $attachmentid = $this->find_media_id_from_file( $issue->path, true );
555
  if ( $attachmentid ) {
556
- $this->log( "Issue listed as filesystem but Media {$attachmentid} exists." );
557
  }
558
  }
559
 
@@ -569,7 +603,7 @@ class Meow_WPMC_Core {
569
  // Delete file from the trash
570
  $trashPath = trailingslashit( $this->get_trashdir() ) . $issue->path;
571
  if ( !unlink( $trashPath ) ) {
572
- $this->log( "Failed to delete the file." );
573
  error_log( "Media Cleaner: Failed to delete the file." );
574
  }
575
  $wpdb->query( $wpdb->prepare( "DELETE FROM $table_name WHERE id = %d", $id ) );
@@ -585,7 +619,7 @@ class Meow_WPMC_Core {
585
  $paths = $this->get_paths_from_attachment( $issue->postId );
586
  foreach ( $paths as $path ) {
587
  if ( !$this->trash_file( $path ) ) {
588
- $this->log( "Could not trash $path." );
589
  error_log( "Media Cleaner: Could not trash $path." );
590
  }
591
  }
@@ -667,14 +701,14 @@ class Meow_WPMC_Core {
667
  array_push( $values, $value['id'], $value['type'] );
668
  $place_holders[] = "('%d',NULL,'%s')";
669
  if ( $this->debug_logs ) {
670
- $this->log( "* {$value['type']}: Media #{$value['id']}" );
671
  }
672
  }
673
  else if ( !is_null( $value['url'] ) ) {
674
  array_push( $values, $value['url'], $value['type'] );
675
  $place_holders[] = "(NULL,'%s','%s')";
676
  if ( $this->debug_logs ) {
677
- $this->log( "* {$value['type']}: {$value['url']}" );
678
  }
679
  }
680
  }
@@ -694,7 +728,7 @@ class Meow_WPMC_Core {
694
  WHERE ignored = 1
695
  AND path LIKE '%". esc_sql( $wpdb->esc_like( $file ) ) . "%'" );
696
  if ( $count > 0 ) {
697
- $this->log( "Could not trash $file." );
698
  }
699
  return ($count > 0);
700
  }
@@ -711,9 +745,9 @@ class Meow_WPMC_Core {
711
  $ret = $wpdb->get_var( $sql );
712
  if ( $doLog ) {
713
  if ( empty( $ret ) )
714
- $this->log( "File $file not found as _wp_attached_file (Library)." );
715
  else {
716
- $this->log( "File $file found as Media $ret." );
717
  }
718
  }
719
 
@@ -764,12 +798,12 @@ class Meow_WPMC_Core {
764
  // if ( is_array( $url ) ) {
765
  // error_log( print_r( $url, 1 ) );
766
  // }
767
- $dirIndex = strpos( $url, $this->contentDir );
768
  if ( empty( $url ) || $dirIndex === false ) {
769
  $finalUrl = null;
770
  }
771
  else {
772
- $finalUrl = urldecode( substr( $url, 1 + strlen( $this->contentDir ) + $dirIndex ) );
773
  }
774
  return $finalUrl;
775
  }
@@ -777,7 +811,7 @@ class Meow_WPMC_Core {
777
  // From a fullpath to the shortened and cleaned path (for example '2013/02/file.png')
778
  // Original version by Jordy
779
  // function clean_uploaded_filename( $fullpath ) {
780
- // $basedir = $this->upload_folder['basedir'];
781
  // $file = str_replace( $basedir, '', $fullpath );
782
  // $file = str_replace( "./", "", $file );
783
  // $file = trim( $file, "/" );
@@ -787,13 +821,13 @@ class Meow_WPMC_Core {
787
  // From a fullpath to the shortened and cleaned path (for example '2013/02/file.png')
788
  // Faster version, more difficult to read, by Mike Meinz
789
  function clean_uploaded_filename( $fullpath ) {
790
- $dirIndex = strpos( $fullpath, $this->contentDir );
791
  if ( $dirIndex == false ) {
792
  $file = $fullpath;
793
  }
794
  else {
795
  // Remove first part of the path leaving yyyy/mm/filename.ext
796
- $file = substr( $fullpath, 1 + strlen( $this->contentDir ) + $dirIndex );
797
  }
798
  if ( substr( $file, 0, 2 ) == './' ) {
799
  $file = substr( $file, 2 );
@@ -816,14 +850,16 @@ class Meow_WPMC_Core {
816
  if ( !empty( $mediaId ) ) {
817
  $row = $wpdb->get_row( $wpdb->prepare( "SELECT originType FROM $table WHERE mediaId = %d", $mediaId ) );
818
  if ( !empty( $row ) ) {
819
- $this->log( "OK! Media #{$mediaId} used by {$row->originType}" );
 
820
  return $row->originType;
821
  }
822
  }
823
  if ( !empty( $file ) ) {
824
  $row = $wpdb->get_row( $wpdb->prepare( "SELECT originType FROM $table WHERE mediaUrl = %s", $file ) );
825
  if ( !empty( $row ) ) {
826
- $this->log( "OK! File {$file} used by {$row->originType}" );
 
827
  return $row->originType;
828
  }
829
  }
@@ -840,7 +876,7 @@ class Meow_WPMC_Core {
840
  $mainfile = $this->clean_uploaded_filename( $fullpath );
841
  array_push( $paths, $mainfile );
842
  $baseUp = pathinfo( $mainfile );
843
- $filespath = trailingslashit( $this->upload_folder['basedir'] ) . trailingslashit( $baseUp['dirname'] );
844
  $meta = wp_get_attachment_metadata( $attachmentId );
845
  if ( isset( $meta['original_image'] ) ) {
846
  $original_image = $this->clean_uploaded_filename( $filespath . $meta['original_image'] );
@@ -903,7 +939,7 @@ class Meow_WPMC_Core {
903
  }
904
 
905
  // Let's count the size of the files for later, in case it's unused
906
- $filepath = trailingslashit( $this->upload_folder['basedir'] ) . $path;
907
  if ( file_exists( $filepath ) )
908
  $size += filesize( $filepath );
909
  $countfiles++;
@@ -914,7 +950,7 @@ class Meow_WPMC_Core {
914
  $is_considered_used = apply_filters( 'wpmc_check_media', false, $attachmentId, $is_broken );
915
  if ( !$is_considered_used ) {
916
  if ( $is_broken ) {
917
- $this->log( "File {$fullpath} does not exist." );
918
  $issue = 'ORPHAN_MEDIA';
919
  }
920
  if ( !$checkOnly ) {
@@ -946,8 +982,8 @@ class Meow_WPMC_Core {
946
  else {
947
  $wpdb->query( "DELETE FROM $table_name WHERE ignored = 0 AND deleted = 0" );
948
  }
949
- if ( file_exists( plugin_dir_path( __FILE__ ) . '/media-cleaner.log' ) ) {
950
- file_put_contents( plugin_dir_path( __FILE__ ) . '/media-cleaner.log', '' );
951
  }
952
  $table_name = $wpdb->prefix . "mclean_refs";
953
  $wpdb->query("TRUNCATE $table_name");
3
  class Meow_WPMC_Core {
4
 
5
  public $admin = null;
6
+ public $is_rest = false;
7
+ public $is_cli = false;
8
+ public $is_pro = false;
9
  public $engine = null;
10
  public $catch_timeout = true; // This will halt the plugin before reaching the PHP timeout.
11
  private $regex_file = '/[A-Za-z0-9-_,.\(\)\s]+[.]{1}(MIMETYPES)/';
12
  public $types = "jpg|jpeg|jpe|gif|png|tiff|bmp|csv|pdf|xls|xlsx|doc|docx|odt|wpd|rtf|tiff|mp3|mp4|mov|wav|lua";
13
  public $current_method = 'media';
14
  private $refcache = array();
15
+ public $servername = null; // meowapps.com (site URL without http/https)
16
+ public $site_url = null; // https://meowapps.com
17
+ public $upload_path = null; // /www/wp-content/uploads (path to uploads)
18
+ public $upload_url = null; // wp-content/uploads (uploads without domain)
19
  private $check_content = null;
20
  private $debug_logs = null;
 
21
 
22
+ public function __construct() {
 
23
  $this->site_url = get_site_url();
24
  $this->current_method = get_option( 'wpmc_method', 'media' );
25
  $this->regex_file = str_replace( "MIMETYPES", $this->types, $this->regex_file );
26
  $this->servername = str_replace( 'http://', '', str_replace( 'https://', '', $this->site_url ) );
27
+ $uploaddir = wp_upload_dir();
28
+ $this->upload_path = $uploaddir['basedir'];
29
+ $this->upload_url = substr( $uploaddir['baseurl'], 1 + strlen( $this->site_url ) );
30
  $this->check_content = get_option( 'wpmc_content', true );
31
  $this->debug_logs = get_option( 'wpmc_debuglogs', false );
32
+ $this->is_rest = MeowCommon_Helpers::is_rest();
33
+ $this->is_cli = defined( 'WP_CLI' ) && WP_CLI;
34
 
35
+ add_action( 'plugins_loaded', array( $this, 'init' ) );
36
+ global $wpmc;
37
+ $wpmc = $this;
38
+ }
39
+
40
+ function init() {
41
+ load_plugin_textdomain( WPMC_DOMAIN, false, basename( WPMC_PATH ) . '/languages' );
42
+
43
+ // Part of the core, settings and stuff
44
+ $this->admin = new Meow_WPMC_Admin();
45
+ if ( class_exists( 'MeowPro_WPMC_Core' ) ) {
46
+ new MeowPro_WPMC_Core( $this, $this->admin );
47
+ }
48
+
49
+ // Install hooks and engine on;y if they might be used
50
+ if ( is_admin() || $this->is_rest || $this->is_cli ) {
51
+ add_action( 'wpmc_initialize_parsers', array( $this, 'initialize_parsers' ), 10, 0 );
52
+ add_filter( 'wp_unique_filename', array( $this, 'wp_unique_filename' ), 10, 3 );
53
+ $this->engine = new Meow_WPMC_Engine( $this, $this->admin );
54
+ }
55
+
56
+ // Only for REST
57
+ if ( $this->is_rest ) {
58
+ new Meow_WPMC_Rest( $this );
59
+ }
60
 
61
+ if ( is_admin() ) {
62
+ new Meow_WPMC_UI( $this, $this->admin );
63
+ }
 
 
 
64
  }
65
 
66
  function initialize_parsers() {
67
  include_once( 'parsers.php' );
68
+ new Meow_WPMC_Parsers();
69
  }
70
 
71
  function deepsleep( $seconds ) {
113
  if ( $this->catch_timeout ) {
114
  if ( $this->time_remaining - $this->item_scan_avg_time < 0 ) {
115
  error_log("Media Cleaner Timeout! Check the Media Cleaner logs for more info.");
116
+ $this->log( "😵 Timeout! Some info for debug:" );
117
+ $this->log( "🍀 Elapsed time: $this->time_elapsed" );
118
+ $this->log( "🍀 WP init time: $this->wordpress_init_time" );
119
+ $this->log( "🍀 Remaining time: $this->time_remaining" );
120
+ $this->log( "🍀 Scan time per item: $this->item_scan_avg_time" );
121
+ $this->log( "🍀 PHP max_execution_time: $this->max_execution_time" );
122
  header("HTTP/1.0 408 Request Timeout");
123
  exit;
124
  }
245
  }
246
  }
247
  else {
248
+ $this->log( '🚫 Failed to load iframe: ' . $iframe_src );
 
 
249
  }
250
  }
251
  }
392
  }
393
  }
394
 
395
+ function logs_directory_check() {
396
+ if ( !file_exists( WPMC_PATH . '/logs/' ) ) {
397
+ mkdir( WPMC_PATH . '/logs/', 0777 );
398
+ }
399
+ }
400
+
401
  function log( $data = null, $force = false ) {
402
  if ( !$this->debug_logs && !$force )
403
  return;
404
+ $this->logs_directory_check();
405
+ $fh = @fopen( WPMC_PATH . '/logs/media-cleaner.log', 'a' );
406
  if ( !$fh )
407
  return false;
408
  $date = date( "Y-m-d H:i:s" );
421
  */
422
 
423
  function get_trashdir() {
424
+ return trailingslashit( $this->upload_path ) . 'wpmc-trash';
425
+ }
426
+
427
+ function get_trashurl() {
428
+ return trailingslashit( $this->upload_url ) . 'wpmc-trash';
429
  }
430
 
431
  /**
456
  */
457
 
458
  function recover_file( $path ) {
459
+ $originalPath = trailingslashit( $this->upload_path ) . $path;
460
  $trashPath = trailingslashit( $this->get_trashdir() ) . $path;
461
  if ( !file_exists( $trashPath ) ) {
462
+ $this->log( "🚫 The file $originalPath actually does not exist in the trash." );
463
  return true;
464
  }
465
  $path_parts = pathinfo( $originalPath );
497
  $paths = $this->get_paths_from_attachment( $issue->postId );
498
  foreach ( $paths as $path ) {
499
  if ( !$this->recover_file( $path ) ) {
500
+ $this->log( "🚫 Could not recover $path." );
501
  error_log( "Media Cleaner: Could not recover $path." );
502
  }
503
  }
510
  }
511
 
512
  function trash_file( $fileIssuePath ) {
513
+ $originalPath = trailingslashit( $this->upload_path ) . $fileIssuePath;
514
  $trashPath = trailingslashit( $this->get_trashdir() ) . $fileIssuePath;
515
  $path_parts = pathinfo( $trashPath );
516
 
517
  try {
518
  if ( !file_exists( $path_parts['dirname'] ) && !wp_mkdir_p( $path_parts['dirname'] ) ) {
519
+ $this->log( "🚫 Could not create the trash directory for Media Cleaner." );
520
  error_log( "Media Cleaner: Could not create the trash directory." );
521
  return false;
522
  }
523
  // Rename the file (move). 'is_dir' is just there for security (no way we should move a whole directory)
524
  if ( is_dir( $originalPath ) ) {
525
+ $this->log( "🚫 Attempted to delete a directory instead of a file ($originalPath). Can't do that." );
526
  error_log( "Media Cleaner: Attempted to delete a directory instead of a file ($originalPath). Can't do that." );
527
  return false;
528
  }
529
  if ( !file_exists( $originalPath ) ) {
530
+ $this->log( "🚫 The file $originalPath actually does not exist." );
531
  return true;
532
  }
533
  if ( !@rename( $originalPath, $trashPath ) ) {
541
  return true;
542
  }
543
 
544
+ function ignore( $id, $ignore ) {
545
  global $wpdb;
546
  $table_name = $wpdb->prefix . "mclean_scan";
547
  $issue = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table_name WHERE id = %d", $id ), OBJECT );
548
+ if ( !$ignore )
549
  $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET ignored = 0 WHERE id = %d", $id ) );
550
  else {
551
  if ( (int) $issue->deleted ) // If it is in trash, recover it
587
  if ( $issue->type == 0 ) {
588
  $attachmentid = $this->find_media_id_from_file( $issue->path, true );
589
  if ( $attachmentid ) {
590
+ $this->log( "🚫 Issue listed as filesystem but Media {$attachmentid} exists." );
591
  }
592
  }
593
 
603
  // Delete file from the trash
604
  $trashPath = trailingslashit( $this->get_trashdir() ) . $issue->path;
605
  if ( !unlink( $trashPath ) ) {
606
+ $this->log( "🚫 Failed to delete the file." );
607
  error_log( "Media Cleaner: Failed to delete the file." );
608
  }
609
  $wpdb->query( $wpdb->prepare( "DELETE FROM $table_name WHERE id = %d", $id ) );
619
  $paths = $this->get_paths_from_attachment( $issue->postId );
620
  foreach ( $paths as $path ) {
621
  if ( !$this->trash_file( $path ) ) {
622
+ $this->log( "🚫 Could not trash $path." );
623
  error_log( "Media Cleaner: Could not trash $path." );
624
  }
625
  }
701
  array_push( $values, $value['id'], $value['type'] );
702
  $place_holders[] = "('%d',NULL,'%s')";
703
  if ( $this->debug_logs ) {
704
+ $this->log( " Media #{$value['id']} (as ID)" );
705
  }
706
  }
707
  else if ( !is_null( $value['url'] ) ) {
708
  array_push( $values, $value['url'], $value['type'] );
709
  $place_holders[] = "(NULL,'%s','%s')";
710
  if ( $this->debug_logs ) {
711
+ $this->log( " {$value['url']}" );
712
  }
713
  }
714
  }
728
  WHERE ignored = 1
729
  AND path LIKE '%". esc_sql( $wpdb->esc_like( $file ) ) . "%'" );
730
  if ( $count > 0 ) {
731
+ $this->log( "🚫 Could not trash $file." );
732
  }
733
  return ($count > 0);
734
  }
745
  $ret = $wpdb->get_var( $sql );
746
  if ( $doLog ) {
747
  if ( empty( $ret ) )
748
+ $this->log( "🚫 File $file not found as _wp_attached_file (Library)." );
749
  else {
750
+ $this->log( "File $file found as Media $ret." );
751
  }
752
  }
753
 
798
  // if ( is_array( $url ) ) {
799
  // error_log( print_r( $url, 1 ) );
800
  // }
801
+ $dirIndex = strpos( $url, $this->upload_url );
802
  if ( empty( $url ) || $dirIndex === false ) {
803
  $finalUrl = null;
804
  }
805
  else {
806
+ $finalUrl = urldecode( substr( $url, 1 + strlen( $this->upload_url ) + $dirIndex ) );
807
  }
808
  return $finalUrl;
809
  }
811
  // From a fullpath to the shortened and cleaned path (for example '2013/02/file.png')
812
  // Original version by Jordy
813
  // function clean_uploaded_filename( $fullpath ) {
814
+ // $basedir = $this->upload_path;
815
  // $file = str_replace( $basedir, '', $fullpath );
816
  // $file = str_replace( "./", "", $file );
817
  // $file = trim( $file, "/" );
821
  // From a fullpath to the shortened and cleaned path (for example '2013/02/file.png')
822
  // Faster version, more difficult to read, by Mike Meinz
823
  function clean_uploaded_filename( $fullpath ) {
824
+ $dirIndex = strpos( $fullpath, $this->upload_url );
825
  if ( $dirIndex == false ) {
826
  $file = $fullpath;
827
  }
828
  else {
829
  // Remove first part of the path leaving yyyy/mm/filename.ext
830
+ $file = substr( $fullpath, 1 + strlen( $this->upload_url ) + $dirIndex );
831
  }
832
  if ( substr( $file, 0, 2 ) == './' ) {
833
  $file = substr( $file, 2 );
850
  if ( !empty( $mediaId ) ) {
851
  $row = $wpdb->get_row( $wpdb->prepare( "SELECT originType FROM $table WHERE mediaId = %d", $mediaId ) );
852
  if ( !empty( $row ) ) {
853
+ $origin = $row->originType === 'MEDIA LIBRARY' ? 'Media Library' : 'content';
854
+ $this->log( "✅ Media #{$mediaId} used by {$origin}" );
855
  return $row->originType;
856
  }
857
  }
858
  if ( !empty( $file ) ) {
859
  $row = $wpdb->get_row( $wpdb->prepare( "SELECT originType FROM $table WHERE mediaUrl = %s", $file ) );
860
  if ( !empty( $row ) ) {
861
+ $origin = $row->originType === 'MEDIA LIBRARY' ? 'Media Library' : 'content';
862
+ $this->log( "✅ File {$file} used by {$origin}" );
863
  return $row->originType;
864
  }
865
  }
876
  $mainfile = $this->clean_uploaded_filename( $fullpath );
877
  array_push( $paths, $mainfile );
878
  $baseUp = pathinfo( $mainfile );
879
+ $filespath = trailingslashit( $this->upload_path ) . trailingslashit( $baseUp['dirname'] );
880
  $meta = wp_get_attachment_metadata( $attachmentId );
881
  if ( isset( $meta['original_image'] ) ) {
882
  $original_image = $this->clean_uploaded_filename( $filespath . $meta['original_image'] );
939
  }
940
 
941
  // Let's count the size of the files for later, in case it's unused
942
+ $filepath = trailingslashit( $this->upload_path ) . $path;
943
  if ( file_exists( $filepath ) )
944
  $size += filesize( $filepath );
945
  $countfiles++;
950
  $is_considered_used = apply_filters( 'wpmc_check_media', false, $attachmentId, $is_broken );
951
  if ( !$is_considered_used ) {
952
  if ( $is_broken ) {
953
+ $this->log( "🚫 File {$fullpath} does not exist." );
954
  $issue = 'ORPHAN_MEDIA';
955
  }
956
  if ( !$checkOnly ) {
982
  else {
983
  $wpdb->query( "DELETE FROM $table_name WHERE ignored = 0 AND deleted = 0" );
984
  }
985
+ if ( file_exists( WPMC_PATH . '/logs/media-cleaner.log' ) ) {
986
+ file_put_contents( WPMC_PATH . '/logs/media-cleaner.log', '' );
987
  }
988
  $table_name = $wpdb->prefix . "mclean_refs";
989
  $wpdb->query("TRUNCATE $table_name");
engine.php → classes/engine.php RENAMED
@@ -48,16 +48,21 @@ SQL;
48
  $this->core->reset_issues();
49
 
50
  $method = $this->core->current_method;
51
- $check_library = get_option(' wpmc_media_library', true );
52
- $check_content = get_option( 'wpmc_content', true );
 
 
 
 
 
 
 
53
 
54
  if ( $method == 'media' && !$check_content ) {
55
  $message = __( "Skipped, as Content is not selected.", 'media-cleaner' );
56
  return true;
57
  }
58
- // DEBUG: This condition was used in a previous version of the plugin
59
- // but it looks like a mistake. The $check_library was removed.
60
- // if ( $method == 'files' && $check_library && !$check_content ) {
61
  if ( $method == 'files' && !$check_content ) {
62
  $message = __( "Skipped, as Content is not selected.", 'media-cleaner' );
63
  return true;
@@ -66,14 +71,12 @@ SQL;
66
  // Initialize the parsers
67
  do_action( 'wpmc_initialize_parsers' );
68
 
69
- global $wpdb;
70
  $posts = $this->get_posts_to_check( $limit, $limitsize );
71
 
72
- // Only at the beginning
73
  if ( empty( $limit ) ) {
74
- $this->core->log( "References from Content:" );
75
  //if ( get_option( 'wpmc_widgets', false ) ) {
76
-
77
  global $wp_registered_widgets;
78
  $syswidgets = $wp_registered_widgets;
79
  $active_widgets = get_option( 'sidebars_widgets' );
@@ -84,7 +87,6 @@ SQL;
84
  }
85
  }
86
  }
87
-
88
  do_action( 'wpmc_scan_widgets' );
89
  //}
90
  do_action( 'wpmc_scan_once' );
@@ -135,12 +137,11 @@ SQL;
135
  return true;
136
  }
137
 
138
- global $wpdb;
139
  $medias = $this->get_media_entries( $limit, $limitsize );
140
 
141
  // Only at the beginning
142
  if ( empty( $limit ) ) {
143
- $this->core->log( "References from Media Library:" );
144
  }
145
 
146
  $this->core->timeout_check_start( count( $medias ) );
@@ -170,7 +171,7 @@ SQL;
170
  // Get files in /uploads (if path is null, the root of /uploads is returned)
171
  function get_files( $path = null ) {
172
  $files = apply_filters( 'wpmc_list_uploaded_files', null, $path );
173
- return $files;
174
  }
175
 
176
  /**
48
  $this->core->reset_issues();
49
 
50
  $method = $this->core->current_method;
51
+
52
+ // Check content is a different option depending on the method
53
+ $check_content = false;
54
+ if ( $method === 'media' ) {
55
+ $check_content = get_option( 'wpmc_content', true );
56
+ }
57
+ else if ( $method === 'files' ) {
58
+ $check_content = get_option( 'wpmc_filesystem_content', true );
59
+ }
60
 
61
  if ( $method == 'media' && !$check_content ) {
62
  $message = __( "Skipped, as Content is not selected.", 'media-cleaner' );
63
  return true;
64
  }
65
+
 
 
66
  if ( $method == 'files' && !$check_content ) {
67
  $message = __( "Skipped, as Content is not selected.", 'media-cleaner' );
68
  return true;
71
  // Initialize the parsers
72
  do_action( 'wpmc_initialize_parsers' );
73
 
 
74
  $posts = $this->get_posts_to_check( $limit, $limitsize );
75
 
76
+ // Only at the beginning, check the Widgets and the Scan Once in the Parsers
77
  if ( empty( $limit ) ) {
78
+ $this->core->log( "🏁 Extracting refs from content..." );
79
  //if ( get_option( 'wpmc_widgets', false ) ) {
 
80
  global $wp_registered_widgets;
81
  $syswidgets = $wp_registered_widgets;
82
  $active_widgets = get_option( 'sidebars_widgets' );
87
  }
88
  }
89
  }
 
90
  do_action( 'wpmc_scan_widgets' );
91
  //}
92
  do_action( 'wpmc_scan_once' );
137
  return true;
138
  }
139
 
 
140
  $medias = $this->get_media_entries( $limit, $limitsize );
141
 
142
  // Only at the beginning
143
  if ( empty( $limit ) ) {
144
+ $this->core->log( "🏁 Extracting refs from Media Library..." );
145
  }
146
 
147
  $this->core->timeout_check_start( count( $medias ) );
171
  // Get files in /uploads (if path is null, the root of /uploads is returned)
172
  function get_files( $path = null ) {
173
  $files = apply_filters( 'wpmc_list_uploaded_files', null, $path );
174
+ return $files ? $files : array();
175
  }
176
 
177
  /**
classes/init.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( class_exists( 'MeowPro_WPMC_Core' ) && class_exists( 'Meow_WPMC_Core' ) ) {
4
+ function wpmc_thanks_admin_notices() {
5
+ echo '<div class="error"><p>' . __( 'Thanks for installing the Pro version of Media Cleaner :) However, the free version is still enabled. Please disable or uninstall it.', 'media-cleaner' ) . '</p></div>';
6
+ }
7
+ add_action( 'admin_notices', 'wpmc_thanks_admin_notices' );
8
+ return;
9
+ }
10
+
11
+ spl_autoload_register(function ( $class ) {
12
+ $necessary = true;
13
+ $file = null;
14
+ if ( strpos( $class, 'Meow_WPMC' ) !== false ) {
15
+ $file = WPMC_PATH . '/classes/' . str_replace( 'meow_wpmc_', '', strtolower( $class ) ) . '.php';
16
+ }
17
+ else if ( strpos( $class, 'MeowCommon_Classes_' ) !== false ) {
18
+ $file = WPMC_PATH . '/common/classes/' . str_replace( 'meowcommon_classes_', '', strtolower( $class ) ) . '.php';
19
+ }
20
+ else if ( strpos( $class, 'MeowCommon_' ) !== false ) {
21
+ $file = WPMC_PATH . '/common/' . str_replace( 'meowcommon_', '', strtolower( $class ) ) . '.php';
22
+ }
23
+ else if ( strpos( $class, 'MeowPro_WPMC' ) !== false ) {
24
+ $necessary = false;
25
+ $file = WPMC_PATH . '/premium/' . str_replace( 'meowpro_wpmc_', '', strtolower( $class ) ) . '.php';
26
+ }
27
+ if ( $file ) {
28
+ if ( !$necessary && !file_exists( $file ) ) {
29
+ return;
30
+ }
31
+ require( $file );
32
+ }
33
+ });
34
+
35
+ //require_once( WPMC_PATH . '/classes/api.php');
36
+ require_once( WPMC_PATH . '/common/helpers.php');
37
+
38
+ // In admin or Rest API request (REQUEST URI begins with '/wp-json/')
39
+ if ( is_admin() || MeowCommon_Helpers::is_rest() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
40
+ global $mfrh_core;
41
+ $mfrh_core = new Meow_WPMC_Core();
42
+ }
43
+
44
+ ?>
parsers.php → classes/parsers.php RENAMED
@@ -1,11 +1,10 @@
1
  <?php
2
 
3
- class MeowApps_WPMC_Parsers {
4
 
5
  public function __construct() {
6
  // require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // mm change
7
  require_once( 'parsers/common.php' );
8
- new MeowApps_WPMC_Parser();
9
 
10
  if ( class_exists( 'WooCommerce' ) )
11
  require_once( 'parsers/woocommerce.php' );
1
  <?php
2
 
3
+ class Meow_WPMC_Parsers {
4
 
5
  public function __construct() {
6
  // require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // mm change
7
  require_once( 'parsers/common.php' );
 
8
 
9
  if ( class_exists( 'WooCommerce' ) )
10
  require_once( 'parsers/woocommerce.php' );
{parsers → classes/parsers}/attachments.php RENAMED
File without changes
{parsers → classes/parsers}/common.php RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- class MeowApps_WPMC_Parser {
4
 
5
  private $metakeys = array( '%gallery%', '%ids%' );
6
 
@@ -125,9 +125,9 @@ class MeowApps_WPMC_Parser {
125
  }
126
  }
127
 
128
- $wpmc->add_reference_id( $posts_images_ids, 'CONTENT (ID)' );
129
- $wpmc->add_reference_url( $posts_images_urls, 'CONTENT (URL)' );
130
- $wpmc->add_reference_url( $galleries_images, 'GALLERY (URL)' );
131
  }
132
 
133
  public function scan_postmeta( $id ) {
@@ -173,3 +173,5 @@ SQL;
173
  }
174
  }
175
  }
 
 
1
  <?php
2
 
3
+ class MeowApps_WPMC_Parser_Common {
4
 
5
  private $metakeys = array( '%gallery%', '%ids%' );
6
 
125
  }
126
  }
127
 
128
+ $wpmc->add_reference_id( $posts_images_ids, "CONTENT #$id (ID)" );
129
+ $wpmc->add_reference_url( $posts_images_urls, "CONTENT #$id (URL)" );
130
+ $wpmc->add_reference_url( $galleries_images, "GALLERY #$id (URL)" );
131
  }
132
 
133
  public function scan_postmeta( $id ) {
173
  }
174
  }
175
  }
176
+
177
+ new MeowApps_WPMC_Parser_Common();
{parsers → classes/parsers}/maxmegamenu.php RENAMED
File without changes
{parsers → classes/parsers}/metaslider.php RENAMED
File without changes
{parsers → classes/parsers}/my-calendar.php RENAMED
File without changes
{parsers → classes/parsers}/woocommerce.php RENAMED
File without changes
{parsers → classes/parsers}/wpseo.php RENAMED
File without changes
classes/rest.php ADDED
@@ -0,0 +1,646 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Meow_WPMC_Rest
4
+ {
5
+ private $core = null;
6
+ private $namespace = 'media-cleaner/v1';
7
+
8
+ public function __construct( $core ) {
9
+ if ( !current_user_can( 'administrator' ) ) {
10
+ return;
11
+ }
12
+ $this->core = $core;
13
+ $this->engine = $core->engine;
14
+ add_action( 'rest_api_init', array( $this, 'rest_api_init' ) );
15
+ }
16
+
17
+ function rest_api_init() {
18
+ try {
19
+ // SETTINGS
20
+ register_rest_route( $this->namespace, '/enable_trash_media', array(
21
+ 'methods' => 'POST',
22
+ 'callback' => array( $this, 'rest_enable_trash_media' )
23
+ ) );
24
+ register_rest_route( $this->namespace, '/update_option', array(
25
+ 'methods' => 'POST',
26
+ 'callback' => array( $this, 'rest_update_option' )
27
+ ) );
28
+ register_rest_route( $this->namespace, '/all_settings', array(
29
+ 'methods' => 'GET',
30
+ 'callback' => array( $this, 'rest_all_settings' ),
31
+ ) );
32
+
33
+ // STATS & LISTING
34
+ register_rest_route( $this->namespace, '/count', array(
35
+ 'methods' => 'POST',
36
+ 'callback' => array( $this, 'rest_count' )
37
+ ) );
38
+ register_rest_route( $this->namespace, '/all_ids', array(
39
+ 'methods' => 'POST',
40
+ 'callback' => array( $this, 'rest_all_ids' ),
41
+ ) );
42
+ register_rest_route( $this->namespace, '/stats', array(
43
+ 'methods' => 'GET',
44
+ 'callback' => array( $this, 'rest_get_stats' ),
45
+ ) );
46
+ register_rest_route( $this->namespace, '/entries', array(
47
+ 'methods' => 'GET',
48
+ 'callback' => array( $this, 'rest_entries' ),
49
+ 'args' => array(
50
+ 'limit' => array( 'required' => false, 'default' => 10 ),
51
+ 'skip' => array( 'required' => false, 'default' => 20 ),
52
+ 'filterBy' => array( 'required' => false, 'default' => 'all' ),
53
+ 'orderBy' => array( 'required' => false, 'default' => 'id' ),
54
+ 'order' => array( 'required' => false, 'default' => 'desc' ),
55
+ 'search' => array( 'required' => false ),
56
+ )
57
+ ) );
58
+
59
+ // ACTIONS
60
+ register_rest_route( $this->namespace, '/set_ignore', array(
61
+ 'methods' => 'POST',
62
+ 'callback' => array( $this, 'rest_set_ignore' )
63
+ ) );
64
+ register_rest_route( $this->namespace, '/delete', array(
65
+ 'methods' => 'POST',
66
+ 'callback' => array( $this, 'rest_delete' )
67
+ ) );
68
+ register_rest_route( $this->namespace, '/recover', array(
69
+ 'methods' => 'POST',
70
+ 'callback' => array( $this, 'rest_recover' )
71
+ ) );
72
+ register_rest_route( $this->namespace, '/reset_db', array(
73
+ 'methods' => 'POST',
74
+ 'callback' => array( $this, 'rest_reset_db' )
75
+ ) );
76
+
77
+ // SCAN
78
+ register_rest_route( $this->namespace, '/reset_issues', array(
79
+ 'methods' => 'POST',
80
+ 'callback' => array( $this, 'rest_reset_issues' )
81
+ ) );
82
+ register_rest_route( $this->namespace, '/extract_references', array(
83
+ 'methods' => 'POST',
84
+ 'callback' => array( $this, 'rest_extract_references' )
85
+ ) );
86
+ register_rest_route( $this->namespace, '/retrieve_medias', array(
87
+ 'methods' => 'POST',
88
+ 'callback' => array( $this, 'rest_retrieve_medias' )
89
+ ) );
90
+ register_rest_route( $this->namespace, '/retrieve_files', array(
91
+ 'methods' => 'POST',
92
+ 'callback' => array( $this, 'rest_retrieve_files' )
93
+ ) );
94
+ register_rest_route( $this->namespace, '/check_targets', array(
95
+ 'methods' => 'POST',
96
+ 'callback' => array( $this, 'rest_check_targets' )
97
+ ) );
98
+
99
+ // LOGS
100
+ register_rest_route( $this->namespace, '/refresh_logs', array(
101
+ 'methods' => 'POST',
102
+ 'callback' => array( $this, 'refresh_logs' )
103
+ ) );
104
+ register_rest_route( $this->namespace, '/clear_logs', array(
105
+ 'methods' => 'POST',
106
+ 'callback' => array( $this, 'clear_logs' )
107
+ ) );
108
+ }
109
+ catch (Exception $e) {
110
+ var_dump($e);
111
+ }
112
+ }
113
+
114
+ function rest_reset_issues() {
115
+ $this->core->reset_issues();
116
+ return new WP_REST_Response( [ 'success' => true, 'message' => 'Issues were reset.' ], 200 );
117
+ }
118
+
119
+ function rest_count( $request ) {
120
+ $params = $request->get_json_params();
121
+ $src = isset( $params['source'] ) ? $params['source'] : null;
122
+ $num = 0;
123
+ if ( $src === 'posts' ) {
124
+ $num = count( $this->engine->get_posts_to_check() );
125
+ }
126
+ else if ( $src === 'medias' ) {
127
+ $num = count( $this->engine->get_media_entries() );
128
+ }
129
+ else {
130
+ return new WP_REST_Response( [
131
+ 'success' => false,
132
+ 'message' => 'No source was mentioned while calling count.'
133
+ ], 200 );
134
+ }
135
+ return new WP_REST_Response( [ 'success' => true, 'data' => $num ], 200 );
136
+ }
137
+
138
+ function rest_all_ids( $request ) {
139
+ $params = $request->get_json_params();
140
+ $src = isset( $params['source'] ) ? $params['source'] : null;
141
+ $ids = [];
142
+ if ( $src === 'issues' ) {
143
+ $ids = $this->get_issues_ids();
144
+ }
145
+ else if ( $src === 'ignored' ) {
146
+ $ids = $this->get_ignored_ids();
147
+ }
148
+ else if ( $src === 'trash' ) {
149
+ $ids = $this->get_trash_ids();
150
+ }
151
+ else {
152
+ return new WP_REST_Response( [
153
+ 'success' => false,
154
+ 'message' => 'No source was mentioned while calling all_ids.'
155
+ ], 200 );
156
+ }
157
+ return new WP_REST_Response( [ 'success' => true, 'data' => $ids ], 200 );
158
+ }
159
+
160
+ function rest_extract_references( $request ) {
161
+ $params = $request->get_json_params();
162
+ $limit = isset( $params['limit'] ) ? $params['limit'] : 0;
163
+ $source = isset( $params['source'] ) ? $params['source'] : null;
164
+ $limitsize = get_option( 'wpmc_posts_buffer', 5 );
165
+ $finished = false;
166
+ $message = ""; // will be filled by extractRefsFrom...
167
+
168
+ if ( $source === 'content' ) {
169
+ $finished = $this->engine->extractRefsFromContent( $limit, $limitsize, $message );
170
+ }
171
+ else if ( $source === 'media' ) {
172
+ $finished = $this->engine->extractRefsFromLibrary( $limit, $limitsize, $message );
173
+ }
174
+ else {
175
+ return new WP_REST_Response( [
176
+ 'success' => false,
177
+ 'message' => 'No source was mentioned while calling the extract_references action.'
178
+ ], 200 );
179
+ }
180
+
181
+ return new WP_REST_Response( [
182
+ 'success' => true,
183
+ 'message' => $message,
184
+ 'data' => [
185
+ 'limit' => $limit + $limitsize,
186
+ 'finished' => $finished,
187
+ ]
188
+ ], 200 );
189
+ }
190
+
191
+ function rest_retrieve_files( $request ) {
192
+ $params = $request->get_json_params();
193
+ $path = isset( $params['path'] ) ? $params['path'] : null;
194
+ $files = $this->engine->get_files( $path );
195
+ $files_count = count( $files );
196
+ $message = null;
197
+ if ( $files_count === 0 ) {
198
+ $message = sprintf( __( "No files for this path (%s).", 'media-cleaner' ), $path );
199
+ }
200
+ else {
201
+ $message = sprintf( __( "Retrieved %d targets.", 'media-cleaner' ), $files_count );
202
+ }
203
+ return new WP_REST_Response( [
204
+ 'success' => true,
205
+ 'message' => $message,
206
+ 'data' => [
207
+ 'results' => $files
208
+ ],
209
+ ], 200 );
210
+ }
211
+
212
+ function rest_retrieve_medias( $request ) {
213
+ $params = $request->get_json_params();
214
+ $limit = isset( $params['limit'] ) ? $params['limit'] : 0;
215
+ $limitsize = get_option( 'wpmc_medias_buffer', 100 );
216
+ $results = $this->engine->get_media_entries( $limit, $limitsize );
217
+ $finished = count( $results ) < $limitsize;
218
+ $message = sprintf( __( "Retrieved %d targets.", 'media-cleaner' ), count( $results ) );
219
+ return new WP_REST_Response( [
220
+ 'success' => true,
221
+ 'message' => $message,
222
+ 'data' => [
223
+ 'limit' => $limit + $limitsize,
224
+ 'finished' => $finished,
225
+ 'results' => $results
226
+ ]
227
+ ], 200 );
228
+ }
229
+
230
+ function rest_check_targets( $request ) {
231
+ $params = $request->get_json_params();
232
+ // DEBUG: Simulate a timeout
233
+ // $this->core->deepsleep(10); header("HTTP/1.0 408 Request Timeout"); exit;
234
+
235
+ //ob_start();
236
+ $data = $params['targets'];
237
+ $method = $this->core->current_method;
238
+
239
+ $this->core->timeout_check_start( count( $data ) );
240
+ $success = 0;
241
+ if ( $method == 'files' ) {
242
+ do_action( 'wpmc_check_file_init' ); // Build_CroppedFile_Cache() in pro core.php
243
+ }
244
+ foreach ( $data as $piece ) {
245
+ $this->core->timeout_check();
246
+ if ( $method == 'files' ) {
247
+ $this->core->log( "🔎 Checking: {$piece}..." );
248
+ $result = ( $this->engine->check_file( $piece ) ? 1 : 0 );
249
+ if ( $result ) {
250
+ $success += $result;
251
+ }
252
+ // else {
253
+ // $this->core->log( "👻 Nothing found." );
254
+ // }
255
+ }
256
+ else if ( $method == 'media' ) {
257
+ $this->core->log( "🔎 Checking #{$piece}..." );
258
+ $result = ( $this->engine->check_media( $piece ) ? 1 : 0 );
259
+ if ( $result ) {
260
+ $success += $result;
261
+ }
262
+ // else {
263
+ // $this->core->log( "👻 Nothing found." );
264
+ // }
265
+ }
266
+ //$this->core->log();
267
+ $this->core->timeout_check_additem();
268
+ }
269
+ //ob_end_clean();
270
+ $elapsed = $this->core->timeout_get_elapsed();
271
+ $issues_found = count( $data ) - $success;
272
+ $message = sprintf(
273
+ // translators: %1$d is a number of targets, %2$d is a number of issues, %3$s is elapsed time in milliseconds
274
+ __( 'Checked %1$d targets and found %2$d issues in %3$s.', 'media-cleaner' ),
275
+ count( $data ), $issues_found, $elapsed
276
+ );
277
+
278
+ return new WP_REST_Response( [
279
+ 'success' => true,
280
+ 'message' => $message,
281
+ 'results' => $success,
282
+ ], 200 );
283
+ }
284
+
285
+ function refresh_logs() {
286
+ $data = "No data.";
287
+ if ( file_exists( WPMC_PATH . '/logs/media-cleaner.log' ) ) {
288
+ $data = file_get_contents( WPMC_PATH . '/logs/media-cleaner.log' );
289
+ }
290
+ return new WP_REST_Response( [ 'success' => true, 'data' => $data ], 200 );
291
+ }
292
+
293
+ function clear_logs() {
294
+ unlink( WPMC_PATH . '/logs/media-cleaner.log' );
295
+ return new WP_REST_Response( [ 'success' => true ], 200 );
296
+ }
297
+
298
+ function rest_enable_trash_media() {
299
+ $is_defined = defined( 'MEDIA_TRASH' );
300
+ if ( $is_defined && MEDIA_TRASH ) {
301
+ return new WP_REST_Response([ 'success' => false, 'message' => 'Already been set.' ], 200 );
302
+ }
303
+
304
+ try {
305
+ $conf = ABSPATH . 'wp-config.php';
306
+ $stream = fopen( $conf, 'r+' );
307
+ if ( $stream === false ) {
308
+ return new WP_REST_Response([ 'success' => false, 'message' => 'Failed to open the config file.' ], 200 );
309
+ }
310
+
311
+ try {
312
+ if ( !flock( $stream, LOCK_EX ) ) {
313
+ return new WP_REST_Response([ 'success' => false, 'message' => 'Failed to lock the config file.' ], 200 );
314
+ }
315
+ $stat = fstat( $stream );
316
+
317
+ /* Find out the ideal position to write on */
318
+ $found = false;
319
+ $patterns = array (
320
+ array (
321
+ 'regex' => '^\/\*\s*' . preg_quote( "That's all, stop editing!" ) . '.*?\s*\*\/',
322
+ 'where' => 'above'
323
+ )
324
+ );
325
+ $current = 0;
326
+ while ( !feof( $stream ) ) {
327
+ $line = fgets( $stream ); // Read line by line
328
+ if ( $line === false ) break; // No more lines
329
+ $prev = $current; // Previous position
330
+ $current = ftell( $stream ); // Current position
331
+ foreach ( $patterns as $item ) {
332
+ if ( !preg_match( '/'.$item['regex'].'/', trim( $line ) ) ) {
333
+ continue;
334
+ }
335
+ $found = true;
336
+ if ( $item['where'] == 'above' ) {
337
+ fseek( $stream, $prev );
338
+ $current = $prev;
339
+ }
340
+ break 2;
341
+ }
342
+ }
343
+
344
+ /* Check if the position is found */
345
+ if ( !$found ) {
346
+ return new WP_REST_Response([ 'success' => false, 'message' => 'Cannot determine the position.' ], 200 );
347
+ }
348
+
349
+ /* Write the constant definition line */
350
+ $new = "define( 'MEDIA_TRASH', true );" . PHP_EOL;
351
+ $rest = fread( $stream, $stat['size'] - $current );
352
+ fseek( $stream, $current );
353
+ $written = fwrite( $stream, $new . $rest );
354
+
355
+ /* All done */
356
+ if ( $written === false ) {
357
+ return new WP_REST_Response([ 'success' => false, 'message' => 'Failed to write.' ], 200 );
358
+ }
359
+ fclose( $stream );
360
+ }
361
+ catch ( Exception $e ) {
362
+ fclose( $stream );
363
+ return new WP_REST_Response([ 'success' => false, 'message' => $e->getMessage() ], 200 );
364
+ }
365
+ }
366
+ catch ( Exception $e ) {
367
+ $result['data']['message'] = $e->getMessage();
368
+ $result['data']['code'] = $e->getCode();
369
+ return new WP_REST_Response([ 'success' => false, 'message' => $e->getMessage() ], 200 );
370
+ }
371
+
372
+ return new WP_REST_Response([ 'success' => true ], 200 );
373
+ }
374
+
375
+ function rest_all_settings() {
376
+ return new WP_REST_Response( [
377
+ 'success' => true,
378
+ 'data' => [
379
+ 'wpmc_method' => get_option( 'wpmc_method', 'media' ),
380
+ 'wpmc_content' => get_option( 'wpmc_content', true ),
381
+ 'wpmc_filesystem_content' => get_option( 'wpmc_filesystem_content', true ),
382
+ 'wpmc_media_library' => get_option( 'wpmc_media_library'),
383
+ 'wpmc_live_content' => get_option( 'wpmc_live_content', false ),
384
+ 'wpmc_debuglogs' => get_option( 'wpmc_debuglogs', false ),
385
+ 'wpmc_images_only' => get_option( 'wpmc_images_only' ),
386
+ 'wpmc_thumbnails_only' => get_option( 'wpmc_thumbnails_only' ),
387
+ 'wpmc_dirs_filter' => get_option( 'wpmc_dirs_filter', '' ),
388
+ 'wpmc_files_filter' => get_option( 'wpmc_files_filter', '' ),
389
+ 'wpmc_hide_thumbnails' => get_option( 'wpmc_hide_thumbnails' ),
390
+ 'wpmc_hide_warning' => get_option( 'wpmc_hide_warning' ),
391
+ 'wpmc_medias_buffer' => get_option( 'wpmc_medias_buffer', 100 ),
392
+ 'wpmc_posts_buffer' => get_option( 'wpmc_posts_buffer', 5 ),
393
+ 'wpmc_analysis_buffer' => get_option( 'wpmc_analysis_buffer', 100 ),
394
+ 'wpmc_file_op_buffer' => get_option( 'wpmc_file_op_buffer', 20 ),
395
+ 'wpmc_delay' => get_option( 'wpmc_delay', 100 ),
396
+ 'wpmc_shortcodes_disabled' => get_option( 'wpmc_shortcodes_disabled' ),
397
+ 'incompatible_plugins' => !class_exists( 'MeowPro_WPMC_Core' ) ? Meow_WPMC_Support::get_issues() : [],
398
+ 'media_trash' => MEDIA_TRASH,
399
+ ]
400
+ ], 200 );
401
+ }
402
+
403
+ function rest_update_option( $request ) {
404
+ $params = $request->get_json_params();
405
+ try {
406
+ $name = $params['name'];
407
+ $value = is_bool( $params['value'] ) ? ( $params['value'] ? '1' : '' ) : $params['value'];
408
+ $success = update_option( $name, $value );
409
+ if ( $success ) {
410
+ $res = $this->validate_updated_option( $name );
411
+ $result = $res['result'];
412
+ $message = $res['message'];
413
+ return new WP_REST_Response([ 'success' => $result, 'message' => $message ], 200 );
414
+ }
415
+ return new WP_REST_Response([ 'success' => false, 'message' => "Could not update option." ], 200 );
416
+ }
417
+ catch (Exception $e) {
418
+ return new WP_REST_Response([
419
+ 'success' => false,
420
+ 'message' => $e->getMessage(),
421
+ ], 500 );
422
+ }
423
+ }
424
+
425
+ function rest_reset_db() {
426
+ wpmc_reset();
427
+ return new WP_REST_Response( [ 'success' => true ], 200 );
428
+ }
429
+
430
+ function rest_entries( $request ) {
431
+ global $wpdb;
432
+ $limit = sanitize_text_field( $request->get_param('limit') );
433
+ $skip = sanitize_text_field( $request->get_param('skip') );
434
+ $filterBy = sanitize_text_field( $request->get_param('filterBy') );
435
+ $orderBy = sanitize_text_field( $request->get_param('orderBy') );
436
+ $order = sanitize_text_field( $request->get_param('order') );
437
+ $search = sanitize_text_field( $request->get_param('search') );
438
+ $table_scan = $wpdb->prefix . "mclean_scan";
439
+ $total = 0;
440
+
441
+ $whereSql = '';
442
+ if ( $filterBy == 'issues' ) {
443
+ $whereSql = 'WHERE ignored = 0 AND deleted = 0';
444
+ $total = $this->count_issues();
445
+ }
446
+ else if ( $filterBy == 'ignored' ) {
447
+ $whereSql = 'WHERE ignored = 1';
448
+ $total = $this->count_ignored();
449
+ }
450
+ else if ( $filterBy == 'trash' ) {
451
+ $whereSql = 'WHERE deleted = 1';
452
+ $total = $this->count_trash();
453
+ }
454
+ else {
455
+ $whereSql = 'WHERE deleted = 0';
456
+ }
457
+
458
+ $orderSql = 'ORDER BY id DESC';
459
+ if ($orderBy === 'type') {
460
+ $orderSql = 'ORDER BY postId ' . ( $order === 'asc' ? 'ASC' : 'DESC' );
461
+ }
462
+ else if ($orderBy === 'postId') {
463
+ $orderSql = 'ORDER BY postId ' . ( $order === 'asc' ? 'ASC' : 'DESC' );
464
+ }
465
+ else if ($orderBy === 'path') {
466
+ $orderSql = 'ORDER BY path ' . ( $order === 'asc' ? 'ASC' : 'DESC' );
467
+ }
468
+ else if ($orderBy === 'size') {
469
+ $orderSql = 'ORDER BY size ' . ( $order === 'asc' ? 'ASC' : 'DESC' );
470
+ }
471
+
472
+ $entries = [];
473
+ if ( empty( $search ) ) {
474
+ $entries = $wpdb->get_results(
475
+ $wpdb->prepare( "SELECT id, type, postId, path, size, ignored, deleted, issue
476
+ FROM $table_scan
477
+ $whereSql
478
+ $orderSql
479
+ LIMIT %d, %d", $skip, $limit
480
+ )
481
+ );
482
+ }
483
+ else {
484
+ $entries = $wpdb->get_results(
485
+ $wpdb->prepare( "SELECT id, type, postId, path, size, ignored, deleted, issue
486
+ FROM $table_scan
487
+ $whereSql
488
+ AND path LIKE %s
489
+ $orderSql
490
+ LIMIT %d, %d", ( '%' . $search . '%' ), $skip, $limit
491
+ )
492
+ );
493
+ }
494
+
495
+ $base = '/' . ( $filterBy == 'trash' ? $this->core->get_trashurl() : $this->core->upload_url );
496
+ foreach ( $entries as $entry ) {
497
+ // FILESYSTEM
498
+ if ( $entry->type == 0 ) {
499
+ $entry->thumbnail_url = htmlspecialchars( trailingslashit( $base ) . $entry->path, ENT_QUOTES );
500
+ }
501
+ // MEDIA
502
+ else {
503
+ $attachment_src = wp_get_attachment_image_src( $entry->postId, 'thumbnail' );
504
+ $thumbnail = empty( $attachment_src ) ? null : $attachment_src[0];
505
+ if ( $filterBy == 'trash' && !empty( $thumbnail ) ) {
506
+ $new_url = $this->core->clean_url( $thumbnail );
507
+ $thumbnail = htmlspecialchars( trailingslashit( $base ) . $new_url, ENT_QUOTES );
508
+ }
509
+ $entry->thumbnail_url = $thumbnail;
510
+ }
511
+ }
512
+
513
+ return new WP_REST_Response( [ 'success' => true, 'data' => $entries, 'total' => $total ], 200 );
514
+ }
515
+
516
+ function rest_set_ignore( $request ) {
517
+ $params = $request->get_json_params();
518
+ $ignore = (boolean)$params['ignore'];
519
+ $entryIds = isset( $params['entryIds'] ) ? (array)$params['entryIds'] : null;
520
+ $entryId = isset( $params['entryId'] ) ? (int)$params['entryId'] : null;
521
+ $data = null;
522
+ if ( !empty( $entryIds ) ) {
523
+ foreach ( $entryIds as $entryId ) {
524
+ $this->core->ignore( $entryId, $ignore );
525
+ }
526
+ $data = 'N/A';
527
+ }
528
+ else if ( !empty( $entryId ) ) {
529
+ $data = $this->core->ignore( $entryId, $ignore );
530
+ }
531
+ return new WP_REST_Response( [ 'success' => true, 'data' => $data ], 200 );
532
+ }
533
+
534
+ function rest_delete( $request ) {
535
+ $params = $request->get_json_params();
536
+ $entryIds = isset( $params['entryIds'] ) ? (array)$params['entryIds'] : null;
537
+ $entryId = isset( $params['entryId'] ) ? (int)$params['entryId'] : null;
538
+ $data = null;
539
+ if ( !empty( $entryIds ) ) {
540
+ foreach ( $entryIds as $entryId ) {
541
+ $this->core->delete( $entryId );
542
+ }
543
+ $data = 'N/A';
544
+ }
545
+ else if ( !empty( $entryId ) ) {
546
+ $data = $this->core->delete( $entryId );
547
+ }
548
+ return new WP_REST_Response( [ 'success' => true, 'data' => $data ], 200 );
549
+ }
550
+
551
+ function rest_recover( $request ) {
552
+ $params = $request->get_json_params();
553
+ $entryIds = isset( $params['entryIds'] ) ? (array)$params['entryIds'] : null;
554
+ $entryId = isset( $params['entryId'] ) ? (int)$params['entryId'] : null;
555
+ $data = null;
556
+ if ( !empty( $entryIds ) ) {
557
+ foreach ( $entryIds as $entryId ) {
558
+ $this->core->recover( $entryId );
559
+ }
560
+ $data = 'N/A';
561
+ }
562
+ else if ( !empty( $entryId ) ) {
563
+ $data = $this->core->recover( $entryId );
564
+ }
565
+ return new WP_REST_Response( [ 'success' => true, 'data' => $data ], 200 );
566
+ }
567
+
568
+ function validate_updated_option( $option_name ) {
569
+ $medias = get_option( 'wpmc_medias_buffer', 100 );
570
+ $posts = get_option( 'wpmc_posts_buffer', 5 );
571
+ $analysis = get_option( 'wpmc_analysis_buffer', 100 );
572
+ $fileOp = get_option( 'wpmc_file_op_buffer', 20 );
573
+ $delay = get_option( 'wpmc_delay', 100 );
574
+ if ( $medias === '' )
575
+ update_option( 'wpmc_medias_buffer', 100 );
576
+ if ( $posts === '' )
577
+ update_option( 'wpmc_posts_buffer', 5 );
578
+ if ( $analysis === '' )
579
+ update_option( 'wpmc_analysis_buffer', 100 );
580
+ if ( $fileOp === '' )
581
+ update_option( 'wpmc_file_op_buffer', 20 );
582
+ if ( $delay === '' )
583
+ update_option( 'wpmc_delay', 100 );
584
+ return $this->createValidationResult();
585
+ }
586
+
587
+ function createValidationResult( $result = true, $message = null) {
588
+ $message = $message ? $message : __( 'OK', 'media-cleaner' );
589
+ return ['result' => $result, 'message' => $message];
590
+ }
591
+
592
+ function get_issues_ids() {
593
+ global $wpdb;
594
+ $table_scan = $wpdb->prefix . "mclean_scan";
595
+ return $wpdb->get_col( "SELECT ID FROM $table_scan WHERE ignored = 0 AND deleted = 0" );
596
+ }
597
+
598
+ function get_ignored_ids() {
599
+ global $wpdb;
600
+ $table_scan = $wpdb->prefix . "mclean_scan";
601
+ return $wpdb->get_col( "SELECT ID FROM $table_scan WHERE ignored = 1" );
602
+ }
603
+
604
+ function get_trash_ids() {
605
+ global $wpdb;
606
+ $table_scan = $wpdb->prefix . "mclean_scan";
607
+ return $wpdb->get_col( "SELECT ID FROM $table_scan WHERE deleted = 1" );
608
+ }
609
+
610
+ function count_issues() {
611
+ global $wpdb;
612
+ $table_scan = $wpdb->prefix . "mclean_scan";
613
+ return (int)$wpdb->get_var( "SELECT COUNT(*) FROM $table_scan WHERE ignored = 0 AND deleted = 0" );
614
+ }
615
+
616
+ function count_ignored() {
617
+ global $wpdb;
618
+ $table_scan = $wpdb->prefix . "mclean_scan";
619
+ return (int)$wpdb->get_var( "SELECT COUNT(*) FROM $table_scan WHERE ignored = 1" );
620
+ }
621
+
622
+ function count_trash() {
623
+ global $wpdb;
624
+ $table_scan = $wpdb->prefix . "mclean_scan";
625
+ return (int)$wpdb->get_var( "SELECT COUNT(*) FROM $table_scan WHERE deleted = 1" );
626
+ }
627
+
628
+ function rest_get_stats() {
629
+ global $wpdb;
630
+ $table_scan = $wpdb->prefix . "mclean_scan";
631
+ $issues = $wpdb->get_row( "SELECT COUNT(*) as entries, SUM(size) as size
632
+ FROM $table_scan WHERE ignored = 0 AND deleted = 0" );
633
+ $ignored = (int)$wpdb->get_var( "SELECT COUNT(*)
634
+ FROM $table_scan WHERE ignored = 1" );
635
+ $trash = $wpdb->get_row( "SELECT COUNT(*) as entries, SUM(size) as size
636
+ FROM $table_scan WHERE deleted = 1" );
637
+
638
+ return new WP_REST_Response( [ 'success' => true, 'data' => array(
639
+ 'issues' => $issues->entries,
640
+ 'issues_size' => $issues->size,
641
+ 'ignored' => $ignored,
642
+ 'trash' => $trash->entries,
643
+ 'trash_size' => $trash->size
644
+ ) ], 200 );
645
+ }
646
+ }
classes/support.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Meow_WPMC_Support {
4
+
5
+ static function get_issues() {
6
+ $unsupported = array();
7
+
8
+ if ( class_exists( 'ACF' ) || function_exists( 'acfw_globals' ) )
9
+ array_push( $unsupported, 'ACF' );
10
+
11
+ if ( function_exists( '_et_core_find_latest' ) )
12
+ array_push( $unsupported, 'Divi' );
13
+
14
+ if ( class_exists( 'Vc_Manager' ) )
15
+ array_push( $unsupported, 'Visual Composer' );
16
+
17
+ if ( function_exists( 'fusion_builder_map' ) )
18
+ array_push( $unsupported, 'Fusion Builder' );
19
+
20
+ if ( function_exists( 'elementor_load_plugin_textdomain' ) )
21
+ array_push( $unsupported, 'Elementor' );
22
+
23
+ if ( class_exists( 'FLBuilderModel' ) )
24
+ array_push( $unsupported, 'Beaver Builder' );
25
+
26
+ if ( class_exists( 'Oxygen_VSB_Dynamic_Shortcodes' ) )
27
+ array_push( $unsupported, 'Oxygen Builder' );
28
+
29
+ if ( class_exists( 'Brizy_Editor_Post' ) )
30
+ array_push( $unsupported, 'Brizy Editor' );
31
+
32
+ if ( function_exists( 'amd_zlrecipe_convert_to_recipe' ) )
33
+ array_push( $unsupported, 'ZipList Recipe' );
34
+
35
+ if ( class_exists( 'UberMenu' ) )
36
+ array_push( $unsupported, 'UberMenu' );
37
+
38
+ if ( class_exists( 'X_Bootstrap' ) )
39
+ array_push( $unsupported, 'Theme X' );
40
+
41
+ if ( class_exists( 'SiteOrigin_Panels' ) )
42
+ array_push( $unsupported, 'SiteOrigin PageBuilder' );
43
+
44
+ if ( defined( 'TASTY_PINS_PLUGIN_FILE' ) )
45
+ array_push( $unsupported, 'Tasty Pins' );
46
+
47
+ if ( class_exists( 'WCFMmp' ) )
48
+ array_push( $unsupported, 'WCFM Marketplace' );
49
+
50
+ if ( class_exists( 'RevSliderFront' ) )
51
+ array_push( $unsupported, 'Revolution Slider' );
52
+
53
+ if ( defined( 'WPESTATE_PLUGIN_URL' ) )
54
+ array_push( $unsupported, 'WP Residence' );
55
+
56
+ if ( defined( 'AV_FRAMEWORK_VERSION' ) )
57
+ array_push( $unsupported, 'Avia Framework' );
58
+
59
+ if ( class_exists( 'FAT_Portfolio' ) )
60
+ array_push( $unsupported, 'FAT Portfolio' );
61
+
62
+ if ( class_exists( 'YIKES_Custom_Product_Tabs' ) )
63
+ array_push( $unsupported, 'Yikes Custom Product Tabs' );
64
+
65
+ if ( function_exists( 'drts' ) )
66
+ array_push( $unsupported, 'Directories' );
67
+
68
+ if ( class_exists( 'ImageMapPro' ) )
69
+ array_push( $unsupported, 'Image Map Pro' );
70
+
71
+ if ( class_exists( 'YOOtheme\Builder\Wordpress\BuilderListener' ) ) {
72
+ array_push( $unsupported, 'YooTheme Builder' );
73
+ }
74
+
75
+ if ( class_exists( 'geodirectory' ) ) {
76
+ array_push( $unsupported, 'GeoDirectory' );
77
+ }
78
+
79
+ return $unsupported;
80
+ }
81
+ }
82
+ ?>
ui.php → classes/ui.php RENAMED
@@ -3,7 +3,7 @@
3
  class Meow_WPMC_UI {
4
 
5
  private $core = null;
6
- private $admin = null;
7
  private $foundTypes = array(
8
  "CONTENT" => "Found in content.",
9
  "CONTENT (ID)" => "Found in content (as an ID).",
@@ -33,94 +33,20 @@ class Meow_WPMC_UI {
33
  "SITE ICON" => "Found as a Site Icon."
34
  );
35
 
36
- function __construct( $core, $admin ) {
37
  $this->core = $core;
38
- $this->admin = $admin;
39
- add_action( 'init', array( $this, 'load_textdomain' ) );
40
  add_action( 'admin_menu', array( $this, 'admin_menu' ) );
41
- add_action( 'admin_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ) );
42
- add_action( 'admin_print_scripts', array( $this, 'admin_inline_js' ) );
43
  add_action( 'add_meta_boxes', array( $this, 'add_metabox' ) );
44
  add_filter( 'media_row_actions', array( $this, 'media_row_actions' ), 10, 2 );
45
  }
46
 
47
- /**
48
- * Renders a view within the views directory.
49
- * @param string $view The name of the view to render
50
- * @param array $data
51
- * An associative array of variables to bind to the view.
52
- * Each key turns into a variable name.
53
- * @return string Rendered view
54
- */
55
- function render_view( $view, $data = null ) {
56
- ob_start();
57
- if ( is_array( $data ) ) extract( $data );
58
- include( __DIR__ . "/views/$view.php" );
59
- return ob_get_clean();
60
- }
61
-
62
- function load_textdomain() {
63
- load_plugin_textdomain( 'media-cleaner', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
64
- }
65
-
66
  function admin_menu() {
67
- add_media_page( 'Media Cleaner', 'Cleaner', 'manage_options', 'media-cleaner', array( $this, 'wpmc_screen' ) );
68
- }
69
-
70
- function wpmc_screen() {
71
- global $wpdb, $wplr;
72
- echo $this->render_view( 'menu-screen', array(
73
- 'wpdb' => $wpdb,
74
- 'wplr' => $wplr,
75
- 'ui' => $this,
76
- 'core' => $this->core,
77
- 'admin' => $this->admin
78
- ) );
79
  }
80
 
81
- function wp_enqueue_scripts() {
82
- global $wpmc_version;
83
- wp_enqueue_style( 'wp-jquery-ui-dialog' );
84
- wp_enqueue_script( 'jquery-ui-dialog' );
85
- wp_enqueue_style( 'media-cleaner-css', plugins_url( '/scripts/style.css', __FILE__ ) );
86
-
87
- $screen = get_current_screen();
88
- switch ( $screen->id ) {
89
- case 'media_page_media-cleaner': // Media > Cleaner
90
- $handle = 'media-cleaner';
91
- wp_enqueue_script( $handle, plugins_url( '/scripts/dashboard.js', __FILE__ ), array( 'jquery', 'jquery-ui-dialog' ), $wpmc_version, true );
92
-
93
- $actions = array ( 'wpmc_define' );
94
- $nonces = array (); // action => nonce
95
- foreach ( $actions as $item ) $nonces[$item] = wp_create_nonce( $item );
96
- wp_localize_script( $handle, 'WPMC_NONCES', $nonces );
97
- wp_localize_script( $handle, 'WPMC_E', Meow_WPMC_API::E ); // Error code enums
98
- break;
99
- case 'meow-apps_page_wpmc_settings-menu': // Meow Apps > Media Cleaner (Settings)
100
- wp_enqueue_script( 'media-cleaner-settings', plugins_url( '/scripts/settings.js', __FILE__ ), array( 'jquery' ),
101
- $wpmc_version, true );
102
- break;
103
- }
104
- }
105
-
106
- /**
107
- *
108
- * DASHBOARD
109
- *
110
- */
111
-
112
- function admin_inline_js() {
113
- echo "<script type='text/javascript'>\n";
114
- echo 'var wpmc_cfg = {
115
- timeout: ' . ( (int) $this->core->get_max_execution_time() ) * 1000 . ',
116
- delay: ' . get_option( 'wpmc_delay', 100 ) . ',
117
- postsBuffer:' . get_option( 'wpmc_posts_buffer', 5 ) . ',
118
- mediasBuffer:' . get_option( 'wpmc_medias_buffer', 100 ) . ',
119
- analysisBuffer: ' . get_option( 'wpmc_analysis_buffer', 50 ) . ',
120
- isPro: ' . ( $this->admin->is_registered() ? '1' : '0') . ',
121
- scanFiles: ' . ( ( $this->core->current_method == 'files' && $this->admin->is_registered() ) ? '1' : '0' ) . ',
122
- scanMedia: ' . ( $this->core->current_method == 'media' ? '1' : '0' ) . ' };';
123
- echo "\n</script>";
124
  }
125
 
126
  /*******************************************************************************
3
  class Meow_WPMC_UI {
4
 
5
  private $core = null;
6
+
7
  private $foundTypes = array(
8
  "CONTENT" => "Found in content.",
9
  "CONTENT (ID)" => "Found in content (as an ID).",
33
  "SITE ICON" => "Found as a Site Icon."
34
  );
35
 
36
+ function __construct( $core ) {
37
  $this->core = $core;
 
 
38
  add_action( 'admin_menu', array( $this, 'admin_menu' ) );
 
 
39
  add_action( 'add_meta_boxes', array( $this, 'add_metabox' ) );
40
  add_filter( 'media_row_actions', array( $this, 'media_row_actions' ), 10, 2 );
41
  }
42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  function admin_menu() {
44
+ add_media_page( 'Media Cleaner Dashboard', __( 'Cleaner', 'media-file-renamer' ), 'manage_options',
45
+ 'wpmc_dashboard', array( $this, 'cleaner_dashboard' ), 1 );
 
 
 
 
 
 
 
 
 
 
46
  }
47
 
48
+ public function cleaner_dashboard() {
49
+ echo '<div id="wpmc-dashboard"></div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  }
51
 
52
  /*******************************************************************************
common/admin.css DELETED
@@ -1,404 +0,0 @@
1
- /* MEOW-TABS */
2
-
3
- .meow-tabs {
4
- display: flex;
5
- flex-wrap: wrap;
6
- box-sizing: border-box;
7
- }
8
-
9
- .meow-tabs * {
10
- box-sizing: border-box;
11
- }
12
-
13
- .meow-tabs .meow-tabs-input {
14
- position: absolute;
15
- opacity: 0;
16
- }
17
-
18
- .meow-tabs .meow-tabs-label {
19
- width: auto;
20
- padding: 4px 12px;
21
- background: #3c3c3c;
22
- cursor: pointer;
23
- font-weight: bold;
24
- font-size: 13px;
25
- text-transform: uppercase;
26
- color: white;
27
- transition: background 0.1s, color 0.1s;
28
- }
29
-
30
- .meow-tabs .inside {
31
- display: none;
32
- width: 100%;
33
- }
34
-
35
- .meow-tabs .meow-tabs-label:hover {
36
- background: #36495f;
37
- }
38
-
39
- .meow-tabs .meow-tabs-label:active {
40
- background: #3C82C7;
41
- }
42
-
43
- .meow-tabs .meow-tabs-input:focus + .meow-tabs-label {
44
- box-shadow: inset 0px 0px 0px 3px #2aa1c0;
45
- z-index: 1;
46
- }
47
-
48
- .meow-tabs .meow-tabs-input:checked + .meow-tabs-label {
49
- background: #3C82C7 !important;
50
- }
51
-
52
- .meow-tabs-input:checked + .meow-tabs-label + .inside {
53
- display: block;
54
- order: 99;
55
- }
56
-
57
- .meow-tabs .inside {
58
- background: #fff;
59
- }
60
-
61
- /* MEOW-BOX */
62
-
63
- .meow-box {
64
- box-sizing: border-box;
65
- border: 1px solid #e5e5e5;
66
- box-shadow: 0px 3px 5px rgba(0, 0, 0, .1);
67
- background: #fff;
68
- color: #444;
69
- margin-bottom: 15px;
70
- font-size: 13px !important;
71
- border-top-right-radius: 8px;
72
- }
73
-
74
- .meow-box input, .meow-box th, .meow-box label, .meow-box select {
75
- font-size: 13px !important;
76
- }
77
-
78
- .meow-box small {
79
- font-size: 12px !important;
80
- }
81
-
82
- .meow-box h3 {
83
- font-size: 14px;
84
- padding: 10px 12px;
85
- margin: 0;
86
- background: #3c3c3c;
87
- color: #ffffff;
88
- text-transform: uppercase;
89
- /*border-bottom: 1px solid #eee;*/
90
- }
91
-
92
- .meow-box h3 .dashicons {
93
- position: relative;
94
- top: 0px;
95
- margin-right: 5px;
96
- }
97
-
98
- .meow-box .pro_info {
99
- padding: 5px;
100
- margin: 10px -10px 5px -10px;
101
- font-size: 11px;
102
- line-height: 13px;
103
- }
104
-
105
- .meow-box .pro_info.enabled {
106
- background: #4482d2;
107
- border-left: 5px solid #4482d2;
108
- color: white;
109
- }
110
-
111
- .meow-box .pro_info.disabled {
112
- background: #96555b;
113
- border-left: 5px solid #632329;
114
- color: white;
115
- }
116
-
117
- .meow-box .pro_info.disabled a {
118
- background: #96555b;
119
- color: red;
120
- text-decoration: none;
121
- }
122
-
123
- .meow-box .inside {
124
- margin: 10px;
125
- }
126
-
127
- .meow-box th {
128
- padding: 10px 10px 10px 0px;
129
- width: 22%;
130
- }
131
-
132
- .meow-box td {
133
- padding: 10px 10px;
134
- }
135
-
136
- .meow-box p.submit, .meow-box div.submit {
137
- text-align: right;
138
- margin: 10px -10px -10px -10px;
139
- padding: 7px 10px 10px 0px !important;
140
- border-top: 1px solid #eee !important;
141
- max-width: inherit;
142
- background: rgba(125, 125, 125, 0.04);
143
- border-radius: 0px;
144
- }
145
-
146
- .meow-box [type="text"], .meow-box select {
147
- width: 100%;
148
- }
149
-
150
- /* CONTROLS INSIDE A COLUMN (LABEL ON THE LEFT, VALUE ON THE RIGHT) */
151
- .meow-box td [type="text"], .meow-box td [type="checkbox"], .meow-box td select {
152
- margin-top: -3px;
153
- }
154
-
155
- .meow-header-ad {
156
- float: right;
157
- }
158
-
159
- /* BUTTONS */
160
-
161
- .meow-button-xs {
162
- font-size: 10px !important;
163
- height: 20px !important;
164
- line-height: 18px !important;
165
- position: relative !important;
166
- top: 1px !important;
167
- text-align: center !important
168
- }
169
-
170
- /* MODAL */
171
-
172
- #meow-modal-info-backdrop {
173
- background: rgba(0, 0, 0, 0.75);
174
- position: fixed;
175
- top: 0px;
176
- bottom: 0px;
177
- right: 0px;
178
- left: 0px;
179
- z-index: 10000;
180
- }
181
-
182
- #meow-modal-info {
183
- background: white;
184
- box-shadow: 0px 0px 5px black;
185
- padding: 15px;
186
- overflow-y: scroll;
187
- position: fixed;
188
- z-index: 10000;
189
- left: 100px;
190
- right: 100px;
191
- top: 50px;
192
- bottom: 50px;
193
- }
194
-
195
- #meow-modal-info h3 {
196
- height: 25px;
197
- border-bottom: 2px solid #808080;
198
- }
199
-
200
- #meow-modal-info td {
201
- text-align: center;
202
- font-size: 11px;
203
- border: 1px solid #D3DCFF;
204
- padding: 10px 15px;
205
- background: #EFF8FF;
206
- }
207
-
208
- #meow-modal-info .close {
209
- float: right;
210
- font-size: 18px;
211
- font-weight: bold;
212
- font-family: Verdana;
213
- cursor: pointer;
214
- }
215
-
216
- #meow-modal-info .loading {
217
- background-color: #F2F2F2;
218
- text-align: center;
219
- padding-top: 10px;
220
- background-size: 32px 32px;
221
- }
222
-
223
- #meow-modal-info .meow-sized-image {
224
- width: 19px;
225
- height: 19px;
226
- margin-right: 10px;
227
- }
228
-
229
- /* IMAGE SIZES RELATED INFO */
230
-
231
- .meow-sized-images {
232
- margin-top: 0px;
233
- cursor: pointer;
234
- }
235
-
236
- .meow-sized-images li, #meow-modal-info .meow-sized-image {
237
- display: block;
238
- color: white;
239
- padding: 5px 0px;
240
- font-size: 10px;
241
- text-align: center;
242
- width: 18px;
243
- height: 18px;
244
- line-height: 8px;
245
- background: black;
246
- float: left;
247
- margin-right: 1px;
248
- box-sizing: border-box;
249
- margin-bottom: 2px;
250
- }
251
-
252
- .meow-sized-images:after {
253
- clear: both;
254
- content:""; display:table;
255
- }
256
-
257
- .meow-sized-images + span {
258
- position: relative;
259
- top: -12px;
260
- }
261
-
262
- /* MEOW COLORS */
263
-
264
- .meow-bk-blue {
265
- background: #3C82C7 !important;
266
- color: white;
267
- }
268
-
269
- .meow-bk-orange {
270
- background: #f1900e !important;
271
- color: white;
272
- }
273
-
274
- .meow-bk-red {
275
- background: #c53a47 !important;
276
- color: white;
277
- }
278
-
279
- .meow-bk-gray {
280
- background: gray !important;
281
- color: white;
282
- }
283
-
284
- .meow-bk-green {
285
- background: #2b9463 !important;
286
- color: white;
287
- }
288
-
289
- .meow-bk-black {
290
- background: #3c3c3c !important;
291
- color: white;
292
- }
293
-
294
- .meow-bk-purple {
295
- background: #984c96 !important;
296
- color: white;
297
- }
298
-
299
- /* DASHBOARD */
300
-
301
- .meow-dashboard {
302
- box-sizing: border-box;
303
- }
304
-
305
- .meow-dashboard .meow-box ul {
306
- padding: 0px;
307
- margin: 0px;
308
- }
309
-
310
- .meow-featured-plugins .meow-box li {
311
- min-height: 80px;
312
- }
313
-
314
- .meow-dashboard .meow-box li {
315
- border-bottom: 1px solid #eee;
316
- margin: 0px;
317
- padding: 10px;
318
- box-sizing: border-box;
319
- }
320
-
321
- .meow-dashboard .meow-box li img {
322
- width: 80px;
323
- height: 80px;
324
- float: left;
325
- margin: -10px 10px -10px -10px;
326
-
327
- }
328
-
329
- .meow-dashboard .meow-box li:last-child {
330
- border: none;
331
- padding-bottom: 0px;
332
- }
333
-
334
- .meow-button-xs .dashicons {
335
- font-size: 18px !important;
336
- }
337
-
338
- .meow-button-xs.updating-message:before {
339
- margin-top: 0px !important;
340
- }
341
-
342
- .meow-button-xs.updating-message * {
343
- display: none;
344
- }
345
-
346
- #phpinfo {
347
- font-size: 11px;
348
- }
349
-
350
- #phpinfo .e {
351
- padding: 5px;
352
- background: lightgray;
353
- }
354
-
355
- #phpinfo .h th {
356
- padding: 5px;
357
- color: white;
358
- background: gray;
359
- text-align: left;
360
- font-size: 14px !important;
361
- }
362
-
363
- #phpinfo h1 {
364
- padding: 10px 0px;
365
- font-weight: bold;
366
- }
367
-
368
- #phpinfo h2 {
369
- padding: 10px 0px;
370
- font-weight: bold;
371
- font-size: 20px;
372
- }
373
-
374
- #error_log {
375
- font-size: 12px;
376
- }
377
-
378
- /* ROWS AND COLUMNS */
379
- .meow-col { display: block; float:left; margin: 1% 0 1% 1.6%; }
380
- .meow-col:first-child { margin-left: 0; }
381
-
382
- /* GROUPING */
383
- .meow-row { clear: both; padding: 0px; margin: 0px; }
384
- .meow-row:before,
385
- .meow-row:after { content:""; display:table; }
386
- .meow-row:after { clear:both; }
387
- .meow-row { zoom:1; /* For IE 6/7 */ }
388
-
389
- /* GRID OF THREE */
390
- .meow-span_3_of_3 { width: 100%; }
391
- .meow-span_2_of_3 { width: 66.1%; }
392
- .meow-span_1_of_3 { width: 32.2%; }
393
-
394
- /* GRID OF TWO */
395
- .meow-span_2_of_2 { width: 100%; }
396
- .meow-span_1_of_2 { width: 49.2%; }
397
-
398
- @media only screen and (max-width: 480px) {
399
- .meow-col { margin: 0 0 0px 0;}
400
- .meow-span_3_of_3, .meow-span_2_of_3, .meow-span_1_of_3 { width: 100%; }
401
- .meow-span_2_of_2, .meow-span_1_of_2 { width: 100%; }
402
- .meow-header-ad { display: none !important; }
403
- .meow-box [type="text"] { width: 100% !important; }
404
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
common/admin.php CHANGED
@@ -1,150 +1,78 @@
1
  <?php
2
 
3
- if ( !class_exists( 'MeowApps_Admin' ) ) {
4
 
5
- class MeowApps_Admin {
6
-
7
- public static $logo = 'data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxIiB2aWV3Qm94PSIwIDAgMTY1IDE2NSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8c3R5bGU+CiAgICAuc3Qye2ZpbGw6IzgwNDYyNX0uc3Qze2ZpbGw6I2ZkYTk2MH0KICA8L3N0eWxlPgogIDxwYXRoIGQ9Ik03MiA3YTc2IDc2IDAgMCAxIDg0IDkxQTc1IDc1IDAgMSAxIDcyIDd6IiBmaWxsPSIjNGE2YjhjIi8+CiAgPHBhdGggZD0iTTQ4IDQ4YzIgNSAyIDEwIDUgMTQgNSA4IDEzIDE3IDIyIDIwbDEtMTBjMS0yIDMtMyA1LTNoMTNjMiAwIDQgMSA1IDNsMyA5IDQtMTBjMi0zIDYtMiA5LTJoMTFjMyAyIDMgNSAzIDhsMiAzN2MwIDMtMSA3LTQgOGgtMTJjLTIgMC0zLTItNS00LTEgMS0yIDMtNCAzLTUgMS05IDEtMTMtMS0zIDItNSAyLTkgMnMtOSAxLTEwLTNjLTItNC0xLTggMC0xMi04LTMtMTUtNy0yMi0xMi03LTctMTUtMTQtMjAtMjMtMy00LTUtOC01LTEzIDEtNCAzLTEwIDYtMTMgNC0zIDEyLTIgMTUgMnoiIGZpbGw9IiMxMDEwMTAiLz4KICA8cGF0aCBjbGFzcz0ic3QyIiBkPSJNNDMgNTFsNCAxMS02IDVoLTZjLTMtNS0zLTExIDAtMTYgMi0yIDYtMyA4IDB6Ii8+CiAgPHBhdGggY2xhc3M9InN0MyIgZD0iTTQ3IDYybDMgNmMwIDMgMCA0LTIgNnMtNCAyLTcgMmwtNi05aDZsNi01eiIvPgogIDxwYXRoIGNsYXNzPSJzdDIiIGQ9Ik01MCA2OGw4IDljLTMgMy01IDYtOSA4bC04LTljMyAwIDUgMCA3LTJzMy0zIDItNnoiLz4KICA8cGF0aCBkPSJNODIgNzRoMTJsNSAxOCAzIDExIDgtMjloMTNsMiA0MmgtOGwtMS0yLTEtMzEtMTAgMzItNyAxLTktMzMtMSAyOS0xIDRoLThsMy00MnoiIGZpbGw9IiNmZmYiLz4KICA8cGF0aCBjbGFzcz0ic3QzIiBkPSJNNTggNzdsNSA1Yy0xIDQtMiA4LTcgOGwtNy01YzQtMiA2LTUgOS04eiIvPgogIDxwYXRoIGNsYXNzPSJzdDIiIGQ9Ik02MyA4Mmw5IDUtNiA5LTEwLTZjNSAwIDYtNCA3LTh6Ii8+CiAgPHBhdGggY2xhc3M9InN0MyIgZD0iTTcyIDg3bDMgMS0xIDExLTgtMyA2LTEweiIvPgo8L3N2Zz4K';
8
 
9
  public static $loaded = false;
10
- public static $admin_version = "2.6";
11
 
12
  public $prefix; // prefix used for actions, filters (mfrh)
13
  public $mainfile; // plugin main file (media-file-renamer.php)
14
  public $domain; // domain used for translation (media-file-renamer)
 
 
 
15
 
16
- public function __construct( $prefix, $mainfile, $domain, $disableReview = false ) {
17
 
18
  // Core Admin (used by all Meow Apps plugins)
19
- if ( !MeowApps_Admin::$loaded ) {
20
  if ( is_admin() ) {
21
  add_action( 'admin_menu', array( $this, 'admin_menu_start' ) );
22
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
23
- add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
24
- add_action( 'wp_ajax_meow_perf_load', array( $this, 'wp_ajax_meow_perf_load' ) );
25
- add_action( 'wp_ajax_meow_file_check', array( $this, 'wp_ajax_meow_file_check' ) );
26
  if ( isset( $_GET['page'] ) && $_GET['page'] === 'meowapps-main-menu' ) {
27
  add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 100000, 1 );
28
  }
29
  }
30
- MeowApps_Admin::$loaded = true;
 
 
 
31
  }
32
 
33
  // Variables for this plugin
34
  $this->prefix = $prefix;
35
  $this->mainfile = $mainfile;
36
  $this->domain = $domain;
37
- $this->is_theme = ( strpos( $this->mainfile, '-theme' ) !== false );
38
 
39
  // If there is no mainfile, it's either a Pro only Plugin (with no Free version available) or a Theme.
40
- if ( !$this->is_theme ) {
41
- register_activation_hook( $mainfile, array( $this, 'show_meowapps_create_rating_date' ) );
42
- if ( is_admin() ) {
43
- $license = get_option( $this->prefix . '_license', "" );
44
- if ( ( !empty( $license ) ) && !file_exists( plugin_dir_path( $this->mainfile ) . 'common/meowapps/admin.php' ) ) {
45
- add_action( 'admin_notices', array( $this, 'admin_notices_licensed_free' ) );
46
- }
47
- if ( !$disableReview ) {
48
- $rating_date = $this->create_rating_date();
49
- if ( time() > $rating_date ) {
50
- add_action( 'admin_notices', array( $this, 'admin_notices_rating' ) );
51
- }
52
- }
53
- }
54
- }
55
-
56
  add_filter( 'edd_sl_api_request_verify_ssl', array( $this, 'request_verify_ssl' ), 10, 0 );
57
  }
58
 
59
- function wp_ajax_meow_perf_load() {
60
- return __( 'Did nothing but a blank request.', $this->domain );
61
- }
62
-
63
- function wp_ajax_meow_file_check() {
64
- $tmpfile = wp_tempnam();
65
- unlink( $tmpfile );
66
- // translators: %s is a filename of an empty temporary file
67
- return sprintf( __( 'Created and deleted %s', $this->domain ), $tmpfile );
 
 
 
 
 
 
 
68
  }
69
 
70
  function request_verify_ssl() {
71
  return get_option( 'force_sslverify', false );
72
  }
73
 
74
- function show_meowapps_create_rating_date() {
75
- delete_option( 'meowapps_hide_meowapps' );
76
- $this->create_rating_date();
77
- }
78
-
79
- function create_rating_date() {
80
- $rating_date = get_option( $this->prefix . '_rating_date' );
81
- if ( empty( $rating_date ) ) {
82
- $two_months = strtotime( '+2 months' );
83
- $six_months = strtotime( '+4 months' );
84
- $rating_date = mt_rand( $two_months, $six_months );
85
- update_option( $this->prefix . '_rating_date', $rating_date, false );
86
- }
87
- return $rating_date;
88
- }
89
-
90
- function admin_notices_rating() {
91
- if ( isset( $_POST[$this->prefix . '_remind_me'] ) ) {
92
- $two_weeks = strtotime( '+2 weeks' );
93
- $six_weeks = strtotime( '+6 weeks' );
94
- $future_date = mt_rand( $two_weeks, $six_weeks );
95
- update_option( $this->prefix . '_rating_date', $future_date, false );
96
- return;
97
- }
98
- else if ( isset( $_POST[$this->prefix . '_never_remind_me'] ) ) {
99
- $twenty_years = strtotime( '+5 years' );
100
- update_option( $this->prefix . '_rating_date', $twenty_years, false );
101
- return;
102
- }
103
- else if ( isset( $_POST[$this->prefix . '_did_it'] ) ) {
104
- $twenty_years = strtotime( '+10 years' );
105
- update_option( $this->prefix . '_rating_date', $twenty_years, false );
106
- return;
107
- }
108
- $rating_date = get_option( $this->prefix . '_rating_date' );
109
- echo '<div class="notice notice-success" data-rating-date="' . date( 'Y-m-d', $rating_date ) . '">';
110
- echo '<p style="font-size: 100%;">';
111
- printf(
112
- // translators: %1$s is a plugin nicename, %2$s is a short url (slug)
113
- __( 'You have been using <b>%1$s</b> for some time now. Thank you! Could you kindly share your opinion with me, along with, maybe, features you would like to see implemented? Then, please <a style="font-weight: bold; color: #b926ff;" target="_blank" href="https://wordpress.org/support/plugin/%2$s/reviews/?rate=5#new-post">write a little review</a>. That will also bring me joy and motivation, and I will get back to you :) <u>In the case you already have written a review</u>, please check again. Many reviews got removed from WordPress recently.', $this->domain ),
114
- $this->nice_name_from_file( $this->mainfile ),
115
- $this->nice_short_url_from_file( $this->mainfile )
116
- );
117
- echo '<p>
118
- <form method="post" action="" style="float: right;">
119
- <input type="hidden" name="' . $this->prefix . '_never_remind_me" value="true">
120
- <input type="submit" name="submit" id="submit" class="button button-red" value="'
121
- . __( 'Never remind me!', $this->domain ) . '">
122
- </form>
123
- <form method="post" action="" style="float: right; margin-right: 10px;">
124
- <input type="hidden" name="' . $this->prefix . '_remind_me" value="true">
125
- <input type="submit" name="submit" id="submit" class="button button-primary" value="'
126
- . __( 'Remind me in a few weeks...', $this->domain ) . '">
127
- </form>
128
- <form method="post" action="" style="float: right; margin-right: 10px;">
129
- <input type="hidden" name="' . $this->prefix . '_did_it" value="true">
130
- <input type="submit" name="submit" id="submit" class="button button-primary" value="'
131
- . __( 'Yes, I did it!', $this->domain ) . '">
132
- </form>
133
- <div style="clear: both;"></div>
134
- </p>
135
- ';
136
- echo '</div>';
137
- }
138
-
139
- function nice_short_url_from_file( $file ) {
140
- $info = pathinfo( $file );
141
- if ( !empty( $info ) ) {
142
- $info['filename'] = str_replace( '-pro', '', $info['filename'] );
143
- return $info['filename'];
144
- }
145
- return "";
146
- }
147
-
148
  function nice_name_from_file( $file ) {
149
  $info = pathinfo( $file );
150
  if ( !empty( $info ) ) {
@@ -163,9 +91,8 @@ if ( !class_exists( 'MeowApps_Admin' ) ) {
163
  delete_option( $this->prefix . '_license' );
164
  return;
165
  }
166
- echo '<div class="error">';
167
  printf(
168
- // translators: %s is a plugin nicename
169
  __( '<p>It looks like you are using the free version of the plugin (<b>%s</b>) but a license for the Pro version was also found. The Pro version might have been replaced by the Free version during an update (might be caused by a temporarily issue). If it is the case, <b>please download it again</b> from the <a target="_blank" href="https://store.meowapps.com">Meow Store</a>. If you wish to continue using the free version and clear this message, click on this button.', $this->domain ),
170
  $this->nice_name_from_file( $this->mainfile ) );
171
  echo '<p>
@@ -179,103 +106,29 @@ if ( !class_exists( 'MeowApps_Admin' ) ) {
179
  echo '</div>';
180
  }
181
 
182
- function display_ads() {
183
- return !get_option( 'meowapps_hide_ads', false );
184
- }
185
-
186
- function display_title( $title = "Meow Apps",
187
- $author = "By <a style='text-decoration: none;' href='https://meowapps.com' target='_blank'>Jordy Meow</a>" ) {
188
- if ( !empty( $this->prefix ) && $title !== "Meow Apps" )
189
- $title = apply_filters( $this->prefix . '_plugin_title', $title );
190
- if ( $this->display_ads() ) {
191
- }
192
- ?>
193
- <h1 style="line-height: 16px;">
194
- <img width="42" style="margin-right: 10px; float: left; position: relative; top: -5px;"
195
- src="<?php echo MeowApps_Admin::$logo ?>"><?php echo $title; ?><br />
196
- <span style="font-size: 12px"><?php echo $author; ?></span>
197
- </h1>
198
- <div style="clear: both;"></div>
199
- <?php
200
- }
201
-
202
- function admin_enqueue_scripts() {
203
- wp_register_style( 'meowapps-core-css', $this->common_url( 'admin.css' ) );
204
- wp_enqueue_style( 'meowapps-core-css' );
205
- }
206
-
207
  function admin_menu_start() {
 
208
  if ( get_option( 'meowapps_hide_meowapps', false ) ) {
209
  register_setting( 'general', 'meowapps_hide_meowapps' );
210
  add_settings_field( 'meowapps_hide_ads', 'Meow Apps Menu', array( $this, 'meowapps_hide_dashboard_callback' ), 'general' );
211
  return;
212
  }
213
 
214
- // Creates standard menu if it does NOT exist
215
  global $submenu;
216
  if ( !isset( $submenu[ 'meowapps-main-menu' ] ) ) {
217
- add_menu_page( 'Meow Apps', '<img alt="Meow Apps" style="width: 24px; margin-left: -30px; position: absolute; margin-top: -3px;" src="' . MeowApps_Admin::$logo . '" />Meow Apps', 'manage_options', 'meowapps-main-menu',
218
  array( $this, 'admin_meow_apps' ), '', 82 );
219
  add_submenu_page( 'meowapps-main-menu', __( 'Dashboard', $this->domain ),
220
  __( 'Dashboard', $this->domain ), 'manage_options',
221
  'meowapps-main-menu', array( $this, 'admin_meow_apps' ) );
222
  }
223
-
224
- add_settings_section( 'meowapps_common_settings', null, null, 'meowapps_common_settings-menu' );
225
- add_settings_field( 'meowapps_hide_meowapps', __( 'Main Menu', $this->domain ),
226
- array( $this, 'meowapps_hide_dashboard_callback' ),
227
- 'meowapps_common_settings-menu', 'meowapps_common_settings' );
228
- add_settings_field( 'meowapps_force_sslverify', __( 'SSL Verify', $this->domain ),
229
- array( $this, 'meowapps_force_sslverify_callback' ),
230
- 'meowapps_common_settings-menu', 'meowapps_common_settings' );
231
- // add_settings_field( 'meowapps_hide_ads', __( 'Ads', $this->domain ),
232
- // array( $this, 'meowapps_hide_ads_callback' ),
233
- // 'meowapps_common_settings-menu', 'meowapps_common_settings' );
234
- register_setting( 'meowapps_common_settings', 'force_sslverify' );
235
- register_setting( 'meowapps_common_settings', 'meowapps_hide_meowapps' );
236
- register_setting( 'meowapps_common_settings', 'meowapps_hide_ads' );
237
- }
238
-
239
- function meowapps_hide_ads_callback() {
240
- $value = get_option( 'meowapps_hide_ads', null );
241
- $html = '<input type="checkbox" id="meowapps_hide_ads" name="meowapps_hide_ads" value="1" ' .
242
- checked( 1, get_option( 'meowapps_hide_ads' ), false ) . '/>';
243
- $html .= __( '<label>Hide</label><br /><small>Doesn\'t display the ads.</small>', $this->domain );
244
- echo $html;
245
  }
246
 
247
  function meowapps_hide_dashboard_callback() {
248
- $value = get_option( 'meowapps_hide_meowapps', null );
249
  $html = '<input type="checkbox" id="meowapps_hide_meowapps" name="meowapps_hide_meowapps" value="1" ' .
250
  checked( 1, get_option( 'meowapps_hide_meowapps' ), false ) . '/>';
251
  $html .= __( '<label>Hide <b>Meow Apps</b> Menu</label><br /><small>Hide Meow Apps menu and all its components, for a cleaner admin. This option will be reset if a new Meow Apps plugin is installed. <b>Once activated, an option will be added in your General settings to display it again.</b></small>', $this->domain );
252
- echo $html;
253
- }
254
-
255
- function meowapps_force_sslverify_callback() {
256
- $value = get_option( 'force_sslverify', null );
257
- $html = '<input type="checkbox" id="force_sslverify" name="force_sslverify" value="1" ' .
258
- checked( 1, get_option( 'force_sslverify' ), false ) . '/>';
259
- $html .= __( '<label>Force</label><br /><small>Updates and licenses checks are usually made without checking SSL certificates and it is actually fine this way. But if you are intransigent when it comes to SSL matters, this option will force it.</small>', $this->domain );
260
- echo $html;
261
- }
262
-
263
- function display_serialkey_box( $url = "https://meowapps.com/" ) {
264
- $html = '<div class="meow-box">';
265
- $html .= '<h3 class="' . ( $this->is_registered( $this->prefix ) ? 'meow-bk-blue' : 'meow-bk-red' ) . '">'
266
- . __( 'Pro Version', $this->domain ) . ' '
267
- . ( $this->is_registered( $this->prefix ) ? __( '(enabled)', $this->domain ) : __( '(disabled)', $this->domain ) )
268
- . '</h3>';
269
- $html .= '<div class="inside">';
270
- echo $html;
271
- $html = apply_filters(
272
- $this->prefix . '_meowapps_license_input',
273
- sprintf(
274
- // translators: %1$s is a url attribute, %2$s is a url visible for user
275
- __( 'More information about the Pro version here: <a target="_blank" href="%1$s">%2$s</a>. If you actually bought the Pro version already, please remove the current plugin and download the Pro version from your account at the <a target="_blank" href="https://store.meowapps.com/account/downloads/">Meow Apps Store</a>.', $this->domain ), $url, $url ),
276
- $url );
277
- $html .= '</div>';
278
- $html .= '</div>';
279
  echo $html;
280
  }
281
 
@@ -283,342 +136,81 @@ if ( !class_exists( 'MeowApps_Admin' ) ) {
283
  return apply_filters( $this->prefix . '_meowapps_is_registered', false, $this->prefix );
284
  }
285
 
286
- function check_install( $plugin ) {
287
- $pro = false;
 
 
 
 
 
 
288
 
289
- $pluginpath = trailingslashit( plugin_dir_path( __FILE__ ) ) . '../../' . $plugin . '-pro';
290
- if ( !file_exists( $pluginpath ) ) {
291
- $pluginpath = trailingslashit( plugin_dir_path( __FILE__ ) ) . '../../' . $plugin;
292
- if ( !file_exists( $pluginpath ) ) {
293
- $url = wp_nonce_url( "update.php?action=install-plugin&plugin=$plugin", "install-plugin_$plugin" );
294
- return "<a href='$url'><small><span class='' style='float: right;'>" . __( 'install', $this->domain ) . "</span></small></a>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
  }
296
  }
297
- else {
298
- $pro = true;
299
- $plugin = $plugin . "-pro";
300
- }
301
-
302
- $plugin_file = $plugin . '/' . $plugin . '.php';
303
- if ( is_plugin_active( $plugin_file ) ) {
304
- if ( $plugin == 'wplr-sync' )
305
- $pro = true;
306
- if ( $pro )
307
- return "<small><span style='float: right;'><span class='dashicons dashicons-heart' style='color: rgba(255, 63, 0, 1); font-size: 30px !important; margin-right: 10px;'></span></span></small>";
308
- else
309
- return "<small><span style='float: right;'><span class='dashicons dashicons-yes' style='color: #00b4ff; font-size: 30px !important; margin-right: 10px;'></span></span></small>";
310
  }
311
  else {
312
- $url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=' . $plugin_file ),
313
- 'activate-plugin_' . $plugin_file );
314
- return '<small><span style="color: black; float: right;">off
315
- (<a style="color: rgba(30,140,190,1); text-decoration: none;" href="' .
316
- $url . '">' . __( 'enable', $this->domain ) . '</a>)</span></small>';
317
- }
318
- }
319
-
320
- function common_url( $file ) {
321
- die( __( "Meow Apps: The function common_url( \$file ) needs to be overriden.", $this->domain ) );
322
- // Normally, this should be used:
323
- // return plugin_dir_url( __FILE__ ) . ( '\/common\/' . $file );
324
- }
325
-
326
- function meowapps_logo_url() {
327
- return $this->common_url( 'img/meowapps.png' );
328
- }
329
-
330
- function plugins_loaded() {
331
- if ( isset( $_GET[ 'tool' ] ) && $_GET[ 'tool' ] == 'error_log' ) {
332
- $sec = "5";
333
- header( "Refresh: $sec;" );
334
  }
335
  }
336
 
337
  function admin_meow_apps() {
 
 
 
 
 
338
 
339
- echo '<div class="wrap meow-dashboard">';
340
- if ( isset( $_GET['tool'] ) && $_GET['tool'] == 'phpinfo' ) {
341
- echo "<a href=\"javascript:history.go(-1)\">< ". __( 'Go back', $this->domain ) . "</a><br /><br />";
342
- echo '<div id="phpinfo">';
343
- ob_start();
344
- phpinfo();
345
- $pinfo = ob_get_contents();
346
- ob_end_clean();
347
- $pinfo = preg_replace( '%^.*<body>(.*)</body>.*$%ms','$1', $pinfo );
348
- echo $pinfo;
349
- echo "</div>";
350
- }
351
- else if ( isset( $_GET['tool'] ) && $_GET['tool'] == 'error_log' ) {
352
- $log_msg = __( '=== MEOW APPS DEBUG (This is not an error) ===', $this->domain );
353
- if ( isset( $_POST['write_logs'] ) ) {
354
- error_log( $log_msg );
355
- }
356
- $errorpath = ini_get( 'error_log' );
357
- echo "<a href=\"javascript:history.go(-1)\">< ". __( 'Go back', $this->domain ) . "</a><br /><br />";
358
- echo '
359
- <form method="post">
360
- <input type="hidden" name="write_logs" value="true">
361
- <input class="button button-primary" type="submit" value=" ' . __( 'Write in the Error Logs', $this->domain ) . '">
362
- </form><br />';
363
- echo '<div id="error_log">';
364
- if ( file_exists( $errorpath ) ) {
365
- printf(
366
- // translators: %s is a preformatted timestamp
367
- __( "Now (auto-reload every 5 seconds): [%s UTC]", $this->domain ),
368
- date( "d-M-Y H:i:s", time() )
369
- );
370
- echo "<br /><br /><h2 style='margin: 0px;'>" . __( 'Errors (order by latest)', $this->domain ) . "</h2>";
371
- $errors = file_get_contents( $errorpath );
372
- $errors = explode( "\n", $errors );
373
- $errors = array_reverse( $errors );
374
- $errors = implode( "<br />", $errors );
375
- echo $errors;
376
- }
377
- else {
378
- _e( "The PHP Error Logs cannot be found. Please ask your hosting service for it.", $this->domain );
379
- }
380
- echo "</div>";
381
-
382
- }
383
- else {
384
-
385
- ?>
386
- <?php $this->display_title( 'Meow Apps' ); ?>
387
- <p>
388
- <?php _e( 'Meow Apps is run by Jordy Meow, a photographer and software developer living in Japan (and taking <a target="_blank" href="http://offbeatjapan.org">a lot of photos</a>). Meow Apps is a suite of plugins focusing on photography, imaging, optimization and it teams up with the best players in the community (other themes and plugins developers). For more information, please check <a href="http://meowapps.com" target="_blank">Meow Apps</a>.', $this->domain )
389
- ?>
390
- </p>
391
-
392
- <h2 style="margin-bottom: 0px; margin-top: 25px;"><?php _e( 'Recommended Meow Apps Plugins', $this->domain ); ?></h2>
393
- <div class="meow-row meow-featured-plugins">
394
- <div class="meow-box meow-col meow-span_1_of_2">
395
- <ul class="">
396
- <li><img src='<?= $this->common_url( 'img/media-cleaner.jpg' ) ?>' />
397
- <a href='https://meowapps.com/plugin/media-cleaner/'><b>Media Cleaner</b></a>
398
- <?php echo $this->check_install( 'media-cleaner' ) ?><br />
399
- <?php _e( 'Very complex plugin which analyzes your WordPress deeply to find out which files are in use, or not. Then you can trash them, before deleting them permanently.', $this->domain ); ?></li>
400
- <li><img src='<?= $this->common_url( 'img/media-file-renamer.jpg' ) ?>' />
401
- <a href='https://meowapps.com/plugin/media-file-renamer/'><b>Media File Renamer</b></a>
402
- <?php echo $this->check_install( 'media-file-renamer' ) ?><br />
403
- <?php _e( 'The Renamer will help you in getting nicer filenames, a better SEO and well-organized files. Extremely popular.', $this->domain ); ?></li>
404
- <li><img src='<?= $this->common_url( 'img/default.png' ) ?>' />
405
- <a href='https://meowapps.com/plugin/contact-form-block/'><b>Contact Form Block</b></a>
406
- <?php echo $this->check_install( 'contact-form-block' ) ?><br />
407
- <?php _e( 'A simpler, nicer, prettier contact form. If you simply want your visitors to get in touch with you, this very light plugin will make your life easier.', $this->domain ); ?></li>
408
- <li><img src='<?= $this->common_url( 'img/default.png' ) ?>' />
409
- <a href='https://meowapps.com/plugin/meow-analytics/'><b>Meow Analytics</b></a>
410
- <?php echo $this->check_install( 'meow-analytics' ) ?><br />
411
- <?php _e( 'Tired of those fat plugins which are messing-up with your install? Switch to Meow Analytics, it\'s extremely light and features a cute dashboard.', $this->domain ); ?></li>
412
- </ul>
413
- </div>
414
- <div class="meow-box meow-col meow-span_1_of_2 ">
415
- <ul class="">
416
- <li><img src='<?= $this->common_url( 'img/meow-gallery.jpg' ) ?>' />
417
- <a href='https://meowapps.com/plugin/meow-gallery/'><b>Meow Gallery</b></a>
418
- <?php echo $this->check_install( 'meow-gallery' ) ?><br />
419
- <?php _e( 'Beautiful but lightweight gallery with many layouts. The only one that allows you to uninstall it without losing anything.', $this->domain ); ?></li>
420
- <li><img src='<?= $this->common_url( 'img/meow-lightbox.jpg' ) ?>' />
421
- <a href='https://meowapps.com/plugin/meow-lightbox/'><b>Meow Lightbox</b></a>
422
- <?php echo $this->check_install( 'meow-lightbox' ) ?><br />
423
- <?php _e( 'A very smooth and fast Lightbox which will also display your EXIF data (camera, lens, etc). Try it, you will love it.', $this->domain ); ?></li>
424
- <li><img src='<?= $this->common_url( 'img/wplr-sync.jpg' ) ?>' />
425
- <a href='https://meowapps.com/plugin/wplr-sync/'><b>WP/LR Sync</b></a>
426
- <?php echo $this->check_install( 'wplr-sync' ) ?><br />
427
- <?php _e( 'Synchronize your Lightroom to your WordPress. This plugin is loved by a huge community of photographers.', $this->domain ); ?></li>
428
- <li><img src='<?= $this->common_url( 'img/wp-retina-2x.jpg' ) ?>' />
429
- <a href='https://meowapps.com/plugin/wp-retina-2x/'><b>WP Retina 2x</b></a>
430
- <?php echo $this->check_install( 'wp-retina-2x' ) ?><br />
431
- <?php _e( 'Here is the very famous plugin that adds Retina support to any website.', $this->domain ); ?></li>
432
- </ul>
433
- </div>
434
- </div>
435
-
436
- <h2><?php _e( 'WordPress Performance', $this->domain ); ?></h2>
437
- <div style="background: white; padding: 5px 15px 5px 15px; box-shadow: 2px 2px 1px rgba(0,0,0,.02); margin-bottom: 15px;">
438
- <p><?php _e( 'The <b>Empty Request Time</b> helps you analyzing the raw performance of your install by giving you the average time it takes to run an empty request to your server. You can try to disable some plugins (or change their options) then and click on Reset to see how it influences the results. With <b>File Operation Time</b>, you will find out if your server is slow with files. An excellent install would have an Empty Request Time of less than 500 ms. Keep it absolutely under 2,000 ms. File Operation Time should take only a few milliseconds more than the Empty Request Time. For more information about this, <a href="https://meowapps.com/clean-optimize-wordpress/#Optimize_your_Empty_Request_Time" target="_blank">click here</a>.', $this->domain ); ?></p>
439
- </div>
440
-
441
- <div>
442
-
443
- <div style="float: left; margin-right: 10px; text-align: center; padding: 10px; background: white; width: 200px; border: 1px solid #e2e2e2;">
444
- <div style='font-size: 14px; line-height: 14px; margin-bottom: 20px;'><?php _e( 'Empty Request Time', $this->domain ); ?></div>
445
- <div style='font-size: 32px; line-height: 32px; margin-bottom: 10px;' id='meow-perf-load-average'><?php _e( 'N/A', $this->domain ); ?></div>
446
- <div style='font-size: 12px; line-height: 12px; margin-bottom: 20px;'><?php _e( 'Based on', $this->domain ); ?>
447
- <span id='meow-perf-load-count'>0</span> <?php _e( 'request(s)', $this->domain ); ?>
448
- </div>
449
- <input type='submit' style='text-align: center; width: 100%;' id="meow-perf-reset" value="Reset" class="button button-primary">
450
- </div>
451
-
452
- <div style="float: left; margin-right: 10px; text-align: center; padding: 10px; background: white; width: 200px; border: 1px solid #e2e2e2;">
453
- <div style='font-size: 14px; line-height: 14px; margin-bottom: 20px;'><?php _e( 'File Operation Time', $this->domain ); ?></div>
454
- <div style='font-size: 32px; line-height: 32px; margin-bottom: 10px;' id='meow-file-check-time'><?php _e( 'N/A', $this->domain ); ?></div>
455
- <div style='font-size: 12px; line-height: 12px; margin-bottom: 20px;'><?php _e( 'Create temporary file and delete it.', $this->domain ); ?></div>
456
- <input type='submit' style='text-align: center; width: 100%;' id="meow-file-check-start" value="<?php _e( 'Check', $this->domain ); ?>" class="button button-primary">
457
- </div>
458
-
459
- <div style="float: left; margin-right: 10px; text-align: center; padding: 10px; background: white; width: 200px; border: 1px solid #e2e2e2;">
460
- <a target='_blank' href='https://kinsta.com/?kaid=MFROFDOOINML'>
461
- <img style='height: 116px;' src='<?= $this->common_url( 'img/kinsta.png' ) ?>'>
462
- <div>Meow's 2020 Favorite Hosting</div>
463
- </a>
464
- </div>
465
-
466
- <div style="float: left; margin-right: 10px; text-align: center; padding: 10px; background: white; width: 200px; border: 1px solid #e2e2e2;">
467
- <a target='_blank' href='https://tracking.maxcdn.com/rPK13'>
468
- <img style='height: 116px;' src='<?= $this->common_url( 'img/stackpath.png' ) ?>'>
469
- <div>Meow's 2020 Favorite CDN</div>
470
- </a>
471
- </div>
472
-
473
- <div style="clear: both;"></div>
474
-
475
- </div>
476
-
477
- <script>
478
- (function ($) {
479
- var calls = 0;
480
- var times = [];
481
-
482
- $('#meow-perf-reset').on('click', function () {
483
- calls = 0;
484
- times = [];
485
- $('#meow-perf-load-average').text('<?php _e( "N/A", $this->domain ); ?>');
486
- $('#meow-perf-load-count').text('0');
487
- });
488
-
489
- function perfLoad() {
490
- var start = new Date().getTime();
491
- $.ajax(ajaxurl, {
492
- method: 'post',
493
- dataType: 'json',
494
- data: {
495
- action: 'meow_perf_load',
496
- }
497
- }).done(function (response) {
498
- var end = new Date().getTime();
499
- var time = end - start;
500
- calls++;
501
- times.push(time);
502
- var sum = times.reduce(function(a, b) { return a + b; });
503
- var avg = Math.ceil(sum / times.length);
504
- $('#meow-perf-load-average').text(avg + ' <?php _e( "ms", $this->domain ); ?>');
505
- $('#meow-perf-load-count').text(calls);
506
- setTimeout(perfLoad, 5000);
507
- });
508
- };
509
-
510
- function perfFile() {
511
- var start = new Date().getTime();
512
- $.ajax(ajaxurl, {
513
- method: 'post',
514
- dataType: 'json',
515
- data: {
516
- action: 'meow_file_check',
517
- }
518
- }).done(function (response) {
519
- var end = new Date().getTime();
520
- var time = end - start;
521
- $('#meow-file-check-time').text(time + ' <?php _e( "ms", $this->domain ); ?>');
522
- $('#meow-file-check-start').text('<?php _e( "Check", $this->domain ); ?>');
523
- });
524
- };
525
-
526
- $('#meow-file-check-start').on('click', function () {
527
- $('#meow-file-check-start').text('...');
528
- perfFile();
529
- });
530
-
531
- setTimeout(perfLoad, 1500);
532
-
533
- })(jQuery);
534
- </script>
535
-
536
- <h2><?php _e( 'WordPress Recommendations', $this->domain ); ?></h2>
537
- <div style="background: white; padding: 5px 15px 5px 15px; box-shadow: 2px 2px 1px rgba(0,0,0,.02); margin-top: 15px;">
538
- <p>
539
- <?php _e( 'Too many WordPress installs are blown-up with useless and/or huge plugins, and bad practices. But that is because most users are overwhelmed by the diversity and immensity of the WordPress jungle. One rule of thumb is to keep your install the simplest as possible, with the least number of plugins (avoiding heavy ones too) and a good hosting service (avoid VPS except if you know exactly what you are doing). Articles are kept being updated on the Meow Apps website, with all the latest recommendations: ', $this->domain )?>
540
- <a href='https://meowapps.com/debugging-wordpress/' target='_blank'>
541
- How To Debug</a>,
542
- <a href='https://meowapps.com/seo-optimization/' target='_blank'>
543
- SEO Checklist & Optimization</a>,
544
- <a href='https://meowapps.com/clean-optimize-wordpress/' target='_blank'>
545
- Clean Up and Optimize</a>,
546
- <a href='https://meowapps.com/optimize-images-cdn/' target='_blank'>
547
- Optimize Images</a>,
548
- <a href='https://meowapps.com/best-hosting-services-wordpress/' target='_blank'>
549
- Best Hosting Services</a>.
550
- </p>
551
- </div>
552
-
553
- <h2 style="margin-bottom: 0px; margin-top: 25px;"><?php _e( 'Common Options & Tools', $this->domain ); ?></h2>
554
- <div class="meow-row">
555
- <div class="meow-box meow-col meow-span_2_of_3">
556
- <h3><span class="dashicons dashicons-admin-tools"></span> <?php _e( 'Common', $this->domain ); ?></h3>
557
- <div class="inside">
558
- <form method="post" action="options.php">
559
- <?php settings_fields( 'meowapps_common_settings' ); ?>
560
- <?php do_settings_sections( 'meowapps_common_settings-menu' ); ?>
561
- <?php submit_button(); ?>
562
- </form>
563
- </div>
564
- </div>
565
-
566
- <div class="meow-box meow-col meow-span_1_of_3">
567
- <h3><span class="dashicons dashicons-admin-tools"></span> <?php _e( 'Debug', $this->domain ); ?></h3>
568
- <div class="inside">
569
- <ul>
570
- <li><a href="?page=meowapps-main-menu&amp;tool=error_log"><?php _e( 'Display Error Log', $this->domain ); ?></a></li>
571
- <li><a href="?page=meowapps-main-menu&amp;tool=phpinfo"><?php _e( 'Display PHP Info', $this->domain ); ?></a></li>
572
- </ul>
573
- </div>
574
- </div>
575
-
576
- <div class="meow-box meow-col meow-span_1_of_3">
577
- <h3><span class="dashicons dashicons-admin-tools"></span> <?php _e( 'Post Types (used by this install)', $this->domain ); ?></h3>
578
- <div class="inside">
579
- <?php
580
- global $wpdb;
581
- // Maybe we could avoid to check more post_types.
582
- // SELECT post_type, COUNT(*) FROM `wp_posts` GROUP BY post_type
583
- $types = $wpdb->get_results( "SELECT post_type as 'type', COUNT(*) as 'count' FROM $wpdb->posts GROUP BY post_type" );
584
- $result = array();
585
- foreach( $types as $type )
586
- array_push( $result, "{$type->type} ({$type->count})" );
587
- echo implode( ', ', $result );
588
- ?>
589
- </div>
590
- </div>
591
- </div>
592
-
593
- <?php
594
- }
595
  }
596
 
597
  function admin_footer_text( $current ) {
598
  return sprintf(
599
  // translators: %1$s is the version of the interface; %2$s is a file path.
600
  __( 'Thanks for using <a href="https://meowapps.com">Meow Apps</a>! This is the Meow Admin %1$s <br /><i>Loaded from %2$s </i>', $this->domain ),
601
- MeowApps_Admin::$admin_version,
602
  __FILE__
603
  );
604
  }
605
-
606
- // HELPERS
607
-
608
- static function size_shortname( $name ) {
609
- $name = preg_split( '[_-]', $name );
610
- $short = strtoupper( substr( $name[0], 0, 1 ) );
611
- if ( count( $name ) > 1 )
612
- $short .= strtoupper( substr( $name[1], 0, 1 ) );
613
- return $short;
614
- }
615
-
616
  }
617
-
618
- }
619
-
620
- if ( file_exists( plugin_dir_path( __FILE__ ) . '/meowapps/admin.php' ) ) {
621
- require( 'meowapps/admin.php' );
622
  }
623
 
624
  ?>
1
  <?php
2
 
3
+ if ( !class_exists( 'MeowCommon_Admin' ) ) {
4
 
5
+ class MeowCommon_Admin {
 
 
6
 
7
  public static $loaded = false;
8
+ public static $admin_version = "3.0";
9
 
10
  public $prefix; // prefix used for actions, filters (mfrh)
11
  public $mainfile; // plugin main file (media-file-renamer.php)
12
  public $domain; // domain used for translation (media-file-renamer)
13
+ public $isPro = false;
14
+
15
+ public static $logo = 'data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxIiB2aWV3Qm94PSIwIDAgMTY1IDE2NSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8c3R5bGU+CiAgICAuc3Qye2ZpbGw6IzgwNDYyNX0uc3Qze2ZpbGw6I2ZkYTk2MH0KICA8L3N0eWxlPgogIDxwYXRoIGQ9Ik03MiA3YTc2IDc2IDAgMCAxIDg0IDkxQTc1IDc1IDAgMSAxIDcyIDd6IiBmaWxsPSIjNGE2YjhjIi8+CiAgPHBhdGggZD0iTTQ4IDQ4YzIgNSAyIDEwIDUgMTQgNSA4IDEzIDE3IDIyIDIwbDEtMTBjMS0yIDMtMyA1LTNoMTNjMiAwIDQgMSA1IDNsMyA5IDQtMTBjMi0zIDYtMiA5LTJoMTFjMyAyIDMgNSAzIDhsMiAzN2MwIDMtMSA3LTQgOGgtMTJjLTIgMC0zLTItNS00LTEgMS0yIDMtNCAzLTUgMS05IDEtMTMtMS0zIDItNSAyLTkgMnMtOSAxLTEwLTNjLTItNC0xLTggMC0xMi04LTMtMTUtNy0yMi0xMi03LTctMTUtMTQtMjAtMjMtMy00LTUtOC01LTEzIDEtNCAzLTEwIDYtMTMgNC0zIDEyLTIgMTUgMnoiIGZpbGw9IiMxMDEwMTAiLz4KICA8cGF0aCBjbGFzcz0ic3QyIiBkPSJNNDMgNTFsNCAxMS02IDVoLTZjLTMtNS0zLTExIDAtMTYgMi0yIDYtMyA4IDB6Ii8+CiAgPHBhdGggY2xhc3M9InN0MyIgZD0iTTQ3IDYybDMgNmMwIDMgMCA0LTIgNnMtNCAyLTcgMmwtNi05aDZsNi01eiIvPgogIDxwYXRoIGNsYXNzPSJzdDIiIGQ9Ik01MCA2OGw4IDljLTMgMy01IDYtOSA4bC04LTljMyAwIDUgMCA3LTJzMy0zIDItNnoiLz4KICA8cGF0aCBkPSJNODIgNzRoMTJsNSAxOCAzIDExIDgtMjloMTNsMiA0MmgtOGwtMS0yLTEtMzEtMTAgMzItNyAxLTktMzMtMSAyOS0xIDRoLThsMy00MnoiIGZpbGw9IiNmZmYiLz4KICA8cGF0aCBjbGFzcz0ic3QzIiBkPSJNNTggNzdsNSA1Yy0xIDQtMiA4LTcgOGwtNy01YzQtMiA2LTUgOS04eiIvPgogIDxwYXRoIGNsYXNzPSJzdDIiIGQ9Ik02MyA4Mmw5IDUtNiA5LTEwLTZjNSAwIDYtNCA3LTh6Ii8+CiAgPHBhdGggY2xhc3M9InN0MyIgZD0iTTcyIDg3bDMgMS0xIDExLTgtMyA2LTEweiIvPgo8L3N2Zz4K';
16
 
17
+ public function __construct( $prefix, $mainfile, $domain, $isPro = false, $disableReview = false ) {
18
 
19
  // Core Admin (used by all Meow Apps plugins)
20
+ if ( !MeowCommon_Admin::$loaded ) {
21
  if ( is_admin() ) {
22
  add_action( 'admin_menu', array( $this, 'admin_menu_start' ) );
 
 
 
 
23
  if ( isset( $_GET['page'] ) && $_GET['page'] === 'meowapps-main-menu' ) {
24
  add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 100000, 1 );
25
  }
26
  }
27
+ if ( MeowCommon_Helpers::is_rest() ) {
28
+ new MeowCommon_Classes_Rest( $this );
29
+ }
30
+ MeowCommon_Admin::$loaded = true;
31
  }
32
 
33
  // Variables for this plugin
34
  $this->prefix = $prefix;
35
  $this->mainfile = $mainfile;
36
  $this->domain = $domain;
37
+ $this->isPro = $isPro;
38
 
39
  // If there is no mainfile, it's either a Pro only Plugin (with no Free version available) or a Theme.
40
+ register_activation_hook( $mainfile, array( $this, 'show_meowapps_create_rating_date' ) );
41
+ if ( is_admin() ) {
42
+ $license = get_option( $this->prefix . '_license', "" );
43
+ if ( !empty( $license ) && !$this->isPro ) {
44
+ add_action( 'admin_notices', array( $this, 'admin_notices_licensed_free' ) );
45
+ }
46
+ if ( !$disableReview ) {
47
+ new MeowCommon_Classes_Ratings( $prefix, $mainfile, $domain );
48
+ }
49
+ }
50
+ add_filter( 'plugin_row_meta', array( $this, 'custom_plugin_row_meta' ), 10, 2 );
 
 
 
 
 
51
  add_filter( 'edd_sl_api_request_verify_ssl', array( $this, 'request_verify_ssl' ), 10, 0 );
52
  }
53
 
54
+ function custom_plugin_row_meta( $links, $file ) {
55
+ $path = pathinfo( $file );
56
+ $pathName = basename( $path['dirname'] );
57
+ $thisPath = pathinfo( $this->mainfile );
58
+ $thisPathName = basename( $thisPath['dirname'] );
59
+ if ( strpos( $pathName, $thisPathName ) !== false ) {
60
+ $new_links = array(
61
+ 'settings' =>
62
+ sprintf( __( '<a href="admin.php?page=%s_settings">Settings</a>', $this->domain ), $this->prefix ),
63
+ 'license' =>
64
+ $this->is_registered() ? '<span style="color: #a75bd6;">' . __( 'Pro Version', $this->domain ) . '</span>' :
65
+ sprintf( '<span style="color: #ff3434;">' . __( 'License Issue', $this->domain ), $this->prefix ) . '</span>',
66
+ );
67
+ $links = array_merge( $new_links, $links );
68
+ }
69
+ return $links;
70
  }
71
 
72
  function request_verify_ssl() {
73
  return get_option( 'force_sslverify', false );
74
  }
75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  function nice_name_from_file( $file ) {
77
  $info = pathinfo( $file );
78
  if ( !empty( $info ) ) {
91
  delete_option( $this->prefix . '_license' );
92
  return;
93
  }
94
+ echo '<div class="notice notice-error">';
95
  printf(
 
96
  __( '<p>It looks like you are using the free version of the plugin (<b>%s</b>) but a license for the Pro version was also found. The Pro version might have been replaced by the Free version during an update (might be caused by a temporarily issue). If it is the case, <b>please download it again</b> from the <a target="_blank" href="https://store.meowapps.com">Meow Store</a>. If you wish to continue using the free version and clear this message, click on this button.', $this->domain ),
97
  $this->nice_name_from_file( $this->mainfile ) );
98
  echo '<p>
106
  echo '</div>';
107
  }
108
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  function admin_menu_start() {
110
+ // Hide the admin if user doesn't like Meow much
111
  if ( get_option( 'meowapps_hide_meowapps', false ) ) {
112
  register_setting( 'general', 'meowapps_hide_meowapps' );
113
  add_settings_field( 'meowapps_hide_ads', 'Meow Apps Menu', array( $this, 'meowapps_hide_dashboard_callback' ), 'general' );
114
  return;
115
  }
116
 
117
+ // Create standard menu if it does not already exist
118
  global $submenu;
119
  if ( !isset( $submenu[ 'meowapps-main-menu' ] ) ) {
120
+ add_menu_page( 'Meow Apps', '<img alt="Meow Apps" style="width: 24px; margin-left: -30px; position: absolute; margin-top: -3px;" src="' . MeowCommon_Admin::$logo . '" />Meow Apps', 'manage_options', 'meowapps-main-menu',
121
  array( $this, 'admin_meow_apps' ), '', 82 );
122
  add_submenu_page( 'meowapps-main-menu', __( 'Dashboard', $this->domain ),
123
  __( 'Dashboard', $this->domain ), 'manage_options',
124
  'meowapps-main-menu', array( $this, 'admin_meow_apps' ) );
125
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  }
127
 
128
  function meowapps_hide_dashboard_callback() {
 
129
  $html = '<input type="checkbox" id="meowapps_hide_meowapps" name="meowapps_hide_meowapps" value="1" ' .
130
  checked( 1, get_option( 'meowapps_hide_meowapps' ), false ) . '/>';
131
  $html .= __( '<label>Hide <b>Meow Apps</b> Menu</label><br /><small>Hide Meow Apps menu and all its components, for a cleaner admin. This option will be reset if a new Meow Apps plugin is installed. <b>Once activated, an option will be added in your General settings to display it again.</b></small>', $this->domain );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  echo $html;
133
  }
134
 
136
  return apply_filters( $this->prefix . '_meowapps_is_registered', false, $this->prefix );
137
  }
138
 
139
+ function get_phpinfo() {
140
+ ob_start();
141
+ phpinfo( INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES );
142
+ $html = ob_get_contents();
143
+ ob_end_clean();
144
+ $html = preg_replace( '%^.*<body>(.*)</body>.*$%ms','$1', $html );
145
+ echo $html;
146
+ }
147
 
148
+ function get_phperrorlogs() {
149
+ $errorpath = ini_get( 'error_log' );
150
+ $output_lines = array();
151
+ if ( !empty( $errorpath ) ) {
152
+ $file = new SplFileObject( $errorpath, 'r' );
153
+ $file->seek( PHP_INT_MAX );
154
+ $last_line = $file->key();
155
+ $iterator = new LimitIterator( $file, $last_line - 500, $last_line );
156
+ $lines = iterator_to_array( $iterator );
157
+ foreach ( $lines as $line ) {
158
+ $newline = '';
159
+ if ( preg_match( '/PHP Fatal/', $line ) ) {
160
+ $newline = '<div class="fatal">' . $line . '</div>';
161
+ }
162
+ else if ( preg_match( '/PHP Warning/', $line ) ) {
163
+ $newline = '<div class="warning">' . $line . '</div>';
164
+ }
165
+ else if ( preg_match( '/PHP Notice/', $line ) ) {
166
+ $newline = '<div class="notice">' . $line . '</div>';
167
+ }
168
+ else {
169
+ continue;
170
+ }
171
+ array_push( $output_lines, $newline );
172
  }
173
  }
174
+ if ( empty( $output_lines ) ) {
175
+ return '<div class="fatal">Your PHP Error Logs is either empty, or (more likely is not accessible through PHP. You should contact your hosting service and ask them how to get it.</div>';
 
 
 
 
 
 
 
 
 
 
 
176
  }
177
  else {
178
+ $output_lines = array_reverse( $output_lines );
179
+ $html = '';
180
+ $previous = '';
181
+ foreach ( $output_lines as $line ) {
182
+ // Let's avoid similar errors, since it's not useful. We should also make this better
183
+ // and not only theck this depending on tie.
184
+ if ( preg_replace( '/\[.*\] PHP/', '', $previous ) !== preg_replace( '/\[.*\] PHP/', '', $line ) ) {
185
+ $html .= $line;
186
+ $previous = $line;
187
+ }
188
+ }
189
+ return $html;
 
 
 
 
 
 
 
 
 
 
190
  }
191
  }
192
 
193
  function admin_meow_apps() {
194
+ echo "<div id='meow-common-dashboard'></div>";
195
+
196
+ echo "<div style='display: none;' id='meow-common-phperrorlogs'>";
197
+ echo $this->get_phperrorlogs();
198
+ echo "</div>";
199
 
200
+ echo "<div style='display: none;' id='meow-common-phpinfo'>";
201
+ echo $this->get_phpinfo();
202
+ echo "</div>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
  }
204
 
205
  function admin_footer_text( $current ) {
206
  return sprintf(
207
  // translators: %1$s is the version of the interface; %2$s is a file path.
208
  __( 'Thanks for using <a href="https://meowapps.com">Meow Apps</a>! This is the Meow Admin %1$s <br /><i>Loaded from %2$s </i>', $this->domain ),
209
+ MeowCommon_Admin::$admin_version,
210
  __FILE__
211
  );
212
  }
 
 
 
 
 
 
 
 
 
 
 
213
  }
 
 
 
 
 
214
  }
215
 
216
  ?>
common/classes/ratings.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( !class_exists( 'MeowCommon_Classes_Ratings' ) ) {
4
+
5
+ class MeowCommon_Classes_Ratings {
6
+
7
+ public $mainfile; // plugin main file (media-file-renamer.php)
8
+ public $domain; // domain used for translation (media-file-renamer)
9
+ public $prefix; // used for many things (filters, options, etc)
10
+
11
+ public function __construct( $prefix, $mainfile, $domain ) {
12
+ $this->mainfile = $mainfile;
13
+ $this->domain = $domain;
14
+ $this->prefix = $prefix;
15
+
16
+ register_activation_hook( $mainfile, array( $this, 'show_meowapps_create_rating_date' ) );
17
+
18
+ if ( is_admin() ) {
19
+ $rating_date = $this->create_rating_date();
20
+ if ( time() > $rating_date ) {
21
+ add_action( 'admin_notices', array( $this, 'admin_notices_rating' ) );
22
+ }
23
+ }
24
+ }
25
+
26
+ function show_meowapps_create_rating_date() {
27
+ delete_option( 'meowapps_hide_meowapps' );
28
+ $this->create_rating_date();
29
+ }
30
+
31
+ function create_rating_date() {
32
+ $rating_date = get_option( $this->prefix . '_rating_date' );
33
+ if ( empty( $rating_date ) ) {
34
+ $two_months = strtotime( '+2 months' );
35
+ $six_months = strtotime( '+4 months' );
36
+ $rating_date = mt_rand( $two_months, $six_months );
37
+ update_option( $this->prefix . '_rating_date', $rating_date, false );
38
+ }
39
+ return $rating_date;
40
+ }
41
+
42
+ function admin_notices_rating() {
43
+ if ( isset( $_POST[$this->prefix . '_remind_me'] ) ) {
44
+ $two_weeks = strtotime( '+2 weeks' );
45
+ $six_weeks = strtotime( '+6 weeks' );
46
+ $future_date = mt_rand( $two_weeks, $six_weeks );
47
+ update_option( $this->prefix . '_rating_date', $future_date, false );
48
+ return;
49
+ }
50
+ else if ( isset( $_POST[$this->prefix . '_never_remind_me'] ) ) {
51
+ $twenty_years = strtotime( '+5 years' );
52
+ update_option( $this->prefix . '_rating_date', $twenty_years, false );
53
+ return;
54
+ }
55
+ else if ( isset( $_POST[$this->prefix . '_did_it'] ) ) {
56
+ $twenty_years = strtotime( '+10 years' );
57
+ update_option( $this->prefix . '_rating_date', $twenty_years, false );
58
+ return;
59
+ }
60
+ $rating_date = get_option( $this->prefix . '_rating_date' );
61
+ echo '<div class="notice notice-success" data-rating-date="' . date( 'Y-m-d', $rating_date ) . '">';
62
+ echo '<p style="font-size: 100%;">';
63
+ printf(
64
+ // translators: %1$s is a plugin nicename, %2$s is a short url (slug)
65
+ __( 'You have been using <b>%1$s</b> for some time now. Thank you! Could you kindly share your opinion with me, along with, maybe, features you would like to see implemented? Then, please <a style="font-weight: bold; color: #b926ff;" target="_blank" href="https://wordpress.org/support/plugin/%2$s/reviews/?rate=5#new-post">write a little review</a>. That will also bring me joy and motivation! I will get back to you :)', $this->domain ),
66
+ $this->nice_name_from_file( $this->mainfile ),
67
+ $this->nice_short_url_from_file( $this->mainfile )
68
+ );
69
+ echo '<p>
70
+ <form method="post" action="" style="float: right;">
71
+ <input type="hidden" name="' . $this->prefix . '_never_remind_me" value="true">
72
+ <input type="submit" name="submit" id="submit" class="button button-red" value="'
73
+ . __( 'Never remind me!', $this->domain ) . '">
74
+ </form>
75
+ <form method="post" action="" style="float: right; margin-right: 10px;">
76
+ <input type="hidden" name="' . $this->prefix . '_remind_me" value="true">
77
+ <input type="submit" name="submit" id="submit" class="button button-primary" value="'
78
+ . __( 'Remind me in a few weeks...', $this->domain ) . '">
79
+ </form>
80
+ <form method="post" action="" style="float: right; margin-right: 10px;">
81
+ <input type="hidden" name="' . $this->prefix . '_did_it" value="true">
82
+ <input type="submit" name="submit" id="submit" class="button button-primary" value="'
83
+ . __( 'Yes, I did it!', $this->domain ) . '">
84
+ </form>
85
+ <div style="clear: both;"></div>
86
+ </p>
87
+ ';
88
+ echo '</div>';
89
+ }
90
+
91
+ function nice_short_url_from_file( $file ) {
92
+ $info = pathinfo( $file );
93
+ if ( !empty( $info ) ) {
94
+ $info['filename'] = str_replace( '-pro', '', $info['filename'] );
95
+ return $info['filename'];
96
+ }
97
+ return "";
98
+ }
99
+
100
+ function nice_name_from_file( $file ) {
101
+ $info = pathinfo( $file );
102
+ if ( !empty( $info ) ) {
103
+ if ( $info['filename'] == 'wplr-sync' ) {
104
+ return "WP/LR Sync";
105
+ }
106
+ $info['filename'] = str_replace( '-', ' ', $info['filename'] );
107
+ $file = ucwords( $info['filename'] );
108
+ }
109
+ return $file;
110
+ }
111
+ }
112
+ }
113
+
114
+ ?>
common/classes/rest.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MeowCommon_Classes_Rest
4
+ {
5
+ private $namespace = null;
6
+
7
+ public function __construct( &$admin ) {
8
+ $this->admin = $admin;
9
+ $this->namespace = "meow-common/v1";
10
+ if ( !current_user_can( 'administrator' ) ) {
11
+ return;
12
+ }
13
+ add_action( 'rest_api_init', array( $this, 'rest_api_init' ) );
14
+ }
15
+
16
+ function rest_api_init() {
17
+ register_rest_route( $this->namespace, '/empty_request/', [
18
+ 'methods' => 'POST',
19
+ 'callback' => [ $this, 'empty_request' ]
20
+ ]);
21
+ register_rest_route( $this->namespace, '/file_operation/', [
22
+ 'methods' => 'POST',
23
+ 'callback' => [ $this, 'file_operation' ]
24
+ ]);
25
+ register_rest_route( $this->namespace, '/sql_request/', [
26
+ 'methods' => 'POST',
27
+ 'callback' => [ $this, 'sql_request' ]
28
+ ]);
29
+ register_rest_route( $this->namespace, '/all_settings/', [
30
+ 'methods' => 'GET',
31
+ 'callback' => [ $this, 'rest_all_settings' ]
32
+ ]);
33
+ register_rest_route( $this->namespace, '/update_option/', [
34
+ 'methods' => 'POST',
35
+ 'callback' => [ $this, 'rest_update_option' ]
36
+ ]);
37
+ }
38
+
39
+ function file_rand( $filesize ) {
40
+ $tmp_file = tmpfile();
41
+ fseek( $tmp_file, $filesize - 1, SEEK_CUR );
42
+ fwrite( $tmp_file, 'a');
43
+ fclose( $tmp_file );
44
+ }
45
+
46
+ function empty_request() {
47
+ return new WP_REST_Response( [ 'success' => true ], 200 );
48
+ }
49
+
50
+ function file_operation() {
51
+ $this->file_rand( 1024 * 10 );
52
+ return new WP_REST_Response( [ 'success' => true ], 200 );
53
+ }
54
+
55
+ function sql_request() {
56
+ global $wpdb;
57
+ $count = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->posts}" );
58
+ return new WP_REST_Response( [ 'success' => true, 'data' => $count ], 200 );
59
+ }
60
+
61
+ function rest_all_settings() {
62
+ $settings = array(
63
+ 'meowapps_hide_meowapps' => get_option( 'meowapps_hide_meowapps', false ),
64
+ 'force_sslverify' => get_option( 'force_sslverify', false )
65
+ );
66
+ return new WP_REST_Response([ 'success' => true, 'data' => $settings ], 200 );
67
+ }
68
+
69
+ function rest_update_option( $request ) {
70
+ $params = $request->get_json_params();
71
+ try {
72
+ $result = update_option( $params['name'], $params['value'] );
73
+ return new WP_REST_Response([ 'success' => $result ], 200 );
74
+ }
75
+ catch (Exception $e) {
76
+ return new WP_REST_Response([ 'success' => false, 'message' => $e->getMessage() ], 500 );
77
+ }
78
+ }
79
+
80
+ }
81
+
82
+ ?>
common/classes/rest_license.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MeowCommon_Classes_Rest_License
4
+ {
5
+ private $licenser = null;
6
+ private $namespace = null;
7
+
8
+ public function __construct( &$licenser ) {
9
+ $this->licenser = $licenser;
10
+ $this->namespace = "meow-licenser/{$licenser->prefix}/v1";
11
+ if ( !current_user_can( 'administrator' ) ) {
12
+ return;
13
+ }
14
+ add_action( 'rest_api_init', array( $this, 'rest_api_init' ) );
15
+ }
16
+
17
+ function rest_api_init() {
18
+ register_rest_route( $this->namespace, '/get_license/', [
19
+ 'methods' => 'POST',
20
+ 'callback' => [ $this, 'get_license' ]
21
+ ]);
22
+ register_rest_route( $this->namespace, '/set_license/', [
23
+ 'methods' => 'POST',
24
+ 'callback' => [ $this, 'set_license' ]
25
+ ]);
26
+ }
27
+
28
+ function get_license() {
29
+ return new WP_REST_Response( [ 'success' => true, 'data' => $this->licenser->license ], 200 );
30
+ }
31
+
32
+ function set_license( $request ) {
33
+ $params = $request->get_json_params();
34
+ $serialKey = $params['serialKey'];
35
+ $this->licenser->validate_pro( $serialKey );
36
+ return new WP_REST_Response( [ 'success' => true, 'data' => $this->licenser->license ], 200 );
37
+ }
38
+ }
39
+
40
+ ?>
common/classes/updater.php ADDED
@@ -0,0 +1,591 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Exit if accessed directly
4
+ if ( ! defined( 'ABSPATH' ) ) exit;
5
+
6
+ /**
7
+ * Allows plugins to use their own update API.
8
+ *
9
+ * @author Easy Digital Downloads
10
+ * @version 1.6.18
11
+ */
12
+ class MeowCommon_Classes_Updater {
13
+
14
+ private $api_url = '';
15
+ private $api_data = array();
16
+ private $name = '';
17
+ private $slug = '';
18
+ private $version = '';
19
+ private $wp_override = false;
20
+ private $cache_key = '';
21
+
22
+ private $health_check_timeout = 5;
23
+
24
+ /**
25
+ * Class constructor.
26
+ *
27
+ * @uses plugin_basename()
28
+ * @uses hook()
29
+ *
30
+ * @param string $_api_url The URL pointing to the custom API endpoint.
31
+ * @param string $_plugin_file Path to the plugin file.
32
+ * @param array $_api_data Optional data to send with API calls.
33
+ */
34
+ public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
35
+
36
+ global $edd_plugin_data;
37
+
38
+ $this->api_url = trailingslashit( $_api_url );
39
+ $this->api_data = $_api_data;
40
+ $this->name = plugin_basename( $_plugin_file );
41
+ $this->slug = basename( $_plugin_file, '.php' );
42
+ $this->version = $_api_data['version'];
43
+ $this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
44
+ $this->beta = ! empty( $this->api_data['beta'] ) ? true : false;
45
+ $this->cache_key = 'edd_sl_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
46
+
47
+ $edd_plugin_data[ $this->slug ] = $this->api_data;
48
+
49
+ /**
50
+ * Fires after the $edd_plugin_data is setup.
51
+ *
52
+ * @since x.x.x
53
+ *
54
+ * @param array $edd_plugin_data Array of EDD SL plugin data.
55
+ */
56
+ do_action( 'post_edd_sl_plugin_updater_setup', $edd_plugin_data );
57
+
58
+ // Set up hooks.
59
+ $this->init();
60
+
61
+ }
62
+
63
+ /**
64
+ * Set up WordPress filters to hook into WP's update process.
65
+ *
66
+ * @uses add_filter()
67
+ *
68
+ * @return void
69
+ */
70
+ public function init() {
71
+
72
+ add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
73
+ add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
74
+ remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10 );
75
+ add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
76
+ add_action( 'admin_init', array( $this, 'show_changelog' ) );
77
+
78
+ }
79
+
80
+ /**
81
+ * Check for Updates at the defined API endpoint and modify the update array.
82
+ *
83
+ * This function dives into the update API just when WordPress creates its update array,
84
+ * then adds a custom API call and injects the custom plugin data retrieved from the API.
85
+ * It is reassembled from parts of the native WordPress plugin update code.
86
+ * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
87
+ *
88
+ * @uses api_request()
89
+ *
90
+ * @param array $_transient_data Update array build by WordPress.
91
+ * @return array Modified update array with custom plugin data.
92
+ */
93
+ public function check_update( $_transient_data ) {
94
+
95
+ global $pagenow;
96
+
97
+ if ( ! is_object( $_transient_data ) ) {
98
+ $_transient_data = new stdClass;
99
+ }
100
+
101
+ if ( 'plugins.php' == $pagenow && is_multisite() ) {
102
+ return $_transient_data;
103
+ }
104
+
105
+ if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) {
106
+ return $_transient_data;
107
+ }
108
+
109
+ $version_info = $this->get_cached_version_info();
110
+
111
+ if ( false === $version_info ) {
112
+ $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
113
+
114
+ $this->set_version_info_cache( $version_info );
115
+
116
+ }
117
+
118
+ if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
119
+
120
+ if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
121
+
122
+ $_transient_data->response[ $this->name ] = $version_info;
123
+
124
+ // Make sure the plugin property is set to the plugin's name/location. See issue 1463 on Software Licensing's GitHub repo.
125
+ $_transient_data->response[ $this->name ]->plugin = $this->name;
126
+
127
+ }
128
+
129
+ $_transient_data->last_checked = time();
130
+ $_transient_data->checked[ $this->name ] = $this->version;
131
+
132
+ }
133
+
134
+ return $_transient_data;
135
+ }
136
+
137
+ /**
138
+ * show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
139
+ *
140
+ * @param string $file
141
+ * @param array $plugin
142
+ */
143
+ public function show_update_notification( $file, $plugin ) {
144
+
145
+ if ( is_network_admin() ) {
146
+ return;
147
+ }
148
+
149
+ if( ! current_user_can( 'update_plugins' ) ) {
150
+ return;
151
+ }
152
+
153
+ if( ! is_multisite() ) {
154
+ return;
155
+ }
156
+
157
+ if ( $this->name != $file ) {
158
+ return;
159
+ }
160
+
161
+ // Remove our filter on the site transient
162
+ remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
163
+
164
+ $update_cache = get_site_transient( 'update_plugins' );
165
+
166
+ $update_cache = is_object( $update_cache ) ? $update_cache : new stdClass();
167
+
168
+ if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
169
+
170
+ $version_info = $this->get_cached_version_info();
171
+
172
+ if ( false === $version_info ) {
173
+ $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
174
+
175
+ // Since we disabled our filter for the transient, we aren't running our object conversion on banners, sections, or icons. Do this now:
176
+ if ( isset( $version_info->banners ) && ! is_array( $version_info->banners ) ) {
177
+ $version_info->banners = $this->convert_object_to_array( $version_info->banners );
178
+ }
179
+
180
+ if ( isset( $version_info->sections ) && ! is_array( $version_info->sections ) ) {
181
+ $version_info->sections = $this->convert_object_to_array( $version_info->sections );
182
+ }
183
+
184
+ if ( isset( $version_info->icons ) && ! is_array( $version_info->icons ) ) {
185
+ $version_info->icons = $this->convert_object_to_array( $version_info->icons );
186
+ }
187
+
188
+ $this->set_version_info_cache( $version_info );
189
+ }
190
+
191
+ if ( ! is_object( $version_info ) ) {
192
+ return;
193
+ }
194
+
195
+ if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
196
+
197
+ $update_cache->response[ $this->name ] = $version_info;
198
+
199
+ }
200
+
201
+ $update_cache->last_checked = time();
202
+ $update_cache->checked[ $this->name ] = $this->version;
203
+
204
+ set_site_transient( 'update_plugins', $update_cache );
205
+
206
+ } else {
207
+
208
+ $version_info = $update_cache->response[ $this->name ];
209
+
210
+ }
211
+
212
+ // Restore our filter
213
+ add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
214
+
215
+ if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
216
+
217
+ // build a plugin list row, with update notification
218
+ $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
219
+ # <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">
220
+ echo '<tr class="plugin-update-tr" id="' . $this->slug . '-update" data-slug="' . $this->slug . '" data-plugin="' . $this->slug . '/' . $file . '">';
221
+ echo '<td colspan="3" class="plugin-update colspanchange">';
222
+ echo '<div class="update-message notice inline notice-warning notice-alt">';
223
+
224
+ $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
225
+
226
+ if ( empty( $version_info->download_link ) ) {
227
+ printf(
228
+ __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'easy-digital-downloads' ),
229
+ esc_html( $version_info->name ),
230
+ '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
231
+ esc_html( $version_info->new_version ),
232
+ '</a>'
233
+ );
234
+ } else {
235
+ printf(
236
+ __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'easy-digital-downloads' ),
237
+ esc_html( $version_info->name ),
238
+ '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
239
+ esc_html( $version_info->new_version ),
240
+ '</a>',
241
+ '<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">',
242
+ '</a>'
243
+ );
244
+ }
245
+
246
+ do_action( "in_plugin_update_message-{$file}", $plugin, $version_info );
247
+
248
+ echo '</div></td></tr>';
249
+ }
250
+ }
251
+
252
+ /**
253
+ * Updates information on the "View version x.x details" page with custom data.
254
+ *
255
+ * @uses api_request()
256
+ *
257
+ * @param mixed $_data
258
+ * @param string $_action
259
+ * @param object $_args
260
+ * @return object $_data
261
+ */
262
+ public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
263
+
264
+ if ( $_action != 'plugin_information' ) {
265
+
266
+ return $_data;
267
+
268
+ }
269
+
270
+ if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
271
+
272
+ return $_data;
273
+
274
+ }
275
+
276
+ $to_send = array(
277
+ 'slug' => $this->slug,
278
+ 'is_ssl' => is_ssl(),
279
+ 'fields' => array(
280
+ 'banners' => array(),
281
+ 'reviews' => false,
282
+ 'icons' => array(),
283
+ )
284
+ );
285
+
286
+ $cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
287
+
288
+ // Get the transient where we store the api request for this plugin for 24 hours
289
+ $edd_api_request_transient = $this->get_cached_version_info( $cache_key );
290
+
291
+ //If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
292
+ if ( empty( $edd_api_request_transient ) ) {
293
+
294
+ $api_response = $this->api_request( 'plugin_information', $to_send );
295
+
296
+ // Expires in 3 hours
297
+ $this->set_version_info_cache( $api_response, $cache_key );
298
+
299
+ if ( false !== $api_response ) {
300
+ $_data = $api_response;
301
+ }
302
+
303
+ } else {
304
+ $_data = $edd_api_request_transient;
305
+ }
306
+
307
+ // Convert sections into an associative array, since we're getting an object, but Core expects an array.
308
+ if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) {
309
+ $_data->sections = $this->convert_object_to_array( $_data->sections );
310
+ }
311
+
312
+ // Convert banners into an associative array, since we're getting an object, but Core expects an array.
313
+ if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) {
314
+ $_data->banners = $this->convert_object_to_array( $_data->banners );
315
+ }
316
+
317
+ // Convert icons into an associative array, since we're getting an object, but Core expects an array.
318
+ if ( isset( $_data->icons ) && ! is_array( $_data->icons ) ) {
319
+ $_data->icons = $this->convert_object_to_array( $_data->icons );
320
+ }
321
+
322
+ // Convert icons into an associative array, since we're getting an object, but Core expects an array.
323
+ if ( isset( $_data->contributors ) && ! is_array( $_data->contributors ) ) {
324
+ $_data->contributors = $this->convert_object_to_array( $_data->contributors );
325
+ foreach ( $_data->contributors as $key => $value ) {
326
+ $_data->contributors[$key] = $this->convert_object_to_array( $value );
327
+ }
328
+ }
329
+
330
+ // FOR DEBUG
331
+ // $fordebug = clone $_data;
332
+ // foreach ( $fordebug->sections as $key => $value ) {
333
+ // if ( strlen( $fordebug->sections[$key] ) > 200 )
334
+ // $fordebug->sections[$key] = '...';
335
+ // }
336
+ // $fordebug->description = '...';
337
+ // $fordebug->changelog = '...';
338
+ // var_dump( $fordebug, 1 );
339
+ // exit;
340
+
341
+ if ( !empty( $_data ) && !isset( $_data->plugin ) ) {
342
+ $_data->plugin = $this->name;
343
+ }
344
+
345
+ return $_data;
346
+ }
347
+
348
+ /**
349
+ * Convert some objects to arrays when injecting data into the update API
350
+ *
351
+ * Some data like sections, banners, and icons are expected to be an associative array, however due to the JSON
352
+ * decoding, they are objects. This method allows us to pass in the object and return an associative array.
353
+ *
354
+ * @since 3.6.5
355
+ *
356
+ * @param stdClass $data
357
+ *
358
+ * @return array
359
+ */
360
+ private function convert_object_to_array( $data ) {
361
+ $new_data = array();
362
+ foreach ( $data as $key => $value ) {
363
+ $new_data[ $key ] = $value;
364
+ }
365
+
366
+ return $new_data;
367
+ }
368
+
369
+ /**
370
+ * Disable SSL verification in order to prevent download update failures
371
+ *
372
+ * @param array $args
373
+ * @param string $url
374
+ * @return object $array
375
+ */
376
+ public function http_request_args( $args, $url ) {
377
+
378
+ $verify_ssl = $this->verify_ssl();
379
+ if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
380
+ $args['sslverify'] = $verify_ssl;
381
+ }
382
+ return $args;
383
+
384
+ }
385
+
386
+ /**
387
+ * Calls the API and, if successfull, returns the object delivered by the API.
388
+ *
389
+ * @uses get_bloginfo()
390
+ * @uses wp_remote_post()
391
+ * @uses is_wp_error()
392
+ *
393
+ * @param string $_action The requested action.
394
+ * @param array $_data Parameters for the API action.
395
+ * @return false|object
396
+ */
397
+ private function api_request( $_action, $_data ) {
398
+
399
+ global $wp_version, $edd_plugin_url_available;
400
+
401
+ $verify_ssl = $this->verify_ssl();
402
+
403
+ // Do a quick status check on this domain if we haven't already checked it.
404
+ $store_hash = md5( $this->api_url );
405
+ if ( ! is_array( $edd_plugin_url_available ) || ! isset( $edd_plugin_url_available[ $store_hash ] ) ) {
406
+ $test_url_parts = parse_url( $this->api_url );
407
+
408
+ $scheme = ! empty( $test_url_parts['scheme'] ) ? $test_url_parts['scheme'] : 'http';
409
+ $host = ! empty( $test_url_parts['host'] ) ? $test_url_parts['host'] : '';
410
+ $port = ! empty( $test_url_parts['port'] ) ? ':' . $test_url_parts['port'] : '';
411
+
412
+ if ( empty( $host ) ) {
413
+ $edd_plugin_url_available[ $store_hash ] = false;
414
+ } else {
415
+ $test_url = $scheme . '://' . $host . $port;
416
+ $response = wp_remote_get( $test_url, array( 'timeout' => $this->health_check_timeout, 'sslverify' => $verify_ssl ) );
417
+ $edd_plugin_url_available[ $store_hash ] = is_wp_error( $response ) ? false : true;
418
+ }
419
+ }
420
+
421
+ if ( false === $edd_plugin_url_available[ $store_hash ] ) {
422
+ return;
423
+ }
424
+
425
+ $data = array_merge( $this->api_data, $_data );
426
+
427
+ if ( $data['slug'] != $this->slug ) {
428
+ return;
429
+ }
430
+
431
+ if( $this->api_url == trailingslashit ( home_url() ) ) {
432
+ return false; // Don't allow a plugin to ping itself
433
+ }
434
+
435
+ $api_params = array(
436
+ 'edd_action' => 'get_version',
437
+ 'license' => ! empty( $data['license'] ) ? $data['license'] : '',
438
+ 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
439
+ 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
440
+ 'version' => isset( $data['version'] ) ? $data['version'] : false,
441
+ 'slug' => $data['slug'],
442
+ 'author' => $data['author'],
443
+ 'url' => home_url(),
444
+ 'beta' => ! empty( $data['beta'] ),
445
+ );
446
+
447
+ $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
448
+
449
+ if ( ! is_wp_error( $request ) ) {
450
+ $request = json_decode( wp_remote_retrieve_body( $request ) );
451
+ }
452
+
453
+ if ( $request && isset( $request->sections ) ) {
454
+ $request->sections = maybe_unserialize( $request->sections );
455
+ } else {
456
+ $request = false;
457
+ }
458
+
459
+ if ( $request && isset( $request->banners ) ) {
460
+ $request->banners = maybe_unserialize( $request->banners );
461
+ }
462
+
463
+ if ( $request && isset( $request->icons ) ) {
464
+ $request->icons = maybe_unserialize( $request->icons );
465
+ }
466
+
467
+ if( ! empty( $request->sections ) ) {
468
+ foreach( $request->sections as $key => $section ) {
469
+ $request->$key = (array) $section;
470
+ }
471
+ }
472
+
473
+ return $request;
474
+ }
475
+
476
+ public function show_changelog() {
477
+
478
+ global $edd_plugin_data;
479
+
480
+ if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
481
+ return;
482
+ }
483
+
484
+ if( empty( $_REQUEST['plugin'] ) ) {
485
+ return;
486
+ }
487
+
488
+ if( empty( $_REQUEST['slug'] ) ) {
489
+ return;
490
+ }
491
+
492
+ if( ! current_user_can( 'update_plugins' ) ) {
493
+ wp_die( __( 'You do not have permission to install plugin updates', 'easy-digital-downloads' ), __( 'Error', 'easy-digital-downloads' ), array( 'response' => 403 ) );
494
+ }
495
+
496
+ $data = $edd_plugin_data[ $_REQUEST['slug'] ];
497
+ $beta = ! empty( $data['beta'] ) ? true : false;
498
+ $cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $beta . '_version_info' );
499
+ $version_info = $this->get_cached_version_info( $cache_key );
500
+
501
+ if( false === $version_info ) {
502
+
503
+ $api_params = array(
504
+ 'edd_action' => 'get_version',
505
+ 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
506
+ 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
507
+ 'slug' => $_REQUEST['slug'],
508
+ 'author' => $data['author'],
509
+ 'url' => home_url(),
510
+ 'beta' => ! empty( $data['beta'] )
511
+ );
512
+
513
+ $verify_ssl = $this->verify_ssl();
514
+ $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
515
+
516
+ if ( ! is_wp_error( $request ) ) {
517
+ $version_info = json_decode( wp_remote_retrieve_body( $request ) );
518
+ }
519
+
520
+
521
+ if ( ! empty( $version_info ) && isset( $version_info->sections ) ) {
522
+ $version_info->sections = maybe_unserialize( $version_info->sections );
523
+ } else {
524
+ $version_info = false;
525
+ }
526
+
527
+ if( ! empty( $version_info ) ) {
528
+ foreach( $version_info->sections as $key => $section ) {
529
+ $version_info->$key = (array) $section;
530
+ }
531
+ }
532
+
533
+ $this->set_version_info_cache( $version_info, $cache_key );
534
+
535
+ }
536
+
537
+ if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) {
538
+ echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>';
539
+ }
540
+
541
+ exit;
542
+ }
543
+
544
+ public function get_cached_version_info( $cache_key = '' ) {
545
+
546
+ if( empty( $cache_key ) ) {
547
+ $cache_key = $this->cache_key;
548
+ }
549
+
550
+ $cache = get_option( $cache_key );
551
+
552
+ if( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) {
553
+ return false; // Cache is expired
554
+ }
555
+
556
+ // We need to turn the icons into an array, thanks to WP Core forcing these into an object at some point.
557
+ $cache['value'] = json_decode( $cache['value'] );
558
+ if ( ! empty( $cache['value']->icons ) ) {
559
+ $cache['value']->icons = (array) $cache['value']->icons;
560
+ }
561
+
562
+ return $cache['value'];
563
+
564
+ }
565
+
566
+ public function set_version_info_cache( $value = '', $cache_key = '' ) {
567
+
568
+ if( empty( $cache_key ) ) {
569
+ $cache_key = $this->cache_key;
570
+ }
571
+
572
+ $data = array(
573
+ 'timeout' => strtotime( '+3 hours', time() ),
574
+ 'value' => json_encode( $value )
575
+ );
576
+
577
+ update_option( $cache_key, $data, 'no' );
578
+
579
+ }
580
+
581
+ /**
582
+ * Returns if the SSL of the store should be verified.
583
+ *
584
+ * @since 1.6.13
585
+ * @return bool
586
+ */
587
+ private function verify_ssl() {
588
+ return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this );
589
+ }
590
+
591
+ }
common/helpers.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( !class_exists( 'MeowCommon_Helpers' ) ) {
4
+
5
+ class MeowCommon_Helpers {
6
+
7
+ /**
8
+ * Checks if the current request is a WP REST API request.
9
+ *
10
+ * Case #1: After WP_REST_Request initialisation
11
+ * Case #2: Support "plain" permalink settings
12
+ * Case #3: It can happen that WP_Rewrite is not yet initialized,
13
+ * so do this (wp-settings.php)
14
+ * Case #4: URL Path begins with wp-json/ (your REST prefix)
15
+ * Also supports WP installations in subfolders
16
+ *
17
+ * @returns boolean
18
+ * @author matzeeable
19
+ */
20
+
21
+ static function is_rest() {
22
+ $prefix = rest_get_url_prefix( );
23
+ if ( defined('REST_REQUEST') && REST_REQUEST || isset( $_GET['rest_route'] ) // (#2)
24
+ && strpos( trim( $_GET['rest_route'], '\\/' ), $prefix , 0 ) === 0)
25
+ return true;
26
+ // (#3)
27
+ global $wp_rewrite;
28
+ if ($wp_rewrite === null) $wp_rewrite = new WP_Rewrite();
29
+
30
+ // (#4)
31
+ $rest_url = wp_parse_url( trailingslashit( rest_url( ) ) );
32
+ $current_url = wp_parse_url( add_query_arg( array( ) ) );
33
+ if ( !$rest_url || !$current_url )
34
+ return false;
35
+ if ( !empty( $current_url['path'] ) && !empty( $rest_url['path'] ) ) {
36
+ return strpos( $current_url['path'], $rest_url['path'], 0 ) === 0;
37
+ }
38
+ return false;
39
+ }
40
+
41
+ static function test_error( $error = 'timeout', $diceSides = 1 ) {
42
+ if ( rand( 1, $diceSides ) === 1 ) {
43
+ if ( $error === 'timeout' ) {
44
+ header("HTTP/1.0 408 Request Timeout");
45
+ die();
46
+ }
47
+ else {
48
+ trigger_error( "Error", E_USER_ERROR);
49
+ }
50
+ }
51
+ }
52
+ }
53
+
54
+ if ( MeowCommon_Helpers::is_rest() ) {
55
+ ini_set( 'display_errors', 0 );
56
+ }
57
+ }
58
+
59
+ ?>
common/licenser.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( !class_exists( 'MeowCommon_Licenser' ) ) {
4
+
5
+ class MeowCommon_Licenser {
6
+ public $license = null;
7
+ public $prefix; // prefix used for actions, filters (mfrh)
8
+ public $mainfile; // plugin main file (media-file-renamer.php)
9
+ public $domain; // domain used for translation (media-file-renamer)
10
+ public $item; // name of the Pro plugin (Media File Renamer Pro)
11
+ public $version; // version of the plugin (Media File Renamer Pro)
12
+
13
+ public function __construct( $prefix, $mainfile, $domain, $item, $version ) {
14
+ $this->prefix = $prefix;
15
+ $this->mainfile = $mainfile;
16
+ $this->domain = $domain;
17
+ $this->item = $item;
18
+ $this->version = $version;
19
+
20
+ if ( $this->is_registered() ) {
21
+ add_filter( $this->prefix . '_meowapps_is_registered', array( $this, 'is_registered' ), 10 );
22
+ }
23
+
24
+ if ( MeowCommon_Helpers::is_rest() ) {
25
+ new MeowCommon_Classes_Rest_License( $this );
26
+ }
27
+ else if ( is_admin() ) {
28
+ $license_key = $this->license && isset( $this->license['key'] ) ? $this->license['key'] : "";
29
+ new MeowCommon_Classes_Updater(
30
+ ( get_option( 'force_sslverify', false ) ? 'https' : 'http' ) . '://store.meowapps.com', $this->mainfile,
31
+ array(
32
+ 'version' => $this->version,
33
+ 'license' => $license_key,
34
+ 'item_name' => $this->item,
35
+ 'wp_override' => true,
36
+ 'author' => 'Jordy Meow',
37
+ 'url' => strtolower( home_url() ),
38
+ 'beta' => false
39
+ )
40
+ );
41
+ }
42
+ }
43
+
44
+ function retry_validation() {
45
+ if ( isset( $_POST[$this->prefix . '_pro_serial'] ) ) {
46
+ $serial = $_POST[$this->prefix . '_pro_serial'];
47
+ $this->validate_pro( $serial );
48
+ }
49
+ }
50
+
51
+ function is_registered( $force = false ) {
52
+ if ( !$force && !empty( $this->license ) )
53
+ return empty( $this->license['issue'] );
54
+ $this->license = get_option( $this->prefix . '_license', "" );
55
+ if ( empty( $this->license ) || !empty( $this->license['issue'] ) )
56
+ return false;
57
+ if ( $this->license['expires'] == "lifetime" )
58
+ return true;
59
+ $datediff = strtotime( $this->license['expires'] ) - time();
60
+ $days = floor( $datediff / ( 60 * 60 * 24 ) );
61
+ if ( $days < 0 )
62
+ $this->validate_pro( $this->license['key'] );
63
+ return true;
64
+ }
65
+
66
+ function validate_pro( $subscr_id ) {
67
+ $prefix = $this->prefix;
68
+ delete_option( $prefix . '_license', "" );
69
+ if ( empty( $subscr_id ) )
70
+ return false;
71
+ $url = ( get_option( 'force_sslverify', false ) ? 'https' : 'http' ) .
72
+ '://store.meowapps.com/?edd_action=activate_license' .
73
+ '&item_name=' . urlencode( $this->item ) .
74
+ '&license=' . $subscr_id . '&url=' . strtolower( home_url() ) . '&cache=' . bin2hex( openssl_random_pseudo_bytes( 4 ) );
75
+ $response = wp_remote_get( $url, array(
76
+ 'user-agent' => "MeowApps",
77
+ 'sslverify' => get_option( 'force_sslverify', false ),
78
+ 'timeout' => 45,
79
+ 'method' => 'GET'
80
+ )
81
+ );
82
+ $body = is_array( $response ) ? $response['body'] : null;
83
+ $post = @json_decode( $body );
84
+ $status = null;
85
+ $license = null;
86
+ $expires = null;
87
+ $logs = null;
88
+ if ( !$post || ( property_exists( $post, 'code' ) ) ) {
89
+ $status = 'error';
90
+ // $status = __( "There was an error while validating the serial.<br />Please contact <a target='_blank' href='https://meowapps.com/contact/'>Meow Apps</a> and mention the following log: <br /><ul>", $this->domain );
91
+ $logs = "<li>Server IP: <b>" . gethostbyname( $_SERVER['SERVER_NAME'] ) . "</b></li>";
92
+ $logs .= "<li>Google GET: ";
93
+ $r = wp_remote_get( 'http://google.com' );
94
+ $logs .= is_wp_error( $r ) ? print_r( $r, true ) : 'OK';
95
+ $logs .= "</li><li>MeowApps GET: ";
96
+ $r = wp_remote_get( 'http://meowapps.com' );
97
+ $logs .= is_wp_error( $r ) ? print_r( $r, true ) : 'OK';
98
+ $logs .= "</li><li>MeowApps STORE:<br /><br />";
99
+ $logs .= "REQUEST: $url<br /><br />";
100
+ $logs .= "RESPONSE: ";
101
+ $logs .= print_r( $response, true );
102
+ $logs .= "</li></ul>";
103
+ error_log( print_r( $response, true ) );
104
+ }
105
+ else if ( $post->license !== "valid" ) {
106
+ $status = $post->error ;
107
+ }
108
+ else {
109
+ $license = $post->license;
110
+ $expires = $post->expires;
111
+ delete_option( '_site_transient_update_plugins' );
112
+ }
113
+ update_option( $prefix . '_license', array(
114
+ 'key' => $subscr_id,
115
+ 'issue' => $status,
116
+ 'expires' => $expires,
117
+ 'license' => $license ) );
118
+ return $this->is_registered( true );
119
+ }
120
+
121
+ }
122
+
123
+ }
124
+
125
+ ?>
media-cleaner.php CHANGED
@@ -2,37 +2,24 @@
2
  /*
3
  Plugin Name: Media Cleaner
4
  Plugin URI: https://meowapps.com
5
- Description: Clean your Media Library, many options, trash system.
6
- Version: 5.6.4
7
  Author: Jordy Meow
8
  Author URI: https://meowapps.com
9
  Text Domain: media-cleaner
10
 
11
  Originally developed for two of my websites:
12
- - Jordy Meow (http://offbeatjapan.org)
13
- - Haikyo (http://haikyo.org)
14
  */
15
 
16
- if ( class_exists( 'Meow_WPMC_Core' ) ) {
17
- function wpmc_thanks_admin_notices() {
18
- echo '<div class="error"><p>Thanks for installing the Pro version of Media Cleaner :) However, the free version is still enabled. Please disable or uninstall it.</p></div>';
19
- }
20
- add_action( 'admin_notices', 'wpmc_thanks_admin_notices' );
21
- return;
22
- }
23
 
24
- if ( is_admin() ) {
25
-
26
- global $wpmc_version;
27
- global $wpmc;
28
- $wpmc_version = '5.6.4';
29
-
30
- require __DIR__ . '/admin.php';
31
- require __DIR__ . '/core.php';
32
-
33
- wpmc_init( __FILE__ );
34
- $admin = new Meow_WPMC_Admin( 'wpmc', __FILE__, 'media-cleaner' );
35
- $wpmc = new Meow_WPMC_Core( $admin );
36
- }
37
 
38
  ?>
2
  /*
3
  Plugin Name: Media Cleaner
4
  Plugin URI: https://meowapps.com
5
+ Description: Clean your WordPress from unused or broken media entries and files.
6
+ Version: 6.0.1
7
  Author: Jordy Meow
8
  Author URI: https://meowapps.com
9
  Text Domain: media-cleaner
10
 
11
  Originally developed for two of my websites:
12
+ - Jordy Meow (https://offbeatjapan.org)
13
+ - Haikyo (https://haikyo.org)
14
  */
15
 
16
+ define( 'WPMC_VERSION', '6.0.1' );
17
+ define( 'WPMC_PREFIX', 'wpmc' );
18
+ define( 'WPMC_DOMAIN', 'media-cleaner' );
19
+ define( 'WPMC_ENTRY', __FILE__ );
20
+ define( 'WPMC_PATH', dirname( __FILE__ ) );
21
+ define( 'WPMC_URL', plugin_dir_url( __FILE__ ) );
 
22
 
23
+ require_once( 'classes/init.php');
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  ?>
readme.txt CHANGED
@@ -1,13 +1,13 @@
1
  === Media Cleaner ===
2
  Contributors: TigrouMeow
3
- Tags: clean, delete, file, files, images, image, media, library, upload, acf, gutenberg
4
  Donate link: https://commerce.coinbase.com/checkout/d047546a-77a8-41c8-9ea9-4a950f61832f
5
  Requires at least: 4.8
6
- Tested up to: 5.4
7
- Requires PHP: 7.0
8
- Stable tag: 5.6.4
9
 
10
- Clean your WordPress from unused or broken media and files. It has its own trash system and recovery features. Please read the description.
11
 
12
  == Description ==
13
 
@@ -17,7 +17,7 @@ Media Cleaner cleans your Media Library from the media entries (and files) which
17
 
18
  For compatibility, Pro version and important information, please read this until the end. Last but not least, it is necessary to read the [tutorial](https://meowapps.com/media-cleaner-tutorial/). It is available on the official website, here: [Media Cleaner](https://meowapps.com/plugin/media-cleaner/).
19
 
20
- === VERY IMPORTANT ===
21
 
22
  This tool is a knife. Do not use it if you don't have any backup, or if you don't understand what it does. This plugin does its best to help you. Learn how to use it and you will get awesome results.
23
 
@@ -56,20 +56,18 @@ Last but not least, [Media Cleaner Pro](https://meowapps.com/plugin/media-cleane
56
 
57
  Better to be safe than sorry. This plugin deletes files! Therefore, backup is not only important, it is **necessary**. Don't use this plugin if you are not ready. I can't help you if you damaged your install.
58
 
59
- [](http://coderisk.com/wp/plugin/media-cleaner/RIPS-7_lTxPpGFo)
60
-
61
  === SPECIAL THANKS ===
62
 
63
  - Mike Meinz, an amazing developer from the US who made a thorough debugging of the whole process, load lot of corrections and optimizations, and added support for more plugins.
64
- - Satoshi Soma, an excellent Japanese developer who helped me when I needed it the most.
65
  - To all the users who helped me with reproducing issues and testing new plugins and pagebuilders.
66
 
67
  == Installation ==
68
 
69
- 1. Upload `media-file-cleaner-pro` to the `/wp-content/plugins/` directory
70
- 2. Activate the plugin through the 'Plugins' menu in WordPress
71
- 3. Go in the Settings -> Media Cleaner and check the appropriate options
72
- 3. Go in Media -> Media Cleaner
73
 
74
  == Screenshots ==
75
 
@@ -77,6 +75,14 @@ Better to be safe than sorry. This plugin deletes files! Therefore, backup is no
77
 
78
  == Changelog ==
79
 
 
 
 
 
 
 
 
 
80
  = 5.6.4 =
81
  * Fix: Support for GeoDirectory.
82
  * Fix: Support for Modula Gallery.
1
  === Media Cleaner ===
2
  Contributors: TigrouMeow
3
+ Tags: clean, delete, file, files, images, image, media, library, upload, acf
4
  Donate link: https://commerce.coinbase.com/checkout/d047546a-77a8-41c8-9ea9-4a950f61832f
5
  Requires at least: 4.8
6
+ Tested up to: 5.5
7
+ Requires PHP: 5.6
8
+ Stable tag: 6.0.1
9
 
10
+ Clean your WordPress from unused or broken media entries and files.
11
 
12
  == Description ==
13
 
17
 
18
  For compatibility, Pro version and important information, please read this until the end. Last but not least, it is necessary to read the [tutorial](https://meowapps.com/media-cleaner-tutorial/). It is available on the official website, here: [Media Cleaner](https://meowapps.com/plugin/media-cleaner/).
19
 
20
+ === IMPORTANT ===
21
 
22
  This tool is a knife. Do not use it if you don't have any backup, or if you don't understand what it does. This plugin does its best to help you. Learn how to use it and you will get awesome results.
23
 
56
 
57
  Better to be safe than sorry. This plugin deletes files! Therefore, backup is not only important, it is **necessary**. Don't use this plugin if you are not ready. I can't help you if you damaged your install.
58
 
 
 
59
  === SPECIAL THANKS ===
60
 
61
  - Mike Meinz, an amazing developer from the US who made a thorough debugging of the whole process, load lot of corrections and optimizations, and added support for more plugins.
62
+ - Satoshi Soma, an excellent Japanese developer.
63
  - To all the users who helped me with reproducing issues and testing new plugins and pagebuilders.
64
 
65
  == Installation ==
66
 
67
+ 1. Upload the plugin to WordPress.
68
+ 2. Activate the plugin through the 'Plugins' menu in WordPress/
69
+ 3. Go in the Settings -> Media Cleaner and check the appropriate options.
70
+ 3. Go in Media -> Media Cleaner.
71
 
72
  == Screenshots ==
73
 
75
 
76
  == Changelog ==
77
 
78
+ = 6.0.1 =
79
+ * Update: Brings back errors management to the bulk actions (skip, skip all).
80
+ * Update: Prompt before emptying the trash.
81
+
82
+ = 6.0.0 =
83
+ * Update: Better and fresh new UI. The way it works was simplified while keeping the same features and giving more room for new ones. This is the biggest update to Media Cleaner ever :)
84
+ * Add: Support for a few more plugins and themes.
85
+
86
  = 5.6.4 =
87
  * Fix: Support for GeoDirectory.
88
  * Fix: Support for Modula Gallery.
scripts/dashboard.js DELETED
@@ -1,985 +0,0 @@
1
- /*
2
- Plugin Name: Media Cleaner
3
- Description: Clean your Media Library and Uploads Folder.
4
- Author: Jordy Meow
5
- */
6
-
7
- if (WPMC_E) { // WPMC_E is supposed to be passed from PHP with wp_localize_script()
8
- // Since wp_localize_script() forces any values to be strings,
9
- // we need to cast these error-codes back into integers.
10
- // This issue will be fixed in a future version of WP.
11
- for (code in WPMC_E) WPMC_E[code] = parseInt(WPMC_E[code]);
12
- }
13
-
14
- const WPMC_TARGET_FILES = 'files';
15
- const WPMC_TARGET_MEDIAS = 'media';
16
- const WPMC_SOURCE_CONTENT = 'content';
17
- const WPMC_SOURCE_MEDIAS = 'media';
18
-
19
- var wpmc = null; // Global Context
20
-
21
- function wpmc_pop_array(items, count) {
22
- var newItems = [];
23
- while ( newItems.length < count && items.length > 0 ) {
24
- newItems.push( items.pop() );
25
- }
26
- return newItems;
27
- }
28
-
29
- /**
30
- *
31
- * RECOVER
32
- *
33
- */
34
-
35
- function wpmc_recover() {
36
- var items = [];
37
- jQuery('#wpmc-table input:checked').each(function (index) {
38
- if (jQuery(this)[0].value != 'on') {
39
- items.push(jQuery(this)[0].value);
40
- }
41
- });
42
- wpmc_recover_do(items, items.length);
43
- }
44
-
45
- function wpmc_recover_all() {
46
- var items = [];
47
- var data = { action: 'wpmc_get_all_deleted' };
48
- jQuery.post(ajaxurl, data, function (response) {
49
- reply = jQuery.parseJSON(response);
50
- if ( !reply.success ) {
51
- alert( reply.message );
52
- return;
53
- }
54
- wpmc_recover_do(reply.results.ids, reply.results.ids.length);
55
- });
56
- }
57
-
58
- function wpmc_recover_do(items, totalcount) {
59
- wpmc_update_progress(totalcount - items.length, totalcount);
60
- if (items.length > 0) {
61
- newItems = wpmc_pop_array(items, 5);
62
- data = { action: 'wpmc_recover_do', data: newItems };
63
- }
64
- else {
65
- jQuery('#wpmc_pause').hide();
66
- jQuery('#wpmc_progression').html("Done. Please <a href='?page=media-cleaner'>refresh</a> this page.");
67
- return;
68
- }
69
- jQuery.post(ajaxurl, data, function (response) {
70
- reply = jQuery.parseJSON(response);
71
- if ( !reply.success ) {
72
- alert( reply.message );
73
- return;
74
- }
75
- wpmc_recover_do(items, totalcount);
76
- });
77
- }
78
-
79
- /**
80
- *
81
- * DELETE
82
- *
83
- */
84
-
85
- function wpmc_ignore() {
86
- var items = [];
87
- jQuery('#wpmc-table input:checked').each(function (index) {
88
- if (jQuery(this)[0].value != 'on') {
89
- items.push(jQuery(this)[0].value);
90
- }
91
- });
92
- wpmc_ignore_do(items, items.length);
93
- }
94
-
95
- function wpmc_delete() {
96
- var items = [];
97
- jQuery('#wpmc-table input:checked').each(function (index) {
98
- if (jQuery(this)[0].value != 'on') {
99
- items.push(jQuery(this)[0].value);
100
- }
101
- });
102
- wpmc_delete_do(items, items.length);
103
- }
104
-
105
- function wpmc_delete_all(isTrash, filter = {}) {
106
- var data = {
107
- action: 'wpmc_get_all_issues',
108
- isTrash: isTrash ? 1 : 0,
109
- filter: filter
110
- };
111
-
112
- jQuery.post(ajaxurl, data, function (response) {
113
- reply = jQuery.parseJSON(response);
114
- if ( !reply.success ) {
115
- alert( reply.message );
116
- return;
117
- }
118
- wpmc_delete_do(reply.results.ids, reply.results.ids.length);
119
- });
120
- }
121
-
122
- function wpmc_update_progress(current, totalcount, isDeleting) {
123
- if (isDeleting === undefined)
124
- isDeleting = false;
125
- var action = isDeleting ? "Deleting" : "Analyzing";
126
- jQuery('#wpmc_progression').html('<span class="dashicons dashicons-controls-play"></span> ' +
127
- action + ' ' + current + "/" + totalcount + " (" + Math.round(current / totalcount * 100) + "%)");
128
- }
129
-
130
- function wpmc_delete_do(items, totalcount) {
131
- wpmc_update_progress(totalcount - items.length, totalcount, true);
132
- if (items.length > 0) {
133
- newItems = wpmc_pop_array(items, 5);
134
- data = { action: 'wpmc_delete_do', data: newItems };
135
- }
136
- else {
137
- jQuery('#wpmc_progression').html("Done. Please <a href='?page=media-cleaner'>refresh</a> this page.");
138
- return;
139
- }
140
- jQuery.post(ajaxurl, data, function (response) {
141
- reply = jQuery.parseJSON(response);
142
- if ( !reply.success ) {
143
- alert( reply.message );
144
- return;
145
- }
146
- wpmc_delete_do(items, totalcount);
147
- });
148
- }
149
-
150
- function wpmc_ignore_do(items, totalcount) {
151
- wpmc_update_progress(totalcount - items.length, totalcount);
152
- if (items.length > 0) {
153
- newItems = wpmc_pop_array(items, 5);
154
- data = { action: 'wpmc_ignore_do', data: newItems };
155
- }
156
- else {
157
- jQuery('#wpmc_progression').html("Done. Please <a href='?page=media-cleaner'>refresh</a> this page.");
158
- return;
159
- }
160
- jQuery.post(ajaxurl, data, function (response) {
161
- reply = jQuery.parseJSON(response);
162
- if ( !reply.success ) {
163
- alert( reply.message );
164
- return;
165
- }
166
- wpmc_ignore_do(items, totalcount);
167
- });
168
- }
169
-
170
- /**
171
- *
172
- * SCAN
173
- *
174
- */
175
-
176
- /**
177
- * Creates a context object that preserves various states and variables for scanning
178
- * @return {object}
179
- *
180
- * TODO: Make this an actual class
181
- * TODO: Create 'Phase' class as the base class of each kind of phase
182
- */
183
- function wpmc_new_context() {
184
- return {
185
- dirs: [],
186
- files: [],
187
- medias: [],
188
- current: 0,
189
- total: 0,
190
- issues: 0,
191
- isPause: false,
192
- isPendingPause: false,
193
- currentPhase: null,
194
- errorHandler: new ErrorHandler(),
195
-
196
- phases: {
197
- extractReferencesFromPosts: {
198
- init: function () {
199
- this.progress = 0; // Scanned posts count
200
- this.progressPrev = 0;
201
- this.progressMax = 0;
202
- return this;
203
- },
204
- run: function () {
205
- var me = this;
206
- var src = WPMC_SOURCE_CONTENT;
207
-
208
- if (!this.progressMax) {
209
- jQuery.ajax(ajaxurl, {
210
- type: 'POST',
211
- dataType: 'text',
212
- data: {
213
- action: 'wpmc_get_num_posts',
214
- source: src
215
- },
216
- timeout: wpmc_cfg.timeout + 5000
217
-
218
- }).done(function (result) {
219
- result = wpmc_parse_response(result);
220
- me.progressMax = result.data.num;
221
- wpmc_extract_references_from(src);
222
-
223
- }).fail(function (e) {
224
- wpmc.errorHandler.handle(e.statusText, e.status);
225
- });
226
-
227
- return;
228
- }
229
-
230
- if (this.progress >= this.progressMax) {
231
- wpmc.currentPhase = this.nextPhase().init();
232
- wpmc.currentPhase.run();
233
- return;
234
- }
235
-
236
- wpmc_extract_references_from(src);
237
- },
238
- pause: function () {
239
- jQuery('#wpmc_progression').html('<span class="dashicons dashicons-controls-pause"></span> Paused at preparing posts (' +
240
- this.progress + ' posts)');
241
- },
242
- skip: function () {
243
- this.progress += wpmc_cfg.postsBuffer;
244
- },
245
- nextPhase: function () {
246
- return wpmc.phases.extractReferencesFromMedias;
247
- }
248
- },
249
- extractReferencesFromMedias: {
250
- init: function () {
251
- this.progress = 0; // Scanned posts count
252
- this.progressPrev = 0;
253
- this.progressMax = 0;
254
- return this;
255
- },
256
- run: function () {
257
- var me = this;
258
- var src = WPMC_SOURCE_MEDIAS;
259
-
260
- if (!this.progressMax) {
261
- jQuery.ajax(ajaxurl, {
262
- type: 'POST',
263
- dataType: 'text',
264
- data: {
265
- action: 'wpmc_get_num_posts',
266
- source: src
267
- },
268
- timeout: wpmc_cfg.timeout + 5000
269
-
270
- }).done(function (result) {
271
- result = wpmc_parse_response(result);
272
- me.progressMax = result.data.num;
273
- wpmc_extract_references_from(src);
274
-
275
- }).fail(function (e) {
276
- wpmc.errorHandler.handle(e.statusText, e.status);
277
- });
278
-
279
- return
280
- }
281
-
282
- if (this.progress >= this.progressMax) {
283
- wpmc.currentPhase = this.nextPhase().init();
284
- wpmc.currentPhase.run();
285
- return;
286
- }
287
-
288
- wpmc_extract_references_from(src);
289
- },
290
- pause: function () {
291
- jQuery('#wpmc_progression').html('<span class="dashicons dashicons-controls-pause"></span> Paused at preparing medias (' +
292
- this.progress + ' medias)');
293
- },
294
- skip: function () {
295
- this.progress += wpmc_cfg.mediasBuffer;
296
- },
297
- nextPhase: function () {
298
- return wpmc.phases.retrieveTargetsToCheck;
299
- console.error('Configuration Error'); // This shouldn't happen
300
- }
301
- },
302
- retrieveTargetsToCheck: {
303
- init: function () {
304
- this.progress = 0; // Scanned media count
305
- this.progressPrev = 0;
306
- return this;
307
- },
308
- run: function () {
309
- wpmc_retrieve_targets_for(this.method, this.method === WPMC_TARGET_FILES ? this.progress : null,
310
- this.method === WPMC_TARGET_MEDIAS ? this.progress : 0);
311
- },
312
- pause: function () {
313
- jQuery('#wpmc_progression').html('<span class="dashicons dashicons-controls-pause"></span> Paused at preparing media (' +
314
- this.progress + ' media)');
315
- },
316
- skip: function () {
317
- this.progress += wpmc_cfg.mediasBuffer;
318
- },
319
- nextPhase: function () {
320
- return wpmc.phases.analyze;
321
- }
322
- },
323
- analyze: {
324
- init: function () {
325
- this.currentFiles = [];
326
- this.currentMedia = [];
327
- return this;
328
- },
329
- run: function () {
330
- wpmc_check_targets();
331
- },
332
- pause: function () {
333
- var current = wpmc.total - (wpmc.files.length + wpmc.medias.length);
334
- var totalcount = wpmc.total;
335
- jQuery('#wpmc_progression').html('<span class="dashicons dashicons-controls-pause"></span> Paused at ' +
336
- current + "/" + totalcount + " (" + Math.round(current / totalcount * 100) + "%)");
337
- },
338
- skip: function () {
339
- if (wpmc.files.length)
340
- this.currentFiles = wpmc_pop_array(wpmc.files, wpmc_cfg.analysisBuffer);
341
- if (wpmc.medias.length)
342
- this.currentMedia = wpmc_pop_array(wpmc.medias, wpmc_cfg.analysisBuffer);
343
- },
344
- rollback: function () {
345
- wpmc.files = wpmc.files.concat(this.currentFiles.reverse()); // @see wpmc_pop_array
346
- this.currentFiles = [];
347
- wpmc.medias = wpmc.medias.concat(this.currentMedia.reverse()); // @see wpmc_pop_array
348
- this.currentMedia = [];
349
- }
350
- }
351
- }
352
- };
353
- }
354
-
355
- // Extract References from Posts
356
-
357
- function wpmc_extract_references_from(source) {
358
- if (!wpmc.currentPhase) return; // Aborted
359
- if (wpmc.isPendingPause)
360
- return wpmc_update_to_pause();
361
- setTimeout(
362
- function() {
363
- if (!wpmc.currentPhase) return; // Aborted
364
- jQuery('#wpmc_progression').html('<span class="dashicons dashicons-portfolio"></span> Extract references (' +
365
- wpmc.currentPhase.progress + ' ' + source + ')...');
366
- jQuery.ajax({
367
- type: 'POST',
368
- url: ajaxurl,
369
- dataType: 'text',
370
- data: {
371
- action: 'wpmc_extract_references',
372
- source: source,
373
- limit: wpmc.currentPhase.progress
374
- },
375
- timeout: wpmc_cfg.timeout + 5000 // Extra 5sec for fail-safe
376
- }).done(function (response) {
377
- if (!wpmc.currentPhase) return; // Aborted
378
- var reply = wpmc_parse_response(response);
379
- if (!reply.success)
380
- return wpmc.errorHandler.handle(reply.message);
381
- if (!reply.finished) {
382
- wpmc.currentPhase.progressPrev = wpmc.currentPhase.progress;
383
- wpmc.currentPhase.progress = reply.limit;
384
- }
385
- else wpmc.currentPhase = wpmc.currentPhase.nextPhase().init();
386
- return wpmc.currentPhase.run();
387
- }).fail(function (e) { // Server Error
388
- wpmc.errorHandler.handle(e.statusText, e.status);
389
- });
390
- }, wpmc_cfg.delay
391
- );
392
- }
393
-
394
- function wpmc_retrieve_targets_for(target, path = null, limit = 0) {
395
- if (!wpmc.currentPhase) return; // Aborted
396
-
397
- if (wpmc.isPendingPause)
398
- return wpmc_update_to_pause();
399
-
400
- if (path) {
401
- elpath = path.replace(/^.*[\\\/]/, '');
402
- jQuery('#wpmc_progression').html('<span class="dashicons dashicons-portfolio"></span> Preparing files (' + elpath + ')...');
403
- }
404
- else if (target === WPMC_TARGET_MEDIAS)
405
- jQuery('#wpmc_progression').html('<span class="dashicons dashicons-admin-media"></span> Preparing medias (' + limit + ' medias)...');
406
- else if (target === WPMC_TARGET_FILES)
407
- jQuery('#wpmc_progression').html('<span class="dashicons dashicons-portfolio"></span> Preparing files...');
408
- else
409
- jQuery('#wpmc_progression').html('<span class="dashicons dashicons-portfolio"></span> Preparing...');
410
-
411
- setTimeout(
412
- function() {
413
- jQuery.ajax({
414
- type: 'POST',
415
- url: ajaxurl,
416
- dataType: 'text',
417
- data: {
418
- action: 'wpmc_retrieve_targets',
419
- path: path,
420
- limit: limit
421
- },
422
- timeout: wpmc_cfg.timeout + 5000 // Extra 5sec for fail-safe
423
-
424
- }).done(function (response) {
425
- if (!wpmc.currentPhase) return; // Aborted
426
-
427
- var reply = wpmc_parse_response(response);
428
- var method = reply.method;
429
- wpmc.currentPhase.method = method;
430
-
431
- if (!reply.success)
432
- return wpmc.errorHandler.handle(reply.message);
433
-
434
- // Store results
435
- for (var i = 0, len = reply.results.length; i < len; i++) {
436
- var r = reply.results[i];
437
- if (method === WPMC_TARGET_FILES) {
438
- if ( r.type === 'dir' )
439
- wpmc.dirs.push( r.path );
440
- else if ( r.type === 'file' ) {
441
- wpmc.files.push( r.path );
442
- wpmc.total++;
443
- }
444
- }
445
- else if (method === WPMC_TARGET_MEDIAS) {
446
- wpmc.medias.push( r );
447
- wpmc.total++;
448
- }
449
- }
450
-
451
- // Next query
452
- if (method === WPMC_TARGET_MEDIAS) {
453
- if (!reply.finished) {
454
- wpmc.currentPhase.progressPrev = wpmc.currentPhase.progress;
455
- wpmc.currentPhase.progress = reply.limit;
456
- }
457
- else
458
- wpmc.currentPhase = wpmc.currentPhase.nextPhase().init();
459
- }
460
- else if (method === WPMC_TARGET_FILES) {
461
- var dir = wpmc.dirs.pop();
462
- if (dir) {
463
- wpmc.currentPhase.progressPrev = wpmc.currentPhase.progress;
464
- wpmc.currentPhase.progress = dir;
465
- }
466
- else
467
- wpmc.currentPhase = wpmc.currentPhase.nextPhase().init();
468
- }
469
- wpmc.currentPhase.run();
470
-
471
- }).fail(function (e) { // Server Error
472
- wpmc.errorHandler.handle(e.statusText, e.status);
473
- });
474
-
475
- }, wpmc_cfg.delay
476
- );
477
- }
478
-
479
- function wpmc_pause() {
480
- if (wpmc.isPause) { // Resume
481
- jQuery('#wpmc_pause').html('<span style="top: 3px; position: relative; left: -5px;" class="dashicons dashicons-controls-pause"></span>Pause');
482
- wpmc.isPause = false;
483
- wpmc.currentPhase.run();
484
- }
485
- else if (wpmc.isPendingPause) {
486
- wpmc.isPendingPause = false;
487
- }
488
- else {
489
- jQuery('#wpmc_pause').html('<span style="top: 3px; position: relative; left: -5px;" class="dashicons dashicons-controls-pause"></span>Pausing...');
490
- wpmc.isPendingPause = true;
491
- }
492
- }
493
-
494
- function wpmc_update_to_pause() {
495
- if (wpmc.isPendingPause) {
496
- wpmc.currentPhase.pause();
497
- jQuery('#wpmc_pause').html('<span style="top: 3px; position: relative; left: -5px;" class="dashicons dashicons-controls-play"></span>Continue');
498
- wpmc.isPendingPause = false;
499
- wpmc.isPause = true;
500
- }
501
- }
502
-
503
- /**
504
- * Parses a Ajax response into a valid JSON
505
- * @param {string} response The response content to parse
506
- * @return {object} The parsed result
507
- */
508
- function wpmc_parse_response(response) {
509
- if (typeof response == 'object') return response;
510
-
511
- var r;
512
- try {
513
- r = jQuery.parseJSON(response);
514
- } catch (e) {
515
- r = null;
516
- }
517
- if (!r) { // Couldn't parse as a valid JSON
518
- r = {
519
- success: false,
520
- message: 'The reply from the server is broken. The reply will be displayed in your Javascript console. You should also check your PHP Error Logs.'
521
- };
522
- console.error('Media File Cleaner got a broken reply from the server:', response);
523
- }
524
- return r;
525
- }
526
-
527
- function wpmc_update_to_error() {
528
- var current = wpmc.total - (wpmc.files.length + wpmc.medias.length);
529
- var totalcount = wpmc.total;
530
- jQuery('#wpmc_progression').html('<span class="dashicons dashicons-controls-pause"></span> Error at ' + current + "/" + totalcount + " (" + Math.round(current / totalcount * 100) + "%): " + error);
531
- jQuery('#wpmc_pause').html('<span style="top: 3px; position: relative; left: -5px;" class="dashicons dashicons-controls-play"></span>Retry');
532
- wpmc.isPendingPause = false;
533
- wpmc.isPause = true;
534
- }
535
-
536
- function wpmc_check_targets() {
537
- if (!wpmc.currentPhase) return; // Aborted
538
- if (wpmc.isPendingPause)
539
- return wpmc_update_to_pause();
540
-
541
- wpmc_update_progress(wpmc.total - (wpmc.files.length + wpmc.medias.length), wpmc.total);
542
- var data = {};
543
- var expectedSuccess = 0;
544
- if (wpmc.files.length > 0) {
545
- wpmc.currentPhase.currentFiles = wpmc_pop_array(wpmc.files, wpmc_cfg.analysisBuffer);
546
- expectedSuccess = wpmc.currentPhase.currentFiles.length;
547
- data = { action: 'wpmc_check_targets', method: 'file', data: wpmc.currentPhase.currentFiles };
548
- }
549
- else if (wpmc.medias.length > 0) {
550
- wpmc.currentPhase.currentMedia = wpmc_pop_array(wpmc.medias, wpmc_cfg.analysisBuffer);
551
- expectedSuccess = wpmc.currentPhase.currentMedia.length;
552
- data = { action: 'wpmc_check_targets', method: 'media', data: wpmc.currentPhase.currentMedia };
553
- }
554
- else {
555
- jQuery('#wpmc_progression').html("");
556
- var issueMsg = 'No issues were found.';
557
- if (wpmc.issues > 1)
558
- issueMsg = wpmc.issues + ' issues were found.';
559
- else if (wpmc.issues === 1)
560
- issueMsg = 'Only 1 issue was found.';
561
- jQuery('#wpmc-table').html('<div style="padding: 20px; text-align: center;"><p style="font-size: 14px; margin: 0px 0px 10px 0px;">' +
562
- issueMsg + '</p><a class="button-primary" href="?page=media-cleaner">Display the results</a></div>');
563
- wpmc = wpmc_new_context(); // Reset the context
564
- jQuery('#wpmc_pause').hide();
565
- jQuery('#wpmc_scan').html('<span style="top: 3px; position: relative; left: -5px;" class="dashicons dashicons-search"></span>Start Scan');
566
- jQuery('#wpmc_actions').trigger('idle');
567
- //location.reload();
568
- return;
569
- }
570
-
571
- setTimeout(
572
- function () {
573
- jQuery.ajax({
574
- type: 'POST',
575
- url: ajaxurl,
576
- dataType: 'text',
577
- data: data,
578
- timeout: wpmc_cfg.timeout + 5000 // Extra 5sec for fail-safe
579
- }).done(function (response) {
580
- var reply = wpmc_parse_response(response);
581
- if (!reply.success)
582
- return wpmc.errorHandler.handle(reply.message);
583
- wpmc.issues += expectedSuccess - reply.results;
584
- wpmc_check_targets();
585
- }).fail(function (e) { // Server Error
586
- wpmc.errorHandler.handle(e.statusText, e.status);
587
- });
588
- }, wpmc_cfg.delay
589
- );
590
- }
591
-
592
- /**
593
- * Opens a dialog
594
- * @param {object} content
595
- * @param {string} content.title=null The title of the dialog
596
- * @param {string} content.head=null The heading
597
- * @param {string} content.body=null The body
598
- * @param {jQuery} content.prepend=null Additional element to prepend
599
- * @param {jQuery} content.append=null Additional element to append
600
- * @return {jQuery} The dialog element
601
- */
602
- function wpmc_open_dialog(content) {
603
- var dialog = jQuery('#wpmc-dialog');
604
- dialog.html('');
605
- if (content.title)
606
- dialog.dialog('option', 'title', content.title);
607
- if (content.head)
608
- dialog.append('<h3 class="head">' + content.head + '</h3>');
609
- if (content.body)
610
- dialog.append('<div class="body">' + content.body + '</div>');
611
- if (content.prepend)
612
- dialog.prepend(content.prepend);
613
- if (content.append)
614
- dialog.append(content.append);
615
- dialog.dialog('open');
616
- return dialog;
617
- }
618
-
619
- /**
620
- * @constructor
621
- */
622
- function ErrorHandler() {
623
- this.mode = 'ASK'; // 'RETRY', 'SKIP'
624
- this.MAX_RETRY = 30; // 30;
625
- this.RETRY_DELAY = 5; // in sec
626
- this.nRetried = 0;
627
- this.nSkipped = 0;
628
- }
629
- ErrorHandler.prototype.setMode = function (mode) {
630
- this.mode = mode;
631
- return this;
632
- };
633
- ErrorHandler.prototype.handle = function (msg = null, status = null) {
634
- var me = this;
635
- switch (this.mode) {
636
- case 'RETRY':
637
- if (this.nRetried >= this.MAX_RETRY - 1) {
638
- // Too many retries, switch back to ASK mode
639
- console.warn('Auto-Retry is turned off due to too many fruitless attempts');
640
- this.setMode('ASK');
641
- this.nRetried = 0;
642
- }
643
- // Retry after few seconds
644
- console.log('Retry starts in ' + this.RETRY_DELAY + ' seconds...');
645
- setTimeout(function () {
646
- me.nRetried++;
647
- wpmc.currentPhase.run();
648
-
649
- }, this.RETRY_DELAY * 1000);
650
- break;
651
- case 'SKIP':
652
- wpmc.currentPhase.skip();
653
- this.nSkipped++;
654
- console.warn(this.nSkipped + ' ' + (this.nSkipped > 1 ? 'errors are' : 'error is') + ' ignored automatically');
655
- wpmc.currentPhase.run();
656
- break;
657
- default: // ASK
658
- wpmc.isPendingPause = true;
659
- wpmc_update_to_pause();
660
-
661
- // Show Error Dialog
662
- var errDialog = jQuery('#wpmc-error-dialog');
663
- if (!msg) msg = 'An error happened'; // Default error message
664
- if (status) {
665
- console.error('Media Cleaner got an error from server:', status + ' ' + msg);
666
- msg = '<span class="error-status">' + status + '</span> ' + msg;
667
- } else
668
- console.error(msg);
669
-
670
- errDialog.find('h3').html(msg);
671
- errDialog.dialog('open');
672
- }
673
- };
674
-
675
- /**
676
- *
677
- * INIT
678
- *
679
- */
680
- (function ($) {
681
- // Initialize Global Context
682
- wpmc = wpmc_new_context();
683
-
684
- // Bulk Selection
685
- $('#wpmc-cb-select-all').on('change', function (cb) {
686
- $('#wpmc-table input').prop('checked', cb.target.checked);
687
- });
688
-
689
- // Actions
690
- (function () {
691
- var wrap = $('#wpmc_actions');
692
-
693
- // Events: Busy, Idle
694
- wrap.on('busy', function () {
695
- wrap.addClass('busy');
696
- wrap.find('a.exclusive').addClass('disabled');
697
- wrap.find('input.exclusive').attr('disabled', true);
698
-
699
- }).on('idle', function () {
700
- wrap.find('a.exclusive').removeClass('disabled');
701
- wrap.find('input.exclusive').attr('disabled', false);
702
- wrap.removeClass('busy');
703
- });
704
-
705
- // Scan Button
706
- wrap.find('#wpmc_scan').on('click', function (ev) {
707
- ev.preventDefault();
708
- if (wpmc.currentPhase) { // Abort scan
709
- wpmc = wpmc_new_context(); // Reset the current context
710
- $('#wpmc_pause').hide();
711
- $('#wpmc_pause').html('<span style="top: 3px; position: relative; left: -5px;" class="dashicons dashicons-controls-pause"></span>Pause');
712
- $('#wpmc_progression').text('');
713
- $('#wpmc_scan').html('<span style="top: 3px; position: relative; left: -5px;" class="dashicons dashicons-search"></span>Start Scan');
714
- wrap.trigger('idle');
715
- return;
716
- }
717
- wrap.trigger('busy');
718
- $('#wpmc_scan').html('Stop Scan');
719
- $('#wpmc_pause').show();
720
- wpmc.currentPhase = wpmc.phases.extractReferencesFromPosts.init();
721
- wpmc.currentPhase.run();
722
- });
723
-
724
- // Delete Button
725
- wrap.find('#wpmc_delete').on('click', function (ev) {
726
- ev.preventDefault();
727
- if ($(this).hasClass('disabled')) return;
728
- wpmc_delete();
729
- });
730
-
731
- // Delete All (Search Results) Button
732
- wrap.find('#wpmc_delete_all').on('click', function (ev) {
733
- ev.preventDefault();
734
- var $this = $(this);
735
- if ($this.hasClass('disabled')) return;
736
- var filter = $this.data('filter') || '';
737
- var search = $this.data('search') || '';
738
- if (search != wrap.find('.search-box input[name="s"]').val()) {
739
- var dialog = wpmc_open_dialog({
740
- title: 'Warning',
741
- body: 'You modified the search terms without clicking on the <i>Search</i> button to refresh the results. Therefore, the <b>current</b> results will be deleted. Do you want to continue?',
742
- append: $('<div class="prompt">')
743
- .append(
744
- // Cancel Button
745
- $('<a class="button cancel" href="#">Cancel</a>').on('click', function (ev) {
746
- ev.preventDefault();
747
- dialog.dialog('close');
748
- })
749
- ).append(
750
- // Continue Button
751
- $('<a class="button button-primary continue" href="#">Continue</a>').on('click', function (ev) {
752
- ev.preventDefault();
753
- dialog.dialog('close');
754
- wpmc_delete_all(false, { filter, search });
755
- })
756
- )
757
- });
758
- return;
759
- }
760
- else {
761
- var dialog = wpmc_open_dialog({
762
- title: 'Delete all',
763
- body: '<b>All the issues will be moved to the trash</b>. Please make sure you have a backup. Do you want to continue?',
764
- append: $('<div class="prompt">')
765
- .append(
766
- // Cancel Button
767
- $('<a class="button cancel" href="#">Cancel</a>').on('click', function (ev) {
768
- ev.preventDefault();
769
- dialog.dialog('close');
770
- })
771
- ).append(
772
- // Continue Button
773
- $('<a class="button button-primary continue" href="#">Continue</a>').on('click', function (ev) {
774
- ev.preventDefault();
775
- dialog.dialog('close');
776
- wpmc_delete_all(false, { filter, search });
777
- })
778
- )
779
- });
780
- return;
781
- }
782
- //wpmc_delete_all(false, filter);
783
- });
784
-
785
- // Ignore Button
786
- wrap.find('#wpmc_ignore').on('click', function (ev) {
787
- ev.preventDefault();
788
- if ($(this).hasClass('disabled')) return;
789
- wpmc_ignore();
790
- });
791
-
792
- // Recover All Button
793
- wrap.find('#wpmc_recover_all').on('click', function (ev) {
794
- ev.preventDefault();
795
- if ($(this).hasClass('disabled')) return;
796
- wpmc_recover_all();
797
- });
798
-
799
- // Empty Trash Button
800
- wrap.find('#wpmc_empty_trash').on('click', function (ev) {
801
- ev.preventDefault();
802
- if ($(this).hasClass('disabled')) return;
803
- wpmc_delete_all(true);
804
- });
805
-
806
- // Reset Button
807
- wrap.find('#wpmc_reset').on('click', function (ev) {
808
- ev.preventDefault();
809
- var $this = $(this);
810
- var dialog = wpmc_open_dialog({
811
- title: "Reset",
812
- body: "The information related to the Media Cleaner's trash, latest scan and ignored entries will be lost. Do you want to continue?",
813
- append: $('<div class="prompt">')
814
- .append(
815
- // Cancel Button
816
- $('<a class="button cancel" href="#">Cancel</a>').on('click', function (ev) {
817
- ev.preventDefault();
818
- dialog.dialog('close');
819
- })
820
- ).append(
821
- // Continue Button
822
- $('<a class="button button-primary continue" href="#">Continue</a>').on('click', function (ev) {
823
- ev.preventDefault();
824
- dialog.dialog('close');
825
- location.href = $this.attr('href');
826
- })
827
- )
828
- });
829
- });
830
-
831
- // "Enable MEDIA_TRASH" Button
832
- $('#wpmc_enable_media_trash').on('click', function (ev) {
833
- var self = $(this);
834
- var action = 'wpmc_define';
835
-
836
- $.ajax(ajaxurl, {
837
- type: 'POST',
838
- dataType: 'text',
839
- data: {
840
- action: action,
841
- nonce: WPMC_NONCES[action],
842
- name: 'MEDIA_TRASH',
843
- value: 1
844
- }
845
-
846
- }).done(function (result) {
847
- result = wpmc_parse_response(result);
848
- if (!result.success) {
849
- console.error(result.data.message);
850
- var msg = {
851
- title: 'Warning',
852
- head: '',
853
- body: result.data.message
854
- };
855
- switch (result.data.code) {
856
- case WPMC_E['INVALID_NONCE']:
857
- msg.head = "Invalid Request";
858
- msg.body = "Something wrong is going on here.<br>Please try it again after reloading the page";
859
- break;
860
- case WPMC_E['FILE_OPEN_FAILURE']:
861
- msg.head = "Cannot open wp-config.php";
862
- msg.body = "You still have a chance to enable it by manually editing wp-config.php";
863
- break;
864
- case WPMC_E['FILE_WRITE_FAILURE']:
865
- msg.head = "Cannot modify wp-config.php";
866
- msg.body = "You still have a chance to enable it by manually editing wp-config.php";
867
- break;
868
- }
869
- wpmc_open_dialog(msg);
870
- return;
871
- }
872
- self.closest('.notice').remove();
873
-
874
- }).fail(function (e) {
875
- console.error(e.status + " " + e.statusText);
876
- var msg = {
877
- title: "Request Error",
878
- head: e.status + " " + e.statusText,
879
- body: "You still have a chance to enable it by manually editing wp-config.php"
880
- };
881
- wpmc_open_dialog(msg);
882
- });
883
- });
884
- })();
885
-
886
- // Dialog
887
- (function () {
888
- var dialog = $('#wpmc-dialog');
889
-
890
- dialog.dialog({
891
- dialogClass: 'wp-dialog',
892
- autoOpen: false,
893
- draggable: true,
894
- width: 'auto',
895
- modal: true,
896
- resizable: false,
897
- closeOnEscape: true,
898
- position: {
899
- my: "center",
900
- at: "center",
901
- of: window
902
- },
903
- open: function () {
904
- // Close dialog by clicking the overlay behind it
905
- $('.ui-widget-overlay').on('click', function () {
906
- dialog.dialog('close');
907
- });
908
- },
909
- create: function () {
910
- // Style fix for WordPress admin
911
- $('.ui-dialog-titlebar-close').addClass('ui-button');
912
- }
913
- });
914
- })();
915
-
916
- // Error Dialog
917
- (function () {
918
- var errDialog = $('#wpmc-error-dialog');
919
-
920
- errDialog.dialog({
921
- title: 'ERROR',
922
- dialogClass: 'wp-dialog',
923
- autoOpen: false,
924
- draggable: true,
925
- width: 'auto',
926
- modal: true,
927
- resizable: false,
928
- closeOnEscape: true,
929
- position: {
930
- my: "center",
931
- at: "center",
932
- of: window
933
- },
934
- open: function () {
935
- $('.ui-widget-overlay').on('click', function () {
936
- errDialog.dialog('close');
937
- });
938
- },
939
- create: function () {
940
- $('.ui-dialog-titlebar-close').addClass('ui-button');
941
- }
942
- });
943
-
944
- // Retry
945
- errDialog.find('a.retry').on('click', function (ev) {
946
- ev.preventDefault();
947
-
948
- wpmc_pause(); // Resume
949
- errDialog.dialog('close');
950
- });
951
-
952
- // Skip (Ignore error)
953
- errDialog.find('a.skip').on('click', function (ev) {
954
- ev.preventDefault();
955
-
956
- wpmc.currentPhase.skip();
957
- console.warn('1 error is ignored by you');
958
-
959
- wpmc_pause(); // Resume
960
- errDialog.dialog('close');
961
- });
962
-
963
- // Always Retry
964
- errDialog.find('a.always-retry').on('click', function (ev) {
965
- ev.preventDefault();
966
-
967
- wpmc.errorHandler.setMode('RETRY');
968
-
969
- wpmc_pause(); // Resume
970
- errDialog.dialog('close');
971
- });
972
-
973
- // Skip All
974
- errDialog.find('a.skip-all').on('click', function (ev) {
975
- ev.preventDefault();
976
-
977
- wpmc.errorHandler.setMode('SKIP');
978
-
979
- wpmc_pause(); // Resume
980
- errDialog.dialog('close');
981
- });
982
-
983
- })();
984
-
985
- })(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
scripts/settings.js DELETED
@@ -1,49 +0,0 @@
1
- /**
2
- * Script for settings screen
3
- */
4
- (function ($) {
5
-
6
- /**
7
- * Validation
8
- */
9
- $('form *[data-needs-validation]').on('input', function (ev) {
10
- var $this = $(this);
11
- var form = $this.closest('form');
12
- var submit = form.find('*[type=submit]');
13
- submit.attr('disabled', true);
14
-
15
- $.ajax(ajaxurl, {
16
- method: 'post',
17
- dataType: 'json',
18
- data: {
19
- action: 'wpmc_validate_option',
20
- name: $this.attr('name'),
21
- value: $this.val()
22
- }
23
-
24
- }).always(function () {
25
- submit.attr('disabled', false);
26
-
27
- }).done(function (response) {
28
- if (response.success) {
29
- $this[0].setCustomValidity('');
30
-
31
- } else { // Invalid Data
32
- $this[0].setCustomValidity(response.data.message);
33
- }
34
- });
35
- });
36
-
37
- /**
38
- * Scanning Method
39
- */
40
- $('select#wpmc_method').on('change', function (ev) {
41
- var selected = $(this).val();
42
- if (selected == 'media') { // Method = "Media Library"
43
- $('input#wpmc_media_library').attr('disabled', true);
44
- } else { // Method = Other Else
45
- $('input#wpmc_media_library').attr('disabled', false);
46
- }
47
- });
48
-
49
- })(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
scripts/style.css DELETED
@@ -1,90 +0,0 @@
1
- #wpmc_actions {
2
- background: #FFF;
3
- padding: 6px 6px 8px 6px;
4
- height: 28px;
5
- border-radius: 4px;
6
- box-shadow: 0px 0px 4px #C2C2C2;
7
- }
8
-
9
- #wpmc-paging {
10
- float: right;
11
- position: relative;
12
- top: 12px;
13
- }
14
-
15
- #wpmc-paging a {
16
- text-decoration: none;
17
- border: 1px solid black;
18
- padding: 2px 5px;
19
- border-radius: 4px;
20
-
21
- border-color: #BEBEBE;
22
- }
23
-
24
- #wpmc-paging .current {
25
- font-weight: bold;
26
- }
27
-
28
- .wp-core-ui .button-red {
29
- background-color: #ba1100;
30
- border-color: #ba1100;
31
- color: #fff;
32
- text-decoration: none;
33
- }
34
-
35
- .wp-core-ui .button-red:hover,
36
- .wp-core-ui .button-red:focus {
37
- background-color: #a11800;
38
- border-color: #a11800;
39
- color: #fff;
40
- }
41
-
42
- /* Dialog */
43
- #wpmc-dialog {
44
- text-align: center;
45
- min-height: auto !important;
46
- }
47
- #wpmc-dialog .prompt {
48
- margin-top: 16px;
49
- display: flex;
50
- }
51
- #wpmc-dialog .prompt .button {
52
- flex: 1;
53
- }
54
- #wpmc-dialog .prompt .button + .button {
55
- margin-left: 5px;
56
- }
57
-
58
- /* Error Dialog */
59
- #wpmc-error-dialog .options {
60
- margin-top: 20px;
61
- text-align: right;
62
- }
63
- #wpmc-error-dialog .options a + a {
64
- margin-left: 16px;
65
- }
66
-
67
- /* Settings */
68
- .wrap-media-cleaner .meow-box form input:invalid {
69
- color: red;
70
- }
71
-
72
- /* Nice layout for the notices */
73
- .wrap-media-cleaner .notice {
74
- margin: -10px 0px 15px;
75
- }
76
- .wrap-media-cleaner .notice:first-of-type {
77
- margin: 10px 0px 15px;
78
- }
79
- .wrap-media-cleaner .notice.columned {
80
- display: flex;
81
- flex-direction: row;
82
- }
83
- .wrap-media-cleaner .notice.columned > *:first-child {
84
- flex: auto;
85
- margin-right: 12px;
86
- }
87
- .wrap-media-cleaner .notice.columned > *:last-child {
88
- margin: 12px 0;
89
- padding-left: 12px;
90
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
views/menu-screen.php DELETED
@@ -1,491 +0,0 @@
1
- <div class='wrap wrap-media-cleaner'>
2
-
3
- <?php
4
- echo $admin->display_title( "Media Cleaner" );
5
- $posts_per_page = get_option( 'wpmc_results_per_page', 20 );
6
- $view = isset ( $_GET[ 'view' ] ) ? sanitize_text_field( $_GET[ 'view' ] ) : "issues";
7
- $paged = isset ( $_GET[ 'paged' ] ) ? sanitize_text_field( $_GET[ 'paged' ] ) : 1;
8
- $s = isset ( $_GET[ 's' ] ) ? sanitize_text_field( $_GET[ 's' ] ) : null;
9
- $f = isset ( $_GET[ 'f' ] ) ? sanitize_text_field( $_GET[ 'f' ] ) : null;
10
- $orderby = isset ( $_GET[ 'orderby' ] ) ? sanitize_text_field( $_GET[ 'orderby' ] ) : '';
11
- $order = isset ( $_GET[ 'order' ] ) ? sanitize_text_field( $_GET[ 'order' ] ) : 'asc';
12
- $table_scan = $wpdb->prefix . "mclean_scan";
13
- $table_refs = $wpdb->prefix . "mclean_refs";
14
- $filterByTypeSQL = '';
15
- if ( !empty( $f ) ) {
16
- $availableFilters = [ 'NO_CONTENT', 'ORPHAN_FILE', 'ORPHAN_RETINA', 'ORPHAN_WEBP', 'ORPHAN_MEDIA' ];
17
- if ( in_array( $f, $availableFilters ) )
18
- $filterByTypeSQL = " AND issue = '$f'";
19
- else
20
- $f = null;
21
- }
22
-
23
- // Check the DB
24
- // If does not exist, let's create it.
25
- // TODO: When PHP 7 only, let's clean this and use anonymous functions.
26
- $db_init = !( strtolower( $wpdb->get_var( "SHOW TABLES LIKE '$table_scan'" ) ) != strtolower( $table_scan )
27
- || strtolower( $wpdb->get_var( "SHOW TABLES LIKE '$table_refs'" ) ) != strtolower( $table_refs ) );
28
- if ( !$db_init ) {
29
- wpmc_create_database();
30
- $db_init = !( strtolower( $wpdb->get_var( "SHOW TABLES LIKE '$table_scan'" ) ) != strtolower( $table_scan )
31
- || strtolower( $wpdb->get_var( "SHOW TABLES LIKE '$table_refs'" ) ) != strtolower( $table_refs ) );
32
- }
33
-
34
- // It still doesn't exist. That's not your lucky day :(
35
- if ( !$db_init ) {
36
- echo "<div class='notice notice-error'><p>";
37
- _e( "<b>The database is not ready for Media Cleaner. The scan will not work.</b> Click on the <b>Reset</b> button, it re-creates the tables required by Media Cleaner. If this message still appear, contact the support.", 'media-cleaner' );
38
- echo "</p></div>";
39
- }
40
-
41
- // Check the access rights to the uploads directory
42
- $upload_folder = wp_upload_dir();
43
- $basedir = $upload_folder['basedir'];
44
- if ( !is_writable( $basedir ) ) {
45
- echo "<div class='notice notice-error'><p>";
46
- _e( 'The directory for uploads is not writable. Media Cleaner will only be able to scan.', 'media-cleaner' );
47
- echo "</p></div>";
48
- }
49
-
50
- $issues_count = $wpdb->get_var( "SELECT COUNT(*) FROM $table_scan WHERE ignored = 0 AND deleted = 0" . $filterByTypeSQL );
51
- $total_size = $wpdb->get_var( "SELECT SUM(size) FROM $table_scan WHERE ignored = 0 AND deleted = 0" . $filterByTypeSQL );
52
- $trash_total_size = $wpdb->get_var( "SELECT SUM(size) FROM $table_scan WHERE ignored = 0 AND deleted = 1" . $filterByTypeSQL );
53
- $ignored_count = $wpdb->get_var( "SELECT COUNT(*) FROM $table_scan WHERE ignored = 1" . $filterByTypeSQL );
54
- $deleted_count = $wpdb->get_var( "SELECT COUNT(*) FROM $table_scan WHERE deleted = 1" . $filterByTypeSQL );
55
-
56
- // Create the Order By
57
- $sqlOrderBy = "path, time";
58
- if ( $orderby === 'size' ) {
59
- $sqlOrderBy = "size " . ( $order === 'asc' ? 'ASC' : 'DESC' );
60
- }
61
- else if ( $orderby === 'path' ) {
62
- $sqlOrderBy = "path " . ( $order === 'asc' ? 'ASC' : 'DESC' );
63
- }
64
- else if ( $orderby === 'id' ) {
65
- $sqlOrderBy = "postId " . ( $order === 'asc' ? 'ASC' : 'DESC' );
66
- }
67
-
68
- if ( $view == 'deleted' ) {
69
- $items_count = $deleted_count;
70
- $items = $wpdb->get_results( $wpdb->prepare( "SELECT id, type, postId, path, size, ignored, deleted, issue
71
- FROM $table_scan WHERE ignored = 0 AND deleted = 1 AND path LIKE %s $filterByTypeSQL
72
- ORDER BY $sqlOrderBy
73
- LIMIT %d, %d", '%' . $s . '%', ( $paged - 1 ) * $posts_per_page, $posts_per_page ), OBJECT );
74
- }
75
- else if ( $view == 'ignored' ) {
76
- $items_count = $ignored_count;
77
- $items = $wpdb->get_results( $wpdb->prepare( "SELECT id, type, postId, path, size, ignored, deleted, issue
78
- FROM $table_scan
79
- WHERE ignored = 1 AND deleted = 0 AND path LIKE %s $filterByTypeSQL
80
- ORDER BY $sqlOrderBy
81
- LIMIT %d, %d", '%' . $s . '%', ( $paged - 1 ) * $posts_per_page, $posts_per_page ), OBJECT );
82
- }
83
- else {
84
- $items_count = $issues_count;
85
- $items = $wpdb->get_results( $wpdb->prepare( "SELECT id, type, postId, path, size, ignored, deleted, issue
86
- FROM $table_scan
87
- WHERE ignored = 0 AND deleted = 0 AND path LIKE %s $filterByTypeSQL
88
- ORDER BY $sqlOrderBy
89
- LIMIT %d, %d", '%' . $s . '%', ( $paged - 1 ) * $posts_per_page, $posts_per_page ), OBJECT );
90
- }
91
- ?>
92
-
93
- <div id="wpmc_actions">
94
-
95
- <!-- SCAN -->
96
- <?php if ( $view != 'deleted' ): ?>
97
- <a id='wpmc_scan' class='button-primary' style='float: left;'><span style="top: 3px; position: relative; left: -5px;" class="dashicons dashicons-search"></span><?php _e("Start Scan", 'media-cleaner'); ?></a>
98
- <?php endif; ?>
99
-
100
- <!-- PAUSE -->
101
- <?php if ( $view != 'deleted' ): ?>
102
- <a id='wpmc_pause' onclick='wpmc_pause()' class='button' style='float: left; margin-left: 5px; display: none;'><span style="top: 3px; position: relative; left: -5px;" class="dashicons dashicons-controls-pause"></span><?php _e("Pause", 'media-cleaner'); ?></a>
103
- <?php endif; ?>
104
-
105
- <!-- DELETE SELECTED -->
106
- <a id='wpmc_delete' class='button exclusive' style='float: left; margin-left: 5px;'><span style="top: 3px; position: relative; left: -5px;" class="dashicons dashicons-no"></span><?php _e("Delete", 'media-cleaner'); ?></a>
107
- <?php if ( $view == 'deleted' ): ?>
108
- <a id='wpmc_recover' onclick='wpmc_recover()' class='button-secondary' style='float: left; margin-left: 5px;'><span style="top: 3px; position: relative; left: -5px;" class="dashicons dashicons-controls-repeat"></span><?php _e( "Recover", 'media-cleaner' ); ?></a>
109
- <?php endif; ?>
110
-
111
- <!-- IGNORE SELECTED -->
112
- <a id='wpmc_ignore' class='button exclusive' style='float: left; margin-left: 5px;'><span style="top: 3px; position: relative; left: -5px;" class="dashicons dashicons-yes"></span><?php
113
- if ( $view == 'ignored' )
114
- _e( "Mark as Issue", 'media-cleaner' );
115
- else
116
- _e( "Ignore", 'media-cleaner' );
117
- ?>
118
- </a>
119
-
120
- <!-- DELETE ALL -->
121
- <?php if ( $view == 'deleted' ): // i ?>
122
- <a id='wpmc_empty_trash' class='button button-red exclusive' style='float: right; margin-left: 5px;'><span style="top: 3px; position: relative; left: -5px;" class="dashicons dashicons-trash"></span><?php _e("Empty trash", 'media-cleaner'); ?></a>
123
- <a id='wpmc_recover_all' class='button-primary exclusive' style='float: right; margin-left: 5px;'><span style="top: 3px; position: relative; left: -5px;" class="dashicons dashicons-controls-repeat"></span><?php _e("Recover all", 'media-cleaner'); ?></a>
124
- <?php else: // i ?>
125
- <?php if ( $f || $s ): // ii ?>
126
- <a id='wpmc_delete_all' class='button button-red exclusive' data-filter='<?php echo esc_attr( $f ) ?>' data-search='<?php echo esc_attr( $s ) ?>' style='float: right; margin-left: 5px;'><span style="top: 3px; position: relative; left: -5px;" class="dashicons dashicons-trash"></span><?php _e("Delete these results", 'media-cleaner'); ?></a>
127
- <?php else: // ii ?>
128
- <a id='wpmc_delete_all' class='button button-red exclusive' style='float: right; margin-left: 5px;'><span style="top: 3px; position: relative; left: -5px;" class="dashicons dashicons-trash"></span><?php _e("Delete all", 'media-cleaner'); ?></a>
129
- <?php endif; // ii ?>
130
- <?php endif; // i ?>
131
-
132
- <form id="posts-filter" action="upload.php" method="get" style='float: right;'>
133
- <p class="search-box" style='margin-left: 5px; float: left;'>
134
- <input type="search" name="s" placeholder="<?php _e('Search', 'media-cleaner' ); ?>" style="width: 120px;" value="<?php echo $s ? esc_attr( $s ) : ""; ?>">
135
- <select name="f" id="filter-by-type" style="margin-top: -3px; font-size: 13px;">
136
- <option <?php echo !$f ? 'selected="selected"' : ''; ?> value="0"><?php
137
- _e('All Issues', 'media-cleaner' ); ?></option>
138
- <option <?php echo $f === 'NO_CONTENT' ? 'selected="selected"' : ''; ?> value="NO_CONTENT"><?php
139
- _e( 'Seems not use', 'media-cleaner' ); ?></option>
140
- <option <?php echo $f === 'ORPHAN_MEDIA' ? 'selected="selected"' : ''; ?>value="ORPHAN_MEDIA"><?php
141
- _e( 'No attached file', 'media-cleaner' ); ?></option>
142
- <option <?php echo $f === 'ORPHAN_FILE' ? 'selected="selected"' : ''; ?>value="ORPHAN_FILE"><?php
143
- _e( 'Not in Library', 'media-cleaner' ); ?></option>
144
- <option <?php echo $f === 'ORPHAN_RETINA' ? 'selected="selected"' : ''; ?>value="ORPHAN_RETINA"><?php
145
- _e( 'Orphan Retina', 'media-cleaner' ); ?></option>
146
- <option <?php echo $f === 'ORPHAN_WEBP' ? 'selected="selected"' : ''; ?>value="ORPHAN_WEBP"><?php
147
- _e( 'Orphan WebP', 'media-cleaner' ); ?></option>
148
- </select>
149
- <input type="hidden" name="page" value="media-cleaner">
150
- <input type="hidden" name="view" value="<?php echo $view; ?>">
151
- <input type="hidden" name="paged" value="1">
152
- <input type="submit" class="button exclusive" value="<?php _e( 'Search', 'media-cleaner' ); ?>"><span style='border-right: #A2A2A2 solid 1px; margin-left: 5px; margin-right: 3px;'>&nbsp;</span>
153
- </p>
154
- </form>
155
-
156
- <!-- PROGRESS -->
157
- <span style='margin-left: 12px; font-size: 15px; top: 5px; position: relative; color: #747474;' id='wpmc_progression'></span>
158
-
159
- </div>
160
-
161
- <p>
162
- <?php
163
- $method = get_option( 'wpmc_method', 'media' );
164
- if ( $db_init ) {
165
- if ( !$admin->is_registered() )
166
- $method = 'media';
167
-
168
- $hide_warning = get_option( 'wpmc_hide_warning', false );
169
- if ( !$hide_warning ) {
170
- echo "<div class='notice notice-warning'><p>";
171
- _e( "<b style='color: red;'>Important.</b> <b>Backup your DB and your /uploads directory before using Media Cleaner. </b> The deleted files will be temporarily moved to the <b>uploads/wpmc-trash</b> directory. After testing your website, you can check the <a href='?page=media-cleaner&s&view=deleted'>trash</a> to either empty it or recover the media and files. The Media Cleaner does its best to be safe to use. However, WordPress being a very dynamic and pluggable system, it is impossible to predict all the situations in which your files are used. <b style='color: red;'>Again, please backup!</b> If you don't know how, give a try to this: <a href='https://meow.click/blogvault' target='_blank'>BlogVault</a>. <br /><br /><b style='color: red;'>Be thoughtful.</b> Don't blame Media Cleaner if it deleted too many or not enough of your files. It makes cleaning possible and this task is only possible this way; don't post a bad review because it broke your install. <b>If you have a proper backup, there is no risk</b>. Sorry for the lengthy message, but better be safe than sorry. You can disable this big warning in the options if you have a Pro license. Make sure you read this warning twice. Media Cleaner is awesome and always getting better so I hope you will enjoy it. Thank you :)", 'media-cleaner' );
172
- echo "</p></div>";
173
- }
174
-
175
- if ( !MEDIA_TRASH ) {
176
- echo "<div class='notice notice-warning columned'>";
177
- _e( "<p>The trash for the Media Library is disabled. Any media removed by the plugin will be <b>permanently deleted</b>. To enable it, modify your wp-config.php file and add this line (preferably at the top): <b>define( 'MEDIA_TRASH', true );</b>", 'media-cleaner' );
178
- echo '</p>';
179
- echo '<div><a href="#" id="wpmc_enable_media_trash" class="button-primary">'. __( 'Add it automatically', 'media-cleaner' ) .'</a></div>';
180
- echo '</div>';
181
- }
182
- }
183
-
184
- if ( !$admin->is_registered() ) {
185
- echo "<div class='notice notice-warning'><p>";
186
- _e( "This plugin is a lot of work so please consider <a target='_blank' href='//meowapps.com/plugin/media-cleaner'>Media Cleaner Pro</a> in order to receive support and to contribute in the evolution of it. Also, <a target='_blank' href='//meowapps.com/plugin/media-cleaner'>Media Cleaner Pro</a> version will also give you the option <b>to scan the physical files in your /uploads folder</b> and extra checks for the common Page Builders.", 'media-cleaner' );
187
- echo "</p></div>";
188
-
189
- $unsupported = array();
190
-
191
- if ( class_exists( 'ACF' ) || function_exists( 'acfw_globals' ) )
192
- array_push( $unsupported, 'ACF' );
193
-
194
- if ( function_exists( '_et_core_find_latest' ) )
195
- array_push( $unsupported, 'Divi' );
196
-
197
- if ( class_exists( 'Vc_Manager' ) )
198
- array_push( $unsupported, 'Visual Composer' );
199
-
200
- if ( function_exists( 'fusion_builder_map' ) )
201
- array_push( $unsupported, 'Fusion Builder' );
202
-
203
- if ( function_exists( 'elementor_load_plugin_textdomain' ) )
204
- array_push( $unsupported, 'Elementor' );
205
-
206
- if ( class_exists( 'FLBuilderModel' ) )
207
- array_push( $unsupported, 'Beaver Builder' );
208
-
209
- if ( class_exists( 'Oxygen_VSB_Dynamic_Shortcodes' ) )
210
- array_push( $unsupported, 'Oxygen Builder' );
211
-
212
- if ( class_exists( 'Brizy_Editor_Post' ) )
213
- array_push( $unsupported, 'Brizy Editor' );
214
-
215
- if ( function_exists( 'amd_zlrecipe_convert_to_recipe' ) )
216
- array_push( $unsupported, 'ZipList Recipe' );
217
-
218
- if ( class_exists( 'UberMenu' ) )
219
- array_push( $unsupported, 'UberMenu' );
220
-
221
- if ( class_exists( 'X_Bootstrap' ) )
222
- array_push( $unsupported, 'Theme X' );
223
-
224
- if ( class_exists( 'SiteOrigin_Panels' ) )
225
- array_push( $unsupported, 'SiteOrigin PageBuilder' );
226
-
227
- if ( defined( 'TASTY_PINS_PLUGIN_FILE' ) )
228
- array_push( $unsupported, 'Tasty Pins' );
229
-
230
- if ( class_exists( 'WCFMmp' ) )
231
- array_push( $unsupported, 'WCFM Marketplace' );
232
-
233
- if ( class_exists( 'RevSliderFront' ) )
234
- array_push( $unsupported, 'Revolution Slider' );
235
-
236
- if ( defined( 'WPESTATE_PLUGIN_URL' ) )
237
- array_push( $unsupported, 'WP Residence' );
238
-
239
- if ( defined( 'AV_FRAMEWORK_VERSION' ) )
240
- array_push( $unsupported, 'Avia Framework' );
241
-
242
- if ( class_exists( 'FAT_Portfolio' ) )
243
- array_push( $unsupported, 'FAT Portfolio' );
244
-
245
- if ( class_exists( 'YIKES_Custom_Product_Tabs' ) )
246
- array_push( $unsupported, 'Yikes Custom Product Tabs' );
247
-
248
- if ( function_exists( 'drts' ) )
249
- array_push( $unsupported, 'Directories' );
250
-
251
- if ( class_exists( 'ImageMapPro' ) )
252
- array_push( $unsupported, 'Image Map Pro' );
253
-
254
- if ( class_exists( 'YOOtheme\Builder\Wordpress\BuilderListener' ) ) {
255
- array_push( $unsupported, 'YooTheme Builder' );
256
- }
257
-
258
- if ( class_exists( 'geodirectory' ) ) {
259
- array_push( $unsupported, 'GeoDirectory' );
260
- }
261
-
262
- if ( class_exists( 'Modula' ) ) {
263
- array_push( $unsupported, 'Modula Gallery' );
264
- }
265
-
266
- if ( !empty( $unsupported ) ) {
267
- echo "<div class='notice notice-error'><p>";
268
- _e( "<b>Important note about the following plugin(s): </b>", 'media-cleaner' );
269
- echo '<b>' . join( ', ', $unsupported ) . '</b>. ';
270
- _e( "They require additional checks which are implemented in the <a target='_blank' href='//meowapps.com/plugin/media-cleaner'>Media Cleaner Pro</a>.", 'media-cleaner' );
271
- echo "</p></div>";
272
- }
273
- }
274
-
275
- $check_content = get_option( 'wpmc_content', true );
276
- $check_library = get_option(' wpmc_media_library', true );
277
- $live_content = get_option(' wpmc_live_content', true );
278
-
279
- $access_settings = ' ' . sprintf(
280
- // translators: %s is URL leading to the plugin settings page
281
- __( '<a href="%s">Click here</a> to modify the settings.', 'media-cleaner' ),
282
- 'admin.php?page=wpmc_settings-menu' );
283
-
284
- if ( $method == 'media' && ( $check_content || $live_content ) ) {
285
- echo "<div class='notice notice-success'><p>";
286
- _e( "Media Cleaner will analyze the Media Library for entries which aren't used in the content.", 'media-cleaner' );
287
- echo $access_settings;
288
- echo "</p></div>";
289
- }
290
- else if ( $method == 'media' ) {
291
- echo "<div class='notice notice-error'><p>";
292
- _e( "Media Cleaner will analyze the Media Library. Since <i>Content</i> has not be checked, a special scan will be ran: <u>only broken media entries</u> will be detected.", 'media-cleaner' );
293
- echo $access_settings;
294
- echo "</p></div>";
295
- }
296
- else if ( $method == 'files' && ( $check_content || $live_content ) && $check_library ) {
297
- echo "<div class='notice notice-success'><p>";
298
- _e( "Media Cleaner will analyze the filesystem for files which aren't registered in the Media Library and aren't used in the content.", 'media-cleaner' );
299
- echo $access_settings;
300
- echo "</p></div>";
301
- }
302
- else if ( $method == 'files' && $check_library ) {
303
- echo "<div class='notice notice-success'><p>";
304
- _e( "Media Cleaner will analyze the filesystem for files which aren't registered in the Media Library.", 'media-cleaner' );
305
- echo $access_settings;
306
- echo "</p></div>";
307
- }
308
- else if ( $method == 'files' && ( $check_content || $live_content ) ) {
309
- echo "<div class='notice notice-success'><p>";
310
- _e( "Media Cleaner will analyze the filesystem for files which aren't used in the content.", 'media-cleaner' );
311
- echo $access_settings;
312
- echo "</p></div>";
313
- }
314
- else if ( $method == 'files' ) {
315
- echo "<div class='notice notice-error'><p>";
316
- _e( "Media Cleaner will analyze the filesystem. <b>Neither <i>Content</i> or <i>Media Library</i> has been checked.</b> <u>Therefore, all the files will be listed as issues</u>.", 'media-cleaner' );
317
- echo $access_settings;
318
- echo "</p></div>";
319
- }
320
- else {
321
- echo "<div class='notice notice-error'><p>";
322
- _e( "This type of scan hasn't been set.", 'media-cleaner' );
323
- echo "</p></div>";
324
- }
325
-
326
- echo sprintf(
327
- // translators: %1$s is a number of found issues, %2$s is a size of detected files, %3$s is a total size of files in trash
328
- __( 'There are <b>%1$s issue(s)</b> with your files, accounting for <b>%2$s MB</b>. Your trash contains <b>%3$s MB.</b>', 'media-cleaner' ),
329
- number_format( $issues_count, 0 ),
330
- number_format( $total_size / 1000000, 2 ),
331
- number_format( $trash_total_size / 1000000, 2 )
332
- );
333
- ?>
334
- </p>
335
-
336
- <div id='wpmc-paging'>
337
- <?php
338
-
339
- function create_link( $s, $f, $orderby, $order, $view ) {
340
- return '?page=media-cleaner&s=' . urlencode( $s ) . '&f=' . urlencode( $f ) .
341
- '&orderby=' . urlencode( $orderby ) . '&order=' . urlencode( $order ) . '&view=' . $view;
342
- }
343
-
344
- echo paginate_links(array(
345
- 'base' => create_link( $s, $f, $orderby, $order, $view ) . '%_%',
346
- 'current' => $paged,
347
- 'format' => '&paged=%#%',
348
- 'total' => ceil( $items_count / $posts_per_page ),
349
- 'prev_next' => false
350
- ));
351
- ?>
352
- </div>
353
-
354
- <ul class="subsubsub">
355
- <li class="all"><a <?php if ( $view == 'issues' ) echo "class='current'"; ?> href='?page=media-cleaner&s=<?php echo $s; ?>&view=issues'><?php _e( "Issues", 'media-cleaner' ); ?></a><span class="count">(<?php echo $issues_count; ?>)</span></li> |
356
- <li class="all"><a <?php if ( $view == 'ignored' ) echo "class='current'"; ?> href='?page=media-cleaner&s=<?php echo $s; ?>&view=ignored'><?php _e( "Ignored", 'media-cleaner' ); ?></a><span class="count">(<?php echo $ignored_count; ?>)</span></li> |
357
- <li class="all"><a <?php if ( $view == 'deleted' ) echo "class='current'"; ?> href='?page=media-cleaner&s=<?php echo $s; ?>&view=deleted'><?php _e( "Trash", 'media-cleaner' ); ?></a><span class="count">(<?php echo $deleted_count; ?>)</span></li>
358
- </ul>
359
-
360
- <table id='wpmc-table' class='wp-list-table widefat fixed striped media'>
361
-
362
- <thead>
363
- <tr>
364
- <th scope="col" id="cb" class="manage-column column-cb check-column" style="padding: 8px 2px;">
365
- <input id="wpmc-cb-select-all" type="checkbox">
366
- </th>
367
- <?php if ( !get_option( 'wpmc_hide_thumbnails', false ) ): ?>
368
- <th style='width: 64px;'><?php _e( 'Thumb', 'media-cleaner' ) ?></th>
369
- <?php endif; ?>
370
- <th style='width: 50px;'><?php _e( 'Type', 'media-cleaner' ) ?></th>
371
- <th style='width: 80px;'><?php _e( 'Origin', 'media-cleaner' ) ?></th>
372
-
373
- <?php if ( !empty( $wplr ) ): ?>
374
- <th style='width: 70px;'><?php _e( 'LR ID', 'media-cleaner' ) ?></th>
375
- <?php endif; ?>
376
-
377
- <th class='manage-column sortable <?= $order === "asc" ? "desc" : "asc" ?>'>
378
- <a href='<?= create_link( $s, $f, 'path', ( $order === "asc" ? "desc" : "asc" ), $view ) ?>'>
379
- <span><?php _e( 'Path', 'media-cleaner' ) ?></span>
380
- <span class="sorting-indicator"></span>
381
- </a>
382
- </th>
383
- <th style='width: 220px;'><?php _e( 'Issue', 'media-cleaner' ) ?></th>
384
- <th class='manage-column sortable <?= $order === "asc" ? "desc" : "asc" ?>' style='width: 120px; text-align: right;'>
385
- <a href='<?= create_link( $s, $f, 'size', ( $order === "asc" ? "desc" : "asc" ), $view ) ?>'>
386
- <span><?php _e( 'Size', 'media-cleaner' ) ?></span>
387
- <span class="sorting-indicator"></span>
388
- </a>
389
- </th>
390
- </tr>
391
- </thead>
392
-
393
- <tbody>
394
- <?php
395
- foreach ( $items as $issue ) {
396
- if ( $view == 'deleted' ) {
397
- $regex = "^(.*)(\\s\\(\\+.*)$";
398
- $issue->path = preg_replace( '/' .$regex . '/i', '$1', $issue->path );
399
- }
400
- ?>
401
- <tr>
402
- <td><input type="checkbox" name="id" value="<?php echo $issue->id ?>"></td>
403
- <?php if ( !get_option( 'wpmc_hide_thumbnails', false ) ): ?>
404
- <td>
405
- <?php
406
- if ( $issue->deleted == 0 ) {
407
- if ( $issue ->type == 0 ) {
408
- // FILE
409
- $upload_dir = wp_upload_dir();
410
- $url = htmlspecialchars( $upload_dir['baseurl'] . '/' . $issue->path, ENT_QUOTES );
411
- echo "<a target='_blank' href='" . $url .
412
- "'><img style='max-width: 48px; max-height: 48px;' src='" . $url . "' /></a>";
413
- }
414
- else {
415
- // MEDIA
416
- $file = get_attached_file( $issue->postId );
417
- if ( file_exists( $file ) ) {
418
- $attachmentsrc = wp_get_attachment_image_src( $issue->postId, 'thumbnail' );
419
- if ( empty( $attachmentsrc ) )
420
- echo '<span class="dashicons dashicons-no-alt"></span>';
421
- else {
422
- $attachmentsrc_clean = htmlspecialchars( $attachmentsrc[0], ENT_QUOTES );
423
- echo "<a target='_blank' href='" . $attachmentsrc_clean .
424
- "'><img style='max-width: 48px; max-height: 48px;' src='" .
425
- $attachmentsrc_clean . "' />";
426
- }
427
- }
428
- else {
429
- echo '<span class="dashicons dashicons-no-alt"></span>';
430
- }
431
- }
432
- }
433
- if ( $issue->deleted == 1 ) {
434
- $upload_dir = wp_upload_dir();
435
- $url = htmlspecialchars( $upload_dir['baseurl'] . '/wpmc-trash/' . $issue->path, ENT_QUOTES );
436
- echo "<a target='_blank' href='" . $url .
437
- "'><img style='max-width: 48px; max-height: 48px;' src='" . $url . "' /></a>";
438
- }
439
- ?>
440
- </td>
441
- <?php endif; ?>
442
- <td><?php echo $issue->type == 0 ? 'FILE' : 'MEDIA'; ?></td>
443
- <td><?php echo $issue->type == 0 ? 'Filesystem' : ("<a href='post.php?post=" .
444
- $issue->postId . "&action=edit'>ID " . $issue->postId . "</a>"); ?></td>
445
- <?php if ( !empty( $wplr ) ) { $info = $wplr->get_sync_info( $issue->postId ); ?>
446
- <td style='width: 70px;'><?php echo ( !empty( $info ) && $info->lr_id ? $info->lr_id : "" ); ?></td>
447
- <?php } ?>
448
- <td><?php echo stripslashes( $issue->path ); ?></td>
449
- <td><?php $core->echo_issue( $issue->issue ); ?></td>
450
- <td style='text-align: right;'><?php echo number_format( $issue->size / 1000, 2 ); ?> KB</td>
451
- </tr>
452
- <?php } ?>
453
- </tbody>
454
-
455
- <tfoot>
456
- <tr><th></th>
457
- <?php if ( !get_option( 'hide_thumbnails', false ) ): ?>
458
- <th></th>
459
- <?php endif; ?>
460
- <th><?php _e( 'Type', 'media-cleaner' ) ?></th><th><?php _e( 'Origin', 'media-cleaner' ) ?></th>
461
- <?php if ( !empty( $wplr ) ): ?>
462
- <th style='width: 70px;'><?php _e( 'LR ID', 'media-cleaner' ) ?></th>
463
- <?php endif; ?>
464
- <th><?php _e( 'Path', 'media-cleaner' ) ?></th><th><?php _e( 'Issue', 'media-cleaner' ) ?></th><th style='width: 80px; text-align: right;'><?php _e( 'Size', 'media-cleaner' ) ?></th></tr>
465
- </tfoot>
466
-
467
- </table>
468
-
469
- <div id='wpmc-paging'>
470
- <?php
471
- echo paginate_links(array(
472
- 'base' => '?page=media-cleaner&s=' . urlencode($s) . '&view=' . $view . '%_%',
473
- 'current' => $paged,
474
- 'format' => '&paged=%#%',
475
- 'total' => ceil( $items_count / $posts_per_page ),
476
- 'prev_next' => false
477
- ));
478
- ?>
479
- </div>
480
- </div>
481
-
482
- <div id="wpmc-dialog" class="hidden" style="max-width:800px"></div>
483
-
484
- <div id="wpmc-error-dialog" class="hidden" style="max-width:800px">
485
- <h3><!-- The content will be inserted by JS --></h3>
486
- <p>Please check your logs.<br>Do you want to <a href="#" class="retry">try again</a>, or <a href="#" class="skip">skip this entry</a>?</p>
487
- <div class="options">
488
- <a href="#" class="always-retry"><?php _e( 'Always Retry', 'media-cleaner' ) ?></a>
489
- <a href="#" class="skip-all"><?php _e( 'Skip All', 'media-cleaner' ) ?></a>
490
- </div>
491
- </div>