import{z as c,r as a,j as o,l as m,am as g,a0 as f,o as x}from"./index.BN4Hj9cC.js";const S=c("div",{target:"e4ygpqr0"})(({theme:e,cache:n})=>({...n?{paddingBottom:e.spacing.lg,background:`linear-gradient(to bottom, ${e.colors.bgColor} 0%, ${e.colors.bgColor} 80%, transparent 100%)`}:null})),T=c("div",{target:"e4ygpqr1"})(({theme:e})=>({display:"flex",alignItems:"center",width:"100%",gap:e.spacing.sm})),$=c("div",{target:"e4ygpqr2"})(({theme:e})=>({display:"flex",gap:e.spacing.sm,alignItems:"baseline"})),y=c("div",{target:"e4ygpqr3"})(({theme:e})=>({opacity:.6,fontSize:e.fontSizes.sm})),h=e=>{const n=Math.floor(e/3600),t=Math.floor(e%3600/60),s=e%60;if(n===0&&t===0)return`(${s.toFixed(1)} seconds)`;if(n===0){const d=`${t} minute${t===1?"":"s"}`,p=s===0?"":`, ${s.toFixed(1)} seconds`;return`(${d}${p})`}const l=`${n} hour${n===1?"":"s"}`,r=t===0?"":`, ${t} minute${t===1?"":"s"}`,i=s===0?"":`, ${s.toFixed(1)} seconds`;return`(${l}${r}${i})`};function v({element:e}){const{cache:n,showTime:t}=e,[s,l]=a.useState(0),r=a.useRef(null);return a.useEffect(()=>{if(!t)return;r.current=Date.now();const i=()=>{if(r.current!==null){const u=(Date.now()-r.current)/1e3;l(u)}};i();const d=setInterval(i,100);return()=>clearInterval(d)},[t]),o(S,{className:g({stSpinner:!0,stCacheSpinner:n}),"data-testid":"stSpinner",cache:n,children:m(T,{children:[o(f,{size:"lg",iconValue:"spinner"}),m($,{children:[o(x,{source:e.text,allowHTML:!1}),t&&o(y,{children:h(s)})]})]})})}const b=a.memo(v);export{b as default};
