import{b as P,a as c,D as N,h as n,i as d,j as p,K as V,E as l,z as h,u as s,a6 as x,t as _,G as S,l as D,F as G,I as L,J as T}from"./vue-y3KLWBaS.js";import{u as U}from"./widget-qjKd4HCd.js";import{M as E}from"./MkContainer-6laePfDX.js";import{_ as F}from"./MkMiniChart.vue_vue_type_script_setup_true_lang-pO1kuPAx.js";import{Q as H,i as $,V as g,f as j,T as q,n as z}from"./app-JmgyQoR0.js";import"./v4-U7xWZqn4.js";const A=o=>(L("data-v-5e601e52"),o=o(),T(),o),J=A(()=>s("i",{class:"ph-planet ph-bold ph-lg"},null,-1)),K={class:"wbrkwalb"},Q=["src"],W={class:"body"},O=["href","title"],w="federation",R=P({__name:"federation",props:{widget:{},foldable:{type:Boolean},scrollable:{type:Boolean}},emits:["updateProps"],setup(o,{expose:v,emit:b}){const k={showHeader:{type:"boolean",default:!0}},i=o,y=b,{widgetProps:I,configure:B}=U(w,k,i,y),u=c([]),f=c([]),m=c(!0);H(async()=>{const e=await j("federation/instances",{sort:"+lastCommunicatedAt",limit:5}),r=await Promise.all(e.map(a=>q("charts/instance",{host:a.host,limit:16,span:"hour"})));u.value=e,f.value=r,m.value=!1},1e3*60,{immediate:!0,afterMounted:!0});function C(e){var r,a;return(a=(r=g(e.iconUrl,"preview"))!=null?r:g(e.faviconUrl,"preview"))!=null?a:"/client-assets/dummy.png"}return v({name:w,configure:B,id:i.widget?i.widget.id:null}),(e,r)=>{const a=N("MkLoading");return n(),d(E,{"show-header":h(I).showHeader,foldable:e.foldable,scrollable:e.scrollable,class:"mkw-federation"},{header:p(()=>[J,V(l(h($).ts._widgets.federation),1)]),default:p(()=>[s("div",K,[m.value?(n(),d(a,{key:0})):(n(),d(x,{key:1,tag:"div",name:e.$store.state.animation?"chart":"",class:"instances"},{default:p(()=>[(n(!0),_(G,null,S(u.value,(t,M)=>(n(),_("div",{key:t.id,class:"instance"},[s("img",{src:C(t),alt:""},null,8,Q),s("div",W,[s("a",{class:"a",href:"https://"+t.host,target:"_blank",title:t.host},l(t.host),9,O),s("p",null,l(t.softwareName||"?")+" "+l(t.softwareVersion),1)]),D(F,{class:"chart",src:f.value[M].requests.received},null,8,["src"])]))),128))]),_:1},8,["name"]))])]),_:1},8,["show-header","foldable","scrollable"])}}}),oe=z(R,[["__scopeId","data-v-5e601e52"]]);export{oe as default};
