import{s as b,j as e,g as j,o,r as C,p as R,i as T,O as y,K as c,C as k}from"./index-CCv_8omK.js";const x={success:"#3ab39d",error:"#D0021B"},w="10px",v=b.div`
  display: inline-block;
  min-width: ${s=>s.size||w};
  min-height: ${s=>s.size||w};
  background-color: ${s=>x[s.color]||s.color||x.success};
  border-radius: 100%;
`;function f({children:s,style:n={},...l}){return e.jsx(j,{style:n,...l,children:s})}f.propTypes={children:o.any.isRequired,style:o.object};const r={yellow:"#FFCF71",grey:"#aaaaaa",reverse:"#444",running:"#34BE74",error:"#D0021B",primary:"#1DC1C7"},g={added:r.grey,waiting:r.yellow,downloading:r.yellow,extracting:r.yellow,downloaded:r.grey,installing:r.yellow,installed:r.grey,starting:r.yellow,running:r.running,stopping:r.yellow,stopped:r.reverse,error:r.error,upgrading:r.yellow,restarting:r.yellow,corrupted:r.error,deleting:r.yellow,resource:r.primary},h={added:"primary",waiting:"info",downloading:"info",extracting:"info",downloaded:"primary",installing:"info",installed:"primary",starting:"info",running:"success",stopping:"warning",stopped:"reverse",error:"error",upgrading:"info",restarting:"info",corrupted:"error",deleting:"warning",resource:"primary"};function B({isResource:s=!1,status:n,variant:l="tag",progress:p=0,tip:u="",...t}){const{t:a}=C.useContext(R),m=T.isInProgress(n);let i=s&&n==="stopped"?"resource":n;h[i]||(i="installed");const d=a(`blocklet.status.${i}`);return l==="pin"?e.jsx(y,{title:a("blocklet.statusTip",{status:d}),children:e.jsxs(c,{...t,sx:[{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center"},...Array.isArray(t.sx)?t.sx:[t.sx]],children:[e.jsx(c,{style:{opacity:.15},sx:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:g[i]}}),e.jsx(c,{sx:{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:g[i]}})]})}):l==="dot"?e.jsx(y,{title:a("blocklet.statusTip",{status:d}),children:e.jsx(v,{color:g[i],...t})}):e.jsxs(f,{type:h[i],...t,children:[m&&e.jsx(k,{size:12,color:"inherit",style:{marginRight:5}}),d,u&&e.jsx("span",{style:{marginLeft:5},children:u}),i==="downloading"&&p?e.jsx("div",{style:{marginLeft:5},children:`${p} %`}):null]})}B.propTypes={status:o.string.isRequired,variant:o.oneOf(["dot","tag","pin"]),source:o.string,progress:o.number,isResource:o.bool,tip:o.string};export{B,v as D,f as W,h as m};
