import{d as k}from"./BHEH7-GF.js";import{J as C,N as w,K as T,E as V,A as $,B as t,b as s,G as i,Q as l,S as e,c as _,a8 as B,ad as D,V as c,U as b,a4 as f,i as N}from"#entry";import{a as S,V as F}from"./DlybGOWB.js";import{V as M}from"./DArAxlee.js";import{V as A}from"./C63UuyGC.js";import{V as U}from"./tRJ_cXK7.js";import{V as E}from"./DSnRMG2T.js";import{V as H}from"./D1vV9CHW.js";import"./Cpj98o6Y.js";import"./BML-0xFj.js";import"./CIr4U5gS.js";import"./C1aoz2cp.js";import"./LWaCnj-p.js";import"./xGkJbl6f.js";import"./0VvUL2KS.js";import"./D_qxKlPu.js";const I=["innerHTML"],K=["src"],L=C({__name:"FollowMe",props:{isDialog:{type:Boolean,default:!1}},emits:["close"],setup(p){const r=f(""),d=f(!1),u=f({title:"",thumbnail:""}),m=f(!1),{data:h}=w("/api/ap_actors/stats","$lK_x30xEy1"),o=T("settings"),g=N(()=>`https://${r.value}/authorize_interaction?uri=${o.value.instance_name}@${o.value.hostname}`),y=k(()=>{if(!r.value)return;m.value=!0;const a=`https://${r.value}/api/v1/instance`;$fetch(a).then(n=>{u.value=n,d.value=!0,m.value=!1}).catch(n=>{u.value={},d.value=!1,m.value=!1})},300);return(a,n)=>(V(),$(F,null,{default:t(()=>[s(S,{class:"bg-primary"},{default:t(()=>[i(l(a.$t("common.follow_me_title")),1)]),_:1}),s(M,null,{default:t(()=>[s(A,{class:"mb-4",type:"info",border:"start",icon:"mdi-information"},{default:t(()=>[i(l(a.$t("admin.stats",e(h))),1)]),_:1}),_("p",{innerHTML:a.$t("event.follow_me_description",{title:e(o).title,account:`@${e(o).instance_name}@${e(o).hostname}`})},null,8,I),s(U,{modelValue:e(r),"onUpdate:modelValue":[n[0]||(n[0]=v=>B(r)?r.value=v:null),e(y)],rules:[a.$valid.required("common.url")],loading:e(m),label:a.$t("common.url")},D({append:t(()=>[_("p",null,[_("img",{class:"instance_thumb",src:e(u).thumbnail},null,8,K),i(" "+l(e(u).title),1)])]),_:2},[p.isDialog?void 0:{name:"prepend",fn:t(()=>[s(c,{variant:"text",disabled:!e(d),href:e(g),target:"_blank",loading:e(m),color:"primary"},{default:t(()=>[i(l(a.$t("common.follow")),1)]),_:1},8,["disabled","href","loading"])]),key:"0"}]),1032,["modelValue","rules","loading","label","onUpdate:modelValue"])]),_:1}),p.isDialog?(V(),$(E,{key:0},{default:t(()=>[s(c,{variant:"outlined",color:"info",onClick:n[1]||(n[1]=v=>a.$copyToClipboard(`@${e(o).instance_name}@${e(o).hostname}`))},{default:t(()=>[i(l(a.$t("common.copy"))+" @"+l(e(o).instance_name)+"@"+l(e(o).hostname),1)]),_:1}),s(H),p.isDialog?(V(),$(c,{key:0,variant:"outlined",color:"warning",onClick:n[2]||(n[2]=v=>a.$emit("close"))},{default:t(()=>[i(l(a.$t("common.cancel")),1)]),_:1})):b("",!0),s(c,{disabled:!e(d),variant:"outlined",href:e(g),target:"_blank",loading:e(m),color:"primary"},{default:t(()=>[i(l(a.$t("common.follow")),1)]),_:1},8,["disabled","href","loading"])]),_:1})):b("",!0)]),_:1}))}}),te=Object.assign(L,{__name:"FollowMe"});export{te as default};
