!function(t){t("#et_pb_old_content"),t("#et_pb_use_builder");const e=t("#et_pb_toggle_builder"),i=t("#et-vb-switch-modal-wrapper"),s=t("#et-vb-confirm-switch"),n=t("#et-vb-cancel-switch"),_=t(".et-fb-app__overlay.wp-block-divi-placeholder"),o=(t("#et_pb_main_editor_wrap"),t("#et_pb_use_the_builder"),t("#et_pb_use_the_builder.is-auto-draft")),a=(t("#et_settings_meta_box").find(".et_pb_page_settings_container").first(),t(".et_pb_toggle_builder_wrapper")),d=t(".et_pb_page_setting"),r=t(".et_pb_page_layout_settings"),l=t("#formatdiv"),c=function(){return void 0!==window.tinyMCE&&window.tinyMCE.get("content")&&!window.tinyMCE.get("content").isHidden()},p=function(){t.post(classic_editor_settings.ajax_url,{action:"disable_divi_in_classic_editor",post_id:t("#post_ID").val(),nonce:classic_editor_settings.disable_divi_in_classic_editor_nonce}).done((function(t){t.success&&window.location.reload()})).fail((function(){console.error("Failed to deactivate Divi Builder. Please try again."),alert("Failed to deactivate Divi Builder. Please refresh the page and try again.")}))};a.hasClass("et_pb_builder_is_used")&&(()=>{const e=r.closest("#et_settings_meta_box").find(".et_pb_page_layout_settings");if(d.filter(":visible").length>1?(e.hide(),r.find(".et_pb_side_nav_settings").show()):("post"!==classic_editor_settings.post_type&&"no"===classic_editor_settings.is_third_party_post_type&&e.hide(),r.closest("#et_settings_meta_box").find(".et_pb_side_nav_settings").show(),r.closest("#et_settings_meta_box").find(".et_pb_single_title").show()),e.length>0){const t=e.find('option[value="et_full_width_page"]');t.length>0&&t.show()}if(l.length){const e=l.find('input[type="radio"]:checked').val();l.hide(),t(`.et_divi_format_setting.et_divi_${e}_settings`).hide()}"project"===classic_editor_settings.post_type&&r.closest("#et_settings_meta_box").find(".et_pb_project_nav").show()})(),t(window).on("et_fb_disabling_bfb_confirmed",(function(){p()})),e.on("click",(function(e){if(e.preventDefault(),"visual-builder"===t(this).attr("data-editor"))return i.css("display","flex"),s.one("click",(function(t){t.preventDefault(),i.hide(),_.hide(),p()})),void n.one("click",(function(t){t.preventDefault(),i.hide()}))})),o.on("click",(function(e){e.preventDefault();var i=t("#post_ID").val(),s=c()?window.tinyMCE.get("content").getContent().trim():t("#content").val().trim(),n=t("#title").val().trim(),_=t("#excerpt").val().trim();s||n||_||(t("#title").val("Divi Draft"),t("#title-prompt-text").addClass("screen-reader-text"));var o=t("#title").val().trim();t.ajax({url:classic_editor_settings.ajax_url,type:"POST",data:{action:"enable_divi_in_classic_editor",post_id:i,nonce:classic_editor_settings.enable_divi_in_classic_editor_nonce,post_title:o,post_content:s},success:function(e){e.success&&e.data&&e.data.redirect_url&&(window.onbeforeunload=null,"undefined"!=typeof wp&&wp.autosave&&wp.autosave.server&&wp.autosave.server.suspend&&wp.autosave.server.suspend(),t(window).off("beforeunload"),window.location.href=e.data.redirect_url)}})}))}(jQuery),((window.divi=window.divi||{}).scriptLibrary=window.divi.scriptLibrary||{}).scriptLibraryClassicEditor={};