"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}/*
 * Filtering ajax caching
 *
 */jQuery(document).ready(function($){$(".tablenav .actions:eq(1) select:not(.acp-filter)").each(function(){if($(this).val()!==""){$(this).addClass("active")}if(parseInt($(this).val())===0){$(this).removeClass("active")}});// Date ranges
$(".acp-range.date input.min").on("keydown",function(e){var keyCode=e.keyCode||e.which;if(keyCode===9){e.preventDefault()}}).datepicker({dateFormat:"yy-mm-dd",changeYear:true,beforeShow:function beforeShow(){$("body").addClass("ac-jqui")},onClose:function onClose(selectedDate){$(this).parent(".input_group").find(".max").datepicker("option","minDate",selectedDate).focus()}});$(".acp-range.date input.max").datepicker({dateFormat:"yy-mm-dd",changeYear:true,beforeShow:function beforeShow(){$("body").addClass("ac-jqui")},onClose:function onClose(selectedDate){$(this).parent(".input_group").find(".min").datepicker("option","maxDate",selectedDate)}});// Number ranges
$(".acp-range.number input.min").on("blur change",function(){var minvalue=parseInt($(this).val());var $maxinput=$(this).parent().find("input.max");var maxvalue=parseInt($maxinput.val());if(maxvalue<minvalue){$maxinput.val(minvalue)}});$(".acp-range.number input.max").on("change",function(){var maxvalue=parseInt($(this).val());var $mininput=$(this).parent().find("input.min");var minvalue=parseInt($mininput.val());if(minvalue>maxvalue){$mininput.val(maxvalue)}});// Trigger the user filter button when hitting enter on a filter text field to submit the form
var $user_filter_button=$("input[name=acp_filter_action]");if($user_filter_button.length){$(".acp-range").keypress(function(e){if(e.which===13){$user_filter_button.trigger("click");return false}})}// Taxonomies
var $tax_filters=$(".acp_tax_filters");if($tax_filters.length){$tax_filters.insertAfter($(".tablenav.top .bulkactions"));$("#wpfooter input[name=acp_filter_action]").appendTo(".acp_tax_filters");$("input[name=acp_filter_action]").on("click",function(e){$(this).parents("form").attr("method","get");jQuery().parents("form:first").submit()})}// Multisite Users
if($("body.ac-wp-ms_users").length){var $form=$("<form method=\"get\" id=\"ac_form-user-list\"></form>");$form.insertBefore("#form-user-list");$("#wpfooter select.acp-filter, #wpfooter input[name=acp_filter_action]").appendTo("#ac_form-user-list")}$.post(ajaxurl,{action:"acp_update_filtering_cache",list_screen:AC.list_screen,layout:AC.layout,_ajax_nonce:AC.ajax_nonce},function(response){if(response&&response.success){var $select_boxes=$("select.acp-filter");// populate select options with new data
if(response.data){var $data=$("<div>").html(response.data);$select_boxes.each(function(){var $el=$(this);var name=$(this).attr("name");var $select=$data.find("select[name=\""+name+"\"]");if($select.length>0){$el.replaceWith($select);if($el.hasClass("active")){$select.addClass("active")}var current=$el.data("current");if(""!==current){$select.find("option[data-value=\""+current+"\"]").attr("selected","selected")}if(AdminColumns.hasOwnProperty("ActiveFilters")){$select.on("change",function(){AdminColumns.ActiveFilters.refresh()})}}// No filter values found
else{$el.remove()}})}// there are no select options, we can remove the "loading values" messages
else{$select_boxes.remove()}}// Error
else{// do nothing
}},"json");/**
	 * Don't post empty ACF Filters to the URL
	 */var AcpUrlBuilder=/*#__PURE__*/function(){function AcpUrlBuilder($form){_classCallCheck(this,AcpUrlBuilder);this.$form=$form}_createClass(AcpUrlBuilder,[{key:"init",value:function init(){var _this=this;this.$form.on("submit",function(){_this.disable()});this.$form.on("ACSearch.validationFailed",function(){_this.enable()})}},{key:"disable",value:function disable(){this.toggleFields(true)}},{key:"enable",value:function enable(){this.toggleFields(false)}},{key:"toggleFields",value:function toggleFields(){var disable=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;AcpUrlBuilder.getSelectors().each(function(){if(jQuery(this).val()===""){jQuery(this).prop("disabled",disable)}})}}],[{key:"getSelectors",value:function getSelectors(){return jQuery(".acp-filter, .acp-range input")}}]);return AcpUrlBuilder}();var $urlBuilder=new AcpUrlBuilder(jQuery(AC.table_id).closest("form"));$urlBuilder.init()});