(()=>{var e={465:()=>{!function(e){const t={init:()=>{t.chartInit();try{e(document).on("change","#chart_period",t.renderChart)}catch(e){console.log(e)}},renderChart:function(t){e(this).val(),e(this).before('
'),e(".chart-container").addClass("loading");try{e.ajax({url:ajaxurl,data:{action:"get_visit_usage",nonce:wp_dark_mode.nonce}}).done((t=>{if(!window.wpdm_chart)return;const o=t.data;window.wpdm_chart.data.labels=o.labels||[],window.wpdm_chart.data.datasets[0].data=o.values||[],window.wpdm_chart.update(),e(".wp-dark-mode-chart .spinner").remove(),e(".chart-container").removeClass("loading")}))}catch(t){console.log(t)}},chartInit:()=>{const t=e("#wp_dark_mode_chart");if(!t.length)return;const o=document.getElementById("wp_dark_mode_chart").getContext("2d");window.wpdm_chart=new Chart(o,{type:"line",data:{labels:t.data("labels"),datasets:[{label:"WP Dark Mode Usages",labels:["WP Dark Mode Usages"],data:t.data("values"),fill:!0,borderColor:"#666",backgroundColor:"rgba(0, 0, 0, 0.2)",tension:.1}]},plugins:{legend:{display:!1},tooltip:{enabled:!1}},scales:{x:{type:"linear",beginAtZero:!0},y:{type:"linear",beginAtZero:!0}}})}};e(document).ready(t.init)}(jQuery)},418:()=>{var e;(e=jQuery)(document).ready((function(){e(".wp-dark-mode-review-notice .remind_later").on("click",(function(){e(".notice-overlay-wrap").css("display","flex")})),e(".wp-dark-mode-review-notice .close-notice").on("click",(function(){console.log("Close")})),e(document).on("click",".wp-dark-mode-review-notice .notice-overlay-actions a, .wp-dark-mode-review-notice .notice-actions a.hide_notice, .wp-dark-mode-review-notice .notice-dismiss",(function(){e(this).parents(".wp-dark-mode-review-notice").slideUp();let t=e(this).data("value");t||(t=7),wp.ajax.send("wp_dark_mode_review_notice",{data:{value:t,nonce:wpDarkMode.nonce},success:()=>{},error:e=>console.log(e)})})),e(".wp-dark-mode-affiliate-notice a").on("click",(function(){let t=e(this).data("value");console.log(t),t||(t=7),wp.ajax.send("wp_dark_mode_affiliate_notice",{data:{value:t,nonce:wpDarkMode.nonce},success:()=>{},error:e=>console.log(e)}),e(this).parents(".wp-dark-mode-affiliate-notice").slideUp()})),e(".wp-dark-mode-affiliate-notice .close-notice").on("click",(function(){e(this).parents(".notice-overlay-wrap").css("display","none")})),e(".wp-dark-mode-affiliate-notice .notice-overlay-actions a,\n\t\t\t\t.wp-dark-mode-affiliate-notice .notice-actions a.hide_notice, .wp-dark-mode-affiliate-notice .dashicons-dismiss").on("click",(function(){e(this).parents(".wp-dark-mode-affiliate-notice").slideUp();let t=e(this).data("value");t||(t=7),wp.ajax.send("wp_dark_mode_affiliate_notice",{data:{value:t,nonce:wpDarkMode.nonce},success:()=>{},error:e=>console.log(e)})}))}))},358:()=>{!function(e){const t={init:()=>{t.blockPremiumSettings(),e(".attention_effect select").on("change",t.attentionEffectPreview),t.customPositionToggle(),e(".switcher_position select").on("change",t.customPositionToggle),e(".switcher_position select").on("change",t.customPositionPreview),t.customPositionPreview(),e(".custom_position input[type=radio]").on("change",t.customPositionPreview),e(".cta_text").on("input",t.customPositionPreview),e(".switch_text_light, .switch_text_dark").on("input",t.customPositionPreview),e(window).on("wppool_color_picker",t.handleColorChange),e(window).on("wppool_color_picker_clear",t.handleColorClear),e(".tab-links .tab-link").on("click",t.handleTabs),t.ctaDeps(),e(".enable_cta").on("change",t.ctaDeps),e(".enable_cta").on("change",t.customPositionPreview),e(".switch_style input").on("change",t.handleSwitchChange),t.fontSizeDeps(),e(".font_size_toggle input").on("change",t.fontSizeToggle),e(".font_size select").on("change",t.fontSizeDeps),e(".font_size select").on("change",t.fontSizePreview),t.fontSizeSliderPreview(),t.checkSwitchDeps(),e(".exclude_pages input,.exclude_posts input, .exclude_categories input, .exclude_tags input, .exclude_products input, .exclude_wc_categories input").on("change",t.excludeToggle),t.addProBadge(),t.addUltimateBadge(),t.animationDeps(),e(".toggle_animation input").on("change",t.animationDeps),e(".animation select").on("change",t.handleAnimation),e(".performance_mode input").on("change",t.handlePerformanceMode),e("#get-wp-dark-mode-pro-menu").on("click",t.handleGetProMenu),t.adjustSwitchSize(),t.adjustFrontendMode(),t.reactiveOptions()},isDefault:()=>document.querySelector(".default_mode input[type='checkbox']").checked,reactiveOptions(){e(document).on("click",".default_mode .switcher > label",(function(t){t.stopPropagation();let o=document.querySelector(".default_mode input[type='checkbox']");o.checked?o.checked=!o.checked:Siz.fire({icon:"warning",title:"Are you sure?",html:"Turning on Make Dark Mode Default will disable OS Awareness Mode, Time-based Dark Mode and Sunset Mode
",ok:"Turn on",cancel:"Cancel",classes:{content:"p-3"}}).then((t=>{t.ok&&(o.checked=!o.checked,document.querySelector(".enable_os_mode input[type='checkbox']").checked=!1,document.querySelector(".time_based_mode input[type='checkbox']").checked=!1,document.querySelector(".sunset_mode input[type='checkbox']").checked=!1,e(".start_at, .end_at").hide(0))}))})),e(document).on("click",".enable_os_mode .switcher > label",(function(e){e.stopPropagation();let o=document.querySelector(".enable_os_mode input[type='checkbox']");!o.checked&&t.isDefault()&&(e.preventDefault(),Siz.fire({title:"Attention!",icon:"warning",content:"Please turn off Make Dark Mode Default to use OS Awareness Mode",cancel:!1}),o.checked=!1)})),e(document).on("click",".time_based_mode .switcher > label",(function(e){e.stopPropagation();let o=document.querySelector(".time_based_mode input[type='checkbox']");!o.checked&&t.isDefault()&&(e.preventDefault(),Siz.fire({title:"Attention!",icon:"warning",cancel:!1,content:"Please turn off Make Dark Mode Default to use Time-based Mode"}),o.checked=!1)})),e(document).on("click",".sunset_mode .switcher > label",(function(e){if(!wpDarkMode.is_ultimate_active&&!wpDarkMode.is_pro_active)return;e.stopPropagation();let o=document.querySelector(".sunset_mode input[type='checkbox']");!o.checked&&t.isDefault()?(e.preventDefault(),Siz.warn('Please turn off Make Dark Mode Default to use Sunset Mode'),o.checked=!1):o.checked?o.checked=!1:Siz.fire({title:"Attention!",html:"The sunset feature requires your user to allow their location. WP Dark Mode uses users' location to automatically enables Dark Mode as per the users' local sunset hours",icon:"warning",ok:"Enable",cancel:"Nevermind"}).then((e=>{e.ok&&(o.checked=!0)}))}))},adjustFrontendMode(){const t=()=>{e("tr.enable_frontend .switcher > label").find("[type='checkbox']").is(":checked")?e("tr.enable_os_mode").show(0):e("tr.enable_os_mode").hide(0)};t(),e(document).on("click","tr.enable_frontend .switcher > label",(function(e){e.stopPropagation(),setTimeout((()=>{t()}),20)}))},showHideScaler(t){"Custom"==t?e(".switcher_scale").show():e(".switcher_scale").hide()},adjustSwitchSize(){"undefined"!=typeof wpDarkModeSettings&&(t.showHideScaler(wpDarkModeSettings.switcher_size),e(".wp-dark-mode-buttons span").each((function(){e(this).text().toLowerCase()==wpDarkModeSettings.switcher_size.toLowerCase()?e(this).addClass("active"):e(this).removeClass("active")})),e(document).on("click",".wp-dark-mode-buttons span",(function(o){o.preventDefault();let n=e(this).text(),c=e(this).data("val");e(this).addClass("active").siblings().removeClass("active"),e(".wp-dark-mode-buttons input").val(n),c&&(e("#wp_dark_mode_switch[switcher_scale]").val(c),e("body").get(0).style.setProperty("--wp-dark-mode-scale",c/100),e(".switcher_scale input[type=hidden]").val(c),e(".switcher_scale .ui-slider-handle").text(c),e(".switcher_scale .wppool-slider").attr("data-value",c),e(".switcher_scale .wppool-slider-handle").css({left:100/(300/c)+"%"}),e(".switcher_scale .ui-slider-range").css({width:100/(300/c)+"%"})),t.showHideScaler(n)})))},handleGetProMenu:e=>{const t=window.open("https://go.wppool.dev/wp-dark-mode","_blank");t?t.focus():alert("Please allow popups for this website")},handlePerformanceMode:()=>{"on"==e(".performance_mode input:checked").val()&&Siz.fire({html:"If you are using Dynamic Dark Mode - the page would take a few seconds turn into Dark Mode after the initial load (you may a see a white flash). \n
If you want to use Performance mode without the flashing - use a color preset or custom color",icon:"info",ok:"Use anyway",cancel:"Nevermind"}).then((t=>{t.ok||e(".performance_mode input:checked").prop("checked",!1)}))},animationDeps:()=>{"on"==e(".toggle_animation input:checked").val()?e(".animation").css("display","revert"):e(".animation").css("display","none")},handleAnimation:function(){const t=e(this).val(),o=e("#wp-dark-mode-animation-preview div");"fade"==t?o.css("animation"," wp-dark-mode-fadein 2.5s"):"slide-left"==t?o.css("animation","wp-dark-mode-slide-left 1s"):"slide-up"==t?o.css("animation","wp-dark-mode-slide-top 1s"):"slide-right"==t?o.css("animation","wp-dark-mode-slide-right 1s"):"slide-down"==t?o.css("animation","wp-dark-mode-slide-bottom 1s"):"pulse"==t?o.css("animation","active-pulse 1s"):"flip"==t?o.css("animation","active-flip 1s"):"roll"==t&&o.css("animation","active-roll 1s")},addProBadge:()=>{e(".sunset_mode.disabled,\n .time_based_mode.disabled,\n .enable_cta.disabled,\n .cta_text.disabled,\n .cta_text_color.disabled,\n .cta_bg_color.disabled,\n .enable_menu_switch.disabled,\n .switch_menus.disabled,\n .custom_switch_icon.disabled,\n .switch_icon_light.disabled,\n .switch_icon_dark.disabled,\n .custom_switch_text.disabled,\n .switch_text_light.disabled,\n .switch_text_dark.disabled,\n .show_above_post.disabled,\n .show_above_page.disabled,\n .includes.disabled,\n .excludes.disabled,\n .exclude_pages.disabled,\n .exclude_categories.disabled,\n .exclude_wc_categories.disabled,\n .exclude_tags.disabled,\n .exclude_products.disabled,\n .exclude_post_types.disabled,\n .enable_analytics.disabled,\n .dashboard_widget.disabled\n ").find(".select2, .wppool-switcher, textarea").addClass("wp-dark-mode-badge wp-dark-mode-badge-pro")},addUltimateBadge:()=>{e("\n .image-settings-table.disabled,\n .custom_css.disabled,\n .email_reporting.disabled,\n .reporting_frequency.disabled,\n .reporting_email.disabled,\n .reporting_email_subject.disabled,\n .brightness.disabled,\n .contrast.disabled,\n .sepia.disabled,\n .customize_colors.disabled,\n .custom_switch_icon.disabled,\n .switch_icon_light.disabled,\n .switch_icon_dark.disabled,\n .enable_menu_switch.disabled,\n .switch_menu.disabled,\n .performance_mode.disabled,\n .font_size_toggle,\n .font_size,\n .custom_font_size\n ").find(".select2, .wppool-switcher, textarea").addClass("wp-dark-mode-badge wp-dark-mode-badge-ultimate")},excludeToggle:function(){const t=e(this).parents("td");"on"==e("input:checked",t).val()?(e(".exclude_wrap",t).addClass("disabled"),e(".exclude_except_select",t).removeClass("disabled")):(e(".exclude_wrap",t).removeClass("disabled"),e(".exclude_except_select",t).addClass("disabled"))},fontSizePreview:function(){const t=e(this).val();"custom"!==t&&e(".font_size_preview #hero").css("zoom",`${t}%`)},fontSizeSliderPreview:()=>{const t=e(".custom_font_size .wppool-slider");t.slider({slide:function(o,n){const c=e(".wppool-slider-handle",t);e("input",t).val(n.value),c.text(n.value),e(".font_size_preview #hero").css("zoom",`${n.value}%`)}})},checkSwitchDeps:()=>{const o=e(".switch_style input:checked").val();["14","15","16","17"].includes(o)?e(".enable_cta, .cta_text, .cta_text_color, .cta_bg_color, .side-spacing").css("display","none"):(t.ctaDeps(),e(".enable_cta, .side-spacing").css("display","revert"))},handleSwitchChange:function(){const o=e(".switch_style input:checked").val();["14","15","16","17","18","19"].includes(o)?Siz.fire({text:"This switch will turn on the font-size toggle button settings in the accessibility",icon:"info",cancel:!1}).then((n=>{n.ok&&(e(".font_size_toggle input").prop("checked",!0),t.checkSwitchDeps(),t.getSwitchPreview(o))})):t.getSwitchPreview(o),t.checkSwitchDeps()},getSwitchPreview:o=>{wp.ajax.send("get_switch_preview",{data:{style:o,nonce:wpDarkMode.nonce},success:t=>{t.html&&e(".switch-preview").html(t.html)},error:e=>console.error(e),complete:()=>{t.customPositionPreview(),t.attentionEffectPreview()}})},fontSizeToggle:function(){"on"===e(".font_size_toggle input:checked").val()?Siz.fire({text:"Using font sizes would change the floating switch that supports changing font size.",icon:"info",ok:"OK",cancel:"Cancel"}).then((o=>{o.ok?(e(".switch_style .image-choose-opt:nth-child(14)").addClass("active").find("input").prop("checked",!0),t.fontSizeDeps()):(e(".font_size_toggle input").prop("checked",!1),e(".font_size, .custom_font_size, .font_size_preview").css("display","none"))})):e(".font_size, .custom_font_size, .font_size_preview").css("display","none")},fontSizeDeps:()=>{e(".font_size_toggle input:checked").val()?(e(".font_size, .custom_font_size, .font_size_preview").css("display","revert"),"custom"===e(".font_size select").val()?e(".custom_font_size").css("display","revert"):e(".custom_font_size").css("display","none")):e(".font_size, .custom_font_size, .font_size_preview").css("display","none")},ctaDeps:()=>{"on"===e(".enable_cta input:checked").val()?e(".cta_text, .cta_text_color, .cta_bg_color").css("display","revert"):e(".cta_text, .cta_text_color, .cta_bg_color").css("display","none")},handleColorChange:(t,o)=>{let n=o.element;e(n).parents(".cta_bg_color").length&&e(".wp-dark-mode-switcher-cta").css("--wp-dark-mode-cta-bg",o.color),e(n).parents(".cta_text_color").length&&e(".wp-dark-mode-switcher-cta").css("color",o.color)},handleColorClear:(t,o)=>{let n=o.element;e(n).parents(".cta_bg_color").length&&e(".wp-dark-mode-switcher-cta").css("--wp-dark-mode-cta-bg","#555"),e(n).parents(".cta_text_color").length&&e(".wp-dark-mode-switcher-cta").css("color","#fff")},handleTabs:function(t){t.preventDefault();const o=e(this).attr("href");"changelog"!==o&&(e(".tab-links .tab-link, .tab-content").removeClass("active"),e(this).addClass("active"),e(`#${o}`).addClass("active"))},customPositionToggle:()=>{const t=e(".switcher_position select").val();t&&"custom"!==t?e(".custom_position").css("display","none"):e(".custom_position").css("display","revert")},customPositionPreview:()=>{const t=e(".switch_style input:checked").val();let o=e(".switcher_position select").val();o&&"custom"!==o||(o=e(".side-selection input:checked").val());let n=e(".switch-preview .wp-dark-mode-switcher"),c=e(".wp-dark-mode-side-toggle-wrap");if(c.length&&(n=c),n.removeClass("left_bottom right_bottom"),n.addClass(o),"on"!==e(".enable_cta input:checked").val()||["14","15","16","17"].includes(t))e(".wp-dark-mode-switcher-cta",n).remove();else{let t=e(".cta_text input").val();t=t?`${t} `:"",n.find(".wp-dark-mode-switcher-cta").length?e(".wp-dark-mode-switcher-cta",n).html(t):n.prepend(e(`${t}`));const o=e(".cta_text_color input").val(),c=e(".cta_bg_color input").val();o&&e(".wp-dark-mode-switcher-cta",n).css({color:o}),c&&n.css("--wp-dark-mode-cta-bg",c)}if("on"===e(".custom_switch_text input:checked").val()){const t=e(".switch_text_light input").val(),o=e(".switch_text_dark input").val();e(".switch-light-text",n).text(t),e(".switch-dark-text",n).text(o)}},blockPremiumSettings:()=>{wpDarkMode.js_ul||(e(".switcher_position select option:last-child,\n .attention_effect select option:nth-child(n+4)\n ").attr("disabled","disabled"),e(".color_preset .image-choose-opt:nth-child(n+3), .image-choose-opt:nth-child(n+4)").addClass("disabled").append(e('')),e(".customize_colors,\n .start_at,\n .end_at,\n .specific_category,\n .time_based_mode,\n .sunset_mode,\n .sunset_timezone,\n .custom_position,\n .cta_text,\n .cta_bg_color,\n .cta_text_color,\n .custom_switch_icon,\n .switch_icon_light,\n .switch_icon_dark,\n .custom_switch_text,\n .switch_text_light,\n .switch_text_dark,\n .show_above_post,\n .show_above_page,\n .includes,\n .excludes,\n .exclude_pages,\n .exclude_posts,\n .exclude_categories,\n .exclude_tags,\n .exclude_wc_categories,\n .exclude_products,\n .exclude_post_types,\n .enable_menu_switch,\n .switch_menus,\n .image-settings-table,\n .custom_css,\n .brightness,\n .contrast,\n .sepia,\n .enable_cta,\n .font_size_toggle,\n .font_size,\n .custom_font_size,\n .enable_analytics,\n .dashboard_widget,\n .email_reporting,\n .reporting_frequency,\n .reporting_email,\n .reporting_email_subject,\n .performance_mode\n ").addClass("disabled"))},attentionEffectPreview:()=>{const t=e(".attention_effect select").val();let o=e(".switch-preview label"),n=e(".wp-dark-mode-side-toggle-wrap");n.length&&(o=n),o.removeClass("wp-dark-mode-wobble wp-dark-mode-vibrate wp-dark-mode-flicker wp-dark-mode-shake wp-dark-mode-jello wp-dark-mode-bounce wp-dark-mode-heartbeat wp-dark-mode-blink").addClass(`wp-dark-mode-${t}`)},renderPreview(){const t=e("[name='wp_dark_mode_color[brightness]']").val(),o=e("[name='wp_dark_mode_color[contrast]']").val(),n=e("[name='wp_dark_mode_color[sepia]']").val();"0"!=localStorage.getItem("wp_dark_mode_admin_active")&&wpDarkMode.enable_backend||document.querySelector(".filter-preview")&&(window.wpDarkMode.includes=".filter-preview"),DarkMode.enable({brightness:t,contrast:o,sepia:n})}};e(document).ready(t.init),e(document).ready((function(){if(e("#image_compare").length)try{e("#image_compare").twentytwenty()}catch(e){}e(".brightness, .contrast, .sepia").each((function(){const o=e(this).find(".wppool-slider");o.slider({slide:(n,c)=>{const i=e(".wppool-slider-handle",o);e("input",e(this)).val(c.value),i.text(c.value),t.renderPreview()}})})),setTimeout((function(){const t=e("#wpb_visual_composer");if(!t.length)return;if(!wpDarkMode.enable_backend)return;t.each((function(){e(this).length&&(e(this).addClass("wp-dark-mode-ignore"),e(this).find("*").addClass("wp-dark-mode-ignore"))}));const o=localStorage.getItem("wp_dark_mode_admin_active");o&&0!=o&&(document.querySelector("html").classList.add("wp-dark-mode-active"),DarkMode.enable())}),100),e(".image_settings, .video_settings").find("td").attr("colspan","2")}))}(jQuery)},474:()=>{!function(e){const t={configuration:"WPDarkMode",init(){t.initEvents()},initEvents(){[{target:"wpDarkMode_export",callback:"exportSettingsPopup"},{target:"wpDarkMode_importer",on:"change",callback:"importSettings"},{target:"wpDarkMode_reset",callback:"showResetSettingsConfirmation"}].forEach((e=>{let o=document.querySelector("#"+e.target);o&&o.addEventListener(e.on||"click",t[e.callback])}))},exportSettingsPopup(e){e.preventDefault(),t.exportSettings()},exportSettings(){e.get(wpDarkMode.ajaxurl+"?action=wpdarkmode_export&nonce="+wpDarkMode.nonce,(function(e){if(e.success){let t=document.createElement("a"),o=new Blob([JSON.stringify(e.data)],{type:"application/json"});t.href=URL.createObjectURL(o),t.download=`WP-Dark-Mode-${(new Date).toISOString()}.json`,t.click(),Siz.success("Settings Exported!")}else Siz.error("Something is wrong with Exporting")}))},importSettings(e){e.preventDefault();let o=e.target.files[0]||!1;if("application/json"!=o.type)return void Siz.error("Invalid File Selected","Please select a valid JSON file which is exported through WP Dark Mode only");let n=new FileReader;n.onload=()=>{let e=n.result;t.validateImportFile(e)},n.readAsText(o)},validateImportFile(o){document.querySelector("#wpDarkMode_importer").value="";try{(o=JSON.parse(o))&&"configuration"in o&&o.configuration==t.configuration?Siz.fire({icon:"warning",title:"Confirm Importing?",content:"Are you sure to import settings? If you do, all of your current settings will be lost. We recommend to Export current settings before importing new one."+("version"in o&&o.version!=wpDarkMode.version?`
Version Mismatched!
You are trying to import settings of version ${o.version} where your current version of WP Dark Mode is ${wpDarkMode.version}. Do it at your risk!`:""),ok:"Import Settings",size:"md"}).then((t=>{t.ok?(Siz.loading("Importing Settings... Please wait..."),e.post(wpDarkMode.ajaxurl+"?action=wpdarkmode_import&nonce="+wpDarkMode.nonce,o,(function(e){return console.log("Import result from Ajax:",e),Siz.success("Settings imported successfully!",null),e}))):Siz.error("Settings not imported!")})):Siz.error("Invalid File Selected","Please select a valid JSON file which is exported through WP Dark Mode only")}catch(e){Siz.error("Invalid File Selected","Please select a valid JSON file which is exported through WP Dark Mode only")}},showResetSettingsConfirmation(e){e.preventDefault(),Siz.fire({icon:"warning",title:"Reset Settings to Default",content:"We recommend to Export current settings and store safely before you reset settings to default.",ok:"Continue",cancel:"Cancel",size:"md"}).then((e=>{e.ok&&Siz.fire({icon:"warning",title:"Are you sure?",content:"You are about to reset all settings of WP Dark Mode to factory defaults. You can NOT undo your action.",ok:"Reset",cancel:"Cancel",size:"md"}).then((e=>{e.ok&&t.resetSettings()}))}))},resetSettings(){e.get(wpDarkMode.ajaxurl+"?action=wpdarkmode_reset&nonce="+wpDarkMode.nonce,(function(e){e.success?Siz.success("Settings reset successfully!"):Siz.error("Settings not reset!")}))}};document.addEventListener("DOMContentLoaded",t.init)}(jQuery)}},t={};function o(n){var c=t[n];if(void 0!==c)return c.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,o),i.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";o(358),o(418),o(465),o(474),function(e){const t={init:()=>{t.initDarkMode(),t.checkCategories(),t.checkDesc(),t.checkFloating(),t.checkSwitchDeps(),t.checkCustomize(),t.checkPresetDeps(),t.checkTimeBasedDeps(),t.checkSwitchMenu(),t.checkSwitchText(),t.checkSwitchIcon();const o=document.querySelector(".enable_frontend input[type=checkbox]");o&&o.addEventListener("change",t.checkFloating);const n=document.querySelector(".enable_os_mode input[type=checkbox]");n&&n.addEventListener("change",t.checkDesc);const c=document.querySelector(".show_switcher input[type=checkbox]");c&&c.addEventListener("change",t.checkSwitchDeps);const i=document.querySelector(".customize_colors input[type=checkbox]");i&&i.addEventListener("change",t.checkCustomize);const a=document.querySelector(".enable_preset input[type=checkbox]");a&&a.addEventListener("change",t.checkPresetDeps);const s=document.querySelector(".enable_menu_switch input[type=checkbox]");s&&s.addEventListener("change",t.checkSwitchMenu);const r=document.querySelector(".custom_switch_text input[type=checkbox]");r&&r.addEventListener("change",t.checkSwitchText);const d=document.querySelector(".custom_switch_icon input[type=checkbox]");d&&d.addEventListener("change",t.checkSwitchIcon);const l=document.querySelector(".specific_category input[type=checkbox]");l&&l.addEventListener("change",t.checkCategories),document.querySelectorAll(".color-palette td").forEach((e=>{e.classList.add("wp-dark-mode-ignore")})),setTimeout((()=>document.querySelectorAll(".image-settings-table.disabled, .image-choose-opt.disabled, .form-table tr.disabled").forEach((e=>{e&&e.addEventListener("click",t.showPopup)}))),100),document.addEventListener("keydown",t.accessibility);const u=document.querySelectorAll(".wp-dark-mode-switch");u&&u.forEach((e=>{e.addEventListener("click",t.handleSwitchClick)})),window.addEventListener("wp_dark_mode",(function(o){const n=1==o.detail.active;let c=document.querySelectorAll(".wp-dark-mode-switcher");if(console.log("dark mode Switch 0",c,n),!0===n)c&&c.forEach((e=>{e.classList.add("active")})),"0"!=localStorage.getItem("wp_dark_mode_admin_active")&&wpDarkMode.enable_backend&&(window.wpDarkMode.includes=""),document.querySelector("html").classList.add("wp-dark-mode-active"),t.enable();else{if(c&&c.forEach((e=>{e.classList.remove("active")})),document.querySelector("html").classList.remove("wp-dark-mode-active"),document.querySelector(".filter-preview")){const t=e("[name='wp_dark_mode_color[brightness]']").val()||wpDarkMode.config.brightness,o=e("[name='wp_dark_mode_color[contrast]']").val()||wpDarkMode.config.contrast,n=e("[name='wp_dark_mode_color[sepia]']").val()||wpDarkMode.config.sepia;window.wpDarkMode.includes=".filter-preview",document.querySelector(window.wpDarkMode.includes)&&DarkMode.enable({brightness:t,contrast:o,sepia:n})}t.disable()}})),t.checkOsMode()},checkOsMode:function(){if(!wpDarkMode.enable_os_mode||!wpDarkMode.enable_backend||localStorage.getItem("wp_dark_mode_admin_active"))return!1;const e=window.matchMedia("(prefers-color-scheme: dark)");if(e.matches)return window.dispatchEvent(new CustomEvent("wp_dark_mode",{detail:{active:!0}})),!0;try{e.addEventListener("change",(function(e){const t="dark"==(e.matches?"dark":"light");return window.dispatchEvent(new CustomEvent("wp_dark_mode",{detail:{active:t}})),t}))}catch(t){try{e.addListener((function(e){const t="dark"==(e.matches?"dark":"light");return window.dispatchEvent(new CustomEvent("wp_dark_mode",{detail:{active:t}})),t}))}catch(e){return console.error(e),!1}}return!1},handleSwitchClick:function(e){console.log("clicked"),document.querySelector("html").classList.toggle("wp-dark-mode-active");const t=1==localStorage.getItem("wp_dark_mode_admin_active");localStorage.setItem("wp_dark_mode_admin_active",t?0:1),window.dispatchEvent(new CustomEvent("wp_dark_mode",{detail:{active:t?0:1}}))},accessibility:function(e){e||(e=event),e.ctrlKey&&e.altKey&&68===e.keyCode&&t.handleToggle()},showPopup:e=>{e.preventDefault(),window.showDarkModePromo()},initDarkMode:function(){const e=localStorage.getItem("wp_dark_mode_admin_active");if(e&&1!=e)return!1;if(wpDarkMode.enable_backend&&1==e&&!wpDarkMode.is_block_editor){document.querySelector("html").classList.add("wp-dark-mode-active");let o=document.querySelectorAll(".wp-dark-mode-switcher");o&&o.forEach((e=>{e.classList.add("active")})),t.enable(),window.dispatchEvent(new CustomEvent("wp_dark_mode",{active:e}))}},enable:()=>{const t=e("[name='wp_dark_mode_color[brightness]']").val()||wpDarkMode.config.brightness,o=e("[name='wp_dark_mode_color[contrast]']").val()||wpDarkMode.config.contrast,n=e("[name='wp_dark_mode_color[sepia]']").val()||wpDarkMode.config.sepia;DarkMode.enable({brightness:t,contrast:o,sepia:n})},disable:()=>{console.log("disabled",DarkMode.disable),DarkMode.disable()},checkFloating:function(){const t=document.querySelector(".enable_frontend input[type=checkbox]");t&&(t.checked?e("#wp_dark_mode_switch-tab").closest("a").show(0):e("#wp_dark_mode_switch-tab").closest("a").hide(0))},checkDesc:function(){const e=document.querySelector(".enable_os_mode input[type=checkbox]");if(!e)return;const t=e.checked;document.querySelector(".enable_os_mode .description").style.display=t?"block":"none"},checkSwitchDeps:function(){const e=document.querySelector(".show_switcher input[type=checkbox]");if(!e)return;const t=e.checked,o=document.querySelectorAll(".switch_style, .switcher_size, .switcher_position");t?o.forEach((e=>{e.style.display="revert"})):(document,o.forEach((e=>{e.style.display="none"})))},checkCustomize:function(){const e=document.querySelector(".customize_colors input[type=checkbox]");if(!e)return;const t=e.checked;wpDarkMode.palettes_allow&&t?document.querySelectorAll(".darkmode_bg_color, .darkmode_text_color, .darkmode_link_color").forEach((e=>{e.style.display="table-row"})):document.querySelectorAll(".darkmode_bg_color, .darkmode_text_color, .darkmode_link_color").forEach((e=>{e.style.display="none"}))},checkPresetDeps:function(){const e=document.querySelector(".enable_preset input[type=checkbox]");e&&(e.checked?(document.querySelector(".brightness").classList.add("hidden"),document.querySelector(".contrast").classList.add("hidden"),document.querySelector(".sepia").classList.add("hidden"),document.querySelector(".filter_preview").classList.add("hidden"),document.querySelector(".color_preset").classList.remove("hidden")):(document.querySelector(".brightness").classList.remove("hidden"),document.querySelector(".contrast").classList.remove("hidden"),document.querySelector(".sepia").classList.remove("hidden"),document.querySelector(".filter_preview").classList.remove("hidden"),document.querySelector(".color_preset").classList.add("hidden")))},checkSwitchMenu:function(){const e=document.querySelector(".enable_menu_switch input[type=checkbox]");if(!e)return;const t=e.checked;document.querySelector(".switch_menus").style.display=t?"table-row":"none"},checkCategories:function(){const e=document.querySelector(".specific_category input[type=checkbox]");if(!e)return;const t=e.checked;document.querySelector(".specific_categories").style.display=t?"table-row":"none"},checkSwitchText:function(){const e=document.querySelector(".custom_switch_text input[type=checkbox]");e&&(e.checked?(document.querySelector(".switch_text_light").style.display="table-row",document.querySelector(".switch_text_dark").style.display="table-row"):(document.querySelector(".switch_text_light").style.display="none",document.querySelector(".switch_text_dark").style.display="none"))},checkSwitchIcon:function(){const e=document.querySelector(".custom_switch_icon input[type=checkbox]");e&&(e.checked?(document.querySelector(".switch_icon_light").style.display="table-row",document.querySelector(".switch_icon_dark").style.display="table-row"):(document.querySelector(".switch_icon_light").style.display="none",document.querySelector(".switch_icon_dark").style.display="none"))},checkTimeBasedDeps:function(){const t=document.querySelector(".time_based_mode input[type=checkbox]");if(!t)return;const o=()=>{t.checked?e(".start_at, .end_at").fadeIn(100):e(".start_at, .end_at").hide(100)};window.addEventListener("DOMContentLoaded",o),t&&t.addEventListener("change",o)}};document.addEventListener("DOMContentLoaded",t.init)}(jQuery)})()})();