(()=>{"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 i in a)e.o(a,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:a[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=jQuery;var a;(a=e.n(t)())((function(){a("#bulk-action-selector-top, #bulk-action-selector-bottom").on("change",(function(){var e=a(this),t=e.closest(".tablenav").find(".redirection-category-filter"),i=e.closest(".tablenav").find(".category-filter-submit");"bulk_add_redirection_category"===e.val()?(t.data("oldval",t.val()).val("none").insertAfter(e),i.addClass("hidden")):(t.insertBefore(i),t.data("oldval")&&(t.val(t.data("oldval")),t.data("oldval","")),i.removeClass("hidden"))})),a(".add-redirection-category-button").on("click",(function(){var e=a(this),t=e.siblings(".add-redirection-category-input");e.addClass("disabled"),t.prop("disabled",!0),a.ajax({url:ajaxurl,type:"POST",dataType:"xml",data:{action:"add-rank_math_redirection_category","_ajax_nonce-add-rank_math_redirection_category":rankMath.add_redirection_category_nonce,newrank_math_redirection_category:t.val(),newrank_math_redirection_category_parent:-1}}).always((function(i){t.val(""),e.removeClass("disabled"),t.prop("disabled",!1);var n=i.getElementsByTagName("response_data")[0].innerHTML.slice(9,-3);a(n).appendTo(e.siblings(".cmb2-checkbox-list")).find("input").prop("name","redirection_category[]")}))})),a(".add-redirection-category-input").on("keydown",(function(e){if(13===e.keyCode)return e.preventDefault(),e.stopPropagation(),a(this).siblings(".add-redirection-category-button").trigger("click"),!1})),a("#rank-math-contextual-help-link").on("click",(function(e){e.preventDefault(),a("#contextual-help-link").trigger("click")})),a("#csv-panel-export-redirections").on("submit",(function(){var e=a(this);e.find('button[type="submit"]').prop("disabled",!0).siblings(".input-loading").css("visibility","visible"),setTimeout((function(){e.find('button[type="submit"]').prop("disabled",!1).siblings(".input-loading").css("visibility","hidden")}),5e3)})),a("#panel-import").on("submit",(function(){return confirm(rankMath.confirmRedirectionsCsvImport)})),a("#csv-import-redirections-cancel").on("click",(function(){return confirm(rankMath.confirmRedirectionsCsvCancel)})),a("#csv-import-redirections-progress-details").length&&setTimeout((function e(){a.ajax({url:ajaxurl,type:"GET",dataType:"html",data:{action:"csv_import_redirections_progress",_ajax_nonce:rankMath.csvProgressNonce}}).done((function(t){a("#csv-import-redirections-progress-details").html(t),a(t).find("#csv-import-progress-value").length?setTimeout(e,3e3):a("#csv-import-cancel").addClass("disabled").prop("disabled",!0).siblings(".input-loading").hide()}))}),3e3),"#import-export-box"===window.location.hash&&a(".rank-math-redirections-form.rank-math-importexport-form").show();var e=a("#start_date"),t=e.val(),i=a("#end_date"),n=i.val(),o=a(".cmb2-id-status"),r=!1,c=!1,s=new Date;s.setUTCHours(0,0,0,0);var d=function(e){o.css("opacity","0.4").find("input").prop("disabled",!0).filter('[value="'+e+'"]').prop("checked",!0)},l=function(e,t){e>s?d("inactive"):t>s&&(isNaN(e)||e>=s)?d("active"):o.css("opacity","1").find("input").prop("disabled",!1),p(e,t)},p=function(t,a){if("function"==typeof i.datepicker){if(isNaN(t))i.datepicker("option","minDate",null);else{var n=new Date(t);n.setUTCDate(n.getUTCDate()+1),i.datepicker("option","minDate",n)}if(isNaN(a))e.datepicker("option","maxDate",null);else{var o=new Date(a);o.setUTCDate(o.getUTCDate()-1),e.datepicker("option","maxDate",o)}}};e.on("change",(function(e){var i=a(this).val(),o=new Date(i),r=new Date(n);if(n&&i&&o>=r)return a(this).val(""),void(t="");t=i,l(o,r)})).on("focus",(function(t){if(!r){var a=new Date(s);a.setUTCDate(a.getUTCDate()+1),e.datepicker("option","minDate",a),r=!0}})),i.on("change",(function(e){var i=a(this).val(),o=new Date(i),r=new Date(t);return t&&i&&o<=r||o<=s?(a(this).val(""),void(n="")):(n=i,void l(r,o))})).on("focus",(function(e){if(!c){var t=new Date(s);t.setUTCDate(t.getUTCDate()+1),i.datepicker("option","minDate",t),c=!0}})).trigger("change")}))})();