import{p as Q,a as r,j as f,y as i,l as s,i as l,t as d,r as N,k as c,e as n,h as R,F as M,q as T,g as L,n as V,z as W,A as X}from"./index-BtH6urND.js";var Y=f('<span class="metric-icon"> </span>'),Z=f("<div> </div>"),$=f('<span class="spark svelte-314kjy"></span>'),ee=f('<div class="metric-sparkline svelte-314kjy"></div>'),ae=f('<div class="metric svelte-314kjy"><div class="metric-header svelte-314kjy"><span class="metric-label"> </span> <!></div> <div class="metric-value svelte-314kjy"><!> <!></div> <!> <!></div>');function re(q,t){Q(t,!0);let z=r(t,"format",3,"number"),x=r(t,"prefix",3,void 0),h=r(t,"suffix",3,void 0),v=r(t,"change",3,void 0),A=r(t,"changeLabel",3,"vs last period"),u=r(t,"sparkline",3,void 0),p=r(t,"icon",3,void 0),y=r(t,"color",3,void 0);const C=e=>{if(typeof e=="string")return e;switch(z()){case"currency":return new Intl.NumberFormat(void 0,{style:"currency",currency:"USD"}).format(e);case"percent":return new Intl.NumberFormat(void 0,{style:"percent"}).format(e);case"compact":return new Intl.NumberFormat(void 0,{notation:"compact"}).format(e);default:return new Intl.NumberFormat().format(e)}},D=V(()=>v()!==void 0?v()>=0?"positive":"negative":"");var m=ae(),b=s(m),g=s(b),S=s(g),U=i(g,2);{var B=e=>{var a=Y(),o=s(a);d(()=>c(o,p())),n(e,a)};l(U,e=>{p()&&e(B)})}var k=i(b,2),j=s(k);{var E=e=>{var a=M();d(()=>c(a,x())),n(e,a)};l(j,e=>{x()&&e(E)})}var F=i(j,1,!0),G=i(F);{var H=e=>{var a=M();d(()=>c(a,h())),n(e,a)};l(G,e=>{h()&&e(H)})}var w=i(k,2);{var J=e=>{var a=Z(),o=s(a);d(_=>{T(a,1,`metric-change ${L(D)}`,"svelte-314kjy"),c(o,`${v()>=0?"+":""}${_??""}% ${A()??""}`)},[()=>(v()*100).toFixed(1)]),n(e,a)};l(w,e=>{v()!==void 0&&e(J)})}var K=i(w,2);{var O=e=>{var a=ee();W(a,21,u,X,(o,_)=>{var I=$();d(P=>N(I,P),[()=>`height: ${Math.max(8,L(_)/Math.max(...u())*30)}px`]),n(o,I)}),n(e,a)};l(K,e=>{u()&&e(O)})}d(e=>{N(m,y()?`border-color: ${y()}`:""),c(S,t.label),c(F,e)},[()=>C(t.value)]),n(q,m),R()}export{re as default};
