"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("react/jsx-runtime"),c=require("react"),m=({children:i,data:r})=>{const{data:e,meta:{fields:n}}=r;n[0];const a=n.slice(1).filter(t=>!t.startsWith("_")),l=a.map(t=>{const o={};return o.id=t,o.data=e.map(s=>{const u={};return Object.keys(s).forEach(b=>{u[b]=s[b]}),{x:s[n[0]],y:s[t],variables:{...u,field:t}}}),o}),d={indexBy:"id",keys:a,data:l};return c.Children.map(i,t=>c.cloneElement(t,{options:d}))},p=({children:i,data:r})=>{const{data:e,meta:{fields:n}}=r;n[0];const a=r.data.map(t=>t.ID),l=e.map(t=>{const o={},s={};return Object.keys(t).forEach(u=>{s[u]=t[u]}),s.field=n[1],o.variables=s,o.id=t[n[0]],o.label=t[n[0]],o.value=t[n[1]],o}),d={keys:a,indexBy:"id",data:l};return c.Children.map(i,t=>c.cloneElement(t,{options:d}))},x=({children:i,data:r,measures:e})=>{const{data:n,meta:{fields:a}}=r,l=a[0],d=e&&e.length>0?e:a.slice(1).filter(o=>!o.startsWith("_")),t={indexBy:l,keys:d,data:n};return c.Children.map(i,o=>c.cloneElement(o,{options:t}))},v=({children:i,data:r,keys:e,type:n,measures:a})=>{if(n=="bar")return f.jsx(x,{data:r,keys:e,measures:a,children:i});if(n=="line")return f.jsx(m,{data:r,keys:e,measures:a,children:i});if(n=="bump")return f.jsx(m,{data:r,keys:e,measures:a,children:i});if(n=="pie")return f.jsx(p,{data:r,keys:e,measures:a,children:i});if(n=="radar")return f.jsx(x,{data:r,keys:e,measures:a,children:i})};exports.default=v;
