text: !function(e,a,t){var s=e(document);(a=a||{}).updates=a.updates||{},a.updates.l10n=_.extend(a.updates.l10n,t.l10n||{}),a.updates.addAdminNotice=function(t){var l,d=e(t.selector),r=e(".wp-header-end");delete t.selector,l=a.updates.adminNotice(t),d.length||(d=e("#"+t.id)),d.length?d.replaceWith(l):r.length?e(".wp-header-end").after(l):e(".wrap").find("> h1").after(l),s.trigger("wp-updates-notice-added")},a.updates.importDemo=function(t){var l=e('.demo-import[data-slug="'+t.slug+'"]');return t=_.extend({success:a.updates.importDemoSuccess,error:a.updates.importDemoError},t),l.addClass("updating-message"),l.parents(".theme").addClass("focus"),l.html()!==a.updates.l10n.importing&&l.data("originaltext",l.html()),l.text(a.updates.l10n.importing).attr("aria-label",a.updates.l10n.demoImportingLabel.replace("%s",l.data("name"))),a.a11y.speak(a.updates.l10n.importingMsg,"polite"),e('.theme-info .theme-description, [data-slug="'+t.slug+'"]').removeClass("demo-import-failed").find(".notice.notice-error").remove(),s.trigger("wp-demo-importing",t),a.updates.ajax("import-demo",t)},a.updates.importDemoSuccess=function(t){var l,d=e(".theme-overlay, [data-slug="+t.slug+"]");s.trigger("wp-demo-import-success",t),l=d.find(".button-primary:not(.plugins-install)").removeClass("updating-message").addClass("updated-message disabled").attr("aria-label",a.updates.l10n.demoImportedLabel.replace("%s",t.demoName)).text(a.updates.l10n.imported),a.a11y.speak(a.updates.l10n.importedMsg,"polite"),setTimeout(function(){t.previewUrl&&(l.siblings(".demo-preview").remove(),l.attr("target","_blank").attr("href",t.previewUrl).removeClass("demo-import updated-message disabled").addClass("live-preview").attr("aria-label",a.updates.l10n.livePreviewLabel.replace("%s",t.demoName)).text(a.updates.l10n.livePreview))},1e3)},a.updates.importDemoError=function(t){var l,d=a.updates.l10n.importFailed.replace("%s",t.errorMessage),r=a.updates.adminNotice({className:"update-message notice-error notice-alt",message:d});a.updates.isValidResponse(t,"import")&&(s.find("body").hasClass("modal-open")||s.find(".themes").hasClass("single-theme")?(l=e('.demo-import[data-slug="'+t.slug+'"]'),e(".theme-info .theme-description").prepend(r)):l=e('[data-slug="'+t.slug+'"]').removeClass("focus").addClass("demo-import-failed").append(r).find(".demo-import"),l.removeClass("updating-message").attr("aria-label",a.updates.l10n.demoImportFailedLabel.replace("%s",l.data("name"))).text(a.updates.l10n.importFailedShort),a.a11y.speak(d,"assertive"),s.trigger("wp-demo-import-error",t))},a.updates.deleteDemo=function(t){var l=e(".theme-actions .delete-demo");return t=_.extend({success:a.updates.deleteDemoSuccess,error:a.updates.deleteDemoError},t),l&&l.html()!==a.updates.l10n.deleting&&l.data("originaltext",l.html()).text(a.updates.l10n.deleting),a.a11y.speak(a.updates.l10n.deleting,"polite"),e(".theme-info .update-message").remove(),s.trigger("wp-demo-deleting",t),a.updates.ajax("delete-demo",t)},a.updates.deleteDemoSuccess=function(e){a.a11y.speak(a.updates.l10n.deleted,"polite"),s.trigger("wp-demo-delete-success",e)},a.updates.deleteDemoError=function(t){var l=e(".theme-actions .delete-demo"),d=a.updates.l10n.deleteFailed.replace("%s",t.errorMessage),r=a.updates.adminNotice({className:"update-message notice-error notice-alt",message:d});a.updates.maybeHandleCredentialError(t,"delete-demo")||(e(".theme-info .theme-description").before(r),l.html(l.data("originaltext")),a.a11y.speak(d,"assertive"),s.trigger("wp-demo-delete-error",t))},a.updates.bulkInstallPlugin=function(t){var l=e('tr[data-slug="'+t.slug+'"]'),d=l.find(".plugin-status span");return t=_.extend({success:a.updates.bulkInstallPluginSuccess,error:a.updates.bulkInstallPluginError},t),d.html()!==a.updates.l10n.installing&&d.data("originaltext",d.html()),d.addClass("updating-message").attr("aria-label",a.updates.l10n.pluginInstallingLabel.replace("%s",l.data("name"))).text(a.updates.l10n.installing),a.a11y.speak(a.updates.l10n.installingMsg,"polite"),s.trigger("wp-plugin-bulk-installing",t),a.updates.ajax("install-plugin",t)},a.updates.bulkInstallPluginSuccess=function(t){e('tr[data-slug="'+t.slug+'"]').removeClass("install").addClass("installed").find(".plugin-status span").removeClass("updating-message install-now").addClass("updated-message activate-now").attr("aria-label",a.updates.l10n.pluginInstalledLabel.replace("%s",t.pluginName)).text(a.updates.l10n.pluginInstalled),a.a11y.speak(a.updates.l10n.installedMsg,"polite"),s.trigger("wp-plugin-bulk-install-success",t)},a.updates.bulkInstallPluginError=function(t){var l,d=e('tr[data-slug="'+t.slug+'"]'),r=d.find(".plugin-status span");a.updates.isValidResponse(t,"install")&&(a.updates.maybeHandleCredentialError(t,"install-plugin")||(l=a.updates.l10n.installFailed.replace("%s",t.errorMessage),r.removeClass("updating-message").addClass("updated-message").attr("aria-label",a.updates.l10n.pluginInstallFailedLabel.replace("%s",d.data("name"))).text(a.updates.l10n.installFailedShort),a.a11y.speak(l,"assertive"),s.trigger("wp-plugin-bulk-install-error",t)))},a.updates.isValidResponse=function(t,s){var l,d=a.updates.l10n.unknownError;if(_.isObject(t)&&!_.isFunction(t.always))return!0;switch(_.isString(t)&&"-1"===t?d=a.updates.l10n.nonceError:_.isString(t)?d=t:"undefined"!=typeof t.readyState&&0===t.readyState?d=a.updates.l10n.connectionError:_.isString(t.statusText)&&(d=t.statusText+" "+a.updates.l10n.statusTextLink),s){case"import":l=a.updates.l10n.importFailed}return l=l.replace("%s",d),a.updates.addAdminNotice({id:"unknown_error",className:"notice-error is-dismissible",message:_.unescape(l)}),e(".button.updating-message").removeClass("updating-message").removeAttr("aria-label").text(a.updates.l10n.updateFailedShort),a.a11y.speak(l,"assertive"),!1},a.updates.queueChecker=function(){var e;if(!a.updates.ajaxLocked&&a.updates.queue.length){switch((e=a.updates.queue.shift()).action){case"import-demo":a.updates.importDemo(e.data);break;case"delete-demo":a.updates.deleteDemo(e.data);break;case"install-plugin":a.updates.bulkInstallPlugin(e.data)}s.trigger("wp-updates-queue-job",e)}}}(jQuery,window.wp,window._demoUpdatesSettings);