(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[768],{80756:(t,a,e)=>{"use strict";e.r(a),e.d(a,{default:()=>r});varo=e(19755);functionn(t){returnfunction(t){if(Array.isArray(t))returns(t)}(t)||function(t){if("undefined"!=typeofSymbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])returnArray.from(t)}(t)||function(t,a){if(!t)return;if("string"==typeoft)returns(t,a);vare=Object.prototype.toString.call(t).slice(8,-1);"Object"===e&&t.constructor&&(e=t.constructor.name);if("Map"===e||"Set"===e)returnArray.from(t);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))returns(t,a)}(t)||function(){thrownewTypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}functions(t,a){(null==a||a>t.length)&&(a=t.length);for(vare=0,o=newArray(a);e<a;e++)o[e]=t[e];returno}constr={data:function(){return{notifications:{},notificationCursor:2,notificationMaxId:0}},mounted:function(){this.fetchNotifications()},updated:function(){o('[data-toggle="tooltip"]').tooltip()},methods:{fetchNotifications:function(){vart=this;axios.get("/api/pixelfed/v1/accounts/verify_credentials").then((function(t){window._sharedData.curUser=t.data,window.App.util.navatar()})),axios.get("/api/pixelfed/v1/notifications?pg=true").then((function(a){vare=a.data.filter((function(t){return!("share"==t.type&&!t.status)&&(!("comment"==t.type&&!t.status)&&(!("mention"==t.type&&!t.status)&&(!("favourite"==t.type&&!t.status)&&!("follow"==t.type&&!t.account))))})),s=a.data.map((function(t){returnt.id}));t.notificationMaxId=Math.max.apply(Math,n(s)),t.notifications=e,o(".notification-card .loader").addClass("d-none"),o(".notification-card .contents").removeClass("d-none")}))},infiniteNotifications:function(t){vara=this;this.notificationCursor>10?t.complete():axios.get("/api/pixelfed/v1/notifications",{params:{max_id:this.notificationMaxId}}).then((function(e){if(e.data.length){varo,s=e.data.filter((function(t){return!("share"==t.type&&!t.status)&&(!("comment"==t.type&&!t.status)&&(!("mention"==t.type&&!t.status)&&(!("favourite"==t.type&&!t.status)&&(!("follow"==t.type&&!t.account)&&!_.find(a.notifications,{id:t.id})))))})),r=s.map((function(t){returnt.id}));a.notificationMaxId=Math.max.apply(Math,n(r)),(o=a.notifications).push.apply(o,n(s)),a.notificationCursor++,t.loaded()}elset.complete()}))},truncate:function(t){returnt.length<=15?t:t.slice(0,15)+"..."},timeAgo:function(t){vara=Date.parse(t),e=Math.floor((newDate-a)/1e3),o=Math.floor(e/31536e3);returno>=1?o+"y":(o=Math.floor(e/604800))>=1?o+"w":(o=Math.floor(e/86400))>=1?o+"d":(o=Math.floor(e/3600))>=1?o+"h":(o=Math.floor(e/60))>=1?o+"m":Math.floor(e)+"s"},mentionUrl:function(t){return"/p/"+t.account.username+"/"+t.id},followProfile:function(t){vara=this,e=t.account.id;axios.post("/i/follow",{item:e}).then((function(t){a.notifications.map((function(t){t.account.id===e&&(t.relationship.following=!0)}))})).catch((function(t){t.response.data.message&&swal("Error",t.response.data.message,"error")}))},viewContext:function(t){switch(t.type){case"follow":returnt.account.url;case"mention":case"like":case"favourite":case"comment":returnt.status.url;case"tagged":returnt.tagged.post_url;case"direct":return"/account/direct/t/"+t.account.id}return"/"},getProfileUrl:function(t){return1==t.local?t.url:"/i/web/profile/_/"+t.id},getPostUrl:function(t){return1==t.local?t.url:"/i/web/post/_/"+t.account.id+"/"+t.id}}}},22929:(t,a,e)=>{Vue.component("activity-component",e(567).default)},567:(t,a,e)=>{"use strict";e.r(a),e.d(a,{default:()=>r});varo=e(34231),n=e(29825),s={};for(consttinn)"default"!==t&&(s[t]=()=>n[t]);e.d(a,s);constr=(0,e(51900).default)(n.default,o.render,o.staticRenderFns,!1,null,null,null).exports},29825:(t,a,e)=>{"use strict";e.r(a),e.d(a,{default:()=>s});varo=e(80756),n={};for(consttino)"default"!==t&&(n[t]=()=>o[t]);e.d(a,n);consts=o.default},34231:(t,a,e)=>{"use strict";e.r(a);varo=e(10263),n={};for(consttino)"default"!==t&&(n[t]=()=>o[t]);e.d(a,n)},1