"use strict";(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[529],{43209:(t,e,a)=>{a.r(e),a.d(e,{default:()=>C});vars=a(79984),i=a(78277),n=a(17108),o=a(95002),r=a(87223),l=a(48204),c=a(9716),d=a(20524),u=a(13094),p=a(58753),m=a(54451),f=a(94559),v=a(19413),h=a(26679),g=a(49268);functionb(t){returnfunction(t){if(Array.isArray(t))return_(t)}(t)||function(t){if("undefined"!=typeofSymbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])returnArray.from(t)}(t)||function(t,e){if(t){if("string"==typeoft)return_(t,e);vara={}.toString.call(t).slice(8,-1);return"Object"===a&&t.constructor&&(a=t.constructor.name),"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_(t,e):void0}}(t)||function(){thrownewTypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function_(t,e){(null==e||e>t.length)&&(e=t.length);for(vara=0,s=Array(e);a<e;a++)s[a]=t[a];returns}constC={props:{groupId:{type:String},path:{type:String},permalinkMode:{type:Boolean,default:!1},permalinkId:{type:String}},components:{"status-card":s.default,"group-about":r.default,"group-status":o.default,"group-members":i.default,"group-compose":n.default,"group-topics":d.default,"group-info-card":u.default,"group-media":l.default,"group-moderation":c.default,"leave-group":p.default,"group-insights":m.default,"search-modal":f.default,"invite-modal":v.default,sidebar:h.default,"group-banner":g.default},data:function(){return{initalLoad:!1,profile:void0,group:{},isMember:!1,isAdmin:!1,tab:"feed",requestingMembership:!1,composeText:null,feed:[],ids:[],maxId:null,status:void0,likes:[],likesPage:1,likesId:void0,atabs:{moderation_count:0,request_count:0}}},mounted:function(){vart=this;axios.get("/api/pixelfed/v1/accounts/verify_credentials").then((function(e){t.profile=e.data,t.fetchGroup()})).catch((function(t){window.location.href="/login?_next="+encodeURIComponent(window.location.href)})),this.permalinkMode?this.fetchPermalink():this.fetchFeed()},methods:{initObservers:function(){},fetchGroup:function(){vart=this;axios.get("/api/v0/groups/"+this.groupId).then((function(e){t.group=e.data,t.isMember=e.data.self.is_member,t.isAdmin=["founder","admin"].includes(e.data.self.role),t.isAdmin&&t.fetchAdminTabs(),t.path?t.isMember&&["about","topics","members","events","media","polls"].includes(t.path)||t.isAdmin&&["insights","moderation"].includes(t.path)?setTimeout((function(){t.tab=t.path,t.initalLoad=!0}),500):(history.pushState(null,null,t.group.url),t.initalLoad=!0):t.initalLoad=!0})).catch((function(t){}))},fetchAdminTabs:function(){vart=this;axios.get("/api/v0/groups/"+this.groupId+"/atabs").then((function(e){t.atabs=e.data}))},fetchFeed:function(){vart=this;axios.get("/api/v0/groups/"+this.groupId+"/feed").then((function(e){vara=t;e.data&&e.data.length&&(t.feed=e.data,t.maxId=t.feed[t.feed.length-1].id,e.data.forEach((function(t){-1==a.ids.indexOf(t.id)&&a.ids.push(t.id)}))),t.initObservers()}))},fetchPermalink:function(){vart=this;axios.get("/api/v0/groups/status",{params:{gid:this.groupId,sid:this.permalinkId}}).then((function(e){t.status=e.data,t.status.in_reply_to_id&&(t.status.showCommentDrawer=!0)})).catch((function(e){t.permalinkMode=!1,t.fetchFeed()}))},timestampFormat:function(t){vare=arguments.length>1&&void0!==arguments[1]&&arguments[1],a=newDate(t);returne?a.toDateString()+" · "+a.toLocaleTimeString():a.toDateString()},switchTab:function(t){window.scrollTo(0,0),"feed"==t&&this.permalinkMode&&(this.permalinkMode=!1,this.fetchFeed());vare="feed"==t?this.group.url:this.group.url+"/"+t;history.pushState(t,null,e),this.tab=t},joinGroup:function(){vart=this;this.requestingMembership=!0,axios.post("/api/v0/groups/"+this.groupId+"/join").then((function(e){t.requestingMembership=!1,t.group=e.data,t.fetchGroup(),t.fetchFeed()})).catch((function(e){vara=e.response;422==a.status&&(t.tab="feed",history.pushState("",null,t.group.url),t.requestingMembership=!1,swal("Oops!",a.data.error,"error"