(function(t){function e(e){for(var o,s,i=e[0],c=e[1],l=e[2],p=0,h=[];pt.json()).then(t=>{this.followerCount=t.totalItems}),window.fetch(this.actor.outbox,{method:"get",headers:{accept:"application/activity+json"}}).then(t=>t.json()).then(t=>{this.postCount=t.totalItems})}},created(){this.fetchInfo()},updated(){this.fetchInfo()}},m=w,v=(r("13f2"),Object(s["a"])(m,d,f,!1,null,"c1288b72",null)),g=v.exports,b={name:"home",components:{ProfileSummary:g},data(){return{groups:[],error:null}},created(){window.fetch("/u/",{method:"get",headers:{accept:"application/json"}}).then(t=>t.json()).then(t=>{this.groups=t}).catch(t=>this.error=t.message)}},y=b,_=(r("4bbd"),r("2154"),Object(s["a"])(y,p,h,!1,null,"9c330358",null)),C=_.exports,j=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"w3-container w3-content w3-center w3-padding-32"},[r("profile-summary",{attrs:{actor:t.actor}}),r("p",{staticClass:"w3-left-align"},[t._v("To join "+t._s(t.actor.preferredUsername)+", enter your handle below and you'll be\n redirected back to this group's profile in your app where you can follow it.")]),r("form",{staticClass:"w3-container"},[r("label",[t._v("Your account")]),r("input",{directives:[{name:"model",rawName:"v-model",value:t.handle,expression:"handle"}],staticClass:"w3-input w3-center",attrs:{placeholder:"user@example.com",type:"text"},domProps:{value:t.handle},on:{input:function(e){e.target.composing||(t.handle=e.target.value)}}}),r("button",{staticClass:"w3-btn w3-cyan w3-block w3-margin-top",attrs:{disabled:t.fetchingRemote},on:{click:function(e){return e.preventDefault(),t.doFollow(e)}}},[t._v("\n Procced to follow\n ")])]),r("div",{directives:[{name:"show",rawName:"v-show",value:t.invalidHandle,expression:"invalidHandle"}],staticClass:"w3-panel w3-pale-red w3-display-container w3-border"},[r("span",{staticClass:"w3-button w3-large w3-display-topright",on:{click:function(e){e.preventDefault(),t.invalidHandle=!1}}},[t._v("×")]),r("h3",[t._v("Double check that username")]),r("p",[t._v("e.g. you@yourhost.com")])]),r("div",{directives:[{name:"show",rawName:"v-show",value:t.unreachable,expression:"unreachable"}],staticClass:"w3-panel w3-pale-red w3-display-container w3-border"},[r("span",{staticClass:"w3-button w3-large w3-display-topright",on:{click:function(e){e.preventDefault(),t.unreachable=!1}}},[t._v("×")]),r("h3",[t._v("Oops")]),r("p",[t._v("Couldn't connect with your host.")]),r("p",[t._v("You could try going back to your app and entering @"+t._s(t.groupHandle)+" in the search instead")])]),r("div",{staticClass:"w3-container w3-content w3-padding-64"},[r("h2",{staticClass:"w3-wide w3-center"},[t._v("Recent group posts")]),r("div",t._l(t.stream,(function(t){return r("post-card",{key:t.id,attrs:{activity:t}})})),1)])],1)},k=[],x=(r("a481"),r("3835")),O=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"w3-card w3-margin-bottom"},[r("div",{staticClass:"w3-container w3-left-align"},[r("label",[r("b",[t._v(t._s(t.actor.preferredUsername))]),r("span",{staticClass:"w3-text-grey"},[t._v("@"+t._s(t.actorHost))])])]),r("div",{staticClass:"w3-container"},[r("p",{domProps:{innerHTML:t._s(t.post.content)}})])])},P=[],$={props:{activity:{type:Object,required:!0}},data(){return{post:{},actor:{},isError:!1}},computed:{actorIconUrl(){return this.actor.icon&&this.actor.icon.url},actorHost(){try{const t=new URL(this.actor.id);return t.host}catch(t){return""}}},methods:{resolveObject(t){return"string"!==typeof t?new Promise(e=>e(t)):window.fetch(`/o/${encodeURIComponent(t)}`,{method:"get",headers:{accept:"application/activity+json"}}).then(t=>t.json()).catch(t=>{this.isError=!0,console.log(t.message)})}},created(){this.resolveObject(this.activity.object).then(t=>{return this.post=t,this.resolveObject(this.post.attributedTo)}).then(t=>{this.actor=t})}},H=$,G=(r("4a48"),r("582d"),Object(s["a"])(H,O,P,!1,null,"26eca70a",null)),S=G.exports,E={components:{PostCard:S,ProfileSummary:g},props:{name:{type:String,required:!0},postLimit:{type:Number,default:20}},data(){return{actor:{},stream:{},error:null,handle:"",invalidHandle:!1,unreachable:!1,fetchingRemote:!1}},computed:{groupProfileSrc(){return this.actor&&this.actor.icon?this.actor.icon.url:""},groupHandle(){if(this.actor.id&&this.actor.preferredUsername){const t=new window.URL(this.actor.id);return`${this.actor.preferredUsername.toLowerCase()}@${t.host}`}return""}},methods:{doFollow(){let t,e,r;this.invalidHandle=!1,this.unreachable=!1;try{var o=/@?([^@]+)@(.+)/.exec(this.handle),n=Object(x["a"])(o,3);t=n[0],e=n[1],r=n[2],console.log(t,e,r)}catch(a){return void(this.invalidHandle=!0)}this.fetchingRemote=!0,window.fetch(`https://${r}/.well-known/webfinger?resource=acct:${e}@${r}`,{method:"get",mode:"cors",headers:{accept:"application/json"}}).then(t=>t.json()).then(t=>{const e=t.links.find(t=>"http://ostatus.org/schema/1.0/subscribe"===t.rel);window.location.href=e.template.replace("{uri}",this.groupHandle)}).catch(t=>{console.log(t),this.unreachable=!0}).then(()=>{this.fetchingRemote=!1})}},created(){window.fetch(`/u/${this.name}`,{method:"get",headers:{accept:"application/activity+json"}}).then(t=>t.json()).then(t=>{this.actor=t}).then(()=>{return window.fetch(this.actor.outbox,{method:"get",mode:"cors",headers:{accept:"application/activity+json"}})}).then(t=>t.json()).then(t=>{this.stream=t.orderedItems.filter(t=>"Announce"===t.type).slice(0,this.postLimit)}).catch(t=>this.error=t.message)}},U=E,I=(r("ab71"),Object(s["a"])(U,j,k,!1,null,"94492214",null)),R=I.exports;o["a"].use(u["a"]);var L=new u["a"]({mode:"history",routes:[{path:"/",name:"home",component:C},{path:"/u/:name",name:"profile",component:R,props:!0}],scrollBehavior(t,e,r){return r||{x:0,y:0}}});o["a"].config.productionTip=!1,new o["a"]({router:L,render:t=>t(l)}).$mount("#app")},"582d":function(t,e,r){"use strict";var o=r("c8b5"),n=r.n(o);n.a},"64a9":function(t,e,r){},9838:function(t,e,r){},ab71:function(t,e,r){"use strict";var o=r("ef6c"),n=r.n(o);n.a},c8b5:function(t,e,r){},cbf7:function(t,e,r){},ef6c:function(t,e,r){}}); //# sourceMappingURL=app.08039a55.js.map