diff --git a/assets/img/screenshot-13.png b/assets/img/screenshot-13.png new file mode 100644 index 000000000..4651da44a Binary files /dev/null and b/assets/img/screenshot-13.png differ diff --git a/autoload.php b/autoload.php deleted file mode 100644 index 5ea902fbf..000000000 --- a/autoload.php +++ /dev/null @@ -1,152 +0,0 @@ -prefixes[ $prefix ] ) === false ) { - $this->prefixes[ $prefix ] = array(); - } - - // retain the base directory for the namespace prefix - if ( $prepend ) { - array_unshift( $this->prefixes[ $prefix ], $base_dir ); - } else { - array_push( $this->prefixes[ $prefix ], $base_dir ); - } - } - - /** - * Loads the class file for a given class name. - * - * @param string $classname The fully-qualified class name. - * @return mixed The mapped file name on success, or boolean false on - * failure. - */ - public function load_class( $classname ) { - // the current namespace prefix - $prefix = $classname; - - // work backwards through the namespace names of the fully-qualified - // class name to find a mapped file name - while ( false !== $pos = strrpos( $prefix, '\\' ) ) { // phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition, WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition - - // retain the trailing namespace separator in the prefix - $prefix = substr( $classname, 0, $pos + 1 ); - - // the rest is the relative class name - $relative_class = substr( $classname, $pos + 1 ); - - // try to load a mapped file for the prefix and relative class - $mapped_file = $this->load_mapped_file( $prefix, $relative_class ); - if ( $mapped_file ) { - return $mapped_file; - } - - // remove the trailing namespace separator for the next iteration - // of strrpos() - $prefix = rtrim( $prefix, '\\' ); - } - - // never found a mapped file - return false; - } - - /** - * Load the mapped file for a namespace prefix and relative class. - * - * @param string $prefix The namespace prefix. - * @param string $relative_class The relative class name. - * @return mixed Boolean false if no mapped file can be loaded, or the - * name of the mapped file that was loaded. - */ - protected function load_mapped_file( $prefix, $relative_class ) { - // are there any base directories for this namespace prefix? - if ( isset( $this->prefixes[ $prefix ] ) === false ) { - return false; - } - - // look through base directories for this namespace prefix - foreach ( $this->prefixes[ $prefix ] as $base_dir ) { - - // replace the namespace prefix with the base directory, - // replace namespace separators with directory separators - // in the relative class name, append with .php - $file = $base_dir . str_replace( '\\', '/', $relative_class ) . '.php'; - - // if the mapped file exists, require it - if ( $this->require_file( $file ) ) { - // yes, we're done - return $file; - } - } - - // never found it - return false; - } - - /** - * If a file exists, require it from the file system. - * - * @param string $file The file to require. - * @return bool True if the file exists, false if not. - */ - protected function require_file( $file ) { - if ( file_exists( $file ) ) { - require $file; - return true; - } - return false; - } -} - -// instantiate the loader -$classifai_loader = new \Classifai\Psr4AutoloaderClass(); - -// register the autoloader -$classifai_loader->register(); - -// register the base directories for the namespace prefix -$classifai_loader->add_namespace( 'Classifai', __DIR__ . '/includes/Classifai' ); - -require_once __DIR__ . '/includes/Classifai/Helpers.php'; -require_once __DIR__ . '/includes/Classifai/Blocks.php'; diff --git a/classifai.php b/classifai.php index daa46115f..4982c4446 100644 --- a/classifai.php +++ b/classifai.php @@ -4,7 +4,7 @@ * Plugin URI: https://github.com/10up/classifai * Update URI: https://classifaiplugin.com * Description: Enhance your WordPress content with Artificial Intelligence and Machine Learning services. - * Version: 2.5.1 + * Version: 3.0.0 * Requires at least: 6.1 * Requires PHP: 7.4 * Author: 10up @@ -59,13 +59,14 @@ function () { } /** - * Small wrapper around PHP's define function. The defined constant is - * ignored if it has already been defined. This allows the - * config.local.php to override any constant in config.php. + * Small wrapper around PHP's define function. * - * @param string $name The constant name - * @param mixed $value The constant value - * @return void + * The defined constant is ignored if it has already + * been defined. This allows these constants to be + * overridden. + * + * @param string $name The constant name. + * @param mixed $value The constant value. */ function classifai_define( $name, $value ) { if ( ! defined( $name ) ) { @@ -73,39 +74,17 @@ function classifai_define( $name, $value ) { } } -if ( file_exists( __DIR__ . '/config.test.php' ) && defined( 'PHPUNIT_RUNNER' ) ) { - require_once __DIR__ . '/config.test.php'; -} - -if ( file_exists( __DIR__ . '/config.local.php' ) ) { - require_once __DIR__ . '/config.local.php'; -} - require_once __DIR__ . '/config.php'; -classifai_define( 'CLASSIFAI_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); /** - * Loads the CLASSIFAI PHP autoloader if possible. + * Loads the autoloader if possible. * * @return bool True or false if autoloading was successful. */ function classifai_autoload() { - if ( classifai_can_autoload() ) { - require_once classifai_autoloader(); + if ( file_exists( CLASSIFAI_PLUGIN_DIR . '/vendor/autoload.php' ) ) { + require_once CLASSIFAI_PLUGIN_DIR . '/vendor/autoload.php'; - return true; - } else { - return false; - } -} - -/** - * In server mode we can autoload if autoloader file exists. For - * test environments we prevent autoloading of the plugin to prevent - * global pollution and for better performance. - */ -function classifai_can_autoload() { - if ( file_exists( classifai_autoloader() ) ) { return true; } else { error_log( // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log @@ -116,32 +95,19 @@ function classifai_can_autoload() { } } -/** - * Default is Composer's autoloader - */ -function classifai_autoloader() { - if ( file_exists( CLASSIFAI_PLUGIN_DIR . '/vendor/autoload.php' ) ) { - return CLASSIFAI_PLUGIN_DIR . '/vendor/autoload.php'; - } else { - return CLASSIFAI_PLUGIN_DIR . '/autoload.php'; - } -} - /** * Gets the installation message error. * - * This was put in a function specifically because it's used both in WP-CLI and within an admin notice if not using - * WP-CLI. + * Used both in a WP-CLI context and within an admin notice. * * @return string */ function get_error_install_message() { - return esc_html__( 'Error: Please run $ composer install in the classifai plugin directory.', 'classifai' ); + return esc_html__( 'Error: Please run $ composer install in the ClassifAI plugin directory.', 'classifai' ); } /** - * Plugin code entry point. Singleton instance is used to maintain a common single - * instance of the plugin throughout the current request's lifecycle. + * Plugin code entry point. * * If autoloading failed an admin notice is shown and logged to * the PHP error_log. @@ -167,7 +133,6 @@ function classifai_autorun() { } } - /** * Generate a notice if autoload fails. */ @@ -176,9 +141,8 @@ function classifai_autoload_notice() { error_log( get_error_install_message() ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log } - /** - * Register an activation hook that we can hook into. + * Run functionality on plugin activation. */ function classifai_activation() { set_transient( 'classifai_activation_notice', 'classifai', HOUR_IN_SECONDS ); diff --git a/config.php b/config.php index 4050f7991..f450c479c 100644 --- a/config.php +++ b/config.php @@ -1,20 +1,18 @@ array('react', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => 'e2c9e5cff2b23adf4bdb'); + array('react', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '1518940c87b240cc4463'); diff --git a/dist/admin.css b/dist/admin.css index ec5f42fc2..9bebc13a2 100644 --- a/dist/admin.css +++ b/dist/admin.css @@ -1,3 +1,3 @@ -:root{--classifai-admin-theme-color:#007cba;--classifai-admin-theme-color--rgb:0,124,186;--classifai-admin-theme-color-darker-10:#006ba1;--classifai-highlight-color:#007cba}body.admin-color-light{--classifai-admin-theme-color:#0085ba;--classifai-admin-theme-color--rgb:0,133,186;--classifai-admin-theme-color-darker-10:#0073a1;--classifai-highlight-color:#04a4cc}body.admin-color-modern{--classifai-admin-theme-color:#3858e9;--classifai-admin-theme-color--rgb:56,88,233;--classifai-admin-theme-color-darker-10:#2145e6;--classifai-highlight-color:#3858e9}body.admin-color-blue{--classifai-admin-theme-color:#096484;--classifai-admin-theme-color--rgb:9,100,132;--classifai-admin-theme-color-darker-10:#07526c;--classifai-highlight-color:#096484}body.admin-color-coffee{--classifai-admin-theme-color:#46403c;--classifai-admin-theme-color--rgb:70,64,60;--classifai-admin-theme-color-darker-10:#383330;--classifai-highlight-color:#c7a589}body.admin-color-ectoplasm{--classifai-admin-theme-color:#523f6d;--classifai-admin-theme-color--rgb:82,63,109;--classifai-admin-theme-color-darker-10:#46365d;--classifai-highlight-color:#a3b745}body.admin-color-midnight{--classifai-admin-theme-color:#e14d43;--classifai-admin-theme-color--rgb:225,77,67;--classifai-admin-theme-color-darker-10:#dd382d;--classifai-highlight-color:#e14d43}body.admin-color-ocean{--classifai-admin-theme-color:#627c83;--classifai-admin-theme-color--rgb:98,124,131;--classifai-admin-theme-color-darker-10:#576e74;--classifai-highlight-color:#9ebaa0}body.admin-color-sunrise{--classifai-admin-theme-color:#dd823b;--classifai-admin-theme-color--rgb:221,130,59;--classifai-admin-theme-color-darker-10:#d97426;--classifai-highlight-color:#dd823b}#classifai-activation-notice{padding:24px}#classifai-activation-notice .classifai-logo{line-height:0}#classifai-activation-notice .classifai-logo img{width:180px}#classifai-activation-notice h3.classifai-activation-message{font-size:1.6em;font-weight:400;line-height:1.3;margin:8px 0 18px}a.classifai-button,input.classifai-button{background:var(--classifai-admin-theme-color);border-color:var(--classifai-admin-theme-color);border-radius:4px;border-style:solid;border-width:1px;box-sizing:border-box;color:#fff;cursor:pointer;display:inline-block;font-size:14px;font-style:normal;font-weight:400;padding:8px 16px;text-decoration:none;text-shadow:none;text-transform:uppercase;white-space:nowrap}a.classifai-button:active,a.classifai-button:focus,a.classifai-button:hover,input.classifai-button:active,input.classifai-button:focus,input.classifai-button:hover{background:var(--classifai-admin-theme-color-darker-10);border-color:var(--classifai-admin-theme-color-darker-10);color:#fff}a.classifai-button:focus,input.classifai-button:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px var(--classifai-admin-theme-color-darker-10)}a.classifai-button:active,input.classifai-button:active{box-shadow:none}a.classifai-button.disabled,a.classifai-button:disabled,input.classifai-button.disabled,input.classifai-button:disabled{background:#9ea3a8;box-shadow:none;color:#fff;cursor:not-allowed}#classifai-header{background-color:#fff;box-shadow:0 10px 10px 0 #f0f0f1;box-sizing:border-box;display:block;left:0;margin-left:-20px;padding:0 10px;position:sticky;right:0;top:0;z-index:1001}@media screen and (max-width:782px){#classifai-header{margin-left:-10px;padding:0 5px}}@media(min-width:601px){body.admin-bar #classifai-header{top:46px}}@media(min-width:783px){body.admin-bar #classifai-header{top:32px}}.classifai-setup-page #classifai-header{position:relative}@media(min-width:601px){body.admin-bar .classifai-setup-page #classifai-header{top:0}}@media(min-width:783px){body.admin-bar .classifai-setup-page #classifai-header{top:0}}#classifai-header .classifai-header-layout{align-items:center;display:flex;justify-content:space-between;padding:18px}#classifai-header #classifai-logo{line-height:0}#classifai-header #classifai-logo img{max-width:180px}#classifai-header #classifai-header-controls{align-items:center;display:flex;flex-direction:row}#classifai-header #classifai-header-controls .header-control-item{align-items:center;cursor:pointer;display:flex;flex-direction:column;justify-content:center;margin-left:24px;outline:none;position:relative}#classifai-header #classifai-header-controls a.classifai-help-links{color:#757575;text-align:center;text-decoration:none}#classifai-header #classifai-header-controls a.classifai-help-links:hover,#classifai-header #classifai-header-controls a.classifai-help-links[aria-expanded=true]{color:var(--classifai-admin-theme-color)}#classifai-header #classifai-header-controls a.classifai-help-links span.control-item-text{display:block}#classifai-header .classifai-help-menu{display:block;width:200px}#classifai-header .classifai-help-menu__menu-item{color:#757575;display:block;padding:8px 12px;text-decoration:none}#classifai-header .classifai-help-menu__menu-item:hover{color:var(--classifai-admin-theme-color)}.admin_page_classifai_setup #classifai-header{box-shadow:none}.classifai-content .classifai-wrap{background-color:#fff;border-radius:4px;margin:0 20px 0 0;padding:24px}.classifai-content .classifai-wrap .form-table td fieldset p{margin-bottom:12px}.classifai-content .classifai-wrap textarea{max-width:600px}.classifai-content .classifai-wrap .description{display:block;line-height:1.4;margin-top:8px;max-width:600px}.classifai-content .classifai-wrap tr.allowed_users_row .classifai-search-users-container{max-width:600px}.classifai-content .classifai-wrap tr.allowed_users_row .classifai-search-users-container label.components-form-token-field__label{display:none}.classifai-content .classifai-wrap .components-form-token-field__input-container.is-active{border-color:var(--classifai-highlight-color);box-shadow:0 0 0 1px var(--classifai-highlight-color);outline:2px solid transparent}.classifai-content .classifai-wrap .components-form-token-field__suggestion.is-selected{background:var(--classifai-highlight-color)}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting{border:1px solid #f0f0f1;display:flex;flex-direction:column;max-width:600px;padding:5px 20px;position:relative}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting:first-child>input,.classifai-content .classifai-wrap .classifai-field-type-prompt-setting:first-child>label{display:none}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting:nth-child(odd){background-color:#f0f0f1}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting label{display:block}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting input,.classifai-content .classifai-wrap .classifai-field-type-prompt-setting textarea{display:block;margin-right:0}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting input[type=text]{width:90%}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting .actions-rows{display:flex;margin:.35em 0 .5em!important}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting .actions-rows a{cursor:pointer;margin-left:8px;text-decoration:none}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting .actions-rows a.action__remove_prompt{color:#b32d2e}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting .actions-rows a:before{color:#a7aaad;content:"|"}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting .actions-rows a:first-child{margin-left:0}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting .actions-rows a:first-child.selected{color:#a7aaad;pointer-events:none}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting .actions-rows a:first-child:before{content:""}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting+button{margin-top:10px}.classifai-content input[type=password],.classifai-content input[type=text]{font-size:14px;height:38px;margin-bottom:4px}.classifai-content .components-form-token-field__input-container input[type=text].components-form-token-field__input{font-size:14px;height:auto;margin-bottom:0;min-height:32px}.classifai-content h2.nav-tab-wrapper.classifai-nav-wrapper{border-color:transparent;margin-right:20px;margin-top:20px;padding-top:0}.classifai-content a.nav-tab{background:transparent;border:none;margin-left:0;padding:10px 12px;position:relative}.classifai-content a.nav-tab:after{background:var(--classifai-admin-theme-color);border-radius:3px 3px 0 0;bottom:0;box-shadow:0 4px 10px 3px rgba(var(--classifai-admin-theme-color--rgb),.15);content:"";height:3px;left:0;opacity:0;position:absolute;right:0;transform:scaleX(0);transition:all .3s cubic-bezier(1,0,0,1);will-change:transform,box-shadow,opacity}.classifai-content a.nav-tab.nav-tab-active,.classifai-content a.nav-tab:hover{color:var(--classifai-admin-theme-color);font-weight:600}.classifai-content a.nav-tab.nav-tab-active:after,.classifai-content a.nav-tab:hover:after{opacity:1;transform:scale(1)}.classifai-setup{margin-left:-20px}.classifai-setup__header{align-items:center;background:#fff;border-bottom:1px solid #dcdcde;border-top:1px solid #dcdcde;display:flex;height:60px;justify-content:center}.classifai-setup__step-wrapper{margin:0 16px;max-width:980px;width:100%}.classifai-setup__steps{display:flex;justify-content:space-around}.classifai-setup__step{font-weight:400;padding:8px;position:relative}.classifai-setup__step__label{align-items:center;display:inline-flex;font-size:16px;justify-content:center}.classifai-setup__step__label span.step-count{background:#f0f0f0;border-radius:50%;color:#757575;height:24px;margin-right:8px;min-width:24px;width:24px}.classifai-setup__step__label span.step-count,.classifai-setup__step__label span.step-title{align-items:center;display:inline-flex;justify-content:center}.classifai-setup__step__label a,.classifai-setup__step__label a:active,.classifai-setup__step__label a:focus,.classifai-setup__step__label a:hover{color:#3c434a;display:inherit;text-decoration:none}@media screen and (max-width:480px){.classifai-setup__step__label{font-size:14px}}.classifai-setup__step.is-complete span.step-count{background:var(--classifai-admin-theme-color);color:#fff}.classifai-setup__step.is-active span.step-title{font-weight:600}.classifai-setup__step.is-active span.step-count{background:var(--classifai-admin-theme-color);color:#fff}.classifai-setup__step-divider{align-self:flex-start;border-bottom:1px solid #f0f0f0;flex-grow:1;margin-top:20px}.classifai-setup__step-label{font-size:1.2em}@media screen and (max-width:782px){.classifai-setup{margin-left:-10px}}.classifai-setup__wrapper{margin:0 auto;max-width:1232px}.classifai-setup__content{background-color:#fff;border-radius:4px;box-sizing:border-box;display:block;margin:20px;padding:24px 24px 48px}.classifai-setup__content__row{display:flex;flex-direction:row;flex-wrap:wrap;width:100%}.classifai-setup__content__row__column{display:flex;flex-basis:100%;flex-direction:column}.classifai-setup__content__row__column img{max-width:400px;width:100%}@media screen and (min-width:767px){.classifai-setup__content__row__column{flex:1;padding:0 10px}}.classifai-setup__content h1.classifai-setup-heading{font-size:22px;font-weight:600;margin:24px 0;text-align:center}.classifai-setup__content .classifai-setup-image{margin-top:20px;text-align:center}.classifai-setup__content h2.classifai-setup-title{font-size:22px;font-weight:400;margin:0;padding:0}.classifai-setup__content .classifai-step1-content,.classifai-setup__content .classifai-step4-content{margin-top:20px;max-width:400px}.classifai-setup__content .classifai-step2-content{margin:0 auto;max-width:480px}.classifai-setup__content .classifai-setup-footer{margin-top:40px}.classifai-setup__content .classifai-feature-box{margin:40px 0}.classifai-setup__content .classifai-feature-box-title{font-weight:700;text-transform:uppercase}.classifai-setup__content li.classifai-enable-feature{clear:both;display:block;list-style:none;margin-top:14px;width:100%}.classifai-setup__content li.classifai-enable-feature span.dashicons.dashicons-yes-alt{color:#48be1e}.classifai-setup__content li.classifai-enable-feature span.dashicons.dashicons-dismiss{color:#c00}.classifai-setup__content .classifai-feature-box-divider{border:1px solid #ddd}.classifai-setup__content label.classifai-feature-text,.classifai-setup__content span.classifai-feature-text{color:#707070;font-size:14px}.classifai-setup__content span.classifai-feature-text{float:left}.classifai-setup__content .classifai-setup-footer{text-align:right}.classifai-setup__content a.classifai-setup-skip-link{color:#000;font-weight:400;text-decoration:none}.classifai-setup__content .classifai-setup-footer__right{margin-left:40px}@media screen and (max-width:767px){.classifai-setup__content .classifai-step1-content,.classifai-setup__content .classifai-step4-content{margin-top:20px;max-width:100%}.classifai-setup__content h2.classifai-setup-title{text-align:center}}.classifai-step3-content .classifai-setup__content .classifai-setup-form{margin:0 auto;max-width:480px}.classifai-setup__content .classifai-setup-form .classifai-setup-form-field{margin-top:40px}.classifai-setup__content .classifai-setup-form label{display:block;font-weight:700;margin-bottom:20px;text-transform:uppercase}.classifai-setup__content .classifai-setup-form input[type=password],.classifai-setup__content .classifai-setup-form input[type=text]{font-size:14px;height:38px;margin-bottom:4px;width:100%}.classifai-setup__content .classifai-setup-form .classifai-setup-footer{margin-top:40px}.classifai-setup__content .classifai-step3-content{margin:0 auto}.classifai-setup__content .classifai-step3-content .classifai-setup-title{margin-bottom:12px;text-align:center}.classifai-setup__content .classifai-step3-content .classifai-setup-footer,.classifai-setup__content .classifai-step3-content .classifai-setup-form{margin:0 auto;max-width:480px}.classifai-setup__content .classifai-step3-content .classifai-setup-footer{margin-top:40px}.classifai-setup__content .classifai-tabs{display:block}.classifai-setup__content .classifai-tabs.tabs-center{margin:auto auto 24px}.classifai-setup__content .classifai-tabs.tabs-justify{table-layout:fixed;width:100%}.classifai-setup__content .classifai-tabs a.tab{color:#1d2327;cursor:pointer;display:inline-block;font-size:14px;padding:16px 12px;position:relative;text-decoration:none;transform:translateZ(0);transition:all .3s ease;white-space:nowrap}.classifai-setup__content .classifai-tabs a.tab:focus{box-shadow:none}.classifai-setup__content .classifai-tabs a.tab:hover{color:var(--classifai-admin-theme-color)}.classifai-setup__content .classifai-tabs a.tab:after{background:var(--classifai-admin-theme-color);border-radius:3px 3px 0 0;bottom:0;box-shadow:0 4px 10px 3px rgba(var(--classifai-admin-theme-color--rgb),.15);content:"";height:3px;left:0;opacity:0;position:absolute;right:0;transform:scaleX(0);transition:all .3s cubic-bezier(1,0,0,1);will-change:transform,box-shadow,opacity}.classifai-setup__content .classifai-tabs a.tab.active{color:var(--classifai-admin-theme-color);font-weight:600}.classifai-setup__content .classifai-tabs a.tab.active:after{opacity:1;transform:scale(1)}.classifai-setup__content p.classifai-setup-error{color:red;text-align:center}.classifai-setup__content span.description{font-size:12px}.classifai-toggle{cursor:pointer;display:inline-block;text-align:right;width:100%}.classifai-toggle-switch{background:transparent;border:1px solid #1e1e1e;border-radius:9px;box-sizing:border-box;display:inline-block;height:18px;position:relative;transition:background .25s;vertical-align:middle;width:36px}.classifai-toggle-switch:after,.classifai-toggle-switch:before{content:""}.classifai-toggle-switch:before{background:#1e1e1e;border-radius:50%;box-sizing:border-box;display:block;height:12px;left:2px;position:absolute;top:2px;transition:left .25s;width:12px}.classifai-toggle-checkbox:checked+.classifai-toggle-switch{background:var(--classifai-admin-theme-color);border-color:var(--classifai-admin-theme-color)}.classifai-toggle-checkbox:checked+.classifai-toggle-switch:before{background-color:#fff;left:20px}.classifai-toggle-checkbox{position:absolute;visibility:hidden}#classifai-generate-excerpt{position:absolute;right:12px;top:70px}.classify-post-componenet hr{margin-bottom:20px}.classify-modal{width:500px}.classify-modal hr{margin-bottom:20px}.classifai-modal__notes{float:left;font-size:10px;max-width:350px}.classifai-modal__footer{overflow:hidden}.classifai-modal__footer button{float:right}.editor-post-publish-panel .classifai-modal__footer button{float:none;margin-top:10px}#classifai-profile-features-section tr.classifai-features-row th{padding:10px 10px 10px 0}#classifai-profile-features-section tr.classifai-features-row td{padding:10px}a.components-button.classifai-disable-feature-link{display:block;margin-top:12px}div.classifai-openai__result-disable-link{display:block;padding:0 1em 1.5em} +:root{--classifai-admin-theme-color:#007cba;--classifai-admin-theme-color--rgb:0,124,186;--classifai-admin-theme-color-darker-10:#006ba1;--classifai-highlight-color:#007cba}body.admin-color-light{--classifai-admin-theme-color:#0085ba;--classifai-admin-theme-color--rgb:0,133,186;--classifai-admin-theme-color-darker-10:#0073a1;--classifai-highlight-color:#04a4cc}body.admin-color-modern{--classifai-admin-theme-color:#3858e9;--classifai-admin-theme-color--rgb:56,88,233;--classifai-admin-theme-color-darker-10:#2145e6;--classifai-highlight-color:#3858e9}body.admin-color-blue{--classifai-admin-theme-color:#096484;--classifai-admin-theme-color--rgb:9,100,132;--classifai-admin-theme-color-darker-10:#07526c;--classifai-highlight-color:#096484}body.admin-color-coffee{--classifai-admin-theme-color:#46403c;--classifai-admin-theme-color--rgb:70,64,60;--classifai-admin-theme-color-darker-10:#383330;--classifai-highlight-color:#c7a589}body.admin-color-ectoplasm{--classifai-admin-theme-color:#523f6d;--classifai-admin-theme-color--rgb:82,63,109;--classifai-admin-theme-color-darker-10:#46365d;--classifai-highlight-color:#a3b745}body.admin-color-midnight{--classifai-admin-theme-color:#e14d43;--classifai-admin-theme-color--rgb:225,77,67;--classifai-admin-theme-color-darker-10:#dd382d;--classifai-highlight-color:#e14d43}body.admin-color-ocean{--classifai-admin-theme-color:#627c83;--classifai-admin-theme-color--rgb:98,124,131;--classifai-admin-theme-color-darker-10:#576e74;--classifai-highlight-color:#9ebaa0}body.admin-color-sunrise{--classifai-admin-theme-color:#dd823b;--classifai-admin-theme-color--rgb:221,130,59;--classifai-admin-theme-color-darker-10:#d97426;--classifai-highlight-color:#dd823b}#classifai-activation-notice{padding:24px}#classifai-activation-notice .classifai-logo{line-height:0}#classifai-activation-notice .classifai-logo img{width:180px}#classifai-activation-notice h3.classifai-activation-message{font-size:1.6em;font-weight:400;line-height:1.3;margin:8px 0 18px}a.classifai-button,input.classifai-button{background:var(--classifai-admin-theme-color);border-color:var(--classifai-admin-theme-color);border-radius:4px;border-style:solid;border-width:1px;box-sizing:border-box;color:#fff;cursor:pointer;display:inline-block;font-size:14px;font-style:normal;font-weight:400;padding:8px 16px;text-decoration:none;text-shadow:none;text-transform:uppercase;white-space:nowrap}a.classifai-button:active,a.classifai-button:focus,a.classifai-button:hover,input.classifai-button:active,input.classifai-button:focus,input.classifai-button:hover{background:var(--classifai-admin-theme-color-darker-10);border-color:var(--classifai-admin-theme-color-darker-10);color:#fff}a.classifai-button:focus,input.classifai-button:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px var(--classifai-admin-theme-color-darker-10)}a.classifai-button:active,input.classifai-button:active{box-shadow:none}a.classifai-button.disabled,a.classifai-button:disabled,input.classifai-button.disabled,input.classifai-button:disabled{background:#9ea3a8;box-shadow:none;color:#fff;cursor:not-allowed}#classifai-header{background-color:#fff;box-shadow:0 10px 10px 0 #f0f0f1;box-sizing:border-box;display:block;left:0;margin-left:-20px;padding:0 10px;position:sticky;right:0;top:0;z-index:1001}@media screen and (max-width:782px){#classifai-header{margin-left:-10px;padding:0 5px}}@media(min-width:601px){body.admin-bar #classifai-header{top:46px}}@media(min-width:783px){body.admin-bar #classifai-header{top:32px}}.classifai-setup-page #classifai-header{position:relative}@media(min-width:601px){body.admin-bar .classifai-setup-page #classifai-header{top:0}}@media(min-width:783px){body.admin-bar .classifai-setup-page #classifai-header{top:0}}#classifai-header .classifai-header-layout{align-items:center;display:flex;justify-content:space-between;padding:18px}#classifai-header #classifai-logo{line-height:0}#classifai-header #classifai-logo img{max-width:180px}#classifai-header #classifai-header-controls{align-items:center;display:flex;flex-direction:row}#classifai-header #classifai-header-controls .header-control-item{align-items:center;cursor:pointer;display:flex;flex-direction:column;justify-content:center;margin-left:24px;outline:none;position:relative}#classifai-header #classifai-header-controls a.classifai-help-links{color:#757575;text-align:center;text-decoration:none}#classifai-header #classifai-header-controls a.classifai-help-links:hover,#classifai-header #classifai-header-controls a.classifai-help-links[aria-expanded=true]{color:var(--classifai-admin-theme-color)}#classifai-header #classifai-header-controls a.classifai-help-links span.control-item-text{display:block}#classifai-header .classifai-help-menu{display:block;width:200px}#classifai-header .classifai-help-menu__menu-item{color:#757575;display:block;padding:8px 12px;text-decoration:none}#classifai-header .classifai-help-menu__menu-item:hover{color:var(--classifai-admin-theme-color)}.admin_page_classifai_setup #classifai-header{box-shadow:none}.classifai-content .classifai-wrap{background-color:#fff;border-radius:4px;margin:0 20px 0 0;padding:24px}.classifai-content .classifai-wrap .form-table td fieldset p{margin-bottom:12px}.classifai-content .classifai-wrap textarea{max-width:600px}.classifai-content .classifai-wrap .description{display:block;line-height:1.4;margin-top:8px;max-width:600px}.classifai-content .classifai-wrap tr.allowed_users_row .classifai-search-users-container{max-width:600px}.classifai-content .classifai-wrap tr.allowed_users_row .classifai-search-users-container label.components-form-token-field__label{display:none}.classifai-content .classifai-wrap .components-form-token-field__input-container.is-active{border-color:var(--classifai-highlight-color);box-shadow:0 0 0 1px var(--classifai-highlight-color);outline:2px solid transparent}.classifai-content .classifai-wrap .components-form-token-field__suggestion{box-sizing:border-box}.classifai-content .classifai-wrap .components-form-token-field__suggestion.is-selected{background:var(--classifai-highlight-color)}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting{border:1px solid #f0f0f1;display:flex;flex-direction:column;max-width:600px;padding:5px 20px;position:relative}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting:first-child>input,.classifai-content .classifai-wrap .classifai-field-type-prompt-setting:first-child>label{display:none}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting:nth-child(odd){background-color:#f0f0f1}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting label{display:block}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting input,.classifai-content .classifai-wrap .classifai-field-type-prompt-setting textarea{display:block;margin-right:0}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting input[type=text]{width:90%}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting .actions-rows{display:flex;margin:.35em 0 .5em!important}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting .actions-rows a{cursor:pointer;margin-left:8px;text-decoration:none}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting .actions-rows a.action__remove_prompt{color:#b32d2e}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting .actions-rows a:before{color:#a7aaad;content:"|"}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting .actions-rows a:first-child{margin-left:0}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting .actions-rows a:first-child.selected{color:#a7aaad;pointer-events:none}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting .actions-rows a:first-child:before{content:""}.classifai-content .classifai-wrap .classifai-field-type-prompt-setting+button{margin-top:10px}.classifai-content input[type=password],.classifai-content input[type=text]{font-size:14px;height:38px;margin-bottom:4px}.classifai-content .hide-username{display:none}.classifai-content .components-form-token-field__input-container input[type=text].components-form-token-field__input{font-size:14px;height:auto;margin-bottom:0;min-height:32px}.classifai-content h2.nav-tab-wrapper.classifai-nav-wrapper{border-color:transparent;margin-right:20px;margin-top:20px;padding-top:0}.classifai-content a.nav-tab{background:transparent;border:none;margin-left:0;padding:10px 12px;position:relative}.classifai-content a.nav-tab:after{background:var(--classifai-admin-theme-color);border-radius:3px 3px 0 0;bottom:0;box-shadow:0 4px 10px 3px rgba(var(--classifai-admin-theme-color--rgb),.15);content:"";height:3px;left:0;opacity:0;position:absolute;right:0;transform:scaleX(0);transition:all .3s cubic-bezier(1,0,0,1);will-change:transform,box-shadow,opacity}.classifai-content a.nav-tab.nav-tab-active,.classifai-content a.nav-tab:hover{color:var(--classifai-admin-theme-color);font-weight:600}.classifai-content a.nav-tab.nav-tab-active:after,.classifai-content a.nav-tab:hover:after{opacity:1;transform:scale(1)}.classifai-setup{margin-left:-20px}.classifai-setup__header{align-items:center;background:#fff;border-bottom:1px solid #dcdcde;border-top:1px solid #dcdcde;display:flex;height:60px;justify-content:center}.classifai-setup__step-wrapper{margin:0 16px;max-width:980px;width:100%}.classifai-setup__steps{display:flex;justify-content:space-around}.classifai-setup__step{font-weight:400;padding:8px;position:relative}.classifai-setup__step__label{align-items:center;display:inline-flex;font-size:16px;justify-content:center}.classifai-setup__step__label span.step-count{background:#f0f0f0;border-radius:50%;color:#757575;height:24px;margin-right:8px;min-width:24px;width:24px}.classifai-setup__step__label span.step-count,.classifai-setup__step__label span.step-title{align-items:center;display:inline-flex;justify-content:center}.classifai-setup__step__label a,.classifai-setup__step__label a:active,.classifai-setup__step__label a:focus,.classifai-setup__step__label a:hover{color:#3c434a;display:inherit;text-decoration:none}@media screen and (max-width:480px){.classifai-setup__step__label{font-size:14px}}.classifai-setup__step.is-complete span.step-count{background:var(--classifai-admin-theme-color);color:#fff}.classifai-setup__step.is-active span.step-title{font-weight:600}.classifai-setup__step.is-active span.step-count{background:var(--classifai-admin-theme-color);color:#fff}.classifai-setup__step-divider{align-self:flex-start;border-bottom:1px solid #f0f0f0;flex-grow:1;margin-top:20px}.classifai-setup__step-label{font-size:1.2em}@media screen and (max-width:782px){.classifai-setup{margin-left:-10px}}.classifai-setup .classifai-wrap,.classifai-setup__wrapper{margin:0 auto;max-width:1232px;padding:0}.classifai-setup__content{background-color:#fff;border-radius:4px;box-sizing:border-box;display:block;margin:20px;padding:24px 24px 48px}.classifai-setup__content__row{display:flex;flex-direction:row;flex-wrap:wrap;width:100%}.classifai-setup__content__row__column{display:flex;flex-basis:100%;flex-direction:column}.classifai-setup__content__row__column img{max-width:400px;width:100%}@media screen and (min-width:767px){.classifai-setup__content__row__column{flex:1;padding:0 10px}}.classifai-setup__content h1.classifai-setup-heading{font-size:22px;font-weight:600;margin:24px 0;text-align:center}.classifai-setup__content .classifai-setup-image{margin-top:20px;text-align:center}.classifai-setup__content h2.classifai-setup-title{font-size:22px;font-weight:400;margin:0;padding:0}.classifai-setup__content .classifai-step1-content,.classifai-setup__content .classifai-step4-content{margin-top:20px;max-width:400px}.classifai-setup__content .classifai-step2-content{margin:0 auto;max-width:480px}.classifai-setup__content .classifai-setup-footer{margin-top:40px}.classifai-setup__content .classifai-feature-box{margin:40px 0}.classifai-setup__content .classifai-feature-box-title{font-weight:700;text-transform:uppercase}.classifai-setup__content li.classifai-enable-feature{clear:both;display:block;list-style:none;margin-top:14px;width:100%}.classifai-setup__content li.classifai-enable-feature span.dashicons.dashicons-yes-alt{color:#48be1e}.classifai-setup__content li.classifai-enable-feature span.dashicons.dashicons-dismiss{color:#c00}.classifai-setup__content .classifai-feature-box-divider{border:1px solid #ddd}.classifai-setup__content label.classifai-feature-text,.classifai-setup__content span.classifai-feature-text{color:#707070;font-size:14px}.classifai-setup__content span.classifai-feature-text{float:left}.classifai-setup__content .classifai-setup-footer{text-align:right}.classifai-setup__content a.classifai-setup-skip-link{color:#000;font-weight:400;text-decoration:none}.classifai-setup__content .classifai-setup-footer__right{margin-left:40px}@media screen and (max-width:767px){.classifai-setup__content .classifai-step1-content,.classifai-setup__content .classifai-step4-content{margin-top:20px;max-width:100%}.classifai-setup__content h2.classifai-setup-title{text-align:center}}.classifai-step3-content .classifai-setup__content .classifai-setup-form{margin:0 auto}.classifai-setup__content .classifai-setup-form .classifai-setup-form-field-label{text-align:left}.classifai-setup__content .classifai-setup-form .classifai-setup-form-field{padding:0}.classifai-setup__content .classifai-setup-form .classifai-setup-form-field-label>label{display:block;font-weight:700;margin-bottom:0;text-transform:uppercase}.classifai-setup__content .classifai-setup-form input[type=password],.classifai-setup__content .classifai-setup-form input[type=text]{font-size:14px;height:38px;margin-bottom:4px;width:100%}.classifai-setup__content .classifai-setup-form .classifai-setup-footer{margin-top:40px}.classifai-setup__content .classifai-step3-content{margin:0 auto;max-width:840px;width:100%}.classifai-setup__content .classifai-step3-content .classifai-setup-title{margin-bottom:12px;text-align:center}.classifai-setup__content .classifai-step3-content .classifai-setup-form{box-sizing:border-box;padding-left:48px;width:70%}@media screen and (max-width:782px){.classifai-setup__content .classifai-step3-content .classifai-setup-form{padding-left:18px}}@media screen and (max-width:600px){.classifai-setup__content .classifai-step3-content .classifai-setup-form{margin-bottom:20px;padding-left:0;width:100%}}.classifai-setup__content .classifai-step3-content .classifai-setup-footer{margin-top:20px}.classifai-setup__content .classifai-tabs{box-sizing:border-box;display:block;width:30%}@media screen and (max-width:600px){.classifai-setup__content .classifai-tabs{width:100%}}.classifai-setup__content .classifai-tabs.tabs-center{margin-bottom:24px}.classifai-setup__content .classifai-tabs.tabs-justify{table-layout:fixed;width:100%}.classifai-setup__content .classifai-tabs a.tab{color:#1d2327;cursor:pointer;display:block;font-size:14px;padding:16px 12px;position:relative;text-decoration:none;transform:translateZ(0);transition:all .3s ease}.classifai-setup__content .classifai-tabs a.tab:focus{box-shadow:none}.classifai-setup__content .classifai-tabs a.tab:hover{color:var(--classifai-admin-theme-color)}.classifai-setup__content .classifai-tabs a.tab.active{background:#f0f0f0;border-radius:4px;box-shadow:none;font-weight:600}.classifai-setup__content .classifai-tabs a.tab.active:after{opacity:1;transform:scale(1)}.classifai-setup__content .classifai-providers-wrapper{display:flex;flex-direction:row;flex-wrap:wrap}.classifai-setup__content p.classifai-setup-error{color:red;text-align:center}.classifai-setup__content span.description{font-size:12px}.classifai-setup__content .dashicons-clock{color:#a7aaad}.classifai-setup__content .dashicons-yes-alt{color:#48be1e}.classifai-setup__content .dashicons-warning{color:#dba617}.classifai-toggle{cursor:pointer;display:inline-block;text-align:right;width:100%}.classifai-toggle-switch{background:transparent;border:1px solid #1e1e1e;border-radius:9px;box-sizing:border-box;display:inline-block;height:18px;position:relative;transition:background .25s;vertical-align:middle;width:36px}.classifai-toggle-switch:after,.classifai-toggle-switch:before{content:""}.classifai-toggle-switch:before{background:#1e1e1e;border-radius:50%;box-sizing:border-box;display:block;height:12px;left:2px;position:absolute;top:2px;transition:left .25s;width:12px}.classifai-toggle-checkbox:checked+.classifai-toggle-switch{background:var(--classifai-admin-theme-color);border-color:var(--classifai-admin-theme-color)}.classifai-toggle-checkbox:checked+.classifai-toggle-switch:before{background-color:#fff;left:20px}.classifai-toggle-checkbox{position:absolute;visibility:hidden}#classifai-generate-excerpt{position:absolute;right:12px;top:70px}.classify-post-componenet hr{margin-bottom:20px}.classify-modal{width:500px}.classify-modal hr{margin-bottom:20px}.classifai-modal__notes{float:left;font-size:10px;max-width:350px}.classifai-modal__footer{overflow:hidden}.classifai-modal__footer button{float:right}.editor-post-publish-panel .classifai-modal__footer button{float:none;margin-top:10px}#classifai-profile-features-section tr.classifai-features-row th{padding:10px 10px 10px 0}#classifai-profile-features-section tr.classifai-features-row td{padding:10px}a.components-button.classifai-disable-feature-link{display:block;margin-top:12px}div.classifai-openai__result-disable-link{display:block;padding:0 1em 1.5em} .tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{background-color:#333;border-radius:4px;color:#fff;font-size:14px;line-height:1.4;outline:0;position:relative;transition-property:transform,visibility,opacity;white-space:normal}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{border-top-color:initial;border-width:8px 8px 0;bottom:-7px;left:0;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{border-bottom-color:initial;border-width:0 8px 8px;left:0;top:-7px;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-left-color:initial;border-width:8px 0 8px 8px;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{border-right-color:initial;border-width:8px 8px 8px 0;left:-7px;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{color:#333;height:16px;width:16px}.tippy-arrow:before{border-color:transparent;border-style:solid;content:"";position:absolute}.tippy-content{padding:5px 9px;position:relative;z-index:1} .tippy-box[data-theme~=light]{background-color:#fff;box-shadow:0 0 20px 4px rgba(154,161,177,.15),0 4px 80px -8px rgba(36,40,47,.25),0 4px 4px -2px rgba(91,94,105,.15);color:#26323d}.tippy-box[data-theme~=light][data-placement^=top]>.tippy-arrow:before{border-top-color:#fff}.tippy-box[data-theme~=light][data-placement^=bottom]>.tippy-arrow:before{border-bottom-color:#fff}.tippy-box[data-theme~=light][data-placement^=left]>.tippy-arrow:before{border-left-color:#fff}.tippy-box[data-theme~=light][data-placement^=right]>.tippy-arrow:before{border-right-color:#fff}.tippy-box[data-theme~=light]>.tippy-backdrop{background-color:#fff}.tippy-box[data-theme~=light]>.tippy-svg-arrow{fill:#fff} diff --git a/dist/admin.js b/dist/admin.js index a4cc02fd3..4832cde05 100644 --- a/dist/admin.js +++ b/dist/admin.js @@ -1 +1 @@ -(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.React,n=window.wp.i18n;function r(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function o(e){return e instanceof r(e).Element||e instanceof Element}function i(e){return e instanceof r(e).HTMLElement||e instanceof HTMLElement}function a(e){return"undefined"!=typeof ShadowRoot&&(e instanceof r(e).ShadowRoot||e instanceof ShadowRoot)}var s=Math.max,c=Math.min,u=Math.round;function l(){var e=navigator.userAgentData;return null!=e&&e.brands&&Array.isArray(e.brands)?e.brands.map((function(e){return e.brand+"/"+e.version})).join(" "):navigator.userAgent}function f(){return!/^((?!chrome|android).)*safari/i.test(l())}function p(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);var a=e.getBoundingClientRect(),s=1,c=1;t&&i(e)&&(s=e.offsetWidth>0&&u(a.width)/e.offsetWidth||1,c=e.offsetHeight>0&&u(a.height)/e.offsetHeight||1);var l=(o(e)?r(e):window).visualViewport,p=!f()&&n,d=(a.left+(p&&l?l.offsetLeft:0))/s,m=(a.top+(p&&l?l.offsetTop:0))/c,v=a.width/s,h=a.height/c;return{width:v,height:h,top:m,right:d+v,bottom:m+h,left:d,x:d,y:m}}function d(e){var t=r(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function m(e){return e?(e.nodeName||"").toLowerCase():null}function v(e){return((o(e)?e.ownerDocument:e.document)||window.document).documentElement}function h(e){return p(v(e)).left+d(e).scrollLeft}function g(e){return r(e).getComputedStyle(e)}function y(e){var t=g(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function b(e,t,n){void 0===n&&(n=!1);var o,a,s=i(t),c=i(t)&&function(e){var t=e.getBoundingClientRect(),n=u(t.width)/e.offsetWidth||1,r=u(t.height)/e.offsetHeight||1;return 1!==n||1!==r}(t),l=v(t),f=p(e,c,n),g={scrollLeft:0,scrollTop:0},b={x:0,y:0};return(s||!s&&!n)&&(("body"!==m(t)||y(l))&&(g=(o=t)!==r(o)&&i(o)?{scrollLeft:(a=o).scrollLeft,scrollTop:a.scrollTop}:d(o)),i(t)?((b=p(t,!0)).x+=t.clientLeft,b.y+=t.clientTop):l&&(b.x=h(l))),{x:f.left+g.scrollLeft-b.x,y:f.top+g.scrollTop-b.y,width:f.width,height:f.height}}function w(e){var t=p(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function x(e){return"html"===m(e)?e:e.assignedSlot||e.parentNode||(a(e)?e.host:null)||v(e)}function E(e){return["html","body","#document"].indexOf(m(e))>=0?e.ownerDocument.body:i(e)&&y(e)?e:E(x(e))}function O(e,t){var n;void 0===t&&(t=[]);var o=E(e),i=o===(null==(n=e.ownerDocument)?void 0:n.body),a=r(o),s=i?[a].concat(a.visualViewport||[],y(o)?o:[]):o,c=t.concat(s);return i?c:c.concat(O(x(s)))}function A(e){return["table","td","th"].indexOf(m(e))>=0}function _(e){return i(e)&&"fixed"!==g(e).position?e.offsetParent:null}function L(e){for(var t=r(e),n=_(e);n&&A(n)&&"static"===g(n).position;)n=_(n);return n&&("html"===m(n)||"body"===m(n)&&"static"===g(n).position)?t:n||function(e){var t=/firefox/i.test(l());if(/Trident/i.test(l())&&i(e)&&"fixed"===g(e).position)return null;var n=x(e);for(a(n)&&(n=n.host);i(n)&&["html","body"].indexOf(m(n))<0;){var r=g(n);if("none"!==r.transform||"none"!==r.perspective||"paint"===r.contain||-1!==["transform","perspective"].indexOf(r.willChange)||t&&"filter"===r.willChange||t&&r.filter&&"none"!==r.filter)return n;n=n.parentNode}return null}(e)||t}var T="top",j="bottom",D="right",S="left",C="auto",k=[T,j,D,S],M="start",I="end",q="viewport",B="popper",R=k.reduce((function(e,t){return e.concat([t+"-"+M,t+"-"+I])}),[]),H=[].concat(k,[C]).reduce((function(e,t){return e.concat([t,t+"-"+M,t+"-"+I])}),[]),P=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function V(e){var t=new Map,n=new Set,r=[];function o(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!n.has(e)){var r=t.get(e);r&&o(r)}})),r.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||o(e)})),r}var W={placement:"bottom",modifiers:[],strategy:"absolute"};function N(){for(var e=arguments.length,t=new Array(e),n=0;n=0?"x":"y"}function X(e){var t,n=e.reference,r=e.element,o=e.placement,i=o?$(o):null,a=o?z(o):null,s=n.x+n.width/2-r.width/2,c=n.y+n.height/2-r.height/2;switch(i){case T:t={x:s,y:n.y-r.height};break;case j:t={x:s,y:n.y+n.height};break;case D:t={x:n.x+n.width,y:c};break;case S:t={x:n.x-r.width,y:c};break;default:t={x:n.x,y:n.y}}var u=i?Q(i):null;if(null!=u){var l="y"===u?"height":"width";switch(a){case M:t[u]=t[u]-(n[l]/2-r[l]/2);break;case I:t[u]=t[u]+(n[l]/2-r[l]/2)}}return t}var Y={top:"auto",right:"auto",bottom:"auto",left:"auto"};function J(e){var t,n=e.popper,o=e.popperRect,i=e.placement,a=e.variation,s=e.offsets,c=e.position,l=e.gpuAcceleration,f=e.adaptive,p=e.roundOffsets,d=e.isFixed,m=s.x,h=void 0===m?0:m,y=s.y,b=void 0===y?0:y,w="function"==typeof p?p({x:h,y:b}):{x:h,y:b};h=w.x,b=w.y;var x=s.hasOwnProperty("x"),E=s.hasOwnProperty("y"),O=S,A=T,_=window;if(f){var C=L(n),k="clientHeight",M="clientWidth";C===r(n)&&"static"!==g(C=v(n)).position&&"absolute"===c&&(k="scrollHeight",M="scrollWidth"),(i===T||(i===S||i===D)&&a===I)&&(A=j,b-=(d&&C===_&&_.visualViewport?_.visualViewport.height:C[k])-o.height,b*=l?1:-1),i!==S&&(i!==T&&i!==j||a!==I)||(O=D,h-=(d&&C===_&&_.visualViewport?_.visualViewport.width:C[M])-o.width,h*=l?1:-1)}var q,B=Object.assign({position:c},f&&Y),R=!0===p?function(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:u(n*o)/o||0,y:u(r*o)/o||0}}({x:h,y:b},r(n)):{x:h,y:b};return h=R.x,b=R.y,l?Object.assign({},B,((q={})[A]=E?"0":"",q[O]=x?"0":"",q.transform=(_.devicePixelRatio||1)<=1?"translate("+h+"px, "+b+"px)":"translate3d("+h+"px, "+b+"px, 0)",q)):Object.assign({},B,((t={})[A]=E?b+"px":"",t[O]=x?h+"px":"",t.transform="",t))}const G={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},o=t.elements[e];i(o)&&m(o)&&(Object.assign(o.style,n),Object.keys(r).forEach((function(e){var t=r[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach((function(e){var r=t.elements[e],o=t.attributes[e]||{},a=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce((function(e,t){return e[t]="",e}),{});i(r)&&m(r)&&(Object.assign(r.style,a),Object.keys(o).forEach((function(e){r.removeAttribute(e)})))}))}},requires:["computeStyles"]};var K={left:"right",right:"left",bottom:"top",top:"bottom"};function Z(e){return e.replace(/left|right|bottom|top/g,(function(e){return K[e]}))}var ee={start:"end",end:"start"};function te(e){return e.replace(/start|end/g,(function(e){return ee[e]}))}function ne(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&a(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function re(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function oe(e,t,n){return t===q?re(function(e,t){var n=r(e),o=v(e),i=n.visualViewport,a=o.clientWidth,s=o.clientHeight,c=0,u=0;if(i){a=i.width,s=i.height;var l=f();(l||!l&&"fixed"===t)&&(c=i.offsetLeft,u=i.offsetTop)}return{width:a,height:s,x:c+h(e),y:u}}(e,n)):o(t)?function(e,t){var n=p(e,!1,"fixed"===t);return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}(t,n):re(function(e){var t,n=v(e),r=d(e),o=null==(t=e.ownerDocument)?void 0:t.body,i=s(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=s(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),c=-r.scrollLeft+h(e),u=-r.scrollTop;return"rtl"===g(o||n).direction&&(c+=s(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:a,x:c,y:u}}(v(e)))}function ie(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function ae(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}function se(e,t){void 0===t&&(t={});var n=t,r=n.placement,a=void 0===r?e.placement:r,u=n.strategy,l=void 0===u?e.strategy:u,f=n.boundary,d=void 0===f?"clippingParents":f,h=n.rootBoundary,y=void 0===h?q:h,b=n.elementContext,w=void 0===b?B:b,E=n.altBoundary,A=void 0!==E&&E,_=n.padding,S=void 0===_?0:_,C=ie("number"!=typeof S?S:ae(S,k)),M=w===B?"reference":B,I=e.rects.popper,R=e.elements[A?M:w],H=function(e,t,n,r){var a="clippingParents"===t?function(e){var t=O(x(e)),n=["absolute","fixed"].indexOf(g(e).position)>=0&&i(e)?L(e):e;return o(n)?t.filter((function(e){return o(e)&&ne(e,n)&&"body"!==m(e)})):[]}(e):[].concat(t),u=[].concat(a,[n]),l=u[0],f=u.reduce((function(t,n){var o=oe(e,n,r);return t.top=s(o.top,t.top),t.right=c(o.right,t.right),t.bottom=c(o.bottom,t.bottom),t.left=s(o.left,t.left),t}),oe(e,l,r));return f.width=f.right-f.left,f.height=f.bottom-f.top,f.x=f.left,f.y=f.top,f}(o(R)?R:R.contextElement||v(e.elements.popper),d,y,l),P=p(e.elements.reference),V=X({reference:P,element:I,strategy:"absolute",placement:a}),W=re(Object.assign({},I,V)),N=w===B?W:P,U={top:H.top-N.top+C.top,bottom:N.bottom-H.bottom+C.bottom,left:H.left-N.left+C.left,right:N.right-H.right+C.right},F=e.modifiersData.offset;if(w===B&&F){var $=F[a];Object.keys(U).forEach((function(e){var t=[D,j].indexOf(e)>=0?1:-1,n=[T,j].indexOf(e)>=0?"y":"x";U[e]+=$[n]*t}))}return U}function ce(e,t,n){return s(e,c(t,n))}function ue(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function le(e){return[T,D,j,S].some((function(t){return e[t]>=0}))}var fe=U({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,n=e.instance,o=e.options,i=o.scroll,a=void 0===i||i,s=o.resize,c=void 0===s||s,u=r(t.elements.popper),l=[].concat(t.scrollParents.reference,t.scrollParents.popper);return a&&l.forEach((function(e){e.addEventListener("scroll",n.update,F)})),c&&u.addEventListener("resize",n.update,F),function(){a&&l.forEach((function(e){e.removeEventListener("scroll",n.update,F)})),c&&u.removeEventListener("resize",n.update,F)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,n=e.name;t.modifiersData[n]=X({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=void 0===r||r,i=n.adaptive,a=void 0===i||i,s=n.roundOffsets,c=void 0===s||s,u={placement:$(t.placement),variation:z(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,J(Object.assign({},u,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:c})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,J(Object.assign({},u,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},G,{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.options,r=e.name,o=n.offset,i=void 0===o?[0,0]:o,a=H.reduce((function(e,n){return e[n]=function(e,t,n){var r=$(e),o=[S,T].indexOf(r)>=0?-1:1,i="function"==typeof n?n(Object.assign({},t,{placement:e})):n,a=i[0],s=i[1];return a=a||0,s=(s||0)*o,[S,D].indexOf(r)>=0?{x:s,y:a}:{x:a,y:s}}(n,t.rects,i),e}),{}),s=a[t.placement],c=s.x,u=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=c,t.modifiersData.popperOffsets.y+=u),t.modifiersData[r]=a}},{name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,i=void 0===o||o,a=n.altAxis,s=void 0===a||a,c=n.fallbackPlacements,u=n.padding,l=n.boundary,f=n.rootBoundary,p=n.altBoundary,d=n.flipVariations,m=void 0===d||d,v=n.allowedAutoPlacements,h=t.options.placement,g=$(h),y=c||(g!==h&&m?function(e){if($(e)===C)return[];var t=Z(e);return[te(e),t,te(t)]}(h):[Z(h)]),b=[h].concat(y).reduce((function(e,n){return e.concat($(n)===C?function(e,t){void 0===t&&(t={});var n=t,r=n.placement,o=n.boundary,i=n.rootBoundary,a=n.padding,s=n.flipVariations,c=n.allowedAutoPlacements,u=void 0===c?H:c,l=z(r),f=l?s?R:R.filter((function(e){return z(e)===l})):k,p=f.filter((function(e){return u.indexOf(e)>=0}));0===p.length&&(p=f);var d=p.reduce((function(t,n){return t[n]=se(e,{placement:n,boundary:o,rootBoundary:i,padding:a})[$(n)],t}),{});return Object.keys(d).sort((function(e,t){return d[e]-d[t]}))}(t,{placement:n,boundary:l,rootBoundary:f,padding:u,flipVariations:m,allowedAutoPlacements:v}):n)}),[]),w=t.rects.reference,x=t.rects.popper,E=new Map,O=!0,A=b[0],_=0;_=0,P=B?"width":"height",V=se(t,{placement:L,boundary:l,rootBoundary:f,altBoundary:p,padding:u}),W=B?q?D:S:q?j:T;w[P]>x[P]&&(W=Z(W));var N=Z(W),U=[];if(i&&U.push(V[I]<=0),s&&U.push(V[W]<=0,V[N]<=0),U.every((function(e){return e}))){A=L,O=!1;break}E.set(L,U)}if(O)for(var F=function(e){var t=b.find((function(t){var n=E.get(t);if(n)return n.slice(0,e).every((function(e){return e}))}));if(t)return A=t,"break"},Q=m?3:1;Q>0&&"break"!==F(Q);Q--);t.placement!==A&&(t.modifiersData[r]._skip=!0,t.placement=A,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,i=void 0===o||o,a=n.altAxis,u=void 0!==a&&a,l=n.boundary,f=n.rootBoundary,p=n.altBoundary,d=n.padding,m=n.tether,v=void 0===m||m,h=n.tetherOffset,g=void 0===h?0:h,y=se(t,{boundary:l,rootBoundary:f,padding:d,altBoundary:p}),b=$(t.placement),x=z(t.placement),E=!x,O=Q(b),A="x"===O?"y":"x",_=t.modifiersData.popperOffsets,C=t.rects.reference,k=t.rects.popper,I="function"==typeof g?g(Object.assign({},t.rects,{placement:t.placement})):g,q="number"==typeof I?{mainAxis:I,altAxis:I}:Object.assign({mainAxis:0,altAxis:0},I),B=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,R={x:0,y:0};if(_){if(i){var H,P="y"===O?T:S,V="y"===O?j:D,W="y"===O?"height":"width",N=_[O],U=N+y[P],F=N-y[V],X=v?-k[W]/2:0,Y=x===M?C[W]:k[W],J=x===M?-k[W]:-C[W],G=t.elements.arrow,K=v&&G?w(G):{width:0,height:0},Z=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},ee=Z[P],te=Z[V],ne=ce(0,C[W],K[W]),re=E?C[W]/2-X-ne-ee-q.mainAxis:Y-ne-ee-q.mainAxis,oe=E?-C[W]/2+X+ne+te+q.mainAxis:J+ne+te+q.mainAxis,ie=t.elements.arrow&&L(t.elements.arrow),ae=ie?"y"===O?ie.clientTop||0:ie.clientLeft||0:0,ue=null!=(H=null==B?void 0:B[O])?H:0,le=N+oe-ue,fe=ce(v?c(U,N+re-ue-ae):U,N,v?s(F,le):F);_[O]=fe,R[O]=fe-N}if(u){var pe,de="x"===O?T:S,me="x"===O?j:D,ve=_[A],he="y"===A?"height":"width",ge=ve+y[de],ye=ve-y[me],be=-1!==[T,S].indexOf(b),we=null!=(pe=null==B?void 0:B[A])?pe:0,xe=be?ge:ve-C[he]-k[he]-we+q.altAxis,Ee=be?ve+C[he]+k[he]-we-q.altAxis:ye,Oe=v&&be?function(e,t,n){var r=ce(e,t,n);return r>n?n:r}(xe,ve,Ee):ce(v?xe:ge,ve,v?Ee:ye);_[A]=Oe,R[A]=Oe-ve}t.modifiersData[r]=R}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,r=e.name,o=e.options,i=n.elements.arrow,a=n.modifiersData.popperOffsets,s=$(n.placement),c=Q(s),u=[S,D].indexOf(s)>=0?"height":"width";if(i&&a){var l=function(e,t){return ie("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:ae(e,k))}(o.padding,n),f=w(i),p="y"===c?T:S,d="y"===c?j:D,m=n.rects.reference[u]+n.rects.reference[c]-a[c]-n.rects.popper[u],v=a[c]-n.rects.reference[c],h=L(i),g=h?"y"===c?h.clientHeight||0:h.clientWidth||0:0,y=m/2-v/2,b=l[p],x=g-f[u]-l[d],E=g/2-f[u]/2+y,O=ce(b,E,x),A=c;n.modifiersData[r]=((t={})[A]=O,t.centerOffset=O-E,t)}},effect:function(e){var t=e.state,n=e.options.element,r=void 0===n?"[data-popper-arrow]":n;null!=r&&("string"!=typeof r||(r=t.elements.popper.querySelector(r)))&&ne(t.elements.popper,r)&&(t.elements.arrow=r)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,i=t.modifiersData.preventOverflow,a=se(t,{elementContext:"reference"}),s=se(t,{altBoundary:!0}),c=ue(a,r),u=ue(s,o,i),l=le(c),f=le(u);t.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:u,isReferenceHidden:l,hasPopperEscaped:f},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":l,"data-popper-escaped":f})}}]}),pe="tippy-content",de="tippy-backdrop",me="tippy-arrow",ve="tippy-svg-arrow",he={passive:!0,capture:!0},ge=function(){return document.body};function ye(e,t,n){if(Array.isArray(e)){var r=e[t];return null==r?Array.isArray(n)?n[t]:n:r}return e}function be(e,t){var n={}.toString.call(e);return 0===n.indexOf("[object")&&n.indexOf(t+"]")>-1}function we(e,t){return"function"==typeof e?e.apply(void 0,t):e}function xe(e,t){return 0===t?e:function(r){clearTimeout(n),n=setTimeout((function(){e(r)}),t)};var n}function Ee(e){return[].concat(e)}function Oe(e,t){-1===e.indexOf(t)&&e.push(t)}function Ae(e){return[].slice.call(e)}function _e(e){return Object.keys(e).reduce((function(t,n){return void 0!==e[n]&&(t[n]=e[n]),t}),{})}function Le(){return document.createElement("div")}function Te(e){return["Element","Fragment"].some((function(t){return be(e,t)}))}function je(e,t){e.forEach((function(e){e&&(e.style.transitionDuration=t+"ms")}))}function De(e,t){e.forEach((function(e){e&&e.setAttribute("data-state",t)}))}function Se(e,t,n){var r=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach((function(t){e[r](t,n)}))}function Ce(e,t){for(var n=t;n;){var r;if(e.contains(n))return!0;n=null==n.getRootNode||null==(r=n.getRootNode())?void 0:r.host}return!1}var ke={isTouch:!1},Me=0;function Ie(){ke.isTouch||(ke.isTouch=!0,window.performance&&document.addEventListener("mousemove",qe))}function qe(){var e=performance.now();e-Me<20&&(ke.isTouch=!1,document.removeEventListener("mousemove",qe)),Me=e}function Be(){var e,t=document.activeElement;if((e=t)&&e._tippy&&e._tippy.reference===e){var n=t._tippy;t.blur&&!n.state.isVisible&&t.blur()}}var Re=!("undefined"==typeof window||"undefined"==typeof document||!window.msCrypto),He=Object.assign({appendTo:ge,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},{animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),Pe=Object.keys(He);function Ve(e){var t=(e.plugins||[]).reduce((function(t,n){var r,o=n.name,i=n.defaultValue;return o&&(t[o]=void 0!==e[o]?e[o]:null!=(r=He[o])?r:i),t}),{});return Object.assign({},e,t)}function We(e,t){var n=Object.assign({},t,{content:we(t.content,[e])},t.ignoreAttributes?{}:function(e,t){return(t?Object.keys(Ve(Object.assign({},He,{plugins:t}))):Pe).reduce((function(t,n){var r=(e.getAttribute("data-tippy-"+n)||"").trim();if(!r)return t;if("content"===n)t[n]=r;else try{t[n]=JSON.parse(r)}catch(e){t[n]=r}return t}),{})}(e,t.plugins));return n.aria=Object.assign({},He.aria,n.aria),n.aria={expanded:"auto"===n.aria.expanded?t.interactive:n.aria.expanded,content:"auto"===n.aria.content?t.interactive?null:"describedby":n.aria.content},n}var Ne=function(){return"innerHTML"};function Ue(e,t){e[Ne()]=t}function Fe(e){var t=Le();return!0===e?t.className=me:(t.className=ve,Te(e)?t.appendChild(e):Ue(t,e)),t}function $e(e,t){Te(t.content)?(Ue(e,""),e.appendChild(t.content)):"function"!=typeof t.content&&(t.allowHTML?Ue(e,t.content):e.textContent=t.content)}function ze(e){var t=e.firstElementChild,n=Ae(t.children);return{box:t,content:n.find((function(e){return e.classList.contains(pe)})),arrow:n.find((function(e){return e.classList.contains(me)||e.classList.contains(ve)})),backdrop:n.find((function(e){return e.classList.contains(de)}))}}function Qe(e){var t=Le(),n=Le();n.className="tippy-box",n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=Le();function o(n,r){var o=ze(t),i=o.box,a=o.content,s=o.arrow;r.theme?i.setAttribute("data-theme",r.theme):i.removeAttribute("data-theme"),"string"==typeof r.animation?i.setAttribute("data-animation",r.animation):i.removeAttribute("data-animation"),r.inertia?i.setAttribute("data-inertia",""):i.removeAttribute("data-inertia"),i.style.maxWidth="number"==typeof r.maxWidth?r.maxWidth+"px":r.maxWidth,r.role?i.setAttribute("role",r.role):i.removeAttribute("role"),n.content===r.content&&n.allowHTML===r.allowHTML||$e(a,e.props),r.arrow?s?n.arrow!==r.arrow&&(i.removeChild(s),i.appendChild(Fe(r.arrow))):i.appendChild(Fe(r.arrow)):s&&i.removeChild(s)}return r.className=pe,r.setAttribute("data-state","hidden"),$e(r,e.props),t.appendChild(n),n.appendChild(r),o(e.props,e.props),{popper:t,onUpdate:o}}Qe.$$tippy=!0;var Xe=1,Ye=[],Je=[];function Ge(e,t){var n,r,o,i,a,s,c,u,l=We(e,Object.assign({},He,Ve(_e(t)))),f=!1,p=!1,d=!1,m=!1,v=[],h=xe(Q,l.interactiveDebounce),g=Xe++,y=(u=l.plugins).filter((function(e,t){return u.indexOf(e)===t})),b={id:g,reference:e,popper:Le(),popperInstance:null,props:l,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:y,clearDelayTimeouts:function(){clearTimeout(n),clearTimeout(r),cancelAnimationFrame(o)},setProps:function(t){if(!b.state.isDestroyed){M("onBeforeUpdate",[b,t]),$();var n=b.props,r=We(e,Object.assign({},n,_e(t),{ignoreAttributes:!0}));b.props=r,F(),n.interactiveDebounce!==r.interactiveDebounce&&(B(),h=xe(Q,r.interactiveDebounce)),n.triggerTarget&&!r.triggerTarget?Ee(n.triggerTarget).forEach((function(e){e.removeAttribute("aria-expanded")})):r.triggerTarget&&e.removeAttribute("aria-expanded"),q(),k(),E&&E(n,r),b.popperInstance&&(G(),Z().forEach((function(e){requestAnimationFrame(e._tippy.popperInstance.forceUpdate)}))),M("onAfterUpdate",[b,t])}},setContent:function(e){b.setProps({content:e})},show:function(){var e=b.state.isVisible,t=b.state.isDestroyed,n=!b.state.isEnabled,r=ke.isTouch&&!b.props.touch,o=ye(b.props.duration,0,He.duration);if(!(e||t||n||r||j().hasAttribute("disabled")||(M("onShow",[b],!1),!1===b.props.onShow(b)))){if(b.state.isVisible=!0,T()&&(x.style.visibility="visible"),k(),V(),b.state.isMounted||(x.style.transition="none"),T()){var i=S();je([i.box,i.content],0)}var a,c,u;s=function(){var e;if(b.state.isVisible&&!m){if(m=!0,x.offsetHeight,x.style.transition=b.props.moveTransition,T()&&b.props.animation){var t=S(),n=t.box,r=t.content;je([n,r],o),De([n,r],"visible")}I(),q(),Oe(Je,b),null==(e=b.popperInstance)||e.forceUpdate(),M("onMount",[b]),b.props.animation&&T()&&function(e,t){N(e,(function(){b.state.isShown=!0,M("onShown",[b])}))}(o)}},c=b.props.appendTo,u=j(),(a=b.props.interactive&&c===ge||"parent"===c?u.parentNode:we(c,[u])).contains(x)||a.appendChild(x),b.state.isMounted=!0,G()}},hide:function(){var e=!b.state.isVisible,t=b.state.isDestroyed,n=!b.state.isEnabled,r=ye(b.props.duration,1,He.duration);if(!(e||t||n)&&(M("onHide",[b],!1),!1!==b.props.onHide(b))){if(b.state.isVisible=!1,b.state.isShown=!1,m=!1,f=!1,T()&&(x.style.visibility="hidden"),B(),W(),k(!0),T()){var o=S(),i=o.box,a=o.content;b.props.animation&&(je([i,a],r),De([i,a],"hidden"))}I(),q(),b.props.animation?T()&&function(e,t){N(e,(function(){!b.state.isVisible&&x.parentNode&&x.parentNode.contains(x)&&t()}))}(r,b.unmount):b.unmount()}},hideWithInteractivity:function(e){D().addEventListener("mousemove",h),Oe(Ye,h),h(e)},enable:function(){b.state.isEnabled=!0},disable:function(){b.hide(),b.state.isEnabled=!1},unmount:function(){b.state.isVisible&&b.hide(),b.state.isMounted&&(K(),Z().forEach((function(e){e._tippy.unmount()})),x.parentNode&&x.parentNode.removeChild(x),Je=Je.filter((function(e){return e!==b})),b.state.isMounted=!1,M("onHidden",[b]))},destroy:function(){b.state.isDestroyed||(b.clearDelayTimeouts(),b.unmount(),$(),delete e._tippy,b.state.isDestroyed=!0,M("onDestroy",[b]))}};if(!l.render)return b;var w=l.render(b),x=w.popper,E=w.onUpdate;x.setAttribute("data-tippy-root",""),x.id="tippy-"+b.id,b.popper=x,e._tippy=b,x._tippy=b;var O=y.map((function(e){return e.fn(b)})),A=e.hasAttribute("aria-expanded");return F(),q(),k(),M("onCreate",[b]),l.showOnCreate&&ee(),x.addEventListener("mouseenter",(function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()})),x.addEventListener("mouseleave",(function(){b.props.interactive&&b.props.trigger.indexOf("mouseenter")>=0&&D().addEventListener("mousemove",h)})),b;function _(){var e=b.props.touch;return Array.isArray(e)?e:[e,0]}function L(){return"hold"===_()[0]}function T(){var e;return!(null==(e=b.props.render)||!e.$$tippy)}function j(){return c||e}function D(){var e,t,n=j().parentNode;return n?null!=(t=Ee(n)[0])&&null!=(e=t.ownerDocument)&&e.body?t.ownerDocument:document:document}function S(){return ze(x)}function C(e){return b.state.isMounted&&!b.state.isVisible||ke.isTouch||i&&"focus"===i.type?0:ye(b.props.delay,e?0:1,He.delay)}function k(e){void 0===e&&(e=!1),x.style.pointerEvents=b.props.interactive&&!e?"":"none",x.style.zIndex=""+b.props.zIndex}function M(e,t,n){var r;void 0===n&&(n=!0),O.forEach((function(n){n[e]&&n[e].apply(n,t)})),n&&(r=b.props)[e].apply(r,t)}function I(){var t=b.props.aria;if(t.content){var n="aria-"+t.content,r=x.id;Ee(b.props.triggerTarget||e).forEach((function(e){var t=e.getAttribute(n);if(b.state.isVisible)e.setAttribute(n,t?t+" "+r:r);else{var o=t&&t.replace(r,"").trim();o?e.setAttribute(n,o):e.removeAttribute(n)}}))}}function q(){!A&&b.props.aria.expanded&&Ee(b.props.triggerTarget||e).forEach((function(e){b.props.interactive?e.setAttribute("aria-expanded",b.state.isVisible&&e===j()?"true":"false"):e.removeAttribute("aria-expanded")}))}function B(){D().removeEventListener("mousemove",h),Ye=Ye.filter((function(e){return e!==h}))}function R(t){if(!ke.isTouch||!d&&"mousedown"!==t.type){var n=t.composedPath&&t.composedPath()[0]||t.target;if(!b.props.interactive||!Ce(x,n)){if(Ee(b.props.triggerTarget||e).some((function(e){return Ce(e,n)}))){if(ke.isTouch)return;if(b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else M("onClickOutside",[b,t]);!0===b.props.hideOnClick&&(b.clearDelayTimeouts(),b.hide(),p=!0,setTimeout((function(){p=!1})),b.state.isMounted||W())}}}function H(){d=!0}function P(){d=!1}function V(){var e=D();e.addEventListener("mousedown",R,!0),e.addEventListener("touchend",R,he),e.addEventListener("touchstart",P,he),e.addEventListener("touchmove",H,he)}function W(){var e=D();e.removeEventListener("mousedown",R,!0),e.removeEventListener("touchend",R,he),e.removeEventListener("touchstart",P,he),e.removeEventListener("touchmove",H,he)}function N(e,t){var n=S().box;function r(e){e.target===n&&(Se(n,"remove",r),t())}if(0===e)return t();Se(n,"remove",a),Se(n,"add",r),a=r}function U(t,n,r){void 0===r&&(r=!1),Ee(b.props.triggerTarget||e).forEach((function(e){e.addEventListener(t,n,r),v.push({node:e,eventType:t,handler:n,options:r})}))}function F(){var e;L()&&(U("touchstart",z,{passive:!0}),U("touchend",X,{passive:!0})),(e=b.props.trigger,e.split(/\s+/).filter(Boolean)).forEach((function(e){if("manual"!==e)switch(U(e,z),e){case"mouseenter":U("mouseleave",X);break;case"focus":U(Re?"focusout":"blur",Y);break;case"focusin":U("focusout",Y)}}))}function $(){v.forEach((function(e){var t=e.node,n=e.eventType,r=e.handler,o=e.options;t.removeEventListener(n,r,o)})),v=[]}function z(e){var t,n=!1;if(b.state.isEnabled&&!J(e)&&!p){var r="focus"===(null==(t=i)?void 0:t.type);i=e,c=e.currentTarget,q(),!b.state.isVisible&&be(e,"MouseEvent")&&Ye.forEach((function(t){return t(e)})),"click"===e.type&&(b.props.trigger.indexOf("mouseenter")<0||f)&&!1!==b.props.hideOnClick&&b.state.isVisible?n=!0:ee(e),"click"===e.type&&(f=!n),n&&!r&&te(e)}}function Q(e){var t=e.target,n=j().contains(t)||x.contains(t);if("mousemove"!==e.type||!n){var r=Z().concat(x).map((function(e){var t,n=null==(t=e._tippy.popperInstance)?void 0:t.state;return n?{popperRect:e.getBoundingClientRect(),popperState:n,props:l}:null})).filter(Boolean);(function(e,t){var n=t.clientX,r=t.clientY;return e.every((function(e){var t=e.popperRect,o=e.popperState,i=e.props.interactiveBorder,a=o.placement.split("-")[0],s=o.modifiersData.offset;if(!s)return!0;var c="bottom"===a?s.top.y:0,u="top"===a?s.bottom.y:0,l="right"===a?s.left.x:0,f="left"===a?s.right.x:0,p=t.top-r+c>i,d=r-t.bottom-u>i,m=t.left-n+l>i,v=n-t.right-f>i;return p||d||m||v}))})(r,e)&&(B(),te(e))}}function X(e){J(e)||b.props.trigger.indexOf("click")>=0&&f||(b.props.interactive?b.hideWithInteractivity(e):te(e))}function Y(e){b.props.trigger.indexOf("focusin")<0&&e.target!==j()||b.props.interactive&&e.relatedTarget&&x.contains(e.relatedTarget)||te(e)}function J(e){return!!ke.isTouch&&L()!==e.type.indexOf("touch")>=0}function G(){K();var t=b.props,n=t.popperOptions,r=t.placement,o=t.offset,i=t.getReferenceClientRect,a=t.moveTransition,c=T()?ze(x).arrow:null,u=i?{getBoundingClientRect:i,contextElement:i.contextElement||j()}:e,l=[{name:"offset",options:{offset:o}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!a}},{name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(e){var t=e.state;if(T()){var n=S().box;["placement","reference-hidden","escaped"].forEach((function(e){"placement"===e?n.setAttribute("data-placement",t.placement):t.attributes.popper["data-popper-"+e]?n.setAttribute("data-"+e,""):n.removeAttribute("data-"+e)})),t.attributes.popper={}}}}];T()&&c&&l.push({name:"arrow",options:{element:c,padding:3}}),l.push.apply(l,(null==n?void 0:n.modifiers)||[]),b.popperInstance=fe(u,x,Object.assign({},n,{placement:r,onFirstUpdate:s,modifiers:l}))}function K(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function Z(){return Ae(x.querySelectorAll("[data-tippy-root]"))}function ee(e){b.clearDelayTimeouts(),e&&M("onTrigger",[b,e]),V();var t=C(!0),r=_(),o=r[0],i=r[1];ke.isTouch&&"hold"===o&&i&&(t=i),t?n=setTimeout((function(){b.show()}),t):b.show()}function te(e){if(b.clearDelayTimeouts(),M("onUntrigger",[b,e]),b.state.isVisible){if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(e.type)>=0&&f)){var t=C(!1);t?r=setTimeout((function(){b.state.isVisible&&b.hide()}),t):o=requestAnimationFrame((function(){b.hide()}))}}else W()}}function Ke(e,t){void 0===t&&(t={});var n=He.plugins.concat(t.plugins||[]);document.addEventListener("touchstart",Ie,he),window.addEventListener("blur",Be);var r,o=Object.assign({},t,{plugins:n}),i=(r=e,Te(r)?[r]:function(e){return be(e,"NodeList")}(r)?Ae(r):Array.isArray(r)?r:Ae(document.querySelectorAll(r))).reduce((function(e,t){var n=t&&Ge(t,o);return n&&e.push(n),e}),[]);return Te(e)?i[0]:i}Ke.defaultProps=He,Ke.setDefaultProps=function(e){Object.keys(e).forEach((function(t){He[t]=e[t]}))},Ke.currentInput=ke,Object.assign({},G,{effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow)}}),Ke.setDefaultProps({render:Qe});const Ze=Ke,et=window.wp.element,tt=window.wp.components,nt=window.wp.coreData,rt=window.wp.compose,ot=window.wp.data,it=window.wp.apiFetch;var at=e.n(it);const st=window.wp.url,ct=({value:e,onChange:r})=>{const[o,i]=(0,et.useState)({}),[a,s]=(0,et.useState)([]),[c,u]=(0,et.useState)(""),l=(0,rt.useDebounce)(u,500),f=e=>`${e.name} (${e.slug})`,p=e=>e.replace(/ /g,"").toLowerCase();(0,et.useEffect)((()=>{const t=e.filter((e=>e));if(t.length){const e={context:"view",include:t,per_page:-1,__fields:"id,name,slug"};at()({path:(0,st.addQueryArgs)("/wp/v2/users",e)}).then((e=>{const t=null!=e?e:[],n=t.map(f);s(n);const r={};t.forEach((e=>{r[p(f(e))]=e.id})),i(r)})).catch(console.error)}}),[e]);const d=(0,ot.useSelect)((e=>{const{getUsers:t}=e(nt.store);return t({context:"view",search:encodeURIComponent(c),per_page:100,__fields:"id,name,slug"})}),[c]),m=(0,et.useMemo)((()=>(null!=d?d:[]).map(f)),[d]);return(0,et.useEffect)((()=>{(null!=d?d:[]).forEach((e=>{o[p(f(e))]=e.id})),i(o)}),[d,o]),(0,t.createElement)(tt.FormTokenField,{className:"classifai-user-selector-field",value:a,suggestions:m,onChange:function(e){const t=[],n=e.reduce(((e,n)=>(e.some((e=>e.toLowerCase()===n.toLowerCase()))||(e.push(n),o&&o[p(n)]&&t.push(o[p(n)])),e)),[]);r(t),s(n)},onInputChange:l,label:null,placeholder:(0,n.__)("Search for users","classifai"),__experimentalShowHowTo:!1,messages:{added:(0,n.__)("User added.","classifai"),removed:(0,n.__)("User removed.","classifai"),remove:(0,n.__)("Remove user","classifai"),__experimentalInvalid:(0,n.__)("Invalid user","classifai")}})};document.addEventListener("DOMContentLoaded",(function(){const e=document.getElementById("help-menu-template");if(!e)return;const t=document.createElement("div");t.appendChild(document.importNode(e.content,!0)),Ze(".classifai-help",{allowHTML:!0,content:t.innerHTML,trigger:"click",placement:"bottom-end",arrow:!0,animation:"scale",duration:[250,200],theme:"light",interactive:!0})})),(()=>{const e=document.getElementById("classifai-waston-cred-toggle"),t=document.getElementById("classifai-settings-watson_username");if(null===e||null===t)return;let n=null,r=null;t.closest("tr")?n=t.closest("tr"):t.closest(".classifai-setup-form-field")&&(n=t.closest(".classifai-setup-form-field")),document.getElementById("classifai-settings-watson_password").closest("tr")?[r]=document.getElementById("classifai-settings-watson_password").closest("tr").getElementsByTagName("label"):document.getElementById("classifai-settings-watson_password").closest(".classifai-setup-form-field")&&([r]=document.getElementById("classifai-settings-watson_password").closest(".classifai-setup-form-field").getElementsByTagName("label")),e.addEventListener("click",(o=>{if(o.preventDefault(),n.classList.toggle("hidden"),n.classList.contains("hidden"))return e.innerText=ClassifAI.use_password,r.innerText=ClassifAI.api_key,void(t.value="apikey");e.innerText=ClassifAI.use_key,r.innerText=ClassifAI.api_password}))})(),document.addEventListener("DOMContentLoaded",(function(){function e(e){const t=e.target,n=t.closest("tr.classifai-role-based-access"),r=n.nextElementSibling.classList.contains("allowed_roles_row")?n.nextElementSibling:null;t.checked?r.classList.remove("hidden"):r.classList.add("hidden")}function t(e){const t=e.target,n=t.closest("tr.classifai-user-based-access"),r=n.nextElementSibling.classList.contains("allowed_users_row")?n.nextElementSibling:null;t.checked?r.classList.remove("hidden"):r.classList.add("hidden")}const n=document.querySelectorAll('tr.classifai-role-based-access input[type="checkbox"]'),r=document.querySelectorAll('tr.classifai-user-based-access input[type="checkbox"]');n&&n.forEach((function(t){t.addEventListener("change",e),t.dispatchEvent(new Event("change"))})),r&&r.forEach((function(e){e.addEventListener("change",t),e.dispatchEvent(new Event("change"))}))})),(()=>{const e=document.querySelectorAll(".classifai-user-selector");e&&e.forEach((e=>{const n=e.getAttribute("data-id"),r=document.getElementById(n),o=r.value?.split(",")||[],i=e=>{r.value=e.join(",")};et.createRoot?(0,et.createRoot)(e).render((0,t.createElement)(ct,{value:o,onChange:i})):(0,et.render)((0,t.createElement)(ct,{value:o,onChange:i}),e)}))})(),(()=>{const e=document.querySelectorAll("button.js-classifai-add-prompt-fieldset");e.length&&e.forEach((e=>{e.addEventListener("click",(e=>{e.preventDefault(),function(e){const t=e.parentElement.querySelector(".classifai-field-type-prompt-setting").cloneNode(!0);(function(e,t){const r=t.querySelectorAll("fieldset"),o=Array.from(r).pop(),i=parseInt(o.querySelector("input").name.match(/\d+/).pop()),a=e.querySelectorAll("input, textarea"),s=e.querySelectorAll(".actions-rows .action__set_default");a.forEach((e=>{e.value="",e.removeAttribute("readonly"),e.name=e.name.replace(/(\d+)/g,(()=>i+1))})),s.forEach((e=>{e.classList.remove("selected"),e.textContent=(0,n.__)("Set as default prompt","classifai")}))})(t,e.closest("tr")),r(t),t.querySelector(".classifai-original-prompt").remove(),t.querySelector(".action__remove_prompt").style.display="block",e.insertAdjacentElement("afterend",t)}(e.target.previousElementSibling)}))}));const t=document.querySelectorAll(".classifai-field-type-prompt-setting");function r(e){e.querySelector("a.action__remove_prompt").addEventListener("click",(e=>{var t;e.preventDefault(),t=e.target,jQuery("#js-classifai--delete-prompt-modal").dialog({modal:!0,title:(0,n.__)("Remove Prompt","classifai"),width:550,buttons:[{text:(0,n.__)("Cancel","classifai"),class:"button-secondary",click(){jQuery(this).dialog("close")}},{text:(0,n.__)("Remove","classifai"),class:"button-primary",click(){const e=t.closest("fieldset"),n=e.parentElement,r="1"===e.querySelector(".js-setting-field__default").value,o=2===n.querySelectorAll("fieldset").length;e.remove(),r&&n.querySelector("fieldset .action__set_default").click(),o&&(n.querySelector(".action__remove_prompt").style.display="none"),jQuery(this).dialog("close")},style:"margin-left: 10px;"}]})})),e.querySelector("a.action__set_default").addEventListener("click",(t=>{t.preventDefault(),t.target.classList.contains("selected")||(t.target.closest("tr").querySelectorAll(".action__set_default").forEach((e=>{e.classList.contains("selected")&&(e.textContent=(0,n.__)("Set as default prompt","classifai")),e.classList.remove("selected"),e.closest("fieldset").querySelector(".js-setting-field__default").value=""})),t.target.classList.add("selected"),t.target.textContent=(0,n.__)("Default prompt","classifai"),e.querySelector(".js-setting-field__default").value="1")}))}t.length&&t.forEach((e=>{r(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.React,n=window.wp.i18n;function r(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function o(e){return e instanceof r(e).Element||e instanceof Element}function i(e){return e instanceof r(e).HTMLElement||e instanceof HTMLElement}function a(e){return"undefined"!=typeof ShadowRoot&&(e instanceof r(e).ShadowRoot||e instanceof ShadowRoot)}var s=Math.max,c=Math.min,u=Math.round;function l(){var e=navigator.userAgentData;return null!=e&&e.brands&&Array.isArray(e.brands)?e.brands.map((function(e){return e.brand+"/"+e.version})).join(" "):navigator.userAgent}function p(){return!/^((?!chrome|android).)*safari/i.test(l())}function f(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);var a=e.getBoundingClientRect(),s=1,c=1;t&&i(e)&&(s=e.offsetWidth>0&&u(a.width)/e.offsetWidth||1,c=e.offsetHeight>0&&u(a.height)/e.offsetHeight||1);var l=(o(e)?r(e):window).visualViewport,f=!p()&&n,d=(a.left+(f&&l?l.offsetLeft:0))/s,m=(a.top+(f&&l?l.offsetTop:0))/c,v=a.width/s,h=a.height/c;return{width:v,height:h,top:m,right:d+v,bottom:m+h,left:d,x:d,y:m}}function d(e){var t=r(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function m(e){return e?(e.nodeName||"").toLowerCase():null}function v(e){return((o(e)?e.ownerDocument:e.document)||window.document).documentElement}function h(e){return f(v(e)).left+d(e).scrollLeft}function g(e){return r(e).getComputedStyle(e)}function y(e){var t=g(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function b(e,t,n){void 0===n&&(n=!1);var o,a,s=i(t),c=i(t)&&function(e){var t=e.getBoundingClientRect(),n=u(t.width)/e.offsetWidth||1,r=u(t.height)/e.offsetHeight||1;return 1!==n||1!==r}(t),l=v(t),p=f(e,c,n),g={scrollLeft:0,scrollTop:0},b={x:0,y:0};return(s||!s&&!n)&&(("body"!==m(t)||y(l))&&(g=(o=t)!==r(o)&&i(o)?{scrollLeft:(a=o).scrollLeft,scrollTop:a.scrollTop}:d(o)),i(t)?((b=f(t,!0)).x+=t.clientLeft,b.y+=t.clientTop):l&&(b.x=h(l))),{x:p.left+g.scrollLeft-b.x,y:p.top+g.scrollTop-b.y,width:p.width,height:p.height}}function w(e){var t=f(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function x(e){return"html"===m(e)?e:e.assignedSlot||e.parentNode||(a(e)?e.host:null)||v(e)}function O(e){return["html","body","#document"].indexOf(m(e))>=0?e.ownerDocument.body:i(e)&&y(e)?e:O(x(e))}function E(e,t){var n;void 0===t&&(t=[]);var o=O(e),i=o===(null==(n=e.ownerDocument)?void 0:n.body),a=r(o),s=i?[a].concat(a.visualViewport||[],y(o)?o:[]):o,c=t.concat(s);return i?c:c.concat(E(x(s)))}function A(e){return["table","td","th"].indexOf(m(e))>=0}function _(e){return i(e)&&"fixed"!==g(e).position?e.offsetParent:null}function T(e){for(var t=r(e),n=_(e);n&&A(n)&&"static"===g(n).position;)n=_(n);return n&&("html"===m(n)||"body"===m(n)&&"static"===g(n).position)?t:n||function(e){var t=/firefox/i.test(l());if(/Trident/i.test(l())&&i(e)&&"fixed"===g(e).position)return null;var n=x(e);for(a(n)&&(n=n.host);i(n)&&["html","body"].indexOf(m(n))<0;){var r=g(n);if("none"!==r.transform||"none"!==r.perspective||"paint"===r.contain||-1!==["transform","perspective"].indexOf(r.willChange)||t&&"filter"===r.willChange||t&&r.filter&&"none"!==r.filter)return n;n=n.parentNode}return null}(e)||t}var L="top",j="bottom",D="right",S="left",C="auto",k=[L,j,D,S],M="start",q="end",I="viewport",B="popper",R=k.reduce((function(e,t){return e.concat([t+"-"+M,t+"-"+q])}),[]),H=[].concat(k,[C]).reduce((function(e,t){return e.concat([t,t+"-"+M,t+"-"+q])}),[]),P=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function V(e){var t=new Map,n=new Set,r=[];function o(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!n.has(e)){var r=t.get(e);r&&o(r)}})),r.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||o(e)})),r}var W={placement:"bottom",modifiers:[],strategy:"absolute"};function N(){for(var e=arguments.length,t=new Array(e),n=0;n=0?"x":"y"}function X(e){var t,n=e.reference,r=e.element,o=e.placement,i=o?$(o):null,a=o?z(o):null,s=n.x+n.width/2-r.width/2,c=n.y+n.height/2-r.height/2;switch(i){case L:t={x:s,y:n.y-r.height};break;case j:t={x:s,y:n.y+n.height};break;case D:t={x:n.x+n.width,y:c};break;case S:t={x:n.x-r.width,y:c};break;default:t={x:n.x,y:n.y}}var u=i?Q(i):null;if(null!=u){var l="y"===u?"height":"width";switch(a){case M:t[u]=t[u]-(n[l]/2-r[l]/2);break;case q:t[u]=t[u]+(n[l]/2-r[l]/2)}}return t}var Y={top:"auto",right:"auto",bottom:"auto",left:"auto"};function J(e){var t,n=e.popper,o=e.popperRect,i=e.placement,a=e.variation,s=e.offsets,c=e.position,l=e.gpuAcceleration,p=e.adaptive,f=e.roundOffsets,d=e.isFixed,m=s.x,h=void 0===m?0:m,y=s.y,b=void 0===y?0:y,w="function"==typeof f?f({x:h,y:b}):{x:h,y:b};h=w.x,b=w.y;var x=s.hasOwnProperty("x"),O=s.hasOwnProperty("y"),E=S,A=L,_=window;if(p){var C=T(n),k="clientHeight",M="clientWidth";C===r(n)&&"static"!==g(C=v(n)).position&&"absolute"===c&&(k="scrollHeight",M="scrollWidth"),(i===L||(i===S||i===D)&&a===q)&&(A=j,b-=(d&&C===_&&_.visualViewport?_.visualViewport.height:C[k])-o.height,b*=l?1:-1),i!==S&&(i!==L&&i!==j||a!==q)||(E=D,h-=(d&&C===_&&_.visualViewport?_.visualViewport.width:C[M])-o.width,h*=l?1:-1)}var I,B=Object.assign({position:c},p&&Y),R=!0===f?function(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:u(n*o)/o||0,y:u(r*o)/o||0}}({x:h,y:b},r(n)):{x:h,y:b};return h=R.x,b=R.y,l?Object.assign({},B,((I={})[A]=O?"0":"",I[E]=x?"0":"",I.transform=(_.devicePixelRatio||1)<=1?"translate("+h+"px, "+b+"px)":"translate3d("+h+"px, "+b+"px, 0)",I)):Object.assign({},B,((t={})[A]=O?b+"px":"",t[E]=x?h+"px":"",t.transform="",t))}const G={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},o=t.elements[e];i(o)&&m(o)&&(Object.assign(o.style,n),Object.keys(r).forEach((function(e){var t=r[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach((function(e){var r=t.elements[e],o=t.attributes[e]||{},a=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce((function(e,t){return e[t]="",e}),{});i(r)&&m(r)&&(Object.assign(r.style,a),Object.keys(o).forEach((function(e){r.removeAttribute(e)})))}))}},requires:["computeStyles"]};var K={left:"right",right:"left",bottom:"top",top:"bottom"};function Z(e){return e.replace(/left|right|bottom|top/g,(function(e){return K[e]}))}var ee={start:"end",end:"start"};function te(e){return e.replace(/start|end/g,(function(e){return ee[e]}))}function ne(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&a(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function re(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function oe(e,t,n){return t===I?re(function(e,t){var n=r(e),o=v(e),i=n.visualViewport,a=o.clientWidth,s=o.clientHeight,c=0,u=0;if(i){a=i.width,s=i.height;var l=p();(l||!l&&"fixed"===t)&&(c=i.offsetLeft,u=i.offsetTop)}return{width:a,height:s,x:c+h(e),y:u}}(e,n)):o(t)?function(e,t){var n=f(e,!1,"fixed"===t);return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}(t,n):re(function(e){var t,n=v(e),r=d(e),o=null==(t=e.ownerDocument)?void 0:t.body,i=s(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=s(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),c=-r.scrollLeft+h(e),u=-r.scrollTop;return"rtl"===g(o||n).direction&&(c+=s(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:a,x:c,y:u}}(v(e)))}function ie(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function ae(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}function se(e,t){void 0===t&&(t={});var n=t,r=n.placement,a=void 0===r?e.placement:r,u=n.strategy,l=void 0===u?e.strategy:u,p=n.boundary,d=void 0===p?"clippingParents":p,h=n.rootBoundary,y=void 0===h?I:h,b=n.elementContext,w=void 0===b?B:b,O=n.altBoundary,A=void 0!==O&&O,_=n.padding,S=void 0===_?0:_,C=ie("number"!=typeof S?S:ae(S,k)),M=w===B?"reference":B,q=e.rects.popper,R=e.elements[A?M:w],H=function(e,t,n,r){var a="clippingParents"===t?function(e){var t=E(x(e)),n=["absolute","fixed"].indexOf(g(e).position)>=0&&i(e)?T(e):e;return o(n)?t.filter((function(e){return o(e)&&ne(e,n)&&"body"!==m(e)})):[]}(e):[].concat(t),u=[].concat(a,[n]),l=u[0],p=u.reduce((function(t,n){var o=oe(e,n,r);return t.top=s(o.top,t.top),t.right=c(o.right,t.right),t.bottom=c(o.bottom,t.bottom),t.left=s(o.left,t.left),t}),oe(e,l,r));return p.width=p.right-p.left,p.height=p.bottom-p.top,p.x=p.left,p.y=p.top,p}(o(R)?R:R.contextElement||v(e.elements.popper),d,y,l),P=f(e.elements.reference),V=X({reference:P,element:q,strategy:"absolute",placement:a}),W=re(Object.assign({},q,V)),N=w===B?W:P,U={top:H.top-N.top+C.top,bottom:N.bottom-H.bottom+C.bottom,left:H.left-N.left+C.left,right:N.right-H.right+C.right},F=e.modifiersData.offset;if(w===B&&F){var $=F[a];Object.keys(U).forEach((function(e){var t=[D,j].indexOf(e)>=0?1:-1,n=[L,j].indexOf(e)>=0?"y":"x";U[e]+=$[n]*t}))}return U}function ce(e,t,n){return s(e,c(t,n))}function ue(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function le(e){return[L,D,j,S].some((function(t){return e[t]>=0}))}var pe=U({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,n=e.instance,o=e.options,i=o.scroll,a=void 0===i||i,s=o.resize,c=void 0===s||s,u=r(t.elements.popper),l=[].concat(t.scrollParents.reference,t.scrollParents.popper);return a&&l.forEach((function(e){e.addEventListener("scroll",n.update,F)})),c&&u.addEventListener("resize",n.update,F),function(){a&&l.forEach((function(e){e.removeEventListener("scroll",n.update,F)})),c&&u.removeEventListener("resize",n.update,F)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,n=e.name;t.modifiersData[n]=X({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=void 0===r||r,i=n.adaptive,a=void 0===i||i,s=n.roundOffsets,c=void 0===s||s,u={placement:$(t.placement),variation:z(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,J(Object.assign({},u,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:c})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,J(Object.assign({},u,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},G,{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.options,r=e.name,o=n.offset,i=void 0===o?[0,0]:o,a=H.reduce((function(e,n){return e[n]=function(e,t,n){var r=$(e),o=[S,L].indexOf(r)>=0?-1:1,i="function"==typeof n?n(Object.assign({},t,{placement:e})):n,a=i[0],s=i[1];return a=a||0,s=(s||0)*o,[S,D].indexOf(r)>=0?{x:s,y:a}:{x:a,y:s}}(n,t.rects,i),e}),{}),s=a[t.placement],c=s.x,u=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=c,t.modifiersData.popperOffsets.y+=u),t.modifiersData[r]=a}},{name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,i=void 0===o||o,a=n.altAxis,s=void 0===a||a,c=n.fallbackPlacements,u=n.padding,l=n.boundary,p=n.rootBoundary,f=n.altBoundary,d=n.flipVariations,m=void 0===d||d,v=n.allowedAutoPlacements,h=t.options.placement,g=$(h),y=c||(g!==h&&m?function(e){if($(e)===C)return[];var t=Z(e);return[te(e),t,te(t)]}(h):[Z(h)]),b=[h].concat(y).reduce((function(e,n){return e.concat($(n)===C?function(e,t){void 0===t&&(t={});var n=t,r=n.placement,o=n.boundary,i=n.rootBoundary,a=n.padding,s=n.flipVariations,c=n.allowedAutoPlacements,u=void 0===c?H:c,l=z(r),p=l?s?R:R.filter((function(e){return z(e)===l})):k,f=p.filter((function(e){return u.indexOf(e)>=0}));0===f.length&&(f=p);var d=f.reduce((function(t,n){return t[n]=se(e,{placement:n,boundary:o,rootBoundary:i,padding:a})[$(n)],t}),{});return Object.keys(d).sort((function(e,t){return d[e]-d[t]}))}(t,{placement:n,boundary:l,rootBoundary:p,padding:u,flipVariations:m,allowedAutoPlacements:v}):n)}),[]),w=t.rects.reference,x=t.rects.popper,O=new Map,E=!0,A=b[0],_=0;_=0,P=B?"width":"height",V=se(t,{placement:T,boundary:l,rootBoundary:p,altBoundary:f,padding:u}),W=B?I?D:S:I?j:L;w[P]>x[P]&&(W=Z(W));var N=Z(W),U=[];if(i&&U.push(V[q]<=0),s&&U.push(V[W]<=0,V[N]<=0),U.every((function(e){return e}))){A=T,E=!1;break}O.set(T,U)}if(E)for(var F=function(e){var t=b.find((function(t){var n=O.get(t);if(n)return n.slice(0,e).every((function(e){return e}))}));if(t)return A=t,"break"},Q=m?3:1;Q>0&&"break"!==F(Q);Q--);t.placement!==A&&(t.modifiersData[r]._skip=!0,t.placement=A,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,i=void 0===o||o,a=n.altAxis,u=void 0!==a&&a,l=n.boundary,p=n.rootBoundary,f=n.altBoundary,d=n.padding,m=n.tether,v=void 0===m||m,h=n.tetherOffset,g=void 0===h?0:h,y=se(t,{boundary:l,rootBoundary:p,padding:d,altBoundary:f}),b=$(t.placement),x=z(t.placement),O=!x,E=Q(b),A="x"===E?"y":"x",_=t.modifiersData.popperOffsets,C=t.rects.reference,k=t.rects.popper,q="function"==typeof g?g(Object.assign({},t.rects,{placement:t.placement})):g,I="number"==typeof q?{mainAxis:q,altAxis:q}:Object.assign({mainAxis:0,altAxis:0},q),B=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,R={x:0,y:0};if(_){if(i){var H,P="y"===E?L:S,V="y"===E?j:D,W="y"===E?"height":"width",N=_[E],U=N+y[P],F=N-y[V],X=v?-k[W]/2:0,Y=x===M?C[W]:k[W],J=x===M?-k[W]:-C[W],G=t.elements.arrow,K=v&&G?w(G):{width:0,height:0},Z=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},ee=Z[P],te=Z[V],ne=ce(0,C[W],K[W]),re=O?C[W]/2-X-ne-ee-I.mainAxis:Y-ne-ee-I.mainAxis,oe=O?-C[W]/2+X+ne+te+I.mainAxis:J+ne+te+I.mainAxis,ie=t.elements.arrow&&T(t.elements.arrow),ae=ie?"y"===E?ie.clientTop||0:ie.clientLeft||0:0,ue=null!=(H=null==B?void 0:B[E])?H:0,le=N+oe-ue,pe=ce(v?c(U,N+re-ue-ae):U,N,v?s(F,le):F);_[E]=pe,R[E]=pe-N}if(u){var fe,de="x"===E?L:S,me="x"===E?j:D,ve=_[A],he="y"===A?"height":"width",ge=ve+y[de],ye=ve-y[me],be=-1!==[L,S].indexOf(b),we=null!=(fe=null==B?void 0:B[A])?fe:0,xe=be?ge:ve-C[he]-k[he]-we+I.altAxis,Oe=be?ve+C[he]+k[he]-we-I.altAxis:ye,Ee=v&&be?function(e,t,n){var r=ce(e,t,n);return r>n?n:r}(xe,ve,Oe):ce(v?xe:ge,ve,v?Oe:ye);_[A]=Ee,R[A]=Ee-ve}t.modifiersData[r]=R}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,r=e.name,o=e.options,i=n.elements.arrow,a=n.modifiersData.popperOffsets,s=$(n.placement),c=Q(s),u=[S,D].indexOf(s)>=0?"height":"width";if(i&&a){var l=function(e,t){return ie("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:ae(e,k))}(o.padding,n),p=w(i),f="y"===c?L:S,d="y"===c?j:D,m=n.rects.reference[u]+n.rects.reference[c]-a[c]-n.rects.popper[u],v=a[c]-n.rects.reference[c],h=T(i),g=h?"y"===c?h.clientHeight||0:h.clientWidth||0:0,y=m/2-v/2,b=l[f],x=g-p[u]-l[d],O=g/2-p[u]/2+y,E=ce(b,O,x),A=c;n.modifiersData[r]=((t={})[A]=E,t.centerOffset=E-O,t)}},effect:function(e){var t=e.state,n=e.options.element,r=void 0===n?"[data-popper-arrow]":n;null!=r&&("string"!=typeof r||(r=t.elements.popper.querySelector(r)))&&ne(t.elements.popper,r)&&(t.elements.arrow=r)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,i=t.modifiersData.preventOverflow,a=se(t,{elementContext:"reference"}),s=se(t,{altBoundary:!0}),c=ue(a,r),u=ue(s,o,i),l=le(c),p=le(u);t.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:u,isReferenceHidden:l,hasPopperEscaped:p},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":l,"data-popper-escaped":p})}}]}),fe="tippy-content",de="tippy-backdrop",me="tippy-arrow",ve="tippy-svg-arrow",he={passive:!0,capture:!0},ge=function(){return document.body};function ye(e,t,n){if(Array.isArray(e)){var r=e[t];return null==r?Array.isArray(n)?n[t]:n:r}return e}function be(e,t){var n={}.toString.call(e);return 0===n.indexOf("[object")&&n.indexOf(t+"]")>-1}function we(e,t){return"function"==typeof e?e.apply(void 0,t):e}function xe(e,t){return 0===t?e:function(r){clearTimeout(n),n=setTimeout((function(){e(r)}),t)};var n}function Oe(e){return[].concat(e)}function Ee(e,t){-1===e.indexOf(t)&&e.push(t)}function Ae(e){return[].slice.call(e)}function _e(e){return Object.keys(e).reduce((function(t,n){return void 0!==e[n]&&(t[n]=e[n]),t}),{})}function Te(){return document.createElement("div")}function Le(e){return["Element","Fragment"].some((function(t){return be(e,t)}))}function je(e,t){e.forEach((function(e){e&&(e.style.transitionDuration=t+"ms")}))}function De(e,t){e.forEach((function(e){e&&e.setAttribute("data-state",t)}))}function Se(e,t,n){var r=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach((function(t){e[r](t,n)}))}function Ce(e,t){for(var n=t;n;){var r;if(e.contains(n))return!0;n=null==n.getRootNode||null==(r=n.getRootNode())?void 0:r.host}return!1}var ke={isTouch:!1},Me=0;function qe(){ke.isTouch||(ke.isTouch=!0,window.performance&&document.addEventListener("mousemove",Ie))}function Ie(){var e=performance.now();e-Me<20&&(ke.isTouch=!1,document.removeEventListener("mousemove",Ie)),Me=e}function Be(){var e,t=document.activeElement;if((e=t)&&e._tippy&&e._tippy.reference===e){var n=t._tippy;t.blur&&!n.state.isVisible&&t.blur()}}var Re=!("undefined"==typeof window||"undefined"==typeof document||!window.msCrypto),He=Object.assign({appendTo:ge,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},{animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),Pe=Object.keys(He);function Ve(e){var t=(e.plugins||[]).reduce((function(t,n){var r,o=n.name,i=n.defaultValue;return o&&(t[o]=void 0!==e[o]?e[o]:null!=(r=He[o])?r:i),t}),{});return Object.assign({},e,t)}function We(e,t){var n=Object.assign({},t,{content:we(t.content,[e])},t.ignoreAttributes?{}:function(e,t){return(t?Object.keys(Ve(Object.assign({},He,{plugins:t}))):Pe).reduce((function(t,n){var r=(e.getAttribute("data-tippy-"+n)||"").trim();if(!r)return t;if("content"===n)t[n]=r;else try{t[n]=JSON.parse(r)}catch(e){t[n]=r}return t}),{})}(e,t.plugins));return n.aria=Object.assign({},He.aria,n.aria),n.aria={expanded:"auto"===n.aria.expanded?t.interactive:n.aria.expanded,content:"auto"===n.aria.content?t.interactive?null:"describedby":n.aria.content},n}var Ne=function(){return"innerHTML"};function Ue(e,t){e[Ne()]=t}function Fe(e){var t=Te();return!0===e?t.className=me:(t.className=ve,Le(e)?t.appendChild(e):Ue(t,e)),t}function $e(e,t){Le(t.content)?(Ue(e,""),e.appendChild(t.content)):"function"!=typeof t.content&&(t.allowHTML?Ue(e,t.content):e.textContent=t.content)}function ze(e){var t=e.firstElementChild,n=Ae(t.children);return{box:t,content:n.find((function(e){return e.classList.contains(fe)})),arrow:n.find((function(e){return e.classList.contains(me)||e.classList.contains(ve)})),backdrop:n.find((function(e){return e.classList.contains(de)}))}}function Qe(e){var t=Te(),n=Te();n.className="tippy-box",n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=Te();function o(n,r){var o=ze(t),i=o.box,a=o.content,s=o.arrow;r.theme?i.setAttribute("data-theme",r.theme):i.removeAttribute("data-theme"),"string"==typeof r.animation?i.setAttribute("data-animation",r.animation):i.removeAttribute("data-animation"),r.inertia?i.setAttribute("data-inertia",""):i.removeAttribute("data-inertia"),i.style.maxWidth="number"==typeof r.maxWidth?r.maxWidth+"px":r.maxWidth,r.role?i.setAttribute("role",r.role):i.removeAttribute("role"),n.content===r.content&&n.allowHTML===r.allowHTML||$e(a,e.props),r.arrow?s?n.arrow!==r.arrow&&(i.removeChild(s),i.appendChild(Fe(r.arrow))):i.appendChild(Fe(r.arrow)):s&&i.removeChild(s)}return r.className=fe,r.setAttribute("data-state","hidden"),$e(r,e.props),t.appendChild(n),n.appendChild(r),o(e.props,e.props),{popper:t,onUpdate:o}}Qe.$$tippy=!0;var Xe=1,Ye=[],Je=[];function Ge(e,t){var n,r,o,i,a,s,c,u,l=We(e,Object.assign({},He,Ve(_e(t)))),p=!1,f=!1,d=!1,m=!1,v=[],h=xe(Q,l.interactiveDebounce),g=Xe++,y=(u=l.plugins).filter((function(e,t){return u.indexOf(e)===t})),b={id:g,reference:e,popper:Te(),popperInstance:null,props:l,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:y,clearDelayTimeouts:function(){clearTimeout(n),clearTimeout(r),cancelAnimationFrame(o)},setProps:function(t){if(!b.state.isDestroyed){M("onBeforeUpdate",[b,t]),$();var n=b.props,r=We(e,Object.assign({},n,_e(t),{ignoreAttributes:!0}));b.props=r,F(),n.interactiveDebounce!==r.interactiveDebounce&&(B(),h=xe(Q,r.interactiveDebounce)),n.triggerTarget&&!r.triggerTarget?Oe(n.triggerTarget).forEach((function(e){e.removeAttribute("aria-expanded")})):r.triggerTarget&&e.removeAttribute("aria-expanded"),I(),k(),O&&O(n,r),b.popperInstance&&(G(),Z().forEach((function(e){requestAnimationFrame(e._tippy.popperInstance.forceUpdate)}))),M("onAfterUpdate",[b,t])}},setContent:function(e){b.setProps({content:e})},show:function(){var e=b.state.isVisible,t=b.state.isDestroyed,n=!b.state.isEnabled,r=ke.isTouch&&!b.props.touch,o=ye(b.props.duration,0,He.duration);if(!(e||t||n||r||j().hasAttribute("disabled")||(M("onShow",[b],!1),!1===b.props.onShow(b)))){if(b.state.isVisible=!0,L()&&(x.style.visibility="visible"),k(),V(),b.state.isMounted||(x.style.transition="none"),L()){var i=S();je([i.box,i.content],0)}var a,c,u;s=function(){var e;if(b.state.isVisible&&!m){if(m=!0,x.offsetHeight,x.style.transition=b.props.moveTransition,L()&&b.props.animation){var t=S(),n=t.box,r=t.content;je([n,r],o),De([n,r],"visible")}q(),I(),Ee(Je,b),null==(e=b.popperInstance)||e.forceUpdate(),M("onMount",[b]),b.props.animation&&L()&&function(e,t){N(e,(function(){b.state.isShown=!0,M("onShown",[b])}))}(o)}},c=b.props.appendTo,u=j(),(a=b.props.interactive&&c===ge||"parent"===c?u.parentNode:we(c,[u])).contains(x)||a.appendChild(x),b.state.isMounted=!0,G()}},hide:function(){var e=!b.state.isVisible,t=b.state.isDestroyed,n=!b.state.isEnabled,r=ye(b.props.duration,1,He.duration);if(!(e||t||n)&&(M("onHide",[b],!1),!1!==b.props.onHide(b))){if(b.state.isVisible=!1,b.state.isShown=!1,m=!1,p=!1,L()&&(x.style.visibility="hidden"),B(),W(),k(!0),L()){var o=S(),i=o.box,a=o.content;b.props.animation&&(je([i,a],r),De([i,a],"hidden"))}q(),I(),b.props.animation?L()&&function(e,t){N(e,(function(){!b.state.isVisible&&x.parentNode&&x.parentNode.contains(x)&&t()}))}(r,b.unmount):b.unmount()}},hideWithInteractivity:function(e){D().addEventListener("mousemove",h),Ee(Ye,h),h(e)},enable:function(){b.state.isEnabled=!0},disable:function(){b.hide(),b.state.isEnabled=!1},unmount:function(){b.state.isVisible&&b.hide(),b.state.isMounted&&(K(),Z().forEach((function(e){e._tippy.unmount()})),x.parentNode&&x.parentNode.removeChild(x),Je=Je.filter((function(e){return e!==b})),b.state.isMounted=!1,M("onHidden",[b]))},destroy:function(){b.state.isDestroyed||(b.clearDelayTimeouts(),b.unmount(),$(),delete e._tippy,b.state.isDestroyed=!0,M("onDestroy",[b]))}};if(!l.render)return b;var w=l.render(b),x=w.popper,O=w.onUpdate;x.setAttribute("data-tippy-root",""),x.id="tippy-"+b.id,b.popper=x,e._tippy=b,x._tippy=b;var E=y.map((function(e){return e.fn(b)})),A=e.hasAttribute("aria-expanded");return F(),I(),k(),M("onCreate",[b]),l.showOnCreate&&ee(),x.addEventListener("mouseenter",(function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()})),x.addEventListener("mouseleave",(function(){b.props.interactive&&b.props.trigger.indexOf("mouseenter")>=0&&D().addEventListener("mousemove",h)})),b;function _(){var e=b.props.touch;return Array.isArray(e)?e:[e,0]}function T(){return"hold"===_()[0]}function L(){var e;return!(null==(e=b.props.render)||!e.$$tippy)}function j(){return c||e}function D(){var e,t,n=j().parentNode;return n?null!=(t=Oe(n)[0])&&null!=(e=t.ownerDocument)&&e.body?t.ownerDocument:document:document}function S(){return ze(x)}function C(e){return b.state.isMounted&&!b.state.isVisible||ke.isTouch||i&&"focus"===i.type?0:ye(b.props.delay,e?0:1,He.delay)}function k(e){void 0===e&&(e=!1),x.style.pointerEvents=b.props.interactive&&!e?"":"none",x.style.zIndex=""+b.props.zIndex}function M(e,t,n){var r;void 0===n&&(n=!0),E.forEach((function(n){n[e]&&n[e].apply(n,t)})),n&&(r=b.props)[e].apply(r,t)}function q(){var t=b.props.aria;if(t.content){var n="aria-"+t.content,r=x.id;Oe(b.props.triggerTarget||e).forEach((function(e){var t=e.getAttribute(n);if(b.state.isVisible)e.setAttribute(n,t?t+" "+r:r);else{var o=t&&t.replace(r,"").trim();o?e.setAttribute(n,o):e.removeAttribute(n)}}))}}function I(){!A&&b.props.aria.expanded&&Oe(b.props.triggerTarget||e).forEach((function(e){b.props.interactive?e.setAttribute("aria-expanded",b.state.isVisible&&e===j()?"true":"false"):e.removeAttribute("aria-expanded")}))}function B(){D().removeEventListener("mousemove",h),Ye=Ye.filter((function(e){return e!==h}))}function R(t){if(!ke.isTouch||!d&&"mousedown"!==t.type){var n=t.composedPath&&t.composedPath()[0]||t.target;if(!b.props.interactive||!Ce(x,n)){if(Oe(b.props.triggerTarget||e).some((function(e){return Ce(e,n)}))){if(ke.isTouch)return;if(b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else M("onClickOutside",[b,t]);!0===b.props.hideOnClick&&(b.clearDelayTimeouts(),b.hide(),f=!0,setTimeout((function(){f=!1})),b.state.isMounted||W())}}}function H(){d=!0}function P(){d=!1}function V(){var e=D();e.addEventListener("mousedown",R,!0),e.addEventListener("touchend",R,he),e.addEventListener("touchstart",P,he),e.addEventListener("touchmove",H,he)}function W(){var e=D();e.removeEventListener("mousedown",R,!0),e.removeEventListener("touchend",R,he),e.removeEventListener("touchstart",P,he),e.removeEventListener("touchmove",H,he)}function N(e,t){var n=S().box;function r(e){e.target===n&&(Se(n,"remove",r),t())}if(0===e)return t();Se(n,"remove",a),Se(n,"add",r),a=r}function U(t,n,r){void 0===r&&(r=!1),Oe(b.props.triggerTarget||e).forEach((function(e){e.addEventListener(t,n,r),v.push({node:e,eventType:t,handler:n,options:r})}))}function F(){var e;T()&&(U("touchstart",z,{passive:!0}),U("touchend",X,{passive:!0})),(e=b.props.trigger,e.split(/\s+/).filter(Boolean)).forEach((function(e){if("manual"!==e)switch(U(e,z),e){case"mouseenter":U("mouseleave",X);break;case"focus":U(Re?"focusout":"blur",Y);break;case"focusin":U("focusout",Y)}}))}function $(){v.forEach((function(e){var t=e.node,n=e.eventType,r=e.handler,o=e.options;t.removeEventListener(n,r,o)})),v=[]}function z(e){var t,n=!1;if(b.state.isEnabled&&!J(e)&&!f){var r="focus"===(null==(t=i)?void 0:t.type);i=e,c=e.currentTarget,I(),!b.state.isVisible&&be(e,"MouseEvent")&&Ye.forEach((function(t){return t(e)})),"click"===e.type&&(b.props.trigger.indexOf("mouseenter")<0||p)&&!1!==b.props.hideOnClick&&b.state.isVisible?n=!0:ee(e),"click"===e.type&&(p=!n),n&&!r&&te(e)}}function Q(e){var t=e.target,n=j().contains(t)||x.contains(t);if("mousemove"!==e.type||!n){var r=Z().concat(x).map((function(e){var t,n=null==(t=e._tippy.popperInstance)?void 0:t.state;return n?{popperRect:e.getBoundingClientRect(),popperState:n,props:l}:null})).filter(Boolean);(function(e,t){var n=t.clientX,r=t.clientY;return e.every((function(e){var t=e.popperRect,o=e.popperState,i=e.props.interactiveBorder,a=o.placement.split("-")[0],s=o.modifiersData.offset;if(!s)return!0;var c="bottom"===a?s.top.y:0,u="top"===a?s.bottom.y:0,l="right"===a?s.left.x:0,p="left"===a?s.right.x:0,f=t.top-r+c>i,d=r-t.bottom-u>i,m=t.left-n+l>i,v=n-t.right-p>i;return f||d||m||v}))})(r,e)&&(B(),te(e))}}function X(e){J(e)||b.props.trigger.indexOf("click")>=0&&p||(b.props.interactive?b.hideWithInteractivity(e):te(e))}function Y(e){b.props.trigger.indexOf("focusin")<0&&e.target!==j()||b.props.interactive&&e.relatedTarget&&x.contains(e.relatedTarget)||te(e)}function J(e){return!!ke.isTouch&&T()!==e.type.indexOf("touch")>=0}function G(){K();var t=b.props,n=t.popperOptions,r=t.placement,o=t.offset,i=t.getReferenceClientRect,a=t.moveTransition,c=L()?ze(x).arrow:null,u=i?{getBoundingClientRect:i,contextElement:i.contextElement||j()}:e,l=[{name:"offset",options:{offset:o}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!a}},{name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(e){var t=e.state;if(L()){var n=S().box;["placement","reference-hidden","escaped"].forEach((function(e){"placement"===e?n.setAttribute("data-placement",t.placement):t.attributes.popper["data-popper-"+e]?n.setAttribute("data-"+e,""):n.removeAttribute("data-"+e)})),t.attributes.popper={}}}}];L()&&c&&l.push({name:"arrow",options:{element:c,padding:3}}),l.push.apply(l,(null==n?void 0:n.modifiers)||[]),b.popperInstance=pe(u,x,Object.assign({},n,{placement:r,onFirstUpdate:s,modifiers:l}))}function K(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function Z(){return Ae(x.querySelectorAll("[data-tippy-root]"))}function ee(e){b.clearDelayTimeouts(),e&&M("onTrigger",[b,e]),V();var t=C(!0),r=_(),o=r[0],i=r[1];ke.isTouch&&"hold"===o&&i&&(t=i),t?n=setTimeout((function(){b.show()}),t):b.show()}function te(e){if(b.clearDelayTimeouts(),M("onUntrigger",[b,e]),b.state.isVisible){if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(e.type)>=0&&p)){var t=C(!1);t?r=setTimeout((function(){b.state.isVisible&&b.hide()}),t):o=requestAnimationFrame((function(){b.hide()}))}}else W()}}function Ke(e,t){void 0===t&&(t={});var n=He.plugins.concat(t.plugins||[]);document.addEventListener("touchstart",qe,he),window.addEventListener("blur",Be);var r,o=Object.assign({},t,{plugins:n}),i=(r=e,Le(r)?[r]:function(e){return be(e,"NodeList")}(r)?Ae(r):Array.isArray(r)?r:Ae(document.querySelectorAll(r))).reduce((function(e,t){var n=t&&Ge(t,o);return n&&e.push(n),e}),[]);return Le(e)?i[0]:i}Ke.defaultProps=He,Ke.setDefaultProps=function(e){Object.keys(e).forEach((function(t){He[t]=e[t]}))},Ke.currentInput=ke,Object.assign({},G,{effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow)}}),Ke.setDefaultProps({render:Qe});const Ze=Ke,et=window.wp.element,tt=window.wp.components,nt=window.wp.coreData,rt=window.wp.compose,ot=window.wp.data,it=window.wp.apiFetch;var at=e.n(it);const st=window.wp.url,ct=({value:e,onChange:r})=>{const[o,i]=(0,et.useState)({}),[a,s]=(0,et.useState)([]),[c,u]=(0,et.useState)(""),l=(0,rt.useDebounce)(u,500),p=e=>`${e.name} (${e.slug})`,f=e=>e.replace(/ /g,"").toLowerCase();(0,et.useEffect)((()=>{const t=e.filter((e=>e));if(t.length){const e={context:"view",include:t,per_page:-1,__fields:"id,name,slug"};at()({path:(0,st.addQueryArgs)("/wp/v2/users",e)}).then((e=>{const t=null!=e?e:[],n=t.map(p);s(n);const r={};t.forEach((e=>{r[f(p(e))]=e.id})),i(r)})).catch(console.error)}}),[e]);const d=(0,ot.useSelect)((e=>{const{getUsers:t}=e(nt.store);return t({context:"view",search:encodeURIComponent(c),per_page:100,__fields:"id,name,slug"})}),[c]),m=(0,et.useMemo)((()=>(null!=d?d:[]).map(p)),[d]);return(0,et.useEffect)((()=>{(null!=d?d:[]).forEach((e=>{o[f(p(e))]=e.id})),i(o)}),[d,o]),(0,t.createElement)(tt.FormTokenField,{className:"classifai-user-selector-field",value:a,suggestions:m,onChange:function(e){const t=[],n=e.reduce(((e,n)=>(e.some((e=>e.toLowerCase()===n.toLowerCase()))||(e.push(n),o&&o[f(n)]&&t.push(o[f(n)])),e)),[]);r(t),s(n)},onInputChange:l,label:null,placeholder:(0,n.__)("Search for users","classifai"),__experimentalShowHowTo:!1,messages:{added:(0,n.__)("User added.","classifai"),removed:(0,n.__)("User removed.","classifai"),remove:(0,n.__)("Remove user","classifai"),__experimentalInvalid:(0,n.__)("Invalid user","classifai")}})};var ut;document.addEventListener("DOMContentLoaded",(function(){const e=document.getElementById("help-menu-template");if(!e)return;const t=document.createElement("div");t.appendChild(document.importNode(e.content,!0)),Ze(".classifai-help",{allowHTML:!0,content:t.innerHTML,trigger:"click",placement:"bottom-end",arrow:!0,animation:"scale",duration:[250,200],theme:"light",interactive:!0})})),(()=>{const e=document.getElementById("classifai-waston-cred-toggle"),t=document.getElementById("username"),n=!!document.querySelector(".classifai-setup-form");if(null===e||null===t)return;let r=null,o=null;t.closest("tr")&&(r=t.closest("tr"),n&&(r=t.closest("td"))),document.getElementById("password").closest("tr")&&([o]=document.getElementById("password").closest("tr").getElementsByTagName("label"),n&&(o=document.querySelector('label[for="password"]'))),e.addEventListener("click",(i=>{if(i.preventDefault(),r.classList.toggle("hide-username"),n&&document.querySelector('label[for="username"]')&&document.querySelector('label[for="username"]').closest("th").classList.toggle("hide-username"),r.classList.contains("hide-username"))return e.innerText=ClassifAI.use_password,o.innerText=ClassifAI.api_key,void(t.value="apikey");e.innerText=ClassifAI.use_key,o.innerText=ClassifAI.api_password}))})(),(()=>{const e=document.querySelectorAll(".classifai-user-selector");e&&e.forEach((e=>{const n=e.getAttribute("data-id"),r=document.getElementById(n),o=r.value?.split(",")||[],i=e=>{r.value=e.join(",")};et.createRoot?(0,et.createRoot)(e).render((0,t.createElement)(ct,{value:o,onChange:i})):(0,et.render)((0,t.createElement)(ct,{value:o,onChange:i}),e)}))})(),(()=>{const e=document.querySelectorAll("button.js-classifai-add-prompt-fieldset");e.length&&e.forEach((e=>{e.addEventListener("click",(e=>{e.preventDefault(),function(e){const t=e.parentElement.querySelector(".classifai-field-type-prompt-setting").cloneNode(!0);(function(e,t){const r=t.querySelectorAll("fieldset"),o=Array.from(r).pop(),i=parseInt(o.querySelector("input").name.match(/\d+/).pop()),a=e.querySelectorAll("input, textarea"),s=e.querySelectorAll(".actions-rows .action__set_default");a.forEach((e=>{e.value="",e.removeAttribute("readonly"),e.name=e.name.replace(/(\d+)/g,(()=>i+1))})),s.forEach((e=>{e.classList.remove("selected"),e.textContent=(0,n.__)("Set as default prompt","classifai")}))})(t,e.closest("tr")),r(t),t.querySelector(".classifai-original-prompt").remove(),t.querySelector(".action__remove_prompt").style.display="block",e.insertAdjacentElement("afterend",t)}(e.target.previousElementSibling)}))}));const t=document.querySelectorAll(".classifai-field-type-prompt-setting");function r(e){e.querySelector("a.action__remove_prompt").addEventListener("click",(e=>{var t;e.preventDefault(),t=e.target,jQuery("#js-classifai--delete-prompt-modal").dialog({modal:!0,title:(0,n.__)("Remove Prompt","classifai"),width:550,buttons:[{text:(0,n.__)("Cancel","classifai"),class:"button-secondary",click(){jQuery(this).dialog("close")}},{text:(0,n.__)("Remove","classifai"),class:"button-primary",click(){const e=t.closest("fieldset"),n=e.parentElement,r="1"===e.querySelector(".js-setting-field__default").value,o=2===n.querySelectorAll("fieldset").length;e.remove(),r&&n.querySelector("fieldset .action__set_default").click(),o&&(n.querySelector(".action__remove_prompt").style.display="none"),jQuery(this).dialog("close")},style:"margin-left: 10px;"}]})})),e.querySelector("a.action__set_default").addEventListener("click",(t=>{t.preventDefault(),t.target.classList.contains("selected")||(t.target.closest("tr").querySelectorAll(".action__set_default").forEach((e=>{e.classList.contains("selected")&&(e.textContent=(0,n.__)("Set as default prompt","classifai")),e.classList.remove("selected"),e.closest("fieldset").querySelector(".js-setting-field__default").value=""})),t.target.classList.add("selected"),t.target.textContent=(0,n.__)("Default prompt","classifai"),e.querySelector(".js-setting-field__default").value="1")}))}t.length&&t.forEach((e=>{r(e)}))})(),(ut=jQuery)((function(){const e=ut("select#provider");e.on("change",(function(){const e=ut(this).val(),t=ut(".classifai-provider-field"),n=`.provider-scope-${e}`;t.addClass("hidden"),t.find(":input").prop("disabled",!0),ut(n).removeClass("hidden"),ut(n).find(":input").prop("disabled",!1)})),e.trigger("change")}))})(); \ No newline at end of file diff --git a/dist/commands.asset.php b/dist/commands.asset.php index 942cfc7f6..cd5d28e1f 100644 --- a/dist/commands.asset.php +++ b/dist/commands.asset.php @@ -1 +1 @@ - array('wp-commands', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-primitives'), 'version' => '29252950274641f22357'); + array('react', 'wp-commands', 'wp-i18n', 'wp-plugins', 'wp-primitives'), 'version' => 'f5ee3619ed735ef57882'); diff --git a/dist/commands.js b/dist/commands.js index db108b161..598229982 100644 --- a/dist/commands.js +++ b/dist/commands.js @@ -1 +1 @@ -(()=>{"use strict";const e=window.wp.commands,a=window.wp.element,c=window.wp.primitives,s=(0,a.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(c.Path,{d:"M14.5 13.8c-1.1 0-2.1.7-2.4 1.8H4V17h8.1c.3 1 1.3 1.8 2.4 1.8s2.1-.7 2.4-1.8H20v-1.5h-3.1c-.3-1-1.3-1.7-2.4-1.7zM11.9 7c-.3-1-1.3-1.8-2.4-1.8S7.4 6 7.1 7H4v1.5h3.1c.3 1 1.3 1.8 2.4 1.8s2.1-.7 2.4-1.8H20V7h-8.1z"})),t=(0,a.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(c.Path,{d:"m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"})),l=(0,a.createElement)(c.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(c.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z"})),i=window.wp.i18n,n=window.wp.plugins;"function"==typeof e.useCommandLoader&&(0,n.registerPlugin)("classifai-commands",{render:()=>((0,e.useCommandLoader)({name:"classifai",hook:()=>{const e=[],a=document.querySelector(".editor-post-excerpt button.classifai-post-excerpt"),c=document.querySelector(".classifai-post-status button.title");return e.push({name:"classifai/settings",label:(0,i.__)("ClassifAI settings","classifai"),icon:s,callback:()=>{document.location.href="tools.php?page=classifai"}}),a&&e.push({name:"classifai/generate-excerpt",label:(0,i.__)("ClassifAI: Generate excerpt","classifai"),icon:t,callback:({close:e})=>{e(),a.scrollIntoView({block:"center"}),a.click()}}),c&&e.push({name:"classifai/generate-titles",label:(0,i.__)("ClassifAI: Generate titles","classifai"),icon:t,callback:({close:e})=>{e(),c.scrollIntoView({block:"center"}),c.click()}}),"undefined"!=typeof classifaiDalleData&&e.push({name:"classifai/generate-image",label:(0,i.__)("ClassifAI: Generate image","classifai"),icon:l,callback:()=>{document.location.href="upload.php?action=classifai-generate-image"}}),{commands:e}}}),null)})})(); \ No newline at end of file +(()=>{"use strict";const e=window.wp.commands,a=window.React,c=window.wp.primitives,t=(0,a.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(c.Path,{d:"m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z"}),(0,a.createElement)(c.Path,{d:"m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z"})),s=(0,a.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(c.Path,{d:"m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"})),l=(0,a.createElement)(c.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(c.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z"})),i=window.wp.i18n,n=window.wp.plugins;"function"==typeof e.useCommandLoader&&(0,n.registerPlugin)("classifai-commands",{render:()=>((0,e.useCommandLoader)({name:"classifai",hook:()=>{const e=[],a=document.querySelector(".editor-post-excerpt button.classifai-post-excerpt"),c=document.querySelector(".classifai-post-status button.title");return e.push({name:"classifai/settings",label:(0,i.__)("ClassifAI settings","classifai"),icon:t,callback:()=>{document.location.href="tools.php?page=classifai"}}),a&&e.push({name:"classifai/generate-excerpt",label:(0,i.__)("ClassifAI: Generate excerpt","classifai"),icon:s,callback:({close:e})=>{e(),a.scrollIntoView({block:"center"}),a.click()}}),c&&e.push({name:"classifai/generate-titles",label:(0,i.__)("ClassifAI: Generate titles","classifai"),icon:s,callback:({close:e})=>{e(),c.scrollIntoView({block:"center"}),c.click()}}),"undefined"!=typeof classifaiDalleData&&e.push({name:"classifai/generate-image",label:(0,i.__)("ClassifAI: Generate image","classifai"),icon:l,callback:()=>{document.location.href="upload.php?action=classifai-generate-image"}}),{commands:e}}}),null)})})(); \ No newline at end of file diff --git a/dist/content-resizing-plugin.asset.php b/dist/content-resizing-plugin.asset.php index 93a3afe5d..3d7cae722 100644 --- a/dist/content-resizing-plugin.asset.php +++ b/dist/content-resizing-plugin.asset.php @@ -1 +1 @@ - array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-dom', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-url', 'wp-wordcount'), 'version' => '86e90a59e31ec76feffd'); + array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-dom', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-url', 'wp-wordcount'), 'version' => 'e495efe9c37eb15015df'); diff --git a/dist/content-resizing-plugin.js b/dist/content-resizing-plugin.js index 5041a2514..0e27c2c13 100644 --- a/dist/content-resizing-plugin.js +++ b/dist/content-resizing-plugin.js @@ -1 +1 @@ -(()=>{"use strict";const e=window.React,t=window.wp.plugins,n=window.wp.blockEditor,i=window.wp.editor,s=window.wp.data,a=window.wp.element,c=window.wp.dom,l=window.wp.compose,r=window.wp.components,o=window.wp.wordcount,d=window.wp.i18n,u=({feature:t})=>t&&ClassifAI?.opt_out_enabled_features?.includes(t)?(0,e.createElement)(r.Button,{href:ClassifAI?.profile_url,variant:"link",className:"classifai-disable-feature-link",target:"_blank",rel:"noopener noreferrer",label:(0,d.__)("Opt out of using this ClassifAI feature","classifai"),text:(0,d.__)("Disable this ClassifAI feature","classifai")}):null,p=(window.wp.coreData,window.wp.apiFetch,window.wp.url,(0,e.createElement)("svg",{width:"20",height:"15",viewBox:"0 0 61 46",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.51922 0C1.57575 0 0 1.5842 0 3.53846V42.4615C0 44.4158 1.57575 46 3.51922 46H57.4808C59.4243 46 61 44.4158 61 42.4615V3.53846C61 1.5842 59.4243 0 57.4808 0H3.51922ZM16.709 8.13836H21.4478L33.58 39.5542H27.524L24.0318 30.5144H13.9699L10.5169 39.5542H4.55669L16.709 8.13836ZM19.0894 16.7007C18.9846 17.041 18.878 17.3735 18.7702 17.698L18.7582 17.7344L15.9976 25.1398H22.1464L19.4013 17.6851L19.0894 16.7007ZM40.3164 8.13836H52.9056V12.1528L49.4929 12.9715V34.6306L52.9056 35.41V39.4338H40.3164V35.41L43.7291 34.6306V12.9715L40.3164 12.1528V8.13836Z"}))),g={clientId:"",resizingType:null,isResizing:!1},m=(0,s.createReduxStore)("resize-content-store",{reducer(e=g,t){switch(t.type){case"SET_CLIENT_ID":return{...e,clientId:t.clientId};case"SET_RESIZING_TYPE":return{...e,resizingType:t.resizingType};case"SET_IS_RESIZING":return{...e,isResizing:t.isResizing}}return e},actions:{setClientId:e=>({type:"SET_CLIENT_ID",clientId:e}),setResizingType:e=>({type:"SET_RESIZING_TYPE",resizingType:e}),setIsResizing:e=>({type:"SET_IS_RESIZING",isResizing:e})},selectors:{getClientId:e=>e.clientId,getResizingType:e=>e.resizingType,getIsResizing:e=>e.isResizing}});(0,s.register)(m);const _=({count:t=0,countEntity:n="word"})=>0===t?(0,e.createElement)("div",null,"word"===n?(0,d.__)("No change in word count.","classifai"):(0,d.__)("No change in character count.","classifai")):t<0?(0,e.createElement)("div",{className:"classifai-content-resize__shrink-stat"},"word"===n?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("strong",null,t)," ",(0,d.__)("words","classifai")):(0,e.createElement)(e.Fragment,null,(0,e.createElement)("strong",null,t)," ",(0,d.__)("characters","classifai"))):(0,e.createElement)("div",{className:"classifai-content-resize__grow-stat"},"word"===n?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("strong",null,"+",t)," ",(0,d.__)("words","classifai")):(0,e.createElement)(e.Fragment,null,(0,e.createElement)("strong",null,"+",t)," ",(0,d.__)("characters","classifai")));function w(e){return e=e.replace(/
/g,"\n"),(0,c.__unstableStripHTML)(e).trim().replace(/\n\n+/g,"\n\n")}(0,t.registerPlugin)("tenup-openai-expand-reduce-content",{render:()=>{const[t,c]=(0,a.useState)(""),[l,p]=(0,a.useState)(null),[g,E]=(0,a.useState)([]),[f,h]=(0,a.useState)(!1),{isMultiBlocksSelected:I,resizingType:z,isResizing:y}=(0,s.useSelect)((e=>({isMultiBlocksSelected:e(n.store).hasMultiSelection(),resizingType:e(m).getResizingType(),isResizing:e(m).getIsResizing()})));function S(){p(null),E([]),h(!1),(0,s.dispatch)(m).setResizingType(null)}return(0,a.useEffect)((()=>{z&&(async()=>{await async function(){var e;const t=(0,s.select)(n.store).getSelectedBlock(),i=null!==(e=t.attributes.content)&&void 0!==e?e:"";p(t),c(w(i)),(0,s.dispatch)(m).setIsResizing(!0)}()})()}),[z]),(0,a.useEffect)((()=>{y&&l&&(async()=>{const e=await async function(){let e=[];const n=`${wpApiSettings.root}classifai/v1/openai/resize-content`,a=(0,s.select)(i.store).getCurrentPostId(),c=new FormData;c.append("id",a),c.append("content",t),c.append("resize_type",z),(0,s.dispatch)(m).setClientId(l.clientId);const r=await fetch(n,{method:"POST",body:c,headers:new Headers({"X-WP-Nonce":wpApiSettings.nonce})});return 200===r.status?e=await r.json():((0,s.dispatch)(m).setIsResizing(!1),(0,s.dispatch)(m).setClientId(""),S()),(0,s.dispatch)(m).setIsResizing(!1),(0,s.dispatch)(m).setClientId(""),e}();E(e),h(!0)})()}),[y,l]),I||y?null:!y&&g.length&&f&&(0,e.createElement)(r.Modal,{title:(0,d.__)("Select a suggestion","classifai"),isFullScreen:!1,className:"classifai-content-resize__suggestion-modal",onRequestClose:()=>{h(!1),S()}},(0,e.createElement)("div",{className:"classifai-content-resize__result-wrapper"},(0,e.createElement)("table",{className:"classifai-content-resize__result-table"},(0,e.createElement)("thead",null,(0,e.createElement)("tr",null,(0,e.createElement)("th",null,(0,d.__)("Suggestion","classifai")),(0,e.createElement)("th",{className:"classifai-content-resize__stat-header"},(0,d.__)("Stats","classifai")),(0,e.createElement)("th",null,(0,d.__)("Action","classifai")))),(0,e.createElement)("tbody",null,g.map(((i,a)=>{const c=(0,o.count)(t,"words"),u=(0,o.count)(t,"characters_including_spaces"),p=(0,o.count)(i,"words")-c,g=(0,o.count)(i,"characters_including_spaces")-u;return(0,e.createElement)("tr",{key:a},(0,e.createElement)("td",null,i),(0,e.createElement)("td",null,(0,e.createElement)(_,{count:p}),(0,e.createElement)(_,{count:g,countEntity:"character"})),(0,e.createElement)("td",null,(0,e.createElement)(r.Button,{text:(0,d.__)("Select","classifai"),variant:"secondary",onClick:()=>async function(e){const t=await(0,s.select)("core/editor").isEditedPostDirty(),i=(0,s.select)("core/editor").getCurrentPostId(),a=(0,s.select)("core/editor").getCurrentPostType();(0,s.dispatch)(n.store).updateBlockAttributes(l.clientId,{content:e}),(0,s.dispatch)(n.store).selectionChange(l.clientId,"content",0,e.length),S(),t||await(0,s.dispatch)("core").saveEditedEntityRecord("postType",a,i)}(i),tabIndex:"0"})))}))))),(0,e.createElement)(u,{feature:"resize_content"}))}});const E=["#8c2525","#ca4444","#303030"];let f=0;function h(e="",t){if(!t)return;if(!(0,s.select)(m).getIsResizing())return void clearTimeout(f);const n=e.split(" "),i=function(e=[],t=10){const n=Array.from({length:e.length},((e,t)=>t)),i=[];for(;i.length{if(i.includes(t)){const t=Math.floor(5*Math.random());return`${e}`}return e}));t.current.innerHTML=a.join(" "),f=setTimeout((()=>{requestAnimationFrame((()=>h(e,t)))}),1e3/1.35)}const I=(0,l.createHigherOrderComponent)((t=>n=>{const{currentClientId:i}=(0,s.useSelect)((e=>({currentClientId:e(m).getClientId()}))),c=(0,a.useRef)();if(i!==n.clientId)return(0,e.createElement)(t,{...n});if("core/paragraph"!==n.name)return(0,e.createElement)(t,{...n});const l=w(n.attributes.content);return(0,s.select)(m).getIsResizing()&&requestAnimationFrame((()=>h(l,c))),(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{style:{position:"relative"}},(0,e.createElement)("div",{className:"classifai-content-resize__overlay"},(0,e.createElement)("div",{className:"classifai-content-resize__overlay-text"},(0,d.__)("Processing data…","classifai"))),(0,e.createElement)("div",{id:"classifai-content-resize__mock-content",ref:c},l),(0,e.createElement)(t,{...n})))}),"withInspectorControl");wp.hooks.addFilter("editor.BlockEdit","resize-content/lock-block-editing",I);const z=(0,l.createHigherOrderComponent)((t=>i=>{const{isMultiBlocksSelected:a,resizingType:c}=(0,s.useSelect)((e=>({isMultiBlocksSelected:e(n.store).hasMultiSelection(),currentClientId:e(m).getClientId(),resizingType:e(m).getResizingType()})));return"core/paragraph"!==i.name?(0,e.createElement)(t,{...i}):(0,e.createElement)(e.Fragment,null,c||a?null:(0,e.createElement)(n.BlockControls,{group:"other"},(0,e.createElement)(r.ToolbarDropdownMenu,{icon:p,className:"classifai-resize-content-btn",controls:[{title:(0,d.__)("Expand this text","classifai"),onClick:()=>{(0,s.dispatch)(m).setResizingType("grow")}},{title:(0,d.__)("Condense this text","classifai"),onClick:()=>{(0,s.dispatch)(m).setResizingType("shrink")}}]})),(0,e.createElement)(t,{...i}))}),"withBlockControl");wp.hooks.addFilter("editor.BlockEdit","resize-content/lock-block-editing",z)})(); \ No newline at end of file +(()=>{"use strict";const e=window.React,t=window.wp.plugins,n=window.wp.blockEditor,i=window.wp.editor,s=window.wp.data,a=window.wp.element,c=window.wp.dom,r=window.wp.compose,l=window.wp.components,o=window.wp.wordcount,d=window.wp.i18n,u=({feature:t})=>t&&ClassifAI?.opt_out_enabled_features?.includes(t)?(0,e.createElement)(l.Button,{href:ClassifAI?.profile_url,variant:"link",className:"classifai-disable-feature-link",target:"_blank",rel:"noopener noreferrer",label:(0,d.__)("Opt out of using this ClassifAI feature","classifai"),text:(0,d.__)("Disable this ClassifAI feature","classifai")}):null,p=(window.wp.coreData,window.wp.apiFetch,window.wp.url,(0,e.createElement)("svg",{width:"20",height:"15",viewBox:"0 0 61 46",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.51922 0C1.57575 0 0 1.5842 0 3.53846V42.4615C0 44.4158 1.57575 46 3.51922 46H57.4808C59.4243 46 61 44.4158 61 42.4615V3.53846C61 1.5842 59.4243 0 57.4808 0H3.51922ZM16.709 8.13836H21.4478L33.58 39.5542H27.524L24.0318 30.5144H13.9699L10.5169 39.5542H4.55669L16.709 8.13836ZM19.0894 16.7007C18.9846 17.041 18.878 17.3735 18.7702 17.698L18.7582 17.7344L15.9976 25.1398H22.1464L19.4013 17.6851L19.0894 16.7007ZM40.3164 8.13836H52.9056V12.1528L49.4929 12.9715V34.6306L52.9056 35.41V39.4338H40.3164V35.41L43.7291 34.6306V12.9715L40.3164 12.1528V8.13836Z"}))),g={clientId:"",resizingType:null,isResizing:!1},m=(0,s.createReduxStore)("resize-content-store",{reducer(e=g,t){switch(t.type){case"SET_CLIENT_ID":return{...e,clientId:t.clientId};case"SET_RESIZING_TYPE":return{...e,resizingType:t.resizingType};case"SET_IS_RESIZING":return{...e,isResizing:t.isResizing}}return e},actions:{setClientId:e=>({type:"SET_CLIENT_ID",clientId:e}),setResizingType:e=>({type:"SET_RESIZING_TYPE",resizingType:e}),setIsResizing:e=>({type:"SET_IS_RESIZING",isResizing:e})},selectors:{getClientId:e=>e.clientId,getResizingType:e=>e.resizingType,getIsResizing:e=>e.isResizing}});(0,s.register)(m);const _=({count:t=0,countEntity:n="word"})=>0===t?(0,e.createElement)("div",null,"word"===n?(0,d.__)("No change in word count.","classifai"):(0,d.__)("No change in character count.","classifai")):t<0?(0,e.createElement)("div",{className:"classifai-content-resize__shrink-stat"},"word"===n?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("strong",null,t)," ",(0,d.__)("words","classifai")):(0,e.createElement)(e.Fragment,null,(0,e.createElement)("strong",null,t)," ",(0,d.__)("characters","classifai"))):(0,e.createElement)("div",{className:"classifai-content-resize__grow-stat"},"word"===n?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("strong",null,"+",t)," ",(0,d.__)("words","classifai")):(0,e.createElement)(e.Fragment,null,(0,e.createElement)("strong",null,"+",t)," ",(0,d.__)("characters","classifai")));function w(e){return e=e.replace(/
/g,"\n"),(0,c.__unstableStripHTML)(e).trim().replace(/\n\n+/g,"\n\n")}(0,t.registerPlugin)("tenup-openai-expand-reduce-content",{render:()=>{const[t,c]=(0,a.useState)(""),[r,p]=(0,a.useState)(null),[g,f]=(0,a.useState)([]),[E,h]=(0,a.useState)(!1),{isMultiBlocksSelected:I,resizingType:z,isResizing:y}=(0,s.useSelect)((e=>({isMultiBlocksSelected:e(n.store).hasMultiSelection(),resizingType:e(m).getResizingType(),isResizing:e(m).getIsResizing()})));function S(){p(null),f([]),h(!1),(0,s.dispatch)(m).setResizingType(null)}return(0,a.useEffect)((()=>{z&&(async()=>{await async function(){var e;const t=(0,s.select)(n.store).getSelectedBlock(),i=null!==(e=t.attributes.content)&&void 0!==e?e:"";p(t),c(w(i)),(0,s.dispatch)(m).setIsResizing(!0)}()})()}),[z]),(0,a.useEffect)((()=>{y&&r&&(async()=>{const e=await async function(){let e=[];const n=`${wpApiSettings.root}classifai/v1/resize-content`,a=(0,s.select)(i.store).getCurrentPostId(),c=new FormData;c.append("id",a),c.append("content",t),c.append("resize_type",z),(0,s.dispatch)(m).setClientId(r.clientId);const l=await fetch(n,{method:"POST",body:c,headers:new Headers({"X-WP-Nonce":wpApiSettings.nonce})});return 200===l.status?e=await l.json():((0,s.dispatch)(m).setIsResizing(!1),(0,s.dispatch)(m).setClientId(""),S()),(0,s.dispatch)(m).setIsResizing(!1),(0,s.dispatch)(m).setClientId(""),e}();f(e),h(!0)})()}),[y,r]),I||y?null:!y&&g.length&&E&&(0,e.createElement)(l.Modal,{title:(0,d.__)("Select a suggestion","classifai"),isFullScreen:!1,className:"classifai-content-resize__suggestion-modal",onRequestClose:()=>{h(!1),S()}},(0,e.createElement)("div",{className:"classifai-content-resize__result-wrapper"},(0,e.createElement)("table",{className:"classifai-content-resize__result-table"},(0,e.createElement)("thead",null,(0,e.createElement)("tr",null,(0,e.createElement)("th",null,(0,d.__)("Suggestion","classifai")),(0,e.createElement)("th",{className:"classifai-content-resize__stat-header"},(0,d.__)("Stats","classifai")),(0,e.createElement)("th",null,(0,d.__)("Action","classifai")))),(0,e.createElement)("tbody",null,g.map(((i,a)=>{const c=(0,o.count)(t,"words"),u=(0,o.count)(t,"characters_including_spaces"),p=(0,o.count)(i,"words")-c,g=(0,o.count)(i,"characters_including_spaces")-u;return(0,e.createElement)("tr",{key:a},(0,e.createElement)("td",null,i),(0,e.createElement)("td",null,(0,e.createElement)(_,{count:p}),(0,e.createElement)(_,{count:g,countEntity:"character"})),(0,e.createElement)("td",null,(0,e.createElement)(l.Button,{text:(0,d.__)("Select","classifai"),variant:"secondary",onClick:()=>async function(e){const t=await(0,s.select)("core/editor").isEditedPostDirty(),i=(0,s.select)("core/editor").getCurrentPostId(),a=(0,s.select)("core/editor").getCurrentPostType();(0,s.dispatch)(n.store).updateBlockAttributes(r.clientId,{content:e}),(0,s.dispatch)(n.store).selectionChange(r.clientId,"content",0,e.length),S(),t||await(0,s.dispatch)("core").saveEditedEntityRecord("postType",a,i)}(i),tabIndex:"0"})))}))))),(0,e.createElement)(u,{feature:"feature_content_resizing"}))}});const f=["#8c2525","#ca4444","#303030"];let E=0;function h(e="",t){if(!t)return;if(!(0,s.select)(m).getIsResizing())return void clearTimeout(E);const n=e.split(" "),i=function(e=[],t=10){const n=Array.from({length:e.length},((e,t)=>t)),i=[];for(;i.length{if(i.includes(t)){const t=Math.floor(5*Math.random());return`${e}`}return e}));t.current.innerHTML=a.join(" "),E=setTimeout((()=>{requestAnimationFrame((()=>h(e,t)))}),1e3/1.35)}const I=(0,r.createHigherOrderComponent)((t=>n=>{const{currentClientId:i}=(0,s.useSelect)((e=>({currentClientId:e(m).getClientId()}))),c=(0,a.useRef)();if(i!==n.clientId)return(0,e.createElement)(t,{...n});if("core/paragraph"!==n.name)return(0,e.createElement)(t,{...n});const r=w(n.attributes.content);return(0,s.select)(m).getIsResizing()&&requestAnimationFrame((()=>h(r,c))),(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{style:{position:"relative"}},(0,e.createElement)("div",{className:"classifai-content-resize__overlay"},(0,e.createElement)("div",{className:"classifai-content-resize__overlay-text"},(0,d.__)("Processing data…","classifai"))),(0,e.createElement)("div",{id:"classifai-content-resize__mock-content",ref:c},r),(0,e.createElement)(t,{...n})))}),"withInspectorControl");wp.hooks.addFilter("editor.BlockEdit","resize-content/lock-block-editing",I);const z=(0,r.createHigherOrderComponent)((t=>i=>{const{isMultiBlocksSelected:a,resizingType:c}=(0,s.useSelect)((e=>({isMultiBlocksSelected:e(n.store).hasMultiSelection(),currentClientId:e(m).getClientId(),resizingType:e(m).getResizingType()})));return"core/paragraph"!==i.name?(0,e.createElement)(t,{...i}):(0,e.createElement)(e.Fragment,null,c||a?null:(0,e.createElement)(n.BlockControls,{group:"other"},(0,e.createElement)(l.ToolbarDropdownMenu,{icon:p,className:"classifai-resize-content-btn",controls:[{title:(0,d.__)("Expand this text","classifai"),onClick:()=>{(0,s.dispatch)(m).setResizingType("grow")}},{title:(0,d.__)("Condense this text","classifai"),onClick:()=>{(0,s.dispatch)(m).setResizingType("shrink")}}]})),(0,e.createElement)(t,{...i}))}),"withBlockControl");wp.hooks.addFilter("editor.BlockEdit","resize-content/lock-block-editing",z)})(); \ No newline at end of file diff --git a/dist/editor-ocr.asset.php b/dist/editor-ocr.asset.php index 32f9f9c9a..41fe77e85 100644 --- a/dist/editor-ocr.asset.php +++ b/dist/editor-ocr.asset.php @@ -1 +1 @@ - array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => 'c179e055e2ea547a88d0'); + array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => 'd48e0dea90669ec8432f'); diff --git a/dist/editor-ocr.js b/dist/editor-ocr.js index f5eb095d5..d58203ac8 100644 --- a/dist/editor-ocr.js +++ b/dist/editor-ocr.js @@ -1 +1 @@ -(()=>{"use strict";const e=window.React,t=window.wp.data,c=window.wp.blocks,n=window.wp.apiFetch,o=window.wp.hooks,i=window.wp.compose,r=window.wp.blockEditor,a=window.wp.components,l=window.wp.i18n,s=window.wp.element,{find:d,debounce:p}=lodash,m=(0,e.createElement)("span",{className:"dashicons dashicons-editor-paste-text"}),u=async(e,n,o)=>{if(!o)return;const{getBlockIndex:i}=(0,t.select)("core/block-editor"),r=(0,c.createBlock)("core/group",{anchor:`classifai-ocr-${n}`,className:"is-style-classifai-ocr-text"}),a=(0,c.createBlock)("core/paragraph",{content:o});await(0,t.dispatch)("core/block-editor").insertBlock(r,i(e)+1),(0,t.dispatch)("core/block-editor").insertBlock(a,0,r.clientId)},f=(e,c=[])=>{if(0===c.length){const{getBlocks:e}=(0,t.select)("core/block-editor");c=e()}return!!d(c,(t=>t.attributes.anchor===`classifai-ocr-${e}`))},b=(0,i.createHigherOrderComponent)((t=>c=>{const[o,i]=(0,s.useState)(!1),{attributes:d,clientId:p,isSelected:b,name:h,setAttributes:g}=c;return b&&"core/image"==h?(!d.ocrChecked&&d.id&&(async e=>{const t=await(0,n.apiFetch)({path:`/wp/v2/media/${e}`});return!(!Object.prototype.hasOwnProperty.call(t,"classifai_has_ocr")||!t.classifai_has_ocr)&&!!(Object.prototype.hasOwnProperty.call(t,"description")&&Object.prototype.hasOwnProperty.call(t.description,"rendered")&&t.description.rendered)&&t.description.rendered.replace(/(<([^>]+)>)/gi,"").replace(/(\r\n|\n|\r)/gm,"").trim()})(d.id).then((e=>{e?(g({ocrScannedText:e,ocrChecked:!0}),i(!0)):g({ocrChecked:!0})})),(0,e.createElement)(s.Fragment,null,(0,e.createElement)(t,{...c}),d.ocrScannedText&&(0,e.createElement)(r.BlockControls,null,(0,e.createElement)(a.ToolbarGroup,null,(0,e.createElement)(a.ToolbarButton,{label:(0,l.__)("Insert scanned text into content","classifai"),icon:m,onClick:()=>u(p,d.id,d.ocrScannedText),disabled:f(d.id)}))),o&&(0,e.createElement)(a.Modal,{title:(0,l.__)("ClassifAI detected text in your image","classifai")},(0,e.createElement)("p",null,(0,l.__)("Would you like to insert the scanned text under this image block? This enhances search indexing and accessibility for your readers.","classifai")),(0,e.createElement)(a.Flex,{align:"flex-end",justify:"flex-end"},(0,e.createElement)(a.FlexItem,null,(0,e.createElement)(a.Button,{isPrimary:!0,onClick:()=>{u(p,d.id,d.ocrScannedText),i(!1)}},(0,l.__)("Insert text","classifai"))),(0,e.createElement)(a.FlexItem,null,(0,e.createElement)(a.Button,{isSecondary:!0,onClick:()=>i(!1)},(0,l.__)("Dismiss","classifai"))))))):(0,e.createElement)(t,{...c})}),"imageOcrControl");(0,o.addFilter)("editor.BlockEdit","classifai/image-processing-ocr",b),(0,o.addFilter)("blocks.registerBlockType","classifai/image-processing-ocr",((e,t)=>("core/image"!==t||e.attributes&&(e.attributes.ocrScannedText={type:"string",default:""},e.attributes.ocrChecked={type:"boolean",default:!1}),e))),wp.blocks.registerBlockStyle("core/group",{name:"classifai-ocr-text",label:(0,l.__)("Scanned Text from Image","classifai")});{let e,c=[];(0,t.subscribe)(p((()=>{const n=(0,t.select)("core/block-editor"),r=n.getSelectedBlock(),a=n.getBlocks();if(null===r)return i(),void(e=r);if(r!==e&&!c.includes(r.clientId))if(i(),e=r,"core/image"===r.name){const e=d(a,(e=>e.attributes.anchor===`classifai-ocr-${r.attributes.id}`));void 0!==e&&o([e.clientId,r.clientId])}else{const e=n.getBlock(n.getBlockHierarchyRootClientId(r.clientId));if("core/group"===e.name){let t=/classifai-ocr-([0-9]+)/.exec(e.attributes.anchor);if(null!==t){[,t]=t;const c=d(a,(e=>e.attributes.id==t));void 0!==c&&o([c.clientId,e.clientId])}}}}),100));const n=()=>{const e=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");return t.setAttribute("id","classifai-ocr-style"),e.appendChild(t),t},o=e=>{var t;const o=null!==(t=document.getElementById("classifai-ocr-style"))&&void 0!==t?t:n(),i=`${e.map((e=>`#block-${e}:before`)).join(", ")} {\n\t\t\tcontent: "";\n\t\t\tposition: absolute;\n\t\t\tdisplay: block;\n\t\t\ttop: 0;\n\t\t\tleft: -15px;\n\t\t\tbottom: 0;\n\t\t\tborder-left: 4px solid #cfe7f3;\n\t\t\tmix-blend-mode: difference;\n\t\t\topacity: 0.25;\n\t\t}`;o.appendChild(document.createTextNode(i)),c=e},i=()=>{if(0===c.length)return;const e=document.getElementById("classifai-ocr-style");e&&(e.innerText=""),c=[]}}})(); \ No newline at end of file +(()=>{"use strict";var e={n:t=>{var c=t&&t.__esModule?()=>t.default:()=>t;return e.d(c,{a:c}),c},d:(t,c)=>{for(var o in c)e.o(c,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:c[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.React,c=window.wp.data,o=window.wp.blocks,n=window.wp.apiFetch;var i=e.n(n);const r=window.wp.hooks,a=window.wp.compose,l=window.wp.blockEditor,s=window.wp.components,d=window.wp.i18n,p=window.wp.element,{find:m,debounce:u}=lodash,f=(0,t.createElement)("span",{className:"dashicons dashicons-editor-paste-text"}),b=async(e,t,n)=>{if(!n)return;const{getBlockIndex:i}=(0,c.select)("core/block-editor"),r=(0,o.createBlock)("core/group",{anchor:`classifai-ocr-${t}`,className:"is-style-classifai-ocr-text"}),a=(0,o.createBlock)("core/paragraph",{content:n});await(0,c.dispatch)("core/block-editor").insertBlock(r,i(e)+1),(0,c.dispatch)("core/block-editor").insertBlock(a,0,r.clientId)},g=(e,t=[])=>{if(0===t.length){const{getBlocks:e}=(0,c.select)("core/block-editor");t=e()}return!!m(t,(t=>t.attributes.anchor===`classifai-ocr-${e}`))},h=(0,a.createHigherOrderComponent)((e=>c=>{const[o,n]=(0,p.useState)(!1),{attributes:r,clientId:a,isSelected:m,name:u,setAttributes:h}=c;return m&&"core/image"==u?(!r.ocrChecked&&r.id&&(async e=>{const t=await i()({path:`/wp/v2/media/${e}`});return!(!Object.prototype.hasOwnProperty.call(t,"classifai_has_ocr")||!t.classifai_has_ocr)&&!!(Object.prototype.hasOwnProperty.call(t,"description")&&Object.prototype.hasOwnProperty.call(t.description,"rendered")&&t.description.rendered)&&t.description.rendered.replace(/(<([^>]+)>)/gi,"").replace(/(\r\n|\n|\r)/gm,"").trim()})(r.id).then((e=>{e?(h({ocrScannedText:e,ocrChecked:!0}),n(!0)):h({ocrChecked:!0})})),(0,t.createElement)(p.Fragment,null,(0,t.createElement)(e,{...c}),r.ocrScannedText&&(0,t.createElement)(l.BlockControls,null,(0,t.createElement)(s.ToolbarGroup,null,(0,t.createElement)(s.ToolbarButton,{label:(0,d.__)("Insert scanned text into content","classifai"),icon:f,onClick:()=>b(a,r.id,r.ocrScannedText),disabled:g(r.id)}))),o&&(0,t.createElement)(s.Modal,{title:(0,d.__)("ClassifAI detected text in your image","classifai")},(0,t.createElement)("p",null,(0,d.__)("Would you like to insert the scanned text under this image block? This enhances search indexing and accessibility for your readers.","classifai")),(0,t.createElement)(s.Flex,{align:"flex-end",justify:"flex-end"},(0,t.createElement)(s.FlexItem,null,(0,t.createElement)(s.Button,{isPrimary:!0,onClick:()=>{b(a,r.id,r.ocrScannedText),n(!1)}},(0,d.__)("Insert text","classifai"))),(0,t.createElement)(s.FlexItem,null,(0,t.createElement)(s.Button,{isSecondary:!0,onClick:()=>n(!1)},(0,d.__)("Dismiss","classifai"))))))):(0,t.createElement)(e,{...c})}),"imageOcrControl");(0,r.addFilter)("editor.BlockEdit","classifai/image-processing-ocr",h),(0,r.addFilter)("blocks.registerBlockType","classifai/image-processing-ocr",((e,t)=>("core/image"!==t||e.attributes&&(e.attributes.ocrScannedText={type:"string",default:""},e.attributes.ocrChecked={type:"boolean",default:!1}),e))),wp.blocks.registerBlockStyle("core/group",{name:"classifai-ocr-text",label:(0,d.__)("Scanned Text from Image","classifai")});{let e,t=[];(0,c.subscribe)(u((()=>{const o=(0,c.select)("core/block-editor"),r=o.getSelectedBlock(),a=o.getBlocks();if(null===r)return i(),void(e=r);if(r!==e&&!t.includes(r.clientId))if(i(),e=r,"core/image"===r.name){const e=m(a,(e=>e.attributes.anchor===`classifai-ocr-${r.attributes.id}`));void 0!==e&&n([e.clientId,r.clientId])}else{const e=o.getBlock(o.getBlockHierarchyRootClientId(r.clientId));if("core/group"===e.name){let t=/classifai-ocr-([0-9]+)/.exec(e.attributes.anchor);if(null!==t){[,t]=t;const c=m(a,(e=>e.attributes.id==t));void 0!==c&&n([c.clientId,e.clientId])}}}}),100));const o=()=>{const e=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");return t.setAttribute("id","classifai-ocr-style"),e.appendChild(t),t},n=e=>{var c;const n=null!==(c=document.getElementById("classifai-ocr-style"))&&void 0!==c?c:o(),i=`${e.map((e=>`#block-${e}:before`)).join(", ")} {\n\t\t\tcontent: "";\n\t\t\tposition: absolute;\n\t\t\tdisplay: block;\n\t\t\ttop: 0;\n\t\t\tleft: -15px;\n\t\t\tbottom: 0;\n\t\t\tborder-left: 4px solid #cfe7f3;\n\t\t\tmix-blend-mode: difference;\n\t\t\topacity: 0.25;\n\t\t}`;n.appendChild(document.createTextNode(i)),t=e},i=()=>{if(0===t.length)return;const e=document.getElementById("classifai-ocr-style");e&&(e.innerText=""),t=[]}}})(); \ No newline at end of file diff --git a/dist/generate-excerpt-classic.asset.php b/dist/generate-excerpt-classic.asset.php index a4b767c46..8fd1578ad 100644 --- a/dist/generate-excerpt-classic.asset.php +++ b/dist/generate-excerpt-classic.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-i18n'), 'version' => 'a2d14778608216d11283'); + array('wp-api-fetch', 'wp-i18n'), 'version' => '225f818a9a9f34f1aed7'); diff --git a/dist/generate-excerpt-classic.css b/dist/generate-excerpt-classic.css index fd0552493..6df1f2b94 100644 --- a/dist/generate-excerpt-classic.css +++ b/dist/generate-excerpt-classic.css @@ -1 +1 @@ -#titlewrap{display:flex}#titlewrap #classifai-openai__title-generate-btn{height:2.348rem;line-height:2.348rem;margin-left:.5rem;position:relative}#titlewrap #classifai-openai__title-generate-btn>.classifai-openai__title-generate-btn--spinner{display:none;left:50%;line-height:29px;position:absolute;top:50%;transform:translate(-50%,-50%)}#postexcerpt #classifai-openai__excerpt-generate-btn{display:block;margin:1em 0 0 auto;max-width:100%;position:relative;text-align:center;width:160px}#postexcerpt #classifai-openai__excerpt-generate-btn>.classifai-openai__excerpt-generate-btn--spinner{display:none;left:50%;line-height:29px;position:absolute;top:50%;transform:translate(-50%,-50%)}#postexcerpt .classifai-openai__excerpt-generate-disable-link{margin-top:6px;text-align:right}#classifai-openai__overlay{background:rgba(0,0,0,.35);height:100%;left:0;top:0;z-index:99998}#classifai-openai__modal,#classifai-openai__overlay{position:fixed;transition:opacity .3s ease!important;width:100%}#classifai-openai__modal{background:#fff;border:1px solid;box-shadow:0 .7px 1px rgba(0,0,0,.15),0 2.7px 3.8px -.2px rgba(0,0,0,.15),0 5.5px 7.8px -.3px rgba(0,0,0,.15),.1px 11.5px 16.4px -.5px rgba(0,0,0,.15);left:50%;margin:0 1rem;max-width:900px;top:100px;transform:translate(-50%,-10%);z-index:99999}#classifai-openai__results-title{font-size:1.5rem!important;padding-top:1.5rem!important}#classifai-openai__results-content{display:flex;flex-flow:row wrap;gap:1rem;padding:1rem 1rem 1.5rem}#classifai-openai__close-modal-button{cursor:pointer;height:40px;position:fixed;right:.5rem;top:.5rem;width:40px}#classifai-openai__close-modal-button:before{content:"";display:block;font-family:dashicons;font-size:3rem;position:relative;right:0;top:.5rem}.classifai-openai__result-item{flex-basis:0;flex-grow:1;min-width:25%}.classifai-openai__result-item textarea{display:block;height:80px;width:100%}.classifai-openai__select-title{margin-top:1rem!important}.classifai-openai--fade-in #classifai-openai__overlay{opacity:1!important;transition:opacity .3s ease!important}.classifai-openai--fade-in #classifai-openai__modal{opacity:1!important;transform:translate(-50%)!important;transition:opacity .3s ease,transform .3s ease!important}.classifai-openai__excerpt-generate-btn--spinner:before,.classifai-openai__title-generate-btn--spinner:before{animation:rotation 2s linear infinite;content:"";display:block;font-family:dashicons;font-size:1.75rem;height:1.75rem;width:1.75rem}@keyframes rotation{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}} +#titlewrap{display:flex}#titlewrap #classifai-openai__title-generate-btn{height:2.348rem;line-height:2.348rem;margin-left:.5rem;position:relative}#titlewrap #classifai-openai__title-generate-btn>.classifai-openai__title-generate-btn--spinner{display:none;left:50%;line-height:29px;position:absolute;top:50%;transform:translate(-50%,-50%)}#postexcerpt #classifai-openai__excerpt-generate-btn{display:block;margin:1em 0 0 auto;max-width:100%;position:relative;text-align:center;width:160px}#postexcerpt #classifai-openai__excerpt-generate-btn>.classifai-openai__excerpt-generate-btn--spinner{display:none;left:50%;line-height:29px;position:absolute;top:50%;transform:translate(-50%,-50%)}#postexcerpt .classifai-openai__excerpt-generate-error{color:#dc3232;display:none;text-align:right}#postexcerpt .classifai-openai__excerpt-generate-disable-link{margin-top:6px;text-align:right}#classifai-openai__overlay{background:rgba(0,0,0,.35);height:100%;left:0;top:0;z-index:99998}#classifai-openai__modal,#classifai-openai__overlay{position:fixed;transition:opacity .3s ease!important;width:100%}#classifai-openai__modal{background:#fff;border:1px solid;box-shadow:0 .7px 1px rgba(0,0,0,.15),0 2.7px 3.8px -.2px rgba(0,0,0,.15),0 5.5px 7.8px -.3px rgba(0,0,0,.15),.1px 11.5px 16.4px -.5px rgba(0,0,0,.15);left:50%;margin:0 1rem;max-width:900px;top:100px;transform:translate(-50%,-10%);z-index:99999}#classifai-openai__results-title{font-size:1.5rem!important;padding-top:1.5rem!important}#classifai-openai__results-content{display:flex;flex-flow:row wrap;gap:1rem;padding:1rem 1rem 1.5rem}#classifai-openai__results-content .error{color:#dc3232;font-size:1rem}#classifai-openai__close-modal-button{cursor:pointer;height:40px;position:fixed;right:.5rem;top:.5rem;width:40px}#classifai-openai__close-modal-button:before{content:"";display:block;font-family:dashicons;font-size:3rem;position:relative;right:0;top:.5rem}.classifai-openai__result-item{flex-basis:0;flex-grow:1;min-width:25%}.classifai-openai__result-item textarea{display:block;height:80px;width:100%}.classifai-openai__select-title{margin-top:1rem!important}.classifai-openai--fade-in #classifai-openai__overlay{opacity:1!important;transition:opacity .3s ease!important}.classifai-openai--fade-in #classifai-openai__modal{opacity:1!important;transform:translate(-50%)!important;transition:opacity .3s ease,transform .3s ease!important}.classifai-openai__excerpt-generate-btn--spinner:before,.classifai-openai__title-generate-btn--spinner:before{animation:rotation 2s linear infinite;content:"";display:block;font-family:dashicons;font-size:1.75rem;height:1.75rem;width:1.75rem}@keyframes rotation{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}} diff --git a/dist/generate-excerpt-classic.js b/dist/generate-excerpt-classic.js index b5aad36e2..5492292ef 100644 --- a/dist/generate-excerpt-classic.js +++ b/dist/generate-excerpt-classic.js @@ -1 +1 @@ -(()=>{"use strict";var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.i18n,a=window.wp.apiFetch;var n=e.n(a);const r=window.ClassifAI||{},i=window.classifaiGenerateExcerpt||{};var s;(s=jQuery)(document).ready((()=>{document.getElementById("postexcerpt")&&function(){var e,a;const c=document.getElementById("excerpt");let o=!1;s("",{text:c.value?null!==(e=i?.regenerateText)&&void 0!==e?e:"":null!==(a=i?.buttonText)&&void 0!==a?a:"",class:"classifai-openai__excerpt-generate-btn--text"}).wrap('
').parent().append(s("",{class:"classifai-openai__excerpt-generate-btn--spinner"})).insertAfter(c),r?.opt_out_enabled_features?.includes("excerpt_generation")&&s("",{text:(0,t.__)("Disable this ClassifAI feature","classifai"),href:r?.profile_url,target:"_blank",rel:"noopener noreferrer",class:"classifai-disable-feature-link"}).wrap('