CHARITABLE_ADMIN=window.CHARITABLE_ADMIN||{},function(t,a){if(a.fn.datepicker){t.Datepicker=function(t){this.$el=t;var e={dateFormat:this.$el.data("format")||"yy/mm/dd",minDate:this.$el.data("min-date")||"",beforeShow:function(t,e){a("#ui-datepicker-div").addClass("charitable-datepicker-table")}};this.$el.datepicker(e),this.$el.data("date")&&this.$el.datepicker("setDate",this.$el.data("date")),this.$el.data("min-date")&&this.$el.datepicker("option","minDate",this.$el.data("min-date"))}}}(CHARITABLE_ADMIN,jQuery),function(t,a){t.Settings=function(t){var e=[];show_setting=function(t,a){var e,i="!"===t[0],n=i?t.slice(1):t;return e="checked"===n?a.is(":checked"):"selected"===n?a.selected():a.val()===n,i?!e:e},toggle_setting=function(t,a){var e=function(t){var a=t.parents("tr");return a.length?a.first():t}(t),i=get_setting_value(t),n=show_setting(i,a);e.toggle(n)},get_setting_value=function(t){var a=t.data("trigger-value");return void 0===a&&(a=t.data("show-only-if-value")),a},toggle_options=function(t,e){var i,n=e.val(),o=t.data("trigger-value");("radio"!==e.attr("type")||e.prop("checked"))&&o.hasOwnProperty(n)&&(i=o[n],t.find("input").each(function(){var t=a(this),e=!(t.val()in i);e&&t.prop("checked",!1),t.prop("disabled",e).trigger("change")}))},get_trigger_id=function(t){var a=t.data("trigger-key");return void 0===a&&(a="#"+t.data("show-only-if-key")),a},get_trigger=function(t){return"#"===t[0]?a(t):a('[name="'+t+'"]')},get_change_type=function(t){var a=t.data("trigger-change-type");return void 0===a&&(a="visibility"),a},on_change=function(){var t=a(this);t.data("trigger_idx").forEach(function(a){e[a].settings.forEach(function(a){var e=get_change_type(a);"visibility"===e?toggle_setting(a,t):"options"===e&&toggle_options(a,t)})})},this.$el=t;var i=0;this.$el.find("[data-trigger-key],[data-show-only-if-key]").each(function(){var t=a(this),n=get_trigger_id(t);e[n];void 0===e[n]&&(e[i]={trigger_id:n,settings:[]}),e[i].settings.push(t),i+=1}),e.forEach(function(t,a){var e=get_trigger(t.trigger_id),i=e.data("trigger_idx");void 0===i&&(i=[]),i.push(a),e.data("trigger_idx",i),e.on("change",on_change),e.trigger("change")})}}(CHARITABLE_ADMIN,jQuery),function(t){var a=function(){var a=t("#campaign_allow_custom_donations"),e=t(".charitable-campaign-suggested-donations tbody tr:not(.to-copy)"),i=e.length>1||!1===e.first().hasClass("no-suggested-amounts");a.length&&(a.prop("disabled",!i),i||a.prop("checked",!0))},e=function(){t(".charitable-campaign-suggested-donations tbody").each(function(){t(this).children("tr").not(".no-suggested-amounts .to-copy").each(function(a){t(this).find('input[name="_campaign_suggested_donations_default[]"').val(a),t(this).data("index",a),t(this).find("input").each(function(t){this.name=this.name.replace(/(\[\d\])/,"["+a+"]")})})})},i=function(){t(".charitable-campaign-suggested-donations-mini tbody").each(function(){t(this).children("tr").not(".no-suggested-amounts .to-copy").each(function(a){t(this).find('input[name="_campaign_suggested_donations_default[]"').val(a),t(this).data("index",a),t(this).find("input").each(function(t){this.name=this.name.replace(/(\[\d\])/,"["+a+"]")})})})},n=function(){if("undefined"!=typeof accounting&&"undefined"!=typeof CHARITABLE&&null!==CHARITABLE){t("body").on("change",".currency-input",function(){var a=function(t){return Math.abs(parseFloat(accounting.unformat(t,CHARITABLE.currency_format_decimal_sep)))}(t(this).val());t.trim(a)>0&&t(this).val(function(t){return accounting.formatMoney(t,{symbol:"",decimal:CHARITABLE.currency_format_decimal_sep,thousand:CHARITABLE.currency_format_thousand_sep,precision:CHARITABLE.currency_format_num_decimals,format:CHARITABLE.currency_format}).trim()}(a))}),t(".currency-input").trigger("change")}};t(document).ready(function(){function o(t){if(null===t.match(/^(\d{4})(\/|-)(\d{1,2})(\/|-)(\d{1,2})$/))return!1;const a=t.replace(/\//g,"-"),e=new Date(a),i=e.getTime(),n=e.toISOString();return"number"==typeof i&&!Number.isNaN(i)&&n.startsWith(a)}var r,c,l,s,d;if(t("body").on("click","th.default_amount-col a",function(a){a.stopPropagation(),t(".default_amount-col input").prop("checked",!1),t(this).blur()}),t("a#charitable-modify-keys").on("click",function(a){a.stopPropagation();var e=t(this);e.css("pointer-events","none"),e.css("opacity","0.25");var i={action:"charitable-"+t(this).data("charitable-action"),args:t(this).data("charitable-args"),nonce:t(this).data("nonce")};t.ajax({type:"POST",data:i,dataType:"json",url:ajaxurl,xhrFields:{withCredentials:!0},success:function(t){e.closest("tr").after(t.data),e.closest("tr").hide()}}).fail(function(t){window.console&&window.console.log&&(e.css("pointer-events","all"),e.css("opacity","1.0"))})}),CHARITABLE_ADMIN.Datepicker&&t(".charitable-datepicker").each(function(){CHARITABLE_ADMIN.Datepicker(t(this))}),t(document).on("click","#charitable-campaigns-export-modal form button",function(a){a.preventDefault();var e=!1;if(t("#charitable-campaigns-export-modal form input[type=text]").each(function(){""!==t(this).val().trim()&&(isValidDate=o(t(this).val()),!1===isValidDate&&(e=!0,t(this).val("")))}),!0===e){var i=new Date,n=("0"+i.getDate()).slice(-2),r=("0"+(i.getMonth()+1)).slice(-2),c=i.getFullYear();alert("You have entered an invalid date format. Please use the following format: yyyy/mm/dd. For example: ["+c+"/"+r+"/"+n+"]")}else t("#charitable-campaigns-export-modal form").submit()}),t(document).on("click","#charitable-campaigns-filter-modal form button",function(a){a.preventDefault();var e=!1;if(t("#charitable-campaigns-filter-modal form input[type=text]").each(function(){""!==t(this).val().trim()&&(isValidDate=o(t(this).val()),!1===isValidDate&&(e=!0,t(this).val("")))}),!0===e){var i=new Date,n=("0"+i.getDate()).slice(-2),r=("0"+(i.getMonth()+1)).slice(-2),c=i.getFullYear();alert("You have entered an invalid date format. Please use the following format: yyyy/mm/dd. For example: ["+c+"/"+r+"/"+n+"]")}else t("#charitable-campaigns-filter-modal form").submit()}),t(document).on("click","#charitable-donations-export-modal form button",function(a){a.preventDefault();var e=!1;if(t("#charitable-donations-export-modal form input[type=text]").each(function(){"charitable-filter-part-of-recurring"!==t(this).attr("id")&&""!==t(this).val().trim()&&(isValidDate=o(t(this).val()),!1===isValidDate&&(e=!0,t(this).val("")))}),!0===e){var i=new Date,n=("0"+i.getDate()).slice(-2),r=("0"+(i.getMonth()+1)).slice(-2),c=i.getFullYear();alert("You have entered an invalid date format. Please use the following format: yyyy/mm/dd. For example: ["+c+"/"+r+"/"+n+"]")}else t("#charitable-donations-export-modal form").submit()}),t(document).on("click","#charitable-donations-filter-modal form button",function(a){a.preventDefault();var e=!1;if(t("#charitable-donations-filter-modal form input[type=text]").each(function(){""!==t(this).val().trim()&&(isValidDate=o(t(this).val()),!1===isValidDate&&(e=!0,t(this).val("")))}),!0===e){var i=new Date,n=("0"+i.getDate()).slice(-2),r=("0"+(i.getMonth()+1)).slice(-2),c=i.getFullYear();alert("You have entered an invalid date format. Please use the following format: yyyy/mm/dd. For example: ["+c+"/"+r+"/"+n+"]")}else t("#charitable-donations-filter-modal form").submit()}),t("#charitable-settings, body.post-type-campaign form#post, body.post-type-donation form#post").each(function(){CHARITABLE_ADMIN.Settings(t(this))}),t("body.post-type-campaign .handlediv, body.post-type-donation .handlediv").remove(),t("body.post-type-campaign .hndle, body.post-type-donation .hndle").removeClass("hndle ui-sortable-handle").addClass("postbox-title"),function(){var a=t("#charitable-campaign-advanced-metabox");if(a.length){a.tabs();var e=a.find(".charitable-tabs").height();a.find(".ui-tabs-panel").each(function(){t(this).css("min-height",e)})}}(),void 0!==t.fn.sortable&&t(".charitable-campaign-suggested-donations tbody").sortable({items:"tr:not(.to-copy)",handle:".handle",stop:function(t,a){e()}}),void 0!==t.fn.sortable&&t(".charitable-campaign-suggested-donations-mini tbody").sortable({items:"tr:not(.to-copy)",handle:".handle",stop:function(t,a){i()}}),a(),t("[data-charitable-action]").on("click",function(a){var e=t(this).data("charitable-args")||{},i="charitable-"+t(this).data("charitable-action");return t.post(ajaxurl,{action:i,data:e},function(t){}),!1}),t("[data-charitable-toggle]").on("click",function(a){var e=t(this).data("charitable-toggle"),i=t(this).attr("data-charitable-toggle-text");return i&&i.length&&(t(this).attr("data-charitable-toggle-text",t(this).text()),t(this).text(i)),t("#"+e).toggle(),!1}),t("#campaign_end_date").on("change",function(){var a=t(this),e=a.val(),i=a.siblings(".charitable-end-time"),n=a.siblings("#campaign_end_time");""!==e&&e?(i.text("@ 23:59 PM").show(),n.val("23:59:59")):(i.hide(),n.val(0))}),(s=t(".charitable-actions-form-wrapper")).length&&(r=s.find(".charitable-action-select"),c=s.find(".charitable-actions-submit"),l=c.find("button"),c.hide(),r.on("change",function(){var a=r.val(),e=r.find("option:selected").data("button-text");""!==a?(s.find(".charitable-action-fields").each(function(){var e=t(this);e.toggle(a===e.data("type"))}),e?l.text(e):l.text(l.prop("title")),c.show()):c.hide()})),t.fn.select2&&t(".select2 select, select.select2").select2(),t(".charitable-admin-donation-form #donor-id").on("change",function(){var a,e,i=t(this).val();""!==i&&"new"!==i&&((a=t("#charitable-user-fields-wrap")).addClass("loading-data"),data={action:"charitable_get_donor_data",donor_id:i,fields:("object"==typeof d||(d=[],t("#charitable-user-fields-wrap").find("select,input,textarea").each(function(){d.push(this.name)})),d),nonce:t(this).data("nonce")},t.ajax({type:"POST",data:data,dataType:"json",url:ajaxurl,xhrFields:{withCredentials:!0},success:function(t){if(t.success)for(e in t.data)a.find("[name="+e+"]").val(t.data[e]);a.removeClass("loading-data")}}).fail(function(t){window.console&&window.console.log&&a.removeClass("loading-data")}))}),n(),t("#charitable-settings-connect-btn").on("click",function(a){var e=t(this),i={action:"charitable_license_check",license:t('input[name="license-key"]').val(),nonce:t('input[name="_wpnonce"]').val(),charitable_action:e.data("action")};if(!t("#charitable-settings-connect-btn").data("pro-connect")||"1"!=t("#charitable-settings-connect-btn").data("pro-connect")){var n=e.html(),o=' ';return"verify"===i.charitable_action?e.html(o+charitable_admin.verifying):e.html(o+charitable_admin.deactivating),e.prop("disabled",!0),t.ajax({type:"POST",data:i,dataType:"json",url:ajaxurl,xhrFields:{withCredentials:!0},success:function(a){if(a.success){if(a.data.upgrade_url)return e.data("charitable-skip-restore",!0),void(window.location.href=a.data.upgrade_url);if(a.data.show_manual_upgrade&&a.data.url)return void t.alert({title:charitable_admin.license_validated||charitable_admin.success,content:a.data.message,icon:"fa fa-check-circle",type:"green",boxWidth:"800px",buttons:{confirm:{text:charitable_admin.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){window.location.reload()}},manual:{text:charitable_admin.manual_install,btnClass:"btn-confirm",action:function(){window.open(a.data.url,"_blank"),window.location.reload()}}}});if(a.data.show_activate_pro_popup)return void("undefined"!=typeof CharitableConnect&&CharitableConnect.showActivateProPopup?CharitableConnect.showActivateProPopup(a.data):t.alert({title:charitable_admin.license_validated||charitable_admin.success,content:a.data.message,icon:"fa fa-check-circle",type:"green",boxWidth:"800px",buttons:{activate:{text:charitable_admin.activate_now,btnClass:"btn-confirm",keys:["enter"],action:function(){window.location.href=(a.data.redirect_url||charitable_admin.admin_url+"admin.php?page=charitable-settings&tab=general")+"&valid=valid&pro=activate"}},cancel:{text:charitable_admin.cancel,keys:["esc"],action:function(){window.location.reload()}}}}));if(!0===a.data.valid){var n=void 0!==charitable_admin.is_pro_installed&&"1"===charitable_admin.is_pro_installed;t("#charitable-license-message").html(a.data.message),n?t.alert({title:charitable_admin.activated_title,content:charitable_admin.activated_content,icon:"fa fa-check-circle",type:"green",boxWidth:"800px",buttons:{confirmActivate:{text:charitable_admin.plugin_activate_btn,btnClass:"btn-confirm",keys:["enter"],action:function(t){return window.location.href=charitable_admin.admin_url+"admin.php?page=charitable-settings&tab=general&valid=valid&pro=activate",!1}}}}):(e.data("charitable-skip-restore",!0),void 0!==charitable_admin.admin_url?window.location.href=charitable_admin.admin_url+"admin.php?page=charitable-settings&tab=general&valid=valid":location.reload())}else t("#charitable-license-message").html(a.data.message),void 0!==charitable_admin.admin_url?(e.data("charitable-skip-restore",!0),!0===a.data.license_limit?window.location.href=charitable_admin.admin_url+"admin.php?page=charitable-settings&tab=general&valid=invalid&license_limit=true":!1===a.data.comm_success?window.location.href=charitable_admin.admin_url+"admin.php?page=charitable-settings&tab=general&valid=invalid&comm_success=false":window.location.href="verify"===i.charitable_action?charitable_admin.admin_url+"admin.php?page=charitable-settings&tab=general&valid=invalid":charitable_admin.admin_url+"admin.php?page=charitable-settings&tab=general&valid=success"):(e.data("charitable-skip-restore",!0),location.reload())}}}).fail(function(t){window.console&&window.console.log}).always(function(){var a=t("#charitable-settings-connect-btn");a.length&&a.data("charitable-skip-restore")?a.removeData("charitable-skip-restore").removeData("charitable-license-original-html"):a.length&&a.data("charitable-license-original-html")&&a.html(a.data("charitable-license-original-html")).prop("disabled",!1).removeData("charitable-license-original-html")}),e.data("charitable-license-original-html",n),!1}}),t(document).on("click","a.donor-list-view-donations",function(a){a.preventDefault(),t("table.charitable-donor-history-table").toggle(),t(this).text("Hide Donations"==t(this).text()?"Show Donations":"Hide Donations")}),t("body.charitable_page_charitable-settings input.charitable-color-field").length&&t("input.charitable-color-field").wpColorPicker(),t("[data-charitable-add-row]").on("click",function(){return"suggested-amount"===t(this).data("charitable-add-row")&&function(t){var i=t.closest(".charitable-campaign-suggested-donations").find("tbody"),n=i.find("tr.to-copy").clone().removeClass("to-copy hidden");i.length&&n.length&&(i.find(".no-suggested-amounts").hide(),i.append(n),e(),a())}(t(this)),!1}),t(".charitable-campaign-suggested-donations").on("click",".charitable-delete-row",function(){return function(t){t.closest("tr").remove();var i=t.closest(".charitable-campaign-suggested-donations").find("tbody");1==i.find("tr:not(.to-copy)").length&&i.find(".no-suggested-amounts").removeClass("hidden").show(),e(),a()}(t(this)),!1}),t("body").on("click","[data-campaign-benefactor-delete]",function(){var a=t(this).parents(".charitable-benefactor"),e={action:"charitable_delete_benefactor",benefactor_id:t(this).data("campaign-benefactor-delete"),nonce:t(this).data("nonce")};return t.ajax({type:"POST",data:e,dataType:"json",url:ajaxurl,xhrFields:{withCredentials:!0},success:function(t){t.deleted&&a.remove()}}).fail(function(t){window.console&&window.console.log}),!1}),t("#change-donation-status").on("change",function(){t(this).parents("form").submit()}),t("table.wp-list-table.posts").length>0&&"undefined"!=typeof CHARITABLE&&null!==CHARITABLE&&void 0!==CHARITABLE.banner){var h=CHARITABLE.banner,u=0;if(!1===h||""===h)return;t("table.wp-list-table.posts thead tr:nth-child(1) td").each(function(){t(this).attr("colspan")?u+=+t(this).attr("colspan"):u++}),t("table.wp-list-table.posts thead tr:nth-child(1) th").each(function(){t(this).attr("colspan")?u+=+t(this).attr("colspan"):u++}),t("table.wp-list-table.posts").append('