(()=>{var t={4375:t=>{t.exports=Backbone.Collection.extend({last:function(){return this.at(this.size()-1)}})},8756:(t,n,e)=>{var o=e(4375),i=e(8594);t.exports=o.extend({model:i})},8594:t=>{t.exports=Backbone.Model.extend({idAttribute:"ID",defaults:{title:"",read:0},initialize:function(t){this.set("read",0===t.read?"unread":"read")},get_action:function(){return"notification"},url:function(){var t=ajaxurl+(this.get_action()+"&")+this.get_route();return $.isNumeric(this.get("ID"))&&(t+="&ID="+this.get("ID")),t}})},6102:t=>{jQuery,t.exports=Backbone.View.extend({render:function(){return this}})},4412:(t,n,e)=>{var o;jQuery,o=e(6102),t.exports=o.extend({render:function(){return this.$el.append(TVE_Dash.tpl("ni-notification")({model:this.model})),this}})},5770:(t,n,e)=>{!function(n){var o=e(6102);t.exports=o.extend({events:{"click .tvd-ni-notifications":"open","click .ni-counter-holder":"open"},initialize:function(){var t=this;this.listenTo(this.collection,"change:read",t.render),this.collection.on("bulk_update",(function(){t.render()}))},render:function(){return this.$(".ni-counter-holder").html(TD_Inbox.total_unread),TD_Inbox.total_unread>=1?this.$(".ni-counter-holder").show():this.$(".ni-counter-holder").hide(),this},open:function(){n(".tvd-inbox-holder").toggle()}})}(jQuery)},6345:(t,n,e)=>{!function(n){var o=e(6102);t.exports=o.extend({render:function(){return this.$el.html(TVE_Dash.tpl("ni-notification-detail")({model:this.model})),"unread"===this.model.get("read")&&this.save(),this},save:function(){var t=this;n.ajax({type:"POST",url:TD_Inbox.ajaxurl,data:{action:"thrv_notifications",notification_id:t.model.get("id"),_nonce:TD_Inbox.admin_nonce}}).done((function(n){void 0!==(n=JSON.parse(n)).total_unread&&(TD_Inbox.total_unread=n.total_unread,TD_Inbox.total_unread>=1&&t.$(".ni-counter-holder").show(),t.model.set({read:"read"}))})).error((function(t){TVE_Dash.err(t.responseJSON.error)}))}})}(jQuery)},4171:(t,n,e)=>{var o=e(6102),i=e(4412),a=e(6345),r=e(8594);!function(n){var e=o.extend({events:{"click .tvd-ni-mark-read":"readAll"},render:function(){return this.$el.html(TVE_Dash.tpl("notification-header")({})),0===this.collection.where({read:"unread"}).length&&this.$(".tvd-ni-mark-read").addClass("tvd-ni-disabled"),0==this.collection.length&&this.$(".tvd-ni-mark-read").empty(),this},readAll:function(t){this.collection.each((function(t){t.set({read:"read"},{silent:!0})})),this.saveData(),this.collection.trigger("render"),this.render(),t.stopPropagation()},saveData:function(){var t=this;n.ajax({type:"POST",url:TD_Inbox.ajaxurl,data:{action:"thrv_bulkread",_nonce:TD_Inbox.admin_nonce}}).done((function(n){void 0!==(n=JSON.parse(n)).total_unread&&(TD_Inbox.total_unread=n.total_unread,t.collection.trigger("bulk_update"))}))}});t.exports=o.extend({headerView:null,events:{"click .td-inbox-item":"renderNotification","click .ni-go-back":"render","click .tvd-ni-close":"close","click .tvd-ni-load-inner":"loadMore"},initialize:function(){var t=this;this.collection.on("render",(function(){t.render()}))},render:function(t){return this.$(".tvd-notification-wrapper").html('
'),this.headerView&&this.headerView.undelegateEvents(),this.headerView=new e({el:this.$(".tvd-notification-header"),collection:this.collection}).render(),this.renderList(),0===this.collection.length?this.$(".tvd-load-more").append(''+TD_Inbox.t.no_data+""):this.collection.length