!function(t){function e(i){if(s[i])return s[i].exports;var n=s[i]={exports:{},id:i,loaded:!1};return t[i].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var s={};return e.m=t,e.c=s,e.p="",e(0)}([function(t,e){t.exports={name:"comment",el:"#comments",data:function(){return _.merge({posts:[],config:{filter:this.$session.get("comments.filter",{})},comments:!1,pages:0,count:"",selected:[],user:window.$pagekit.user,replyComment:{},editComment:{}},window.$data)},ready:function(){this.Comments=this.$resource("api/blog/comment{/id}"),this.load(),UIkit.init(this.$el)},watch:{"config.page":function(t,e){t!=e&&this.load()},"config.filter":{handler:function(t){this.load(),this.$session.set("comments.filter",t)},deep:!0}},computed:{statusOptions:function(){var t=_.map(this.$data.statuses,function(t,e){return{text:t,value:e}});return[{label:this.$trans("Filter by"),options:t}]}},methods:{active:function(t){return-1!=this.selected.indexOf(t.id)},submit:function(){this.save(this.editComment.id?this.editComment:this.replyComment)},save:function(t){return this.Comments.save({id:t.id},{comment:t}).then(function(){this.load(),this.$notify("Comment saved.")},function(t){this.$notify(t.data,"danger")})},status:function(t){var e=this.getSelected();e.forEach(function(e){e.status=t}),this.Comments.save({id:"bulk"},{comments:e}).then(function(){this.load(),this.$notify("Comments saved.")})},remove:function(){this.Comments["delete"]({id:"bulk"},{ids:this.selected}).then(function(){this.load(),this.$notify("Comments deleted.")})},load:function(t){t=void 0!==t?t:this.$get("config.page"),this.cancel(),this.Comments.query({filter:this.config.filter,post:this.config.post&&this.config.post.id||0,page:t,limit:this.config.limit}).then(function(e){var s=e.data;this.$set("posts",s.posts),this.$set("comments",s.comments),this.$set("pages",s.pages),this.$set("count",s.count),this.$set("config.page",t),this.$set("selected",[])})},getSelected:function(){var t=this;return this.comments.filter(function(e){return-1!==t.selected.indexOf(e.id)})},getStatusText:function(t){return this.statuses[t.status]},cancel:function(){this.$set("replyComment",{}),this.$set("editComment",{})},reply:function(t){this.cancel(),this.$set("replyComment",{parent_id:t.id,post_id:t.post_id,author:this.user.name,email:this.user.email})},edit:function(t){this.cancel(),this.$set("editComment",_.merge({},t))},toggleStatus:function(t){t.status=1===t.status?0:1,this.save(t)}},partials:{"default-row":"#default-row","edit-row":"#edit-row"}},Vue.ready(t.exports)}]);