1import{b as m}from"/build/_shared/chunk-23PA6PGK.js";import{a as P}from"/build/_shared/chunk-WK3KVVSI.js";import"/build/_shared/chunk-H7M6RTKZ.js";import"/build/_shared/chunk-YM7WARKM.js";import{a as l}from"/build/_shared/chunk-QL5OZGUM.js";import{c}from"/build/_shared/chunk-62AJVCSC.js";import"/build/_shared/chunk-KFJ6Y4LO.js";import"/build/_shared/chunk-NGZY4SNM.js";import"/build/_shared/chunk-UIBGULCG.js";import"/build/_shared/chunk-WSSHVIMB.js";import"/build/_shared/chunk-WMIPC762.js";import"/build/_shared/chunk-BJ4RFIBQ.js";import"/build/_shared/chunk-YTWJGXMQ.js";import"/build/_shared/chunk-HYYMZHF4.js";import"/build/_shared/chunk-RWX2RI66.js";import{Ua as D,b as V}from"/build/_shared/chunk-EOJS7VXF.js";import"/build/_shared/chunk-LHPP46I3.js";import"/build/_shared/chunk-I7IIOYZ4.js";import"/build/_shared/chunk-L327ZUMW.js";import"/build/_shared/chunk-7YZTNJBA.js";import"/build/_shared/chunk-TY43B2WU.js";import"/build/_shared/chunk-RSV5R2LB.js";import{A as C}from"/build/_shared/chunk-X4AHNLAR.js";import{d as N}from"/build/_shared/chunk-DTKMK5PW.js";var a=N(C()),M=({startDate:d,endDate:p,prevStartDate:v,prevEndDate:y})=>{let{data:f,isFetching:_}=m({query:{start_time:l(d),end_time:l(p,!0),unit:"day"},enabled:!!d&&!!p}),{data:g,isFetching:b}=m({query:{start_time:l(v),end_time:l(y,!0),unit:"day"},enabled:!!v&&!!y}),h=()=>{let t=f?.data?.data;if(!t?.length)return;let r=t.filter(e=>e.currency==="MYR"||!e.currency).map(e=>({currentValue:e.average_payment_volume/100,label:e.label})),s=g?.data?.data?.filter(e=>e.currency==="MYR"||!e.currency);return s?.length?r.map((e,n)=>({prevDate:s[n]?.label,prevValue:s[n]?.average_payment_volume!=null?s[n].average_payment_volume/100:void 0,...e})):r},i=()=>{let t=f?.data?.data;if(!t?.length)return 0;let r=t.reduce((e,n)=>e+n.volume,0),s=t.reduce((e,n)=>e+n.count,0);return r/s},u=()=>{let t=g?.data?.data;if(!t?.length)return 0;let r=t.reduce((e,n)=>e+n.volume,0),s=t.reduce((e,n)=>e+n.count,0);return r/s},o=()=>{let t=i(),r=u();return!isNaN(t/r*100-100)&&t/r===0&&r>0?-1/0:t/r*100-100},x=isNaN(i())?"RM 0.00":c().format(i()/100),F=isNaN(u())?"RM 0.00":c().format(u()/100);return(0,a.jsxs)("div",{className:"space-y-2 sm:space-y-6",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("p",{className:"font-semibold text-base",children:["Average Payment Value ",(0,a.jsx)(V,{variant:o()>0?"green":o()==0?"grey":"red",className:"inline-flex font-medium ml-1",children:isFinite(o())?`${o().toFixed(2)}%`:o()>0?"\u221E":"-\u221E"})]}),(0,a.jsxs)("p",{className:"text-lg",children:[x," ",(0,a.jsxs)("span",{className:"text-sm text-dim ml-0.5",children:[F," previous period"]})]})]}),_||b?(0,a.jsx)(D,{className:"w-full h-60"}):(0,a.jsxs)("div",{className:"space-y-0.5",children:[(0,a.jsx)("div",{className:"h-[170px]",children:h()?(0,a.jsx)(P,{data:h(),title:"",currency:!0}):""}),(0,a.jsx)("div",{className:"flex justify-between items-center"})]})]})};M.displayName="LineChartAveragePaymentValue";export{M as LineChartAveragePaymentValue};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.