jQuery(document).ready((function(n){let o=!1,t=[],i=0,c=[],e=null;n.fn.isInViewport=function(){const o=n(this).offset().top,t=o+n(this).outerHeight(),i=n(window).scrollTop(),c=i+n(window).height();return t>i&&o+200<c};const a=n=>(o=n,o),s=()=>n(".rcp-notification-count").html(),_=()=>{n(".news_checkall").show(),n(".rcp_title_new").show()},r=()=>{const o=n(".rcp_previous_box_notifications").children().length>0;n(".rcp_new_notifications").children().length<1?(b("flex"),o?(_(),f()):n(".news_checkall").hide()):(b("none"),n(".rcp_new_notifications").show(),_()),o&&(n(".rcp_previous_notifications").show(),n(".rcp_previous_box_notifications ").show()),(()=>{const o=u(),t=s(),i=o>0?o:t;o<1&&t<1?j():(n(".rcp_count_internal").html(i),n(".rcp-notification-count").html(i<100?i:"+99"))})()},p=(o,t)=>{"old"==t?(d(5,"+"),n(".rcp_previous_box_notifications").append(o)):"new"==t?n(".rcp_new_notifications").append(o):(d(5,"+"),h("none"),n(".rcp_new_notifications").append(o[0]),n(".rcp_previous_box_notifications").append(o[1]),c=o[2],r())},l=o=>{n.ajax({url:ajax_object.ajax_url,type:"post",data:{action:"rcpLoadNotifications",rock_content_notification_nonce:ajax_object.nonce,closed_ids:t,number_notifications:i,type_notification:o},success:n=>{p(n,o),a(!1)},dataType:"json"})},f=()=>{n(".rcp_check").hide(),n(".rcp_checkall_mob").hide()},u=()=>n(".rcp_new_notifications").children().length,h=o=>{n(".rcp_new_notifications").html(""),n(".rcp_previous_box_notifications").html(""),b("none"),n(".news_checkall").hide(),n(".rcp_previous_notifications").hide(),n(".rcp_previous_box_notifications ").hide(),n(".rcp_loader_wrapper").css("display",o)},d=(n,o)=>{"+"==o?i+=n:i-=n},w=n=>n.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,""),x=o=>{n(".rcp_new_notifications").html("");const t=(n=>c.filter((o=>w(o.title).includes(n)||w(o.message).includes(n))))(o=w(o));var i;i=t,h("none"),0===i.length?(b("flex"),n(".rcp_new_notifications").hide()):(n(".rcp_new_notifications").show(),b("none"),n.ajax({url:ajax_object.ajax_url,type:"post",data:{action:"rcpShowSearchedNotifications",rock_content_notification_nonce:ajax_object.nonce,searched_notifications:i},success:n=>{p(n,"new")}}))},b=o=>{n(".rcp_box_whitout_notification").css("display",o)};n(".rcp-box-notification").on("scroll",(function(){const t=n(this)[0].scrollHeight-n(this).scrollTop(),i=n(this).outerHeight()-t,c=v(),e=n(".rcp_previous_box_notifications").isInViewport();0==i&&!o&&c&&(a(!0),l("old")),n(".rcp_previous_box_notifications").css("opacity",e?"1":"0.7")})),n(".rcp_search").keyup((function(){const o=this.value;h("flex");const c=v();clearTimeout(e),e=setTimeout((()=>{c?(()=>{d(i,"-"),t=[],h("none"),l("new_and_old");const o=u();o>0&&n(".news_checkall").show(),n(".rcp_without_notification").show(),b(o<1?"flex":"none")})():x(o)}),1e3)})),n("#rcp_checkall").click((function(){n.ajax({url:ajax_object.ajax_url,type:"post",data:{action:"hide_all_notification",rock_content_notification_nonce:ajax_object.nonce},success:n=>{c=n[0],t.push(...n[1])},dataType:"json"}),(()=>{j();const o=n(".rcp_previous_box_notifications"),t=n(".rcp_new_notifications");f(),t.fadeOut(500),n(".rcp_previous_notifications").fadeIn(),n(".rcp_previous_box_notifications").fadeIn(),o.delay(400).queue((()=>{b("flex"),o.append(...t.children())}))})()}));const j=()=>{n(".rcp-notification-count").css("height","18px"),n(".rcp-notification-count").css("background-color","transparent"),n(".rcp-notification-count").css("border","none"),n(".rcp-notification-count").html(""),n(".rcp_count_internal").css("background-color","transparent"),n(".rcp_count_internal").css("border","none"),n(".rcp_count_internal").html("")},v=()=>0===n(".rcp_search").val().length;n(".rcp_new_notifications").on("click",".rcp_notification_close",(function(){const o=n(this).attr("data-id"),i=n(this);v()&&t.push(o),(()=>{const o=u()-1;o>0?(n(".rcp_count_internal").html(o),o<100&&n(".rcp-notification-count").html(o)):j()})(),(o=>{const t=v();if(!n("#rcp_checkall").is(":checked")){let n=o.parent().parent().parent();"rcp_notification_box"!=n.attr("class")&&(n=n.parent()),t&&(n.fadeOut(500),n.delay(400).queue((()=>{n.appendTo(".rcp_previous_box_notifications"),n.css("display","flex")})))}o.parent().hide(),t&&(n(".rcp_previous_notifications").fadeIn(),n(".rcp_previous_box_notifications").fadeIn())})(i),n(".rcp_new_notifications").children().length-1<1&&(f(),n(".rcp_box_whitout_notification").delay(800).queue((()=>{b("flex")}))),n.ajax({url:ajax_object.ajax_url,type:"post",data:{action:"hide_notification",rock_content_notification_nonce:ajax_object.nonce,already_read:1,id_notification:o},success:n=>{c=n},dataType:"json"})})),h("flex"),l("new_and_old")}));
//# sourceMappingURL=admin.js.map
