(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var a in n)e.o(n,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:n[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.ReactDOM,n="@media only screen and (max-width: 1024px)",a="@media only screen and (max-width: 640px)",l="linear-gradient(135deg, #0040E3, #18D4FD)",s=window.React;var r=e.n(s);const o=(e,t)=>{return null==(n=t)||""===n||Array.isArray(n)&&0===n.length||"object"==typeof n&&0===Object.keys(n).length||"string"==typeof n&&""===n.trim()||"number"==typeof n&&0===n?"":`${e}: ${t};`;var n},i=(e,t=!0,n=!0,a=!0)=>{const{type:s="solid",color:r="",gradient:i=l,image:c={},position:d="center center",attachment:h="",repeat:u="no-repeat",size:g="",overlayColor:x=""}=e||{};return"gradient"===s&&n?o("background",i):"image"===s&&a?`background: url(${c?.url});\n\t\t\t\t${o("background-color",x)}\n\t\t\t\t${o("background-position",d)}\n\t\t\t\t${o("background-size",g)}\n\t\t\t\t${o("background-repeat",u)}\n\t\t\t\t${o("background-attachment",h)}\n\t\t\t\t${o("background-repeat",u)}\n\t\t\t\tbackground-blend-mode: overlay;`:t&&o("background",r)},c=(e,t,l=!0)=>{const{fontFamily:s="Default",fontCategory:r="sans-serif",fontVariant:i=400,fontWeight:c,isUploadFont:d=!0,fontSize:h={desktop:null,tablet:null,mobile:null},fontStyle:u,textTransform:g,textDecoration:x,lineHeight:p,letterSpace:m}=t||{},b=!l||!s||"Default"===s,f=h?.desktop||h,y=h?.tablet||f,$=h?.mobile||y,v=e=>{const t=String(e);return["px","em","rem","%","vh","vw"].some(e=>t.endsWith(e))?t:"number"==typeof e?`${t}px`:""},j=`\n\t\t${b?"":`font-family: '${s}', ${r};`}\n\t\t${o("font-weight",c)}\n\t\t${o("font-size",v(f))}\n\t\t${o("font-style",u)}\n\t\t${o("text-transform",g)}\n\t\t${o("text-decoration",x)}\n\t\t${o("line-height",p)}\n\t\t${o("letter-spacing",m)}\n\t`,w=i&&400!==i?"400i"===i?":ital@1":i?.includes("00i")?`: ital, wght@1, ${i?.replace("00i","00")} `:`: wght@${i} `:"",S=b?"":`https://fonts.googleapis.com/css2?family=${s?.split(" ").join("+")}${w.replace(/ /g,"")}&display=swap`;return{googleFontLink:!d||b?"":`@import url(${S});`,styles:`${e}{\n\t\t\t${j}\n\t\t}\n\t\t${n} {\n\t\t\t${e}{\n\t\t\t\t${o("font-size",v(y))}\n\t\t\t}\n\t\t}\n\t\t${a} {\n\t\t\t${e}{\n\t\t\t\t${o("font-size",v($))}\n\t\t\t}\n\t\t}`.replace(/\s+/g," ").trim()}},d=window.ReactJSXRuntime,h=({attributes:e,id:t})=>{const{background:l,width:s,height:r,alignment:h,styles:u,options:g}=e,x=`#${t}`,p=`${x} .bChart`,m=`${x} .bp-bchart-block`,b=`${m} .bpl-vertical-wapper`,f=`${b} .bpbc-barchat-title`,y=`${b} .bar-subtitle-h3`,$=`${b} .bpl-chart-Width`,v=`${$} .barchartLabel`,j=`${$} .grid-value`,w=`${b} .column-legend .column-legend-item .column-legend-text`,S=`${b} .bpbc-barchat-y-axis-label`,C=`${b} .bpbc-barchat-x-axis-label`,M=`${m} .group-two-wrapper`,k=`${M} .chart-container`,N=`${k} .group-svg-wrapper`,L=`${k} .chart-header`,T=`${L} .chart-h2`,W=`${L} .chart-subtitle-h3`,R=`${L} .legend .legend-item .legend-series-name`,A=`${N} .y-label`,z=`${N} .category-label`,P=`${N} .group-value`,D=`${N} .axis-line`,E=`${N} .grid-line`,F=`${m} .bchart-stacked-main-wapper`,V=`${F} .stacked-chart-title`,B=`${F} .stacked-subtitle-h3`,G=`${F} .stacked-chart-legend .stacked-chart-legend-item .stacked-chart-legend-label`,O=`${F} .stack-svg-wapper`,H=`${O} .stack-axios`,Y=`${O} .stack-label`,X=`${O} .stack-value`,I=`${O} .stack-axios-line`,_=`${O} .stack-grid-line`,U=`${m} .bc-PieChartswrapper`,J=`${U} .pieChartSection .pieChartSvg .bc-legend-label`,Z=`${J} .tspanValue`,q=`${J} .bc-legend-label-text`,K=`${U} .bc-PieChartsLegend`,Q=`${K} .bc-PieChartsLegendHeader`,ee=`${Q} .bc-PieChartsLegendH2`,te=`${Q} .bc-PieChartsLegendSub`,ne=`${K} .bc-PieChartsLegendScroll .bc-PieChartsLegendlist`,ae=`${ne} .bc-legendSection .bc-legendSectionLabel`,le=`${ne} .bc-legendSectionValue`,se=`${m} .bclineChartMinWapper`,re=`${se} .line-chart-header`,oe=`${re} .line-chart-h2`,ie=`${re} .line-chart-subtitle-h3`,ce=`${se} .line-column-legend .column-legend-item .column-legend-text`,de=`${se} .lineChartSvgWapper`,he=`${de} .lineChartSvg`,ue=`${he} .lineChartAxios`,ge=`${he} .lineChartAxisText`,xe=`${m} .bcSingleLineChartwapper`,pe=`${xe} .line-chart-header`,me=`${pe} .line-chart-h2`,be=`${pe} .line-chart-subtitle-h3`,fe=`${xe} .line-column-legend .column-legend-item .column-legend-text`,ye=`${xe} .bcSingleSvgWapper .bcSingleValue`,$e=`${m} .bcScatterChartMainWapper`,ve=`${$e} .bcSvgScatterMainWapper`,je=`${ve} .bcSvgSection`,we=`${je} .bcScatterGridLine`,Se=`${je} .bcScatterLabelText`,Ce=`${$e} .scatter-chart-header`,Me=`${Ce} .line-chart-h2`,ke=`${Ce} .line-chart-subtitle-h3`,Ne=`${$e} .bcScatterColumnlegend .column-legend-item .column-legend-text`,Le=`${m} .bcRadarChartMainWapper .bcSVGMainWapper`,Te=`${Le} .radarScatter-chart-header`,We=`${Te} .line-chart-h2`,Re=`${Te} .line-chart-subtitle-h3`,Ae=`${Le} .bcSVGRanderMainWapper .bcAxiosLabelName`,ze=`${Le} .bcLegendMainWapper .bcLegendNameText .bcLegendText`,Pe=`${m} .bcGaugeChartWapper`,De=`${Pe} .bpbcGaugeChatTitle`,Ee=`${Pe} .bpbcGaugeChatSubtitleH3`,Fe=`${Pe} .bcGaugeChartlegend`,Ve=`${Fe} .bcGaugeChartlegendWapper .bcGaugeChartlegendLabel`,Be=`${Pe} .bcGaugeChartAnimated .bcGaugeChartlegendAnimated`,Ge=`${Pe} .bcGaugeChartSvg`,Oe=`${Ge} .bcActualValue`,He=`${Ge} .bcGaugeChartlegendText`,Ye=`${m} .bcFunnelChartWapper`,Xe=`${Ye} .chart-header`,Ie=`${Xe} .chart-h2`,_e=`${Xe} .chart-subtitle-h3`,Ue=`${Ye} .funnel-chart-svg`,Je=`${Ue} .funnel-label`,Ze=`${Ue} .funnel-value`,qe=`${Ue} .funnel-drop-rate`,Ke=`${m} .bcHeatmapChartWapper`,Qe=`${Ke} .chart-header`,et=`${Qe} .chart-h2`,tt=`${Qe} .chart-subtitle-h3`,nt=`${Ke} .heatmap-chart-svg`,at=`${nt} .heatmap-x-label`,lt=`${nt} .heatmap-y-label`,st=`${nt} .heatmap-cell-value`,rt=`${m} .chart-candlestick-wrap`,ot=`${rt} .chart-header`,it=`${ot} .chart-h2`,ct=`${ot} .chart-subtitle-h3`,dt=`${rt} .stats .stat`,ht=`${dt} .stat-label`,ut=`${dt} .stat-val`;return(0,d.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n${c("",u?.titleTypo)?.googleFontLink}\n\t\t${c("",u?.groupSubTitleTypo)?.googleFontLink}\n ${c("",u?.valueTypo)?.styles}\n ${c("",u?.valueTypo)?.styles}\n ${c("",u?.textTypo)?.styles}\n ${c("",u?.textTypo)?.styles}\n ${c("",u?.textTypo)?.styles}\n\n\t\t${c("",u?.titleTypo)?.styles}\n\t\t${c("",u?.groupSubTitleTypo)?.styles}\n\t\t${c("",u?.gridLabelTypo)?.styles}\n\t ${c("",u?.gridLabelTypo)?.styles}\n\t ${c("",u?.gridLabelTypo)?.styles}\n\n\t\t${c("",u?.titleTypo)?.googleFontLink}\n\t\t${c("",u?.groupSubTitleTypo)?.googleFontLink}\n\t\t${c("",u?.gridLabelTypo)?.styles}\n\t\t${c("",u?.gridLabelTypo)?.styles}\n\n\t\t${c("",u?.pieLabelTypo)?.styles}\n\t\t${c("",u?.pieValueTypo)?.styles}\n\t\t${c("",u?.titleTypo)?.styles}\n\t ${c("",u?.groupSubTitleTypo)?.styles}\n\t ${c("",u?.gridLabelTypo)?.styles}\n\t ${c("",u?.gridLabelTypo)?.styles}\n\n\n\t\t${c("",u?.titleTypo)?.googleFontLink}\n\t\t${c("",u?.groupSubTitleTypo)?.googleFontLink}\n\t\t${c("",u?.legendLabelTypo)?.styles}\n ${c("",u?.gridLabelTypo)?.styles}\n\n\t\t${c("",u?.titleTypo)?.styles}\n\t ${c("",u?.groupSubTitleTypo)?.styles}\n\t ${c("",u?.legendLabelTypo)?.styles}\n\t\t${c("",u?.valueTypo)?.styles}\n\n\n\t\t${c("",u?.titleTypo)?.styles}\n\t ${c("",u?.groupSubTitleTypo)?.styles}\n\t\t${c("",u?.legendLabelTypo)?.styles}\n ${c("",u?.valueTypo)?.styles}\n\t\t${c("",u?.legendValueTypo)?.styles}\n\n\n\t\t${c("",u?.statTextTypo)?.styles}\n\t\t${c("",u?.statValueTypo)?.styles}\n\n\n\t\t${c(f,u?.titleTypo)?.styles}\n\t\t${c(y,u?.groupSubTitleTypo)?.styles}\n\t\t${c(v,u?.valueTypo)?.styles}\n\t\t${c(j,u?.valueTypo)?.styles}\n\t\t${c(w,u?.valueTypo)?.styles}\n\t\t${c(S,u?.textTypo)?.styles}\n\t\t${c(C,u?.textTypo)?.styles}\n\n\n\t ${c(T,u?.titleTypo)?.styles}\n\t ${c(W,u?.groupSubTitleTypo)?.styles}\n\t ${c(A,u?.gridLabelTypo)?.styles}\n\t ${c(z,u?.gridLabelTypo)?.styles}\n\t ${c(R,u?.gridLabelTypo)?.styles}\n\n\n\t\t${c(V,u?.titleTypo)?.styles}\n\t\t${c(B,u?.groupSubTitleTypo)?.styles}\n\t\t${c(H,u?.gridLabelTypo)?.styles}\n\t\t${c(Y,u?.gridLabelTypo)?.styles}\n\n\n\t\t${c(q,u?.pieLabelTypo)?.styles}\n\t\t${c(Z,u?.pieValueTypo)?.styles}\n\t\t${c(ee,u?.titleTypo)?.styles}\n\t\t${c(te,u?.groupSubTitleTypo)?.styles}\n\t\t${c(ae,u?.gridLabelTypo)?.styles}\n\t\t${c(le,u?.gridLabelTypo)?.styles}\n\n\n\n\t ${c(oe,u?.titleTypo)?.styles}\n\t ${c(ie,u?.groupSubTitleTypo)?.styles}\n\t ${c(ce,u?.legendLabelTypo)?.styles}\n\t ${c(ge,u?.gridLabelTypo)?.styles}\n\n\n\n\t ${c(me,u?.titleTypo)?.styles}\n\t ${c(be,u?.groupSubTitleTypo)?.styles}\n\t ${c(fe,u?.legendLabelTypo)?.styles}\n\t ${c(ye,u?.valueTypo)?.styles}\n\n\n\t\t${c(Me,u?.titleTypo)?.styles}\n\t ${c(ke,u?.groupSubTitleTypo)?.styles}\n ${c(Ne,u?.legendLabelTypo)?.styles}\n ${c(Se,u?.valueTypo)?.styles}\n\n\n\n\t\t${c(We,u?.titleTypo)?.styles}\n\t ${c(Re,u?.groupSubTitleTypo)?.styles}\n\t\t${c(ze,u?.legendLabelTypo)?.styles}\n\t\t${c(Ae,u?.valueTypo)?.styles}\n\n\n\n\t\t${c(De,u?.titleTypo)?.styles}\n ${c(Ee,u?.groupSubTitleTypo)?.styles}\n ${c(Fe,u?.legendLabelTypo)?.styles}\n\t\t${c(He,u?.legendValueTypo)?.styles}\n\t\t${c(Be,u?.valueTypo)?.styles}\n\t\t${c(Oe,u?.valueTypo)?.styles}\n\n\n\n ${c(Ie,u?.titleTypo)?.styles}\n ${c(_e,u?.groupSubTitleTypo)?.styles}\n ${c(Je,u?.legendLabelTypo)?.styles}\n\t\t${c(Ze,u?.legendValueTypo)?.styles}\n\t\t${c(qe,u?.valueTypo)?.styles}\n\n\n ${c(et,u?.titleTypo)?.styles}\n ${c(tt,u?.groupSubTitleTypo)?.styles}\n ${c(at,u?.legendLabelTypo)?.styles}\n\t\t${c(lt,u?.legendLabelTypo)?.styles}\n\t\t${c(st,u?.valueTypo)?.styles}\n\t\n\n\n\t\t${c(it,u?.titleTypo)?.styles}\n ${c(ct,u?.groupSubTitleTypo)?.styles}\n ${c(dt,u?.statTextTypo)?.styles}\n ${c(ut,u?.statValueTypo)?.styles}\n\n\t\t${x}{\n\t\t\ttext-align: ${h};\n\t\t}\n\t\t${p}{\n\t\t\theight: ${r};\n\t\t\tmargin-left: ${"right"===h||"center"===h?"auto":"0"};\n\t\t\tmargin-right: ${"left"===h||"center"===h?"auto":"0"};\n\t\t}\n\n\t\t${p},\n\t\t${x} .downloadArea{\n\t\t\twidth: ${s};\n\t\t}\n\t\t${p} canvas{\n\t\t\t${i(l)};\n\t\t}\n\n\n ${b}{\n\t\t background: ${u?.backgroundColor?.includes("gradient")?u?.backgroundColor:`${u?.backgroundColor}`};\n\t\t}\n\t\t${$}{\n\t\t width: ${g?.barChartWidth?.desktop};\n\t\t}\n\t\t${f}{\n\t\t\tcolor:${u?.titleColor};\n\t\t}\n\t\t${y}{\n\t\t\tcolor:${u?.groupSubTitleColor};\n\t\t}\n\t\t${w}{\n\t\t\tcolor:${u?.valueColor};\n\t\t}\n\n ${M}{\n\t\t background: ${u?.backgroundColor?.includes("gradient")?u?.backgroundColor:`${u?.backgroundColor}`};\n\t\t}\n ${N}{\n\t\t width: ${g?.groupChartWidth?.desktop}%;\n\t\t}\n ${T}{\n color:${u?.titleColor};\n\t\t}\n ${W}{\n\t\t color:${u?.groupSubTitleColor};\n\t\t}\n ${R}{\n color:${u?.gridLabelColor};\n\t\t}\n ${A}{\n fill:${u?.gridLabelColor};\n\t\t}\n ${z}{\n fill:${u?.gridLabelColor};\n\t\t}\n ${P}{\n\t\t\tfill:${u?.gridLabelColor};\n\t\t}\n\t\t${D}{\n stroke:${u?.groupAxisLineColor};\n\t\t}\n ${E}{\n\t\t stroke:${u?.groupGridLineColor};\n\t\t}\n\n\n\n\t\t${F}{\n\t\t background: ${u?.backgroundColor?.includes("gradient")?u?.backgroundColor:`${u?.backgroundColor}`};\n\t\t}\n ${V}{\n\t\t color:${u?.titleColor};\n\t }\n\t\t${B}{\n\t\t color:${u?.groupSubTitleColor};\n\t\t}\n\t\t${G}{\n\t\t color:${u?.gridLabelColor};\n\t\t}\n\t\t${H}{\n\t\t fill:${u?.gridLabelColor};\n\t\t}\n\t\t${Y}{\n\t\t fill:${u?.gridLabelColor};\n\t\t}\n\t\t${X}{\n\t\t fill:${u?.gridLabelColor};\n\t\t}\n\t ${I}{\n\t\t stroke:${u?.groupAxisLineColor};\n\t\t}\n\t\t${_}{\n\t\t stroke:${u?.groupGridLineColor};\n\t\t}\n\n\n\n ${U}{\n\t\t max-width:${g?.pieWidth?.desktop};\n\t\t}\n\t\t${ee}{\n\t\t color:${u?.titleColor};\n\t\t}\n\t\t${te}{\n\t\t color:${u?.groupSubTitleColor};\n\t\t}\n ${ne}{\n\t\t background: ${u?.backgroundColor?.includes("gradient")?u?.backgroundColor:`${u?.backgroundColor}`};\n\t\t}\n\t\t${ae}{\n\t\t color:${u?.gridLabelColor};\n\t\t}\n\t\t${le}{\n\t\t color:${u?.gridLabelColor};\n\t\t}\n\n\n\n\t\t${se}{\n\t\t\t\tbackground: ${u?.backgroundColor?.includes("gradient")?u?.backgroundColor:`${u?.backgroundColor}`};\n\t\t}\n\t\t${oe}{\n\t\t\tcolor:${u?.titleColor};\n\t\t}\n\t\t${ie}{\n\t\t\tcolor:${u?.groupSubTitleColor};\n\t\t}\n\t\t${ce}{\n\t\t\tcolor:${u?.legendLabelColor};\n\t\t}\n\t\t${de}{\n\t\t width:${g?.multiChartWidth?.desktop}%;\n\t\t}\n ${ue}{\n\t\t stroke:${u?.groupAxisLineColor};\n\t\t}\n ${ge}{\n\t\t fill:${u?.gridLabelColor};\n\t\t}\n\n\n\n ${xe}{\n\t\t width:${g?.multiChartWidth?.desktop}%;\n\t\t\tbackground: ${u?.backgroundColor?.includes("gradient")?u?.backgroundColor:`${u?.backgroundColor}`};\n\t\t}\n\t\t${me}{\n\t\t\tcolor:${u?.titleColor};\n\t\t}\n\t\t${be}{\n\t\t\tcolor:${u?.groupSubTitleColor};\n\t\t}\n\t\t${fe}{\n\t\t\tcolor:${u?.legendLabelColor};\n\t\t}\n ${ye}{\n\t\t fill:${u?.valueColor};\n\t\t}\n\n ${$e}{\n\t\t\tbackground: ${u?.backgroundColor?.includes("gradient")?u?.backgroundColor:`${u?.backgroundColor}`};\n\t\t}\n\n ${ve}{\n\t\t width:${g?.multiChartWidth?.desktop}%;\n\t\t}\n\t\t${Me}{\n color:${u?.titleColor};\n\t\t}\n ${ke}{\n\t\t color:${u?.groupSubTitleColor};\n\t\t}\n\t\t${Ne}{\n\t\t color:${u?.legendLabelColor};\n\t\t}\n ${we}{\n\t\t stroke: ${u?.axisLineColor};\n\t\t}\n\t\t${Se}{\n\t\t fill:${u?.valueColor};\n\t\t}\n\n\n\n\t\t${Le}{\n\t\t\tbackground: ${u?.backgroundColor?.includes("gradient")?u?.backgroundColor:`${u?.backgroundColor}`};\n\t\t}\n ${We}{\n\t\t color:${u?.titleColor};\n\t\t}\n\t\t${Re}{\n\t\t color:${u?.groupSubTitleColor};\n\t\t}\n\n ${ze}{\n\t\t color:${u?.legendLabelColor};\n\t\t}\n ${Ae}{\n\t\t fill: ${u?.valueColor};\n\t\t}\n\n\t\t${Pe}{\n\t\t\tbackground: ${u?.backgroundColor?.includes("gradient")?u?.backgroundColor:`${u?.backgroundColor}`};\n\t\t}\n ${De}{\n\t\t color:${u?.titleColor};\n\t\t}\n ${Ee}{\n\t\t color:${u?.groupSubTitleColor};\n\t\t}\n ${Ve}{\n\t\t color:${u?.legendLabelColor};\n\t\t}\n ${Be}{\n\t\t color: ${u?.valueColor};\n\t\t}\n ${Oe}{\n\t\t fill: ${u?.valueColor};\n\t\t}\n\n ${He}{\n\t\t fill:${u?.legendValueColor};\n\t\t}\n\n\n\n\t\t${Ye}{\n\t\t\tbackground: ${u?.backgroundColor?.includes("gradient")?u?.backgroundColor:`${u?.backgroundColor}`};\n\t\t}\n\t\n\t\t${Ie}{\n\t\t\tcolor:${u?.titleColor};\n\t\t}\n\t\t${_e}{\n\t\t\tcolor:${u?.groupSubTitleColor};\n\t\t}\n ${Je}{\n fill:${u?.legendLabelColor};\n }\n ${Ze}{\n fill:${u?.legendValueColor};\n }\n ${qe}{\n fill:${u?.valueColor};\n }\n\n\n\t\t${Ke}{\n\t\t\tbackground: ${u?.backgroundColor?.includes("gradient")?u?.backgroundColor:`${u?.backgroundColor}`};\n\t\t}\n\t\t${et}{\n\t\t\tcolor:${u?.titleColor};\n\t\t}\n\t\t${tt}{\n\t\t\tcolor:${u?.groupSubTitleColor};\n\t\t}\n\t\t${at}{\n\t\t\tfill:${u?.gridLabelColor};\n\t\t}\n\t\t${lt}{\n\t\t\tfill:${u?.gridLabelColor};\n\t\t}\n\t\t${st}{\n\t\t\tfont-size:${u?.valueTypo?.fontSize?.desktop}px;\n\t\t}\n\n\n ${rt}{\n\t\t\tbackground: ${u?.backgroundColor?.includes("gradient")?u?.backgroundColor:`${u?.backgroundColor}`};\n\t\t}\n\n\t\t${it}{\n\t\t\tcolor:${u?.titleColor};\n\t\t}\n\t\t${ct}{\n\t\t\tcolor:${u?.groupSubTitleColor};\n\t\t}\n\n\t\t${dt}{\n\t\t\tbackground: ${u?.statBgColor?.includes("gradient")?u?.statBgColor:`${u?.statBgColor}`};\n\t\t}\n\t\t\n\n\n\t\t${ht}{\n\t\t\tcolor: ${u?.statTextColor};\n\t\t}\n\t\t${ut}{\n\t\t\tcolor: ${u?.statTextColor};\n\t\t}\n\n\n\t\t${n}{\n\n\t\t\t${N}{\n\t\t\t\twidth: ${g?.groupChartWidth?.tablet}%;\n\t\t\t}\n\n\t\t\t${$}{\n\t\t\t\twidth: ${g?.barChartWidth?.tablet};\n\t\t\t}\n\n\t\t\t${U}{\n\t\t ${o("max-width",g?.pieWidth?.tablet)};\n\t\t }\n\t\t\t${de}{\n\t\t\t width:${g?.multiChartWidth?.tablet}%;\n\t\t\t}\n\t\t\t${xe}{\n\t\t\t\twidth:${g?.multiChartWidth?.tablet}%;\n\t\t\t}\n\n\t\t ${ve}{\n\t\t width:${g?.multiChartWidth?.tablet}%;\n\t\t }\n\t\t}\n\n\t\t${a}{\n\t\t\t${N}{\n\t\t\t\twidth: ${g?.groupChartWidth?.mobile}%;\n\t\t\t}\n\t\t\t${$}{\n \t\t\t width: ${g?.barChartWidth?.mobile};\n\t\t\t}\n\t\t\t${U}{\n\t\t\t\t${o("max-width",g?.pieWidth?.mobile)};\n\t\t }\n\t\t\t${de}{\n\t\t\t width:${g?.multiChartWidth?.mobile}%;\n\t\t\t}\n\t\t\t${xe}{\n\t\t\t\twidth:${g?.multiChartWidth?.mobile}%;\n\t\t\t}\n\t\t ${ve}{\n\t\t width:${g?.multiChartWidth?.mobile}%;\n\t\t }\n\t\t}\n\n\n\t\t`.replace(/\s+/g," ")}})},u=()=>"undefined"==typeof window?"desktop":window.innerWidth<=640?"mobile":window.innerWidth<=1024?"tablet":"desktop",g=()=>{const e=window.innerWidth;return e<=640?"mobile":e<=1024?"tablet":"desktop"},x=(e,t,n,a="chart")=>{const l=n.map(n=>{const a=e.find(e=>e.id===n.category_id)?.name||"",l=t.find(e=>e.id===n.series_id)?.name||"",s=t.find(e=>e.id===n.series_id)?.color||"";return[a,l,n.value,s]}),s=[["Category","Series","Value","Color"].join(","),...l.map(e=>e.join(","))].join("\n"),r=new Blob([s],{type:"text/csv;charset=utf-8;"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.setAttribute("download","stack"===a?"single-line-chart.csv":"multi-line-chart.csv"),document.body.appendChild(i),i.click(),document.body.removeChild(i)},p=(e,t="chart")=>{const n=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),a=document.createElement("a");a.href=URL.createObjectURL(n),a.download="stack"===t?"single-line-chart.json":"multi-line-chart.json",a.click()},m=(e,t="chart")=>{if(!e)return void alert("SVG not found");let n=(new XMLSerializer).serializeToString(e);n.includes("xmlns")||(n=n.replace("{s.fillStyle="#fff",s.fillRect(0,0,l.width,l.height),s.drawImage(r,0,0);const e=document.createElement("a");e.download={stack:"stack-barchart.png",multi:"multi-line-chart.png",group:"group-barchart.png",funnel:"funnel-chart.png",heatmap:"heatmap-chart.png"}[t]||"chart.png",e.href=l.toDataURL("image/png"),e.click()},r.onerror=e=>{console.error("PNG error",e)},r.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(n)},b=({attributes:e,device:t})=>{const{categories:n=[],series:a=[],dataPoints:l=[],options:r}=e,o=(0,s.useRef)(null),i=(0,s.useRef)(null),c=(0,s.useRef)(null),[h,g]=(0,s.useState)(800),[b,f]=(0,s.useState)(null);(0,s.useEffect)(()=>{if(!o.current)return;const e=new ResizeObserver(([e])=>g(Math.floor(e.contentRect.width)));return e.observe(o.current),()=>e.disconnect()},[]);const y=(0,s.useMemo)(()=>((e=[])=>{const t=new Map;return e.forEach(e=>{t.set(`${e.category_id}_${e.series_id}`,{...e,value:Number(e.value)||0})}),Array.from(t.values())})(l),[l]),$=(0,s.useMemo)(()=>{const e={};return y.forEach(t=>{e[`${t.category_id}_${t.series_id}`]=t.value}),e},[y]),v=(0,s.useMemo)(()=>{const e={};return l.forEach(t=>{e[t.category_id]=(e[t.category_id]||0)+(Number(t.value)||0)}),Math.max(...Object.values(e),0)},[l]),j=50,w=t?t.toLowerCase():u(),S=Number(r?.groupChartHeight?.[w])||360,C=Number(r?.groupChartWidth?.[w])||100,M=S-20-60,k=70*n.length+120,N=h*C/100,L=Math.max(N,k),T=(L-j-20)/Math.max(n.length,1),W=.6*T,R=v>0?v:1,A=e=>M-e/R*M,z=r?.stackBarSpace?2:0,[P,D]=(0,s.useState)("");return(0,d.jsxs)("div",{className:"bchart-stacked-main-wapper",children:[r?.groupChartTitleShow&&(0,d.jsx)("h3",{className:"stacked-chart-title",children:r?.chartTitle}),r?.groupSubTitleShow&&(0,d.jsx)("h3",{className:"stacked-subtitle-h3",children:r?.chartSubTitle}),r?.groupShowLegend&&(0,d.jsx)("div",{className:"stacked-chart-legend",children:a.map(e=>(0,d.jsxs)("div",{className:"stacked-chart-legend-item",children:[(0,d.jsx)("span",{className:"stacked-chart-legend-color",style:{backgroundColor:e.color}}),(0,d.jsx)("span",{className:"stacked-chart-legend-label",children:e.name})]},e.id))}),r?.downloadButton&&(0,d.jsxs)("div",{className:"chart-download-row",children:[(0,d.jsxs)("select",{className:"chart-download-select",value:P,onChange:e=>D(e.target.value),children:[(0,d.jsx)("option",{disabled:!0,value:"",children:"Select Format"}),(0,d.jsx)("option",{value:"csv",children:"CSV"}),(0,d.jsx)("option",{value:"png",children:"PNG"}),(0,d.jsx)("option",{value:"json",children:"JSON"})]}),(0,d.jsx)("button",{className:"chart-download-btn",disabled:!P,onClick:()=>{if(P){switch(P){case"csv":x(n,a,l,"stack");break;case"png":m(i.current,"stack");break;case"json":p({categories:n,series:a,dataPoints:l},"stack")}D("")}},children:"Download"})]}),(0,d.jsx)("div",{style:{position:"relative"},children:(0,d.jsxs)("div",{ref:o,className:"stack-svg-wapper",style:{maxWidth:`${C}%`},children:[(0,d.jsxs)("svg",{ref:i,width:L,height:S,xmlns:"http://www.w3.org/2000/svg",children:[[...Array(6)].map((e,t)=>{const n=v/5*t,a=20+A(n);return(0,d.jsxs)("g",{children:[r?.groupGridShow&&0!==n&&(0,d.jsx)("line",{x1:j,y1:a,x2:L-20,y2:a,stroke:"#e5e7eb",strokeDasharray:"4 4",vectorEffect:"non-scaling-stroke",className:"stack-grid-line",opacity:"0.5"}),(0,d.jsx)("text",{x:42,y:a+4,textAnchor:"end",fontSize:"12",fill:"#6b7280",className:"stack-axios",children:Math.round(n)})]},`grid-${t}`)}),(0,d.jsx)("line",{x1:j,y1:19,x2:j,y2:S-60+1,stroke:"#111",strokeWidth:"2",className:"stack-axios-line"}),(0,d.jsx)("line",{x1:j,y1:S-60,x2:L-20,y2:S-60,stroke:"#111",strokeWidth:"2",className:"stack-axios-line"}),n.map((e,t)=>{let n=0;const l=j+T*t+(T-W)/2,s=a.reduce((t,n)=>t+($[`${e.id}_${n.id}`]||0),0);return(0,d.jsxs)("g",{onMouseLeave:()=>f(null),onMouseMove:t=>((e,t,n,a)=>{if(!o.current)return;const l=o.current.getBoundingClientRect(),s=o.current.scrollLeft,r=e.clientX-l.left,i=e.clientY-l.top;let c=r+s+12,d=i-120-12;c+180>s+l.width-10&&(c=r+s-180-12),c({name:e.name,color:e.color,value:a[`${t.id}_${e.id}`]||0}));f({x:c,y:d,category:t.name,rows:h})})(t,e,a,$),children:[a.map(t=>{const a=$[`${e.id}_${t.id}`]||0,o=n;n+=a;const i=A(o)-A(n),c=Math.max(i-z,0),h=20+A(n)+z/2,u=s>0?Math.round(a/s*100):0;return(0,d.jsxs)("g",{children:[(0,d.jsx)("rect",{x:l,y:h,width:W,height:c,fill:t.color,ry:Number(r?.stackBorderRadius)||0}),"percent"===r?.valueDisplay&&c>14&&r?.stackedValue&&(0,d.jsxs)("text",{x:l+W/2,y:h+c/2+4,textAnchor:"middle",fontSize:"11",fill:"#fff",fontWeight:"500",pointerEvents:"none",className:"stack-label",children:[u,"%"]})]},t.id)}),"number"===r?.valueDisplay&&r?.stackedValue&&(0,d.jsx)("text",{x:l+W/2,y:20+A(n)-6,textAnchor:"middle",fontSize:"12",fill:"#111",fontWeight:"600",className:"stack-value",children:n}),(0,d.jsx)("text",{x:l+W/2,y:S-60+20,textAnchor:"middle",fontSize:"12",fill:"#6b7280",className:"stack-label",dy:"10",children:e.name})]},e.id)})]}),b&&(0,d.jsxs)("div",{ref:c,className:"stack-tooltip",style:{left:b.x,top:b.y},children:[(0,d.jsx)("div",{className:"stack-tooltip-title",children:b.category}),b.rows.map((e,t)=>(0,d.jsxs)("div",{className:"stack-tooltip-row",children:[(0,d.jsx)("span",{className:"stack-tooltip-dot",style:{background:e.color}}),(0,d.jsx)("span",{className:"stack-tooltip-name",children:e.name}),(0,d.jsx)("strong",{className:"stack-tooltip-value",children:e.value})]},t))]})]})})]})},f=()=>{const e=()=>window.innerWidth<=480?"mobile":window.innerWidth<=768?"tablet":"desktop",[t,n]=(0,s.useState)(e);return(0,s.useEffect)(()=>{const t=()=>n(e());return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]),t},y=(e,t,n)=>"percent"===n?t?`${Math.round(e/t*100)}%`:"0%":e?.toString()??"0",$=(e=[],t="",n="chart")=>{let a=[],l=[];"themeThree"===t?(a=["Label","Value","Color"],l=e.map(e=>[e.label,e.value,e.color])):"themeFour"===t?(a=["name","color","x","y","size","label","singleColor"],l=e.flatMap(e=>e.data.map(t=>[e.name,e.color,t.x,t.y,t.size??"",t.label,t.singleColor??""]))):"themeFive"===t?(a=["name","color","axiosData","value"],l=e.flatMap(e=>e?.data?.map((t,n)=>{const a=e?.axiosData?.[n]?.axis||"";return[e.name,e.color,a,t.value]}))):"themeSix"===t?(a=["label","min","max","color"],l=(e||[]).map(e=>[e.label,e.min,e.max,e.color])):"themeNine"===t?(a=["d","o","h","l","c"],l=e.map(e=>[e.d,e.o,e.h,e.l,e.c])):(a=["Label","Value","Color"],l=e.map(e=>[e.label,e.value,e.color]));const s=[a,...l].map(e=>e.join(",")).join("\n"),r=new Blob([s],{type:"text/csv;charset=utf-8;"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download={single:"single-chart-data.csv",bar:"bar-chart-data.csv",pie:"pie-chart-data.csv",scatter:"scatter-chart-data.csv",radar:"radar-chart-data.csv",gauge:"gauge-chart-data.csv",candlestick:"candlestick-chart-data.csv"}[n]||"chart-data.csv",i.click()},v=(e,t="chart")=>{const n=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),a=URL.createObjectURL(n),l=document.createElement("a");l.href=a,l.download={single:"single-chart-data.json",bar:"bar-chart-data.json",pie:"pie-chart-data.json",scatter:"scatter-chart-data.json",radar:"radar-chart-data.json",gauge:"gauge-chart-data.json",candlestick:"candlestick-chart-data.json",funnel:"funnel-chart-data.json",heatmap:"heatmap-chart-data.json"}[t]||"chart-data.json",l.click()},j=(e,t="chart")=>{const n=e.current;if(!n)return;const a=n.getBoundingClientRect(),l=n.width.baseVal.value||a.width,s=n.height.baseVal.value||a.height;let r=(new XMLSerializer).serializeToString(n);r.includes('xmlns="http://www.w3.org/2000/svg"')||(r=r.replace(/^{i.fillStyle="#ffffff",i.fillRect(0,0,o.width,o.height),i.drawImage(c,20,0,l,s);const e=o.toDataURL("image/png"),n=document.createElement("a");n.href=e,n.download={single:"single-chart-data.png",bar:"bar-chart-data.png",pie:"pie-chart-data.png",scatter:"sactter-chart-data.png",radar:"radar-chart-data.png",gauge:"gauge-chart-data.png"}[t]||"chart-data.png",document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(h)},c.src=h},w=({attributes:e})=>{const{columnBarData:t=[],options:n={},styles:a={},themeStyle:l}=e,r=(0,s.useRef)(null),o=(0,s.useRef)(null),i=(0,s.useRef)(null),c=f(),h="mobile"===c,u="tablet"===c,g={top:50,right:h?72:u?58:40,bottom:h?76:70,left:h?110:u?130:150},[x,p]=(0,s.useState)(0);(0,s.useEffect)(()=>{if(!o.current)return;const e=new ResizeObserver(([e])=>{p(e.contentRect.width)});return e.observe(o.current),()=>e.disconnect()},[]);const m=Math.max(...t.map(e=>e.value),0),b=m||1,w=h?360:u?450:560,S=Math.max(x,g.left+g.right+w),C=Math.max(0,S-g.left-g.right),M=g.top+46*t.length+g.bottom,k=g.top+(M-g.top-g.bottom)/2,N=h?4:u?6:10,L=h?10:11,T=h?12:u?15:20,[W,R]=(0,s.useState)(""),[A,z]=(0,s.useState)({visible:!1,x:0,y:0,label:"",value:0,color:"#888"}),P=()=>{z(e=>({...e,visible:!1}))};return(0,d.jsxs)("div",{className:"bpl-vertical-wapper",children:[n?.chartTitleShow&&(0,d.jsxs)("h2",{className:"bpbc-barchat-title",children:[" ",n?.chartTitle]}),n?.groupSubTitleShow&&(0,d.jsx)("h3",{className:"bar-subtitle-h3",children:n?.chartSubTitle}),n?.showLegend&&(0,d.jsx)("div",{className:"column-legend",children:t?.map((e,t)=>(0,d.jsxs)("div",{className:"column-legend-item",children:[(0,d.jsx)("div",{className:"column-legend-color",style:{backgroundColor:e.color}}),(0,d.jsx)("span",{className:"column-legend-text",children:e.label})]},t))}),n?.downloadButton&&(0,d.jsxs)("div",{className:"chart-download-row",children:[(0,d.jsxs)("select",{className:"chart-download-select",value:W,onChange:e=>R(e.target.value),children:[(0,d.jsx)("option",{disabled:!0,value:"",children:"Select Format"}),(0,d.jsx)("option",{value:"csv",children:"CSV"}),(0,d.jsx)("option",{value:"png",children:"PNG"}),(0,d.jsx)("option",{value:"json",children:"JSON"})]}),(0,d.jsx)("button",{className:"chart-download-btn",disabled:!W,onClick:()=>{if(W)switch(W){case"csv":$(t,l,"bar");break;case"json":v(t,"bar");break;case"png":j(r,"bar")}},children:"Download"})]}),(0,d.jsxs)("div",{ref:o,style:{overflowX:"auto",position:"relative",margin:"0 auto"},className:"bpl-chart-Width",children:[(0,d.jsxs)("svg",{ref:r,width:S,height:M,children:[Array.from({length:N+1}).map((e,t)=>{const l=b/N*t,s=g.left+l/b*C;return(0,d.jsxs)("g",{children:[n.showGrid&&(0,d.jsx)("line",{x1:s,y1:g.top,x2:s,y2:M-g.bottom,stroke:a?.gridColor,opacity:"0.4",strokeWidth:"1",strokeDasharray:"4 4",className:"barchartLabel"}),(0,d.jsx)("text",{x:s,y:M-g.bottom+18,textAnchor:"middle",fontSize:L,fill:a?.valueColor,className:"barchartLabel",children:Math.round(l)})]},t)}),(0,d.jsx)("line",{x1:g.left,y1:g.top,x2:g.left,y2:M-g.bottom,stroke:a?.axisLineColor,strokeWidth:"2"}),(0,d.jsx)("line",{x1:g.left,y1:M-g.bottom,x2:g.left+C,y2:M-g.bottom,stroke:a?.axisLineColor,strokeWidth:"2"}),t.map((e,t)=>{const l=0===m?0:Math.max(0,e.value/m*C),s=g.top+46*t,r=String(e?.label??""),c=r.length>T?`${r.slice(0,Math.max(1,T-3))}...`:r,h=Math.min(g.left+l+8,g.left+C-6),u=h>=g.left+C-6?"end":"start";return(0,d.jsxs)("g",{onMouseMove:t=>((e,t)=>{const n=o.current,a=i.current;if(!n)return;const l=n.getBoundingClientRect();let s=e.clientX-l.left+n.scrollLeft+12,r=e.clientY-l.top+n.scrollTop-12,c=!1;if(a){const t=a.offsetWidth,o=a.offsetHeight,i=n.scrollLeft+n.clientWidth-t-8,d=n.scrollLeft+8;s=Math.max(d,Math.min(s,i)),r-o<8&&(r=e.clientY-l.top+n.scrollTop+16,c=!0)}z({visible:!0,x:s,y:r,flipped:c,label:t.label,value:t.value,color:t.color})})(t,e),onMouseLeave:P,children:[(0,d.jsxs)("text",{x:g.left-10,y:s+15,textAnchor:"end",dominantBaseline:"middle",fontSize:"12",fill:a?.valueColor,className:"barchartLabel",children:[(0,d.jsx)("title",{children:r}),c]}),(0,d.jsx)("rect",{x:g.left,y:s,width:l,height:30,fill:e.color,rx:Number(n?.borderRadius)||0}),n.showValues&&(0,d.jsx)("text",{x:h,y:s+15,textAnchor:u,dominantBaseline:"middle",fontSize:"12",fontWeight:"500",className:"barchartLabel",fill:a?.valueColor,children:y(e.value,m,n.valueDisplay)})]},t)}),n.chartLabelShow&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("text",{x:g.left+C/2,y:M-g.top+35,textAnchor:"middle",fill:a.textColor,className:"bpbc-barchat-x-axis-label",children:n.xAxisLabel}),(0,d.jsx)("text",{x:g.left-110,y:k,textAnchor:"middle",dominantBaseline:"middle",transform:`rotate(-90 ${g.left-110} ${k})`,fill:a.textColor,className:"bpbc-barchat-y-axis-label",children:n.yAxisLabel})]})]}),(0,d.jsxs)("div",{ref:i,className:"tools-tip-wapper "+(A.visible?"":"hiding"),style:{left:A.x,top:A.y,transform:A.flipped?"translate(-50%, 0)":"translate(-50%, -100%)"},children:[(0,d.jsx)("div",{className:"tools-top-label",children:A.label}),(0,d.jsxs)("div",{className:"tools-top-value-section",children:[(0,d.jsx)("div",{className:"tools-top-value-checkBox",style:{backgroundColor:A.color}}),(0,d.jsx)("div",{children:y(A?.value,m,n?.valueDisplay)})]})]})]})]})},S=({attributes:e,device:t})=>{const{options:n,categories:a=[],series:l=[],dataPoints:r=[]}=e,o=(0,s.useRef)(null),i=(0,s.useRef)(null),c=(0,s.useRef)(null),h=(0,s.useMemo)(()=>[...a].sort((e,t)=>e.order-t.order),[a]),u=(0,s.useMemo)(()=>[...l].sort((e,t)=>e.order-t.order),[l]),[b,f]=(0,s.useState)(""),y=(e=>{const[t,n]=(0,s.useState)(e||g());return(0,s.useEffect)(()=>{e&&n(e)},[e]),(0,s.useEffect)(()=>{if(e)return;const t=()=>{n(g())};return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[e]),t})(t),$=n?.groupChartHeight?.[y]??n?.groupChartHeight?.desktop??500,[v,j]=(0,s.useState)(800);(0,s.useEffect)(()=>{if(!o.current)return;const e=new ResizeObserver(([e])=>j(Math.floor(e.contentRect.width)));return e.observe(o.current),()=>e.disconnect()},[]);const w=Math.max(20,.08*$),S=v-50-50,C=$-w-Math.max(40,.16*$),M=u.length,k=h.length*(35*M+12),N=k>S,L=N?k:S,T=Math.max(M||0,1),W=r.length>0?Math.max(...r.map(e=>e.value)):100,R=(e=>{const t=Math.floor(Math.log10(e)),n=e/Math.pow(10,t);return n<=1?1*Math.pow(10,t):n<=2?2*Math.pow(10,t):n<=5?5*Math.pow(10,t):10*Math.pow(10,t)})(W/10),A=0===W?R:Math.ceil(W/R)*R,z=e=>C-e/A*C,P=(0,s.useMemo)(()=>{const e=[];for(let t=0;t<=A;t+=R)e.push(t);return e},[A,R]),D=(0,s.useMemo)(()=>{const e={};return r.forEach(t=>e[`${t.category_id}-${t.series_id}`]=t.value),e},[r]),E=(0,s.useMemo)(()=>{const e={};return r.forEach(t=>{e[t.category_id]=(e[t.category_id]||0)+t.value}),e},[r]),F=(e,t)=>{if("percent"===(n?.valueDisplay||"number")){const n=E[t]||0;return 0===n?"0%":`${(e/n*100).toFixed(1)}%`}return e},[V,B]=(0,s.useState)({visible:!1,x:0,y:0}),G=(0,s.useCallback)((e,t)=>{const n=o.current,a=c.current;if(!n)return;const l=n.getBoundingClientRect(),s=e.clientX-l.left+n.scrollLeft,r=e.clientY-l.top+n.scrollTop;let i=s+10,d=r-10;if(a){const e=a.offsetWidth,t=a.offsetHeight,l=n.clientWidth,o=n.clientHeight,c=n.scrollLeft,h=n.scrollTop;i+e>c+l&&(i=s-e-10),ih+o&&(d=r-t-10),dB({visible:!1});return(0,d.jsx)("div",{className:"group-two-wrapper",children:(0,d.jsxs)("div",{className:"chart-container",children:[(0,d.jsxs)("div",{className:"chart-header",children:[n?.groupChartTitleShow&&(0,d.jsx)(d.Fragment,{children:(0,d.jsx)("h2",{className:"chart-h2",children:n?.chartTitle})}),n?.groupSubTitleShow&&(0,d.jsx)("h3",{className:"chart-subtitle-h3",children:n?.chartSubTitle}),n?.groupShowLegend&&(0,d.jsx)(d.Fragment,{children:(0,d.jsx)("div",{className:"legend",children:u.map(e=>(0,d.jsxs)("div",{className:"legend-item",children:[(0,d.jsx)("div",{className:"legend-color",style:{backgroundColor:e.color}}),(0,d.jsx)("span",{className:"legend-series-name",children:e.name})]},e.id))})}),n?.downloadButton&&(0,d.jsxs)("div",{className:"chart-download-row",children:[(0,d.jsxs)("select",{className:"chart-download-select",value:b,onChange:e=>f(e.target.value),children:[(0,d.jsx)("option",{disabled:!0,value:"",children:"Select Format"}),(0,d.jsx)("option",{value:"csv",children:"CSV"}),(0,d.jsx)("option",{value:"png",children:"PNG"}),(0,d.jsx)("option",{value:"json",children:"JSON"})]}),(0,d.jsx)("button",{className:"chart-download-btn",disabled:!b,onClick:()=>{b&&("csv"===b&&x(h,u,r,"group"),"png"===b&&m(i.current,"group"),"json"===b&&p({categories:a,series:l,dataPoints:r},"group"))},children:"Download"})]})]}),(0,d.jsxs)("div",{ref:o,className:"group-svg-wrapper",style:{height:$,overflowX:N?"auto":"hidden",overflowY:"hidden",position:"relative"},children:[(0,d.jsx)("svg",{ref:i,width:L+50+50,height:$,viewBox:`0 0 ${L+50+50} ${$}`,preserveAspectRatio:"xMinYMin meet",children:(0,d.jsxs)("g",{transform:`translate(50,${w})`,children:[(0,d.jsx)("line",{className:"axis-line",x1:"0",y1:C,x2:L,y2:C,stroke:"#e5e7eb",strokeWidth:"2"}),(0,d.jsx)("line",{className:"axis-line",x1:"0",y1:"0",x2:"0",y2:C,stroke:"#e5e7eb",strokeWidth:"2"}),P.map(e=>(0,d.jsxs)("g",{children:[n?.groupGridShow&&0!==e&&(0,d.jsx)("line",{className:"grid-line",x1:"0",x2:L,y1:z(e),y2:z(e),stroke:"#9da6b9",strokeDasharray:"4 4",opacity:"0.4",strokeWidth:"1.5"}),(0,d.jsx)("text",{className:"y-label",x:-6,y:z(e),textAnchor:"end",dominantBaseline:"middle",fontSize:"12",children:e})]},e)),h.map((e,t)=>{const a=N?35*T+12:L/h.length,l=N?35:.7*a/T,s=(a-l*T)/2,r=Math.max(4,Math.min(20,Math.floor(a/7))),o=String(e.name||""),i=o.length>r?`${o.slice(0,Math.max(1,r-3))}...`:o;return(0,d.jsxs)("g",{children:[u.map((r,o)=>{const i=D[`${e.id}-${r.id}`]??0,c=t*a+s+o*l;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("rect",{x:c,y:z(i),width:l,height:C-z(i),fill:r.color,style:{cursor:"pointer"},rx:n?.groupBorderRadius,onMouseMove:t=>G(t,{category:e.name,categoryId:e.id,label:r.name,value:i,color:r.color}),onMouseLeave:O},r.id),n?.groupValue&&(0,d.jsx)("text",{className:"group-value",x:c+l/2,y:z(i)-6,textAnchor:"middle",fontSize:"12",fill:"#111",fontWeight:"500",pointerEvents:"none",children:F(i,e.id)})]})}),(0,d.jsxs)("text",{className:"category-label",x:t*a+a/2,y:C+28,textAnchor:"middle",fontSize:"13",children:[(0,d.jsx)("title",{children:o}),i]})]},e.id)})]})}),V.visible&&(0,d.jsxs)("div",{ref:c,className:"group-tooltip",style:{position:"absolute",left:V.x,top:V.y,pointerEvents:"none",zIndex:999},children:[(0,d.jsxs)("div",{className:"group-tools-wapper",children:[(0,d.jsx)("span",{className:"group-tooltip-checkbox",style:{background:V.color}}),(0,d.jsx)("span",{className:"group-tooltip-title",children:V.category})]}),(0,d.jsxs)("span",{className:"group-labelsValue",children:[V.label,": ",F(V.value,V.categoryId)]})]})]})]})})},C=({attributes:e,device:t})=>{const{columnBarData:n=[],options:a={},styles:l={},themeStyle:r}=e,o=(0,s.useRef)(null),i=(0,s.useRef)(null),c=(0,s.useRef)(null),h=40,u=70,g=70,x=f(),p=t||x,m=((e,t={})=>{const{barChartHeight:n=420}=t,[a,l]=(0,s.useState)({width:0,height:Number(n)||420});return(0,s.useEffect)(()=>{l(e=>({...e,height:Number(n)||420}))},[n]),(0,s.useEffect)(()=>{if(!e?.current)return;const t=new ResizeObserver(([e])=>{const t=Math.round(e.contentRect.width);l(e=>e.width===t?e:{...e,width:t})});return t.observe(e.current),()=>t.disconnect()},[e]),a})(o,{barChartHeight:a?.barChartHeight?.[p]??a?.barChartHeight?.desktop}),[b,w]=(0,s.useState)(0);(0,s.useEffect)(()=>{if(!o.current)return;const e=new ResizeObserver(([e])=>{w(Math.floor(e.contentRect.width))});return e.observe(o.current),()=>e.disconnect()},[]);const S=b-g-30,C=n.length>0?(S-20*(n.length-1))/n.length:60,M=C>60?C:60,k=Math.max(4,Math.min(18,Math.floor((M+20)/7))),N=Math.max(...n?.map(e=>e.value),0),L=Math.max(0,m?.height-h-u),T=n.length*M+20*(n.length-1),W=T+g+30,R=Math.max(W,b),A=b>W?(b-W)/2:0,z=g+T,P=N||10,D=Array.from({length:11},(e,t)=>{const n=P/10*t;return{y:h+(L-n/P*L),value:n}}),[E,F]=(0,s.useState)(""),[V,B]=(0,s.useState)({visible:!1,x:0,y:0,label:"",value:0,color:"#888"}),G=()=>{B(e=>({...e,visible:!1}))};return(0,d.jsxs)("div",{className:"bpl-vertical-wapper",children:[a?.chartTitleShow&&(0,d.jsxs)("h2",{className:"bpbc-barchat-title",children:[" ",a?.chartTitle]}),a?.groupSubTitleShow&&(0,d.jsx)("h3",{className:"bar-subtitle-h3",children:a?.chartSubTitle}),a?.showLegend&&(0,d.jsx)("div",{className:"column-legend",children:n?.map((e,t)=>(0,d.jsxs)("div",{className:"column-legend-item",children:[(0,d.jsx)("div",{className:"column-legend-color",style:{backgroundColor:e.color}}),(0,d.jsx)("span",{className:"column-legend-text",children:e.label})]},t))}),a?.downloadButton&&(0,d.jsxs)("div",{className:"chart-download-row",children:[(0,d.jsxs)("select",{className:"chart-download-select",value:E,onChange:e=>F(e.target.value),children:[(0,d.jsx)("option",{disabled:!0,value:"",children:"Select Format"}),(0,d.jsx)("option",{value:"csv",children:"CSV"}),(0,d.jsx)("option",{value:"png",children:"PNG"}),(0,d.jsx)("option",{value:"json",children:"JSON"})]}),(0,d.jsx)("button",{className:"chart-download-btn",disabled:!E,onClick:()=>{if(E)switch(E){case"csv":$(n,r,"bar");break;case"json":v(n,"bar");break;case"png":j(i,"bar")}},children:"Download"})]}),(0,d.jsxs)("div",{ref:o,className:"bpl-chart-Width",style:{position:"relative",overflowX:"auto",overflowY:"hidden",margin:"0 auto",WebkitOverflowScrolling:"touch"},children:[(0,d.jsx)("svg",{ref:i,width:R,height:m?.height,style:{display:"block",margin:"0 auto"},children:(0,d.jsxs)("g",{transform:`translate(${A}, 0)`,children:[D.map((e,t)=>(0,d.jsxs)("g",{children:[a.showGrid&&0!==e.value&&(0,d.jsx)("line",{x1:g,y1:e.y,x2:z+20,y2:e.y,stroke:l?.gridColor,strokeDasharray:"4 4",opacity:"0.4",strokeWidth:"1",shapeRendering:"crispEdges"}),(0,d.jsx)("text",{x:60,y:e.y+4,textAnchor:"end",fontSize:"11",fill:l?.valueColor,className:"grid-value",children:Math.round(e.value)})]},t)),(0,d.jsx)("line",{x1:g,y1:h,x2:g,y2:m?.height-u+1,stroke:l?.axisLineColor,strokeWidth:"2",opacity:"0.3",shapeRendering:"crispEdges"}),(0,d.jsx)("line",{x1:g,y1:m?.height-u,x2:z+20,y2:m?.height-u,stroke:l?.axisLineColor,strokeWidth:"2",opacity:"0.3",shapeRendering:"crispEdges"}),n.map((e,t)=>{const n=0===N?0:e.value/N*L,s=g+t*(M+20)+10,r=h+(L-n),i=s+M/2,x=String(e?.label??""),p=x.length>k?`${x.slice(0,Math.max(1,k-3))}...`:x;return(0,d.jsxs)("g",{onMouseMove:t=>((e,t)=>{const n=o.current,a=c.current;if(!n)return;const l=n.getBoundingClientRect();let s=e.clientX-l.left+n.scrollLeft+12,r=e.clientY-l.top+n.scrollTop-12,i=!1;if(a){const t=a.offsetWidth,o=a.offsetHeight,c=n.scrollLeft+n.clientWidth-t-8,d=n.scrollLeft+8;s=Math.max(d,Math.min(s,c)),r-o<8&&(r=e.clientY-l.top+n.scrollTop+16,i=!0)}B({visible:!0,x:s,y:r,flipped:i,label:t.label,value:t.value,color:t.color})})(t,e),onMouseLeave:G,children:[(0,d.jsx)("rect",{x:s,y:r,width:M,height:n,fill:e.color||"#4f46e5",rx:Number(a?.borderRadius)||0}),a?.showValues&&(0,d.jsx)("text",{x:i,y:r-8,textAnchor:"middle",fontSize:"12",fill:l?.valueColor,fontWeight:"500",children:y(e?.value,N,a?.valueDisplay)}),(0,d.jsxs)("text",{x:i,y:m?.height-u+25,textAnchor:"middle",fontSize:"12",fill:l?.valueColor,className:"barchartLabel",children:[(0,d.jsx)("title",{children:x}),p]})]},t)}),a?.chartLabelShow&&(0,d.jsx)("text",{x:g+T/2,y:m?.height-u+55,textAnchor:"middle",fill:l?.textColor,className:"bpbc-barchat-x-axis-label",children:a?.xAxisLabel}),a?.chartLabelShow&&(0,d.jsx)("text",{transform:`rotate(-90 30 ${h+L/2})`,x:30,y:h+L/2,textAnchor:"middle",fill:l?.textColor,className:"bpbc-barchat-y-axis-label",children:a?.yAxisLabel})]})}),(0,d.jsxs)("div",{ref:c,className:"tools-tip-wapper "+(V.visible?"":"hiding"),style:{left:V.x,top:V.y,transform:V.flipped?"translate(-50%, 0)":"translate(-50%, -100%)"},children:[(0,d.jsx)("div",{className:"tools-top-label",children:V.label}),(0,d.jsxs)("div",{className:"tools-top-value-section",children:[(0,d.jsx)("div",{className:"tools-top-value-checkBox",style:{backgroundColor:V.color}}),(0,d.jsx)("div",{children:y(V?.value,N,a?.valueDisplay)})]})]})]})]})},M=({attributes:e,device:t})=>{const{options:n}=e;return(0,d.jsxs)(d.Fragment,{children:["column"===n?.chartType&&("horizontal"===n?.orientation?(0,d.jsx)(w,{attributes:e,device:t}):(0,d.jsx)(C,{attributes:e,device:t})),"grouped"===n?.chartType&&(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(S,{attributes:e,device:t})}),"stacked"===n?.chartType&&(0,d.jsx)(b,{attributes:e,device:t})]})},k="#16a34a",N="#dc2626",L=({attributes:e,device:t})=>{const n=(0,s.useRef)(null),a=(0,s.useRef)(null),l=e?.options||{},r=l.candlestickChartType||"candlestick",o=e?.candlestickData||[],i=l?.upColor||k,c=l?.downColor||N,h=l?.currencySymbol||"",u=()=>h?(0,d.jsx)("span",{className:"currency-icon",dangerouslySetInnerHTML:{__html:h}}):null,[g,x]=(0,s.useState)(-1),[p,m]=(0,s.useState)([]),[b,f]=(0,s.useState)({show:!1,x:0,y:0,d:null}),[y,j]=(0,s.useState)(0),[w,S]=(0,s.useState)(""),C=t?t.toLowerCase():"desktop",M="mobile"===C?300:"tablet"===C?400:500,L=l?.candlestickChartHeight?.[C]||M,T=l?.candlestickChartWidth?.[C]||"100%",W="mobile"===C?14:"tablet"===C?18:22,R=p.length>0?Math.max(y||0,p.length*W+80):y||600,A=e=>{if(!e)return new Date(NaN);const t=String(e).trim();if(/^\d{4}[-/]\d{1,2}[-/]\d{1,2}$/.test(t))return new Date(t.replace(/\//g,"-"));const n=t.split(/[/\-.]/);if(3===n.length){let[e,t,a]=n.map(Number);if(a>31)return e>12?new Date(a,t-1,e):new Date(a,e-1,t)}return new Date(t)};(0,s.useEffect)(()=>{if(o&&o.length>0&&o[0].d){const e=o.map(e=>({t:A(e.d),o:parseFloat(e.o),h:parseFloat(e.h),l:parseFloat(e.l),c:parseFloat(e.c)}));m(e)}else m(((e=40)=>{const t=[];let n=150;const a=Date.now();for(let l=0;l((e,t)=>{if("heikinashi"!==t)return e;const n=[];for(let t=0;t{const e=new ResizeObserver(e=>{e[0]&&j(Math.floor(e[0].contentRect.width))});return a.current&&e.observe(a.current),()=>e.disconnect()},[]);const P=e?.styles||{};(0,s.useEffect)(()=>{((e,t,n,a,l={},s={})=>{if(!e||0===t.length)return;const r=e.getContext("2d"),o=window.devicePixelRatio||1,i=e.getBoundingClientRect();e.width=i.width*o,e.height=i.height*o,r.scale(o,o);const c=i.width,d=i.height,h=55,u=c-12,g=16,x=d-36,p=u-h,m=x-g,b=t.length;let f=1/0,y=-1/0;t.forEach(e=>{f=Math.min(f,e.l),y=Math.max(y,e.h)});const $=y-f,v=p/b,j=e=>g+(y-e)/(y-f)*(x-g);r.clearRect(0,0,c,d);const w=s?.gridColor||"rgba(0,0,0,0.15)",S=s?.candlestickLabelColor||"#666";r.lineWidth=1,r.font="12px Manrope, sans-serif",r.textBaseline="middle";for(let e=0;e<=6;e++){const t=g+e*(m/6);!1!==l?.showGrid&&(r.strokeStyle=w,r.beginPath(),r.moveTo(h,t),r.lineTo(u,t),r.stroke()),!1!==l?.chartLabelShow&&(r.fillStyle=S,r.textAlign="right",r.fillText((y-e*($/6)).toFixed(1),45,t))}const C=Math.ceil(b/8);if(r.textBaseline="top",t.forEach((e,t)=>{if(t%C===0){const n=h+t*v+v/2;!1!==l?.showGrid&&(r.strokeStyle=w,r.beginPath(),r.moveTo(n,g),r.lineTo(n,x),r.stroke()),!1!==l?.chartLabelShow&&(r.fillStyle=S,r.textAlign=0===t?"left":"center",r.fillText(e.t.toLocaleDateString("en",{month:"short",day:"numeric"}),n,x+12))}}),a>=0&&(r.fillStyle="rgba(0,0,0,0.03)",r.fillRect(h+a*v,g,v,m)),"line"===n||"area"===n){if("area"===n){const e=h+v/2,n=h+(b-1)*v+v/2;r.beginPath(),r.moveTo(e,x),t.forEach((e,t)=>r.lineTo(h+t*v+v/2,j(e.c))),r.lineTo(n,x),r.closePath(),r.fillStyle="rgba(37,99,235,0.1)",r.fill()}r.beginPath(),r.strokeStyle="#2563eb",r.lineWidth=1.5,t.forEach((e,t)=>{const n=h+t*v+v/2;0===t?r.moveTo(n,j(e.c)):r.lineTo(n,j(e.c))}),r.stroke()}else{const e=l?.upColor||k,a=l?.downColor||N;t.forEach((t,l)=>{const s=h+l*v+v/2,o=t.c>=t.o?e:a,i=j(Math.max(t.o,t.c)),c=j(Math.min(t.o,t.c)),d=Math.max(c-i,1),u=Math.max(.55*v,3);if(r.strokeStyle=o,r.beginPath(),r.moveTo(s,j(t.h)),r.lineTo(s,j(t.l)),r.stroke(),"ohlc"===n){const e=Math.max(.25*v,2);r.beginPath(),r.moveTo(s-e,j(t.o)),r.lineTo(s,j(t.o)),r.stroke(),r.beginPath(),r.moveTo(s,j(t.c)),r.lineTo(s+e,j(t.c)),r.stroke()}else if("hlc"===n){const e=Math.max(.25*v,2);r.beginPath(),r.moveTo(s,j(t.c)),r.lineTo(s+e,j(t.c)),r.stroke()}else"hollow"===n&&t.c>=t.o?r.strokeRect(s-u/2,i,u,d):(r.fillStyle=o,r.fillRect(s-u/2,i,u,d))})}})(n.current,z,r,g,l,P)},[z,g,r,T,L,y,l,P,C]);const D=z[z.length-1]||{},E=z[z.length-2]||{},F=D.c?((D.c-E.c)/E.c*100).toFixed(2):0;return(0,d.jsxs)("div",{className:"chart-candlestick-wrap",ref:a,children:[(0,d.jsxs)("div",{className:"chart-header",children:[!1!==l?.groupChartTitleShow&&(0,d.jsx)("h2",{className:"chart-h2",children:l?.chartTitle||"Product Sales Comparison"}),!1!==l?.groupSubTitleShow&&(0,d.jsx)("h3",{className:"chart-subtitle-h3",children:l?.chartSubTitle||"Comparison of Electronics, Clothing, and Home products"}),l?.downloadButton&&(0,d.jsxs)("div",{className:"chart-download-row row",children:[(0,d.jsxs)("select",{className:"chart-download-select",value:w,onChange:e=>S(e.target.value),children:[(0,d.jsx)("option",{disabled:!0,value:"",children:"Select Format"}),(0,d.jsx)("option",{value:"csv",children:"CSV"}),(0,d.jsx)("option",{value:"png",children:"PNG"}),(0,d.jsx)("option",{value:"json",children:"JSON"})]}),(0,d.jsx)("button",{className:"chart-download-btn",disabled:!w,onClick:()=>{if(w)switch(w){case"csv":$(o,"themeNine","candlestick");break;case"json":v(o,"candlestick");break;case"png":{const e=n.current;if(!e)return;const t=e.toDataURL("image/png"),a=document.createElement("a");a.href=t,a.download="candlestick-chart-data.png",a.click();break}}},children:"Download"})]})]}),(0,d.jsx)("div",{className:"chart-area",style:{height:`${L}px`,width:T},children:(0,d.jsxs)("div",{className:"canvas-wapper",style:{width:`${R}px`},children:[(0,d.jsx)("canvas",{ref:n,className:"canvas-svg",onMouseMove:e=>{const t=n.current.getBoundingClientRect(),a=e.clientX-t.left,l=(t.width-55-12)/z.length,s=Math.floor((a-55)/l);if(s>=0&&st.height?l-r-10:l+15;f({show:!0,x:a>t.width-160?a-150:a+15,y:o<0?5:o,d:n})}else x(-1),f({...b,show:!1})},onMouseLeave:()=>{x(-1),f({...b,show:!1})}}),b.show&&(0,d.jsxs)("div",{className:"tooltip",style:{left:b.x,top:b.y,display:"block"},children:[(0,d.jsx)("div",{className:"tt-date",children:b.d.t.toLocaleDateString()}),(0,d.jsxs)("div",{className:"tt-row",children:[(0,d.jsx)("span",{className:"tt-label",children:"Open"}),(0,d.jsxs)("span",{className:"tt-val",children:[(0,d.jsx)(u,{}),b.d.o]})]}),(0,d.jsxs)("div",{className:"tt-row",children:[(0,d.jsx)("span",{className:"tt-label",children:"High"}),(0,d.jsxs)("span",{className:"tt-val",style:{color:i},children:[(0,d.jsx)(u,{}),b.d.h]})]}),(0,d.jsxs)("div",{className:"tt-row",children:[(0,d.jsx)("span",{className:"tt-label",children:"Low"}),(0,d.jsxs)("span",{className:"tt-val",style:{color:c},children:[(0,d.jsx)(u,{}),b.d.l]})]}),(0,d.jsxs)("div",{className:"tt-row",children:[(0,d.jsx)("span",{className:"tt-label",children:"Close"}),(0,d.jsxs)("span",{className:"tt-val",children:[(0,d.jsx)(u,{}),b.d.c]})]})]})]})}),!1!==l?.showStats&&(0,d.jsxs)("div",{className:"stats",children:[(0,d.jsxs)("div",{className:"stat",children:[(0,d.jsx)("div",{className:"stat-label",children:"Open"}),(0,d.jsxs)("div",{className:"stat-val",children:[(0,d.jsx)(u,{}),D.o]})]}),(0,d.jsxs)("div",{className:"stat",children:[(0,d.jsx)("div",{className:"stat-label",children:"High"}),(0,d.jsxs)("div",{className:"stat-val",style:{color:i},children:[(0,d.jsx)(u,{}),D.h]})]}),(0,d.jsxs)("div",{className:"stat",children:[(0,d.jsx)("div",{className:"stat-label",children:"Low"}),(0,d.jsxs)("div",{className:"stat-val",style:{color:c},children:[(0,d.jsx)(u,{}),D.l]})]}),(0,d.jsxs)("div",{className:"stat",children:[(0,d.jsx)("div",{className:"stat-label",children:"Close / Change"}),(0,d.jsxs)("div",{className:"stat-val",style:{color:D.c>=D.o?i:c},children:[(0,d.jsx)(u,{}),D.c," ",(0,d.jsxs)("span",{className:"closeChangeValue",children:["(",F,"%)"]})]})]})]})]})},T=(e,t)=>{if(!e)return[""];const n=e.split(" "),a=[];let l="";return n.forEach(e=>{const n=l?`${l} ${e}`:e;n.length<=t||!l?l=n:(a.push(l),l=e)}),l&&a.push(l),a.length?a:[e]},W=(e,t,n)=>"mobile"===e?{height:420,horizontalHeight:Math.max(360,170+22*t.length),padding:{top:24,right:16,bottom:24,left:16},outsidePadding:{top:24,right:110,bottom:24,left:16},outsideDropPadding:{top:24,right:110,bottom:24,left:72},horizontalOutsidePadding:{top:24,right:16,bottom:96,left:16},stageGap:n,labelSize:11,valueSize:14,percentageSize:10,showDropRates:!0,labelLineHeight:14,valueLineHeight:13}:"tablet"===e?{height:500,horizontalHeight:Math.max(400,185+20*t.length),padding:{top:28,right:24,bottom:28,left:24},outsidePadding:{top:28,right:150,bottom:28,left:24},outsideDropPadding:{top:28,right:150,bottom:28,left:72},horizontalOutsidePadding:{top:28,right:24,bottom:108,left:24},stageGap:n,labelSize:12,valueSize:16,percentageSize:11,showDropRates:!0,labelLineHeight:15,valueLineHeight:14}:{height:900,horizontalHeight:Math.max(620,100+10*t.length),padding:{top:40,right:96,bottom:40,left:96},outsidePadding:{top:40,right:200,bottom:40,left:96},outsideDropPadding:{top:40,right:200,bottom:40,left:160},horizontalOutsidePadding:{top:40,right:96,bottom:96,left:96},stageGap:n,labelSize:14,valueSize:18,percentageSize:12,showDropRates:!0,labelLineHeight:18,valueLineHeight:16},R=(e,t)=>0===e?100:t[e].value/t[0].value*100,A=(e,t)=>0===e?0:(t[e-1].value-t[e].value)/t[e-1].value*100,z=({stage:e,value:t,conversionRate:n,x:a,y:l,maxChars:s=18,reservedStageLines:o,labelLineHeight:i,valueLineHeight:c,anchor:h="middle",options:u})=>{if(!1===u?.funnelShowLabels)return null;const g=T(e,s),x=`${t.toLocaleString()}${u?.funnelShowPercentages?` (${n.toFixed(1)}%)`:""}`,p=T(x,Math.max(s,10)),m=l+(o||g.length)*i+8;return(0,d.jsxs)(r().Fragment,{children:[(0,d.jsx)("text",{x:a,y:l,textAnchor:h,fill:"#111827",className:"funnel-label",children:g.map((t,n)=>(0,d.jsx)("tspan",{x:a,dy:0===n?0:i,children:t},`${e}-${n}`))}),(0,d.jsx)("text",{x:a,y:m,textAnchor:h,fill:"#374151",className:"funnel-value",children:p.map((e,t)=>(0,d.jsx)("tspan",{x:a,dy:0===t?0:c,children:e},`${x}-${t}`))})]})},P=({columnBarData:e,metrics:t,innerHeight:n,innerWidth:a,maxValue:l,neckWidth:s,animate:o,options:i,currentDevice:c,valueColor:h})=>{const[u,g]=r().useState({show:!1,data:null}),x=r().useRef(null),p=r().useRef({x:0,y:0}),m=(e.length-1)*t.stageGap,b=(n-m)/e.length;let f=0;return(0,d.jsxs)(d.Fragment,{children:[e.map((r,h)=>{const u=h===e.length-1,m=r.value/l*a,y=u?s/100*a:(e[h+1]?.value||r.value)/l*a,$=b,v=(a-m)/2,j=(a-y)/2,w="mobile"===c,S=w?-10:0,C=f+$/2,M=R(h,e),k=A(h,e),N=`${v+S},${f} ${v+m+S},${f} ${j+y+S},${f+$} ${j+S},${f+$}`,L=v+m+S,T=Math.min(L+10,a-60),W=w?T:a+12,P=C-6,D=(0,d.jsxs)("g",{style:{opacity:o?1:0,transform:o?"translateY(0px)":"translateY(-20px)",transition:`all 0.4s ease ${.1*h}s`},children:[(0,d.jsx)("polygon",{points:N,fill:r.color,stroke:"white",strokeWidth:"2",style:{transition:"all 0.3s ease",cursor:"pointer",opacity:.9},onMouseEnter:e=>{e.target.style.opacity=1,g({show:!0,data:{index:h,stage:r,conversionRate:M,dropRate:k}})},onMouseMove:e=>{const t=e.target.parentElement.parentElement;if(!t)return;const l=t.getScreenCTM();if(!l)return;const s=e.target.ownerSVGElement;if(!s)return;const r=s.createSVGPoint();r.x=e.clientX,r.y=e.clientY;const o=r.matrixTransform(l.inverse());if(p.current={x:o.x,y:o.y},x.current){const e=140,t=h>0&&i?.funnelShowPercentages?66:50;let l=o.x+20;l+e>a&&(l=o.x-e-20),l<0&&(l=4);let s=o.y-t-20;s<0&&(s=o.y+24),s+t>n&&(s=n-t-4),x.current.style.transform=`translate(${l}px, ${s}px)`}},onMouseLeave:e=>{e.target.style.opacity=.9,g({show:!1,data:null})}}),!w&&z({stage:r.label,value:r.value,conversionRate:M,x:W,y:P,maxChars:w?14:18,anchor:"start",labelSize:t.labelSize,valueSize:t.percentageSize,labelLineHeight:t.labelLineHeight,valueLineHeight:t.valueLineHeight,options:i}),i?.funnelShowPercentages&&h>0&&t.showDropRates&&"mobile"!==c&&(0,d.jsx)("text",{x:-8,y:f-6,textAnchor:"end",className:"funnel-drop-rate",children:`${i?.funnelDownText} ${k.toFixed(1)}%`})]},h);return f+=$+t.stageGap,D}),u.data&&(()=>{const e=u.data.index>0&&i?.funnelShowPercentages,t=e?66:50,l=p.current.x,s=p.current.y;let r=l+20;r+140>a&&(r=l-140-20),r<0&&(r=4);let o=s-t-20;return o<0&&(o=s+24),o+t>n&&(o=n-t-4),(0,d.jsxs)("g",{ref:x,style:{pointerEvents:"none",opacity:u.show?1:0,transform:`translate(${r}px, ${o}px)`,transition:"opacity 0.18s ease-out, transform 0.1s ease-out"},children:[(0,d.jsx)("rect",{width:140,height:t,rx:6,ry:6,fill:"rgba(17,24,39,0.92)"}),(0,d.jsx)("text",{x:70,y:20,textAnchor:"middle",fill:"#f9fafb",style:{fontSize:"12px",fontWeight:700},children:u.data.stage.label}),(0,d.jsxs)("text",{x:70,y:38,textAnchor:"middle",fill:"#d1d5db",style:{fontSize:"11px",fontWeight:500},children:[u.data.stage.value.toLocaleString(),i?.funnelShowPercentages?` (${u.data.conversionRate.toFixed(1)}%)`:""]}),e&&(0,d.jsx)("text",{x:70,y:54,textAnchor:"middle",fill:h,style:{fontSize:"10px",fontWeight:600},children:`${i?.funnelDownText} ${u.data.dropRate.toFixed(1)}%`})]})})()]})},D=({columnBarData:e,metrics:t,innerHeight:n,innerWidth:a,maxValue:l,neckWidth:s,size:o,animate:i,options:c,currentDevice:h,valueColor:u})=>{const g=(e.length-1)*t.stageGap,x=(a-g)/e.length,p="mobile"===h,m="mobile"===h&&o.width<=360,b=m?Math.max(9,t.labelSize-2):p?Math.max(10,t.labelSize-1):t.labelSize,f=m?Math.max(8,t.percentageSize-2):p?Math.max(9,t.percentageSize-1):t.percentageSize,y=m?Math.max(11,t.labelLineHeight-2):p?Math.max(12,t.labelLineHeight-1):t.labelLineHeight,$=m?Math.max(10,t.valueLineHeight-2):p?Math.max(11,t.valueLineHeight-1):t.valueLineHeight,v=e.map((t,n)=>{const a=Math.max(x-8,36),l=Math.max(m?4:p?5:6,Math.floor(a/(m?5:p?5.5:7))),s=R(n,e),r=T(t.label,l).length,o=`${t.value.toLocaleString()}${c?.funnelShowPercentages?` (${s.toFixed(1)}%)`:""}`;return{maxChars:l,stageLineCount:r,valueLineCount:T(o,Math.max(l,10)).length}}),j=Math.max(...v.map(e=>e.stageLineCount),1),w=Math.max(...v.map(e=>e.valueLineCount),1),[S,C]=r().useState({show:!1,data:null}),M=r().useRef(null),k=r().useRef({x:0,y:0});let N=0;return(0,d.jsxs)(d.Fragment,{children:[e.map((r,o)=>{const h=o===e.length-1,u=r.value/l*n,g=h?s/100*n:(e[o+1]?.value||r.value)/l*n,p=x,m=(n-u)/2,S=(n-g)/2,L=N+p/2,T=R(o,e),{maxChars:W}=v[o],P=`${N},${m} ${N+p},${S} ${N+p},${S+g} ${N},${m+u}`,D=n+18,E=D+j*y+12+w*$+14,F=A(o,e),V=(0,d.jsxs)("g",{style:{opacity:i?1:0,transform:i?"translateX(0px)":"translateX(-20px)",transition:`all 0.4s ease ${.1*o}s`},children:[(0,d.jsx)("polygon",{points:P,fill:r.color,stroke:"white",strokeWidth:"2",style:{transition:"all 0.3s ease",cursor:"pointer",opacity:.9},onMouseEnter:e=>{e.target.style.opacity=1,C({show:!0,data:{index:o,stage:r,conversionRate:T,dropRate:F}})},onMouseMove:e=>{const t=e.target.parentElement.parentElement;if(!t)return;const l=t.getScreenCTM();if(!l)return;const s=e.target.ownerSVGElement;if(!s)return;const r=s.createSVGPoint();r.x=e.clientX,r.y=e.clientY;const i=r.matrixTransform(l.inverse());if(k.current={x:i.x,y:i.y},M.current){const e=140,t=o>0&&c?.funnelShowPercentages?66:50;let l=i.x+20;l+e>a&&(l=i.x-e-20),l<0&&(l=4);let s=i.y-t-20;s<0&&(s=i.y+24),s+t>n&&(s=n-t-4),M.current.style.transform=`translate(${l}px, ${s}px)`}},onMouseLeave:e=>{e.target.style.opacity=.9,C({show:!1,data:null})}}),z({stage:r.label,value:r.value,conversionRate:T,x:L,y:D,maxChars:W,reservedStageLines:j,labelSize:b,valueSize:f,labelLineHeight:y,valueLineHeight:$,anchor:"middle",options:c}),c?.funnelShowPercentages&&o>0&&t.showDropRates&&(0,d.jsx)("text",{x:L,y:E,textAnchor:"middle",className:"funnel-drop-rate",children:`${c?.funnelDownText} ${F.toFixed(1)}%`})]},o);return N+=p+t.stageGap,V}),S.data&&(()=>{const e=S.data.index>0&&c?.funnelShowPercentages,t=e?66:50,l=k.current.x,s=k.current.y;let r=l+20;r+140>a&&(r=l-140-20),r<0&&(r=4);let o=s-t-20;return o<0&&(o=s+24),o+t>n&&(o=n-t-4),(0,d.jsxs)("g",{ref:M,style:{pointerEvents:"none",opacity:S.show?1:0,transform:`translate(${r}px, ${o}px)`,transition:"opacity 0.18s ease-out, transform 0.1s ease-out"},children:[(0,d.jsx)("rect",{width:140,height:t,rx:6,ry:6,fill:"rgba(17,24,39,0.92)"}),(0,d.jsx)("text",{x:70,y:20,textAnchor:"middle",fill:"#f9fafb",style:{fontSize:"12px",fontWeight:700},children:S.data.stage.label}),(0,d.jsxs)("text",{x:70,y:38,textAnchor:"middle",fill:"#d1d5db",style:{fontSize:"11px",fontWeight:500},children:[S.data.stage.value.toLocaleString(),c?.funnelShowPercentages?` (${S.data.conversionRate.toFixed(1)}%)`:""]}),e&&(0,d.jsx)("text",{x:70,y:54,textAnchor:"middle",fill:u,style:{fontSize:"10px",fontWeight:600},children:`${c?.funnelDownText} ${S.data.dropRate.toFixed(1)}%`})]})})()]})},E=({attributes:e={},device:t})=>{const{columnBarData:n,options:a,styles:l}=e,{valueColor:r}=l,o=t?t.toLowerCase():u(),i=a?.multChartHeight?.[o],c=a?.multiChartWidth?.[o]||100,h=(0,s.useRef)(null),g=(0,s.useRef)(null),[x,p]=(0,s.useState)({width:0,height:600}),[b,f]=(0,s.useState)(!1),y="vertical"===a?.funnelOrientation?.toLowerCase()?"vertical":"horizontal",$=Number(a?.neckWidth??5),v=Number(a?.funnelGap??1);(0,s.useEffect)(()=>{const e=new ResizeObserver(e=>{if(!e[0])return;const t=Math.max(Math.floor(e[0].contentRect.width),1),a=W(o,n,v);p({width:t,height:"vertical"===y?a.height:a.horizontalHeight})});return h.current&&e.observe(h.current),()=>e.disconnect()},[y,v,n,o]),(0,s.useEffect)(()=>{const e=setTimeout(()=>f(!0),100);return()=>clearTimeout(e)},[]);const j=(0,s.useMemo)(()=>W(o,n,v),[o,v,n]),w=(0,s.useMemo)(()=>"horizontal"===y?((e,t)=>{const n=Math.max(...t?.map(e=>e?.label.length),0),a=Math.max(120,7*n);return e<=360?Math.max(e,t.length*a):e<=480?Math.max(e,t.length*(a+8)):e<=768?Math.max(e,t.length*(a+20)):Math.max(e,t.length*(a+36))})(x.width||500,n):x.width||500,[y,x.width,n]);if(!n||0===n.length)return null;const S=Math.max(...n.map(e=>e.value)),C=(0,s.useMemo)(()=>{let e="vertical"===y&&"mobile"===o?{...j.padding,left:8,right:8}:"horizontal"===y?j.horizontalOutsidePadding:"vertical"===y&&j.showDropRates?j.outsideDropPadding:"vertical"===y?j.outsidePadding:j.padding;const t=e.left+e.right,n=.65*w,a=t>n?n/t:1;return{width:w,height:i?Number(i):x.height,padding:{...e,left:e.left*a,right:e.right*a}}},[j.outsideDropPadding,j.outsidePadding,j.horizontalOutsidePadding,j.padding,j.showDropRates,w,x.height,x.width,y,i]),M=Math.max(C.width-C.padding.left-C.padding.right,20),k=Math.max(C.height-C.padding.top-C.padding.bottom,20),[N,L]=(0,s.useState)("");return(0,d.jsxs)("div",{ref:h,className:"bcFunnelChartWapper",style:{width:`${c}%`,minWidth:0,padding:"mobile"===o?"12px":"tablet"===o?"16px":"24px",overflowX:"horizontal"===y?"auto":"visible",overflowY:"visible",margin:"0 auto"},children:[(0,d.jsxs)("div",{className:"chart-header",children:[a?.groupChartTitleShow&&(0,d.jsx)(d.Fragment,{children:(0,d.jsx)("h2",{className:"chart-h2",children:a?.chartTitle})}),a?.groupSubTitleShow&&(0,d.jsx)("h3",{className:"chart-subtitle-h3",children:a?.chartSubTitle}),a?.downloadButton&&(0,d.jsxs)("div",{className:"chart-download-row",children:[(0,d.jsxs)("select",{className:"chart-download-select",value:N,onChange:e=>L(e.target.value),children:[(0,d.jsx)("option",{disabled:!0,value:"",children:"Select Format"}),(0,d.jsx)("option",{value:"csv",children:"CSV"}),(0,d.jsx)("option",{value:"png",children:"PNG"}),(0,d.jsx)("option",{value:"json",children:"JSON"})]}),(0,d.jsx)("button",{className:"chart-download-btn",disabled:!N,onClick:()=>{if(N){if("csv"===N){const e=["Label","Value","Color"],t=n.map(e=>[`"${(e.label||"").replace(/"/g,'""')}"`,e.value,e.color]),a=[e.join(","),...t.map(e=>e.join(","))].join("\n"),l=new Blob([a],{type:"text/csv;charset=utf-8;"}),s=document.createElement("a");s.href=URL.createObjectURL(l),s.setAttribute("download","funnel-chart.csv"),document.body.appendChild(s),s.click(),document.body.removeChild(s)}if("png"===N&&m(g.current,"funnel"),"json"===N){const e=new Blob([JSON.stringify({funnelData:n},null,2)],{type:"application/json"}),t=document.createElement("a");t.href=URL.createObjectURL(e),t.download="funnel-chart.json",t.click()}}},children:"Download"})]})]}),(0,d.jsx)("svg",{ref:g,width:C.width,height:C.height,viewBox:`0 0 ${C.width} ${C.height}`,preserveAspectRatio:"xMinYMid meet",className:"funnel-chart-svg",children:(0,d.jsx)("g",{transform:`translate(${C.padding.left}, ${C.padding.top})`,children:"horizontal"===y?(0,d.jsx)(D,{columnBarData:n,metrics:j,innerHeight:k,innerWidth:M,maxValue:S,neckWidth:$,size:x,animate:b,options:a,currentDevice:o,valueColor:r}):(0,d.jsx)(P,{columnBarData:n,metrics:j,innerHeight:k,innerWidth:M,maxValue:S,neckWidth:$,size:x,animate:b,options:a,currentDevice:o,valueColor:r})})})]})};function F({attributes:e,device:t}){const{gaugeChartOptions:n,gaugeChartData:a,themeStyle:l,options:r}=e;if(!n)return null;const o=n,i=o?.actualValue,c=(0,s.useRef)(null),h={...o,thresholds:Array.isArray(a)?a:[]},g=Number.isFinite(h.minValue)?h.minValue:0,x=Number.isFinite(h.maxValue)?h.maxValue:100,p=Number.isFinite(i)?i:g,[m,b]=(0,s.useState)(g),f=(0,s.useRef)(null),[y,w]=(0,s.useState)(0);(0,s.useEffect)(()=>{if(h.animation){const e=60,t=(p-m)/e;let n=0;const a=setInterval(()=>{n++,n>=e?(b(p),clearInterval(a)):b(e=>e+t)},1e3/e);return()=>clearInterval(a)}b(p)},[p,h.animation]);const S=t?t.toLowerCase():u(),C=h.chartSize||h.gaugeChartSize,M=Number.isFinite(C)?C:Number(C?.[S]??C?.desktop),k=Number.isFinite(M)?M:400,N=y>0?Math.min(k,y):k,L={width:N,height:"semicircular"===h.gaugeType?N/2+70:N,centerX:N/2,centerY:N/2,radius:.4*N};(0,s.useEffect)(()=>{const e=f.current;if(!e)return;const t=()=>{const t=e.clientWidth||0;w(t)};if(t(),"undefined"!=typeof ResizeObserver){const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()}return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const{startAngle:T,displayAngle:W}=(()=>{switch(h.gaugeType){case"full":default:return{startAngle:0,endAngle:360,displayAngle:360};case"half":return{startAngle:180,endAngle:360,displayAngle:180};case"semicircular":return{startAngle:270,endAngle:450,displayAngle:180};case"quarter":return{startAngle:225,endAngle:315,displayAngle:90}}})(),R=e=>{const t=(e=>Math.max(g,Math.min(x,e)))(e),n=x-g;return T+(t-g)/(0===n?1:n)*W},A=e=>(e-90)*Math.PI/180,z=L.radius-20,P=L.radius-20,D=h?.currencySymbol||"",E="string"==typeof D&&D.toLowerCase().includes("D&&E?(0,d.jsx)("span",{className:"currency-icon",dangerouslySetInnerHTML:{__html:D}}):null,V=(e,t=!0)=>{const n=(Number.isFinite(e)?e:0).toFixed(0);return"percentage"===h.valueFormat?`${n}%`:"currency"===h.valueFormat&&t?E?n:`${D||"$"}${n}`:n},B=(e,t,n)=>{const a=A(e),l=A(t),s=L.radius,r=L.radius-62,o=L.centerX+s*Math.cos(a),i=L.centerY+s*Math.sin(a),c=L.centerX+s*Math.cos(l),h=L.centerY+s*Math.sin(l),u=L.centerX+r*Math.cos(l),g=L.centerY+r*Math.sin(l),x=L.centerX+r*Math.cos(a),p=L.centerY+r*Math.sin(a),m=t-e>180?1:0;return(0,d.jsx)("path",{d:`M ${o} ${i}\n A ${s} ${s} 0 ${m} 1 ${c} ${h}\n L ${u} ${g}\n A ${r} ${r} 0 ${m} 0 ${x} ${p}\n Z`,fill:n})},[G,O]=(0,s.useState)("");return(0,d.jsxs)("div",{ref:f,className:"bcGaugeChartWapper",style:{maxWidth:k},children:[r?.groupChartTitleShow&&(0,d.jsxs)("h2",{className:"bpbcGaugeChatTitle",children:[" ",r?.chartTitle]}),r?.groupSubTitleShow&&(0,d.jsx)("h3",{className:"bpbcGaugeChatSubtitleH3",children:r?.chartSubTitle}),r?.downloadButton&&(0,d.jsxs)("div",{className:"chart-download-row",children:[(0,d.jsxs)("select",{className:"chart-download-select",value:G,onChange:e=>O(e.target.value),children:[(0,d.jsx)("option",{disabled:!0,value:"",children:"Select Format"}),(0,d.jsx)("option",{value:"csv",children:"CSV"}),(0,d.jsx)("option",{value:"png",children:"PNG"}),(0,d.jsx)("option",{value:"json",children:"JSON"})]}),(0,d.jsx)("button",{className:"chart-download-btn",disabled:!G,onClick:()=>{if(G)switch(G){case"csv":$(a,l,"gauge");break;case"json":v(a,"gauge");break;case"png":j(c,"gauge")}},children:"Download"})]}),(0,d.jsxs)("svg",{ref:c,width:L.width,height:L.height,viewBox:`0 0 ${L.width} ${L.height}`,preserveAspectRatio:"xMidYMid meet",className:"bcGaugeChartSvg",children:[(0,d.jsx)("g",{children:h?.thresholds?.map((e,t)=>{const n=R(e.min),a=R(e.max);return(0,d.jsx)("g",{children:B(n,a,e.color)},t)})}),(()=>{const{x:e,y:t,angle:n}=(()=>{const e=R(m),t=A(e),n=L.radius-20;return{x:L.centerX+n*Math.cos(t),y:L.centerY+n*Math.sin(t),angle:t}})();switch(h.needleStyle){case"arrow":return(0,d.jsxs)("g",{transform:`rotate(${180*n/Math.PI}, ${L.centerX}, ${L.centerY})`,children:[(0,d.jsx)("path",{d:`M ${L.centerX} ${L.centerY-8}\n L ${L.centerX+z} ${L.centerY}\n L ${L.centerX} ${L.centerY+8}\n Z`,fill:"#1f2937"}),(0,d.jsx)("circle",{cx:L.centerX,cy:L.centerY,r:12,fill:"#1f2937"}),(0,d.jsx)("circle",{cx:L.centerX,cy:L.centerY,r:8,fill:"white"})]});case"line":return(0,d.jsxs)("g",{children:[(0,d.jsx)("line",{x1:L.centerX,y1:L.centerY,x2:e,y2:t,stroke:"#1f2937",strokeWidth:"4",strokeLinecap:"round"}),(0,d.jsx)("circle",{cx:L.centerX,cy:L.centerY,r:10,fill:"#1f2937"}),(0,d.jsx)("circle",{cx:L.centerX,cy:L.centerY,r:6,fill:"white"})]});case"triangle":return(0,d.jsxs)("g",{transform:`rotate(${180*n/Math.PI}, ${L.centerX}, ${L.centerY})`,children:[(0,d.jsx)("path",{d:`M ${L.centerX} ${L.centerY-10}\n L ${L.centerX+P} ${L.centerY}\n L ${L.centerX} ${L.centerY+10}\n L ${L.centerX+10} ${L.centerY}\n Z`,fill:"#1f2937"}),(0,d.jsx)("circle",{cx:L.centerX,cy:L.centerY,r:10,fill:"#1f2937"}),(0,d.jsx)("circle",{cx:L.centerX,cy:L.centerY,r:6,fill:"white"})]});default:return null}})(),"inside"===h.showValue&&(0,d.jsx)("g",{children:E&&"currency"===h.valueFormat?(0,d.jsx)("foreignObject",{x:L.centerX-100,y:L.centerY+25,width:"200",height:"60",children:(0,d.jsxs)("div",{className:"bcActualValue",style:{height:"100%"},children:[(0,d.jsx)(F,{}),(0,d.jsx)("span",{style:{marginLeft:"4px"},children:V(m)})]})}):(0,d.jsx)("text",{x:L.centerX,y:L.centerY+60,textAnchor:"middle",className:"bcActualValue",children:V(m)})}),"semicircular"===h.gaugeType?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("text",{x:L.centerX-L.radius+20,y:L.centerY+25,textAnchor:"start",className:"bcGaugeChartlegendText",children:V(g)}),(0,d.jsx)("text",{x:L.centerX+L.radius-10,y:L.centerY+25,textAnchor:"end",className:"bcGaugeChartlegendText",children:V(x)})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("text",{x:L.centerX-L.radius+10,y:L.centerY+("full"===h.gaugeType?0:L.radius+30),textAnchor:"start",className:"bcGaugeChartlegendText",children:V(g)}),(0,d.jsx)("text",{x:L.centerX+L.radius-10,y:L.centerY+("full"===h.gaugeType?0:L.radius+30),textAnchor:"end",className:"bcGaugeChartlegendText",children:V(x)})]})]}),"below"===h.showValue&&(0,d.jsx)("div",{className:"bcGaugeChartAnimated",children:(0,d.jsxs)("div",{className:" bcGaugeChartlegendAnimated",children:["currency"===h.valueFormat&&(0,d.jsx)(F,{}),V(m)]})}),h.thresholds.length>0&&(0,d.jsx)("div",{className:"bcGaugeChartlegend",children:h.thresholds.map((e,t)=>(0,d.jsxs)("div",{className:"bcGaugeChartlegendWapper",children:[(0,d.jsx)("div",{className:"bcGaugeChartlegendthreshold",style:{backgroundColor:e.color}}),(0,d.jsx)("span",{className:"bcGaugeChartlegendLabel",children:e.label})]},t))})]})}const V=e=>{if(!e)return{r:0,g:0,b:0};const t=e.toString().trim().toLowerCase();if(t.startsWith("rgb")){const e=t.match(/(\d+\.?\d*)/g);if(e&&e.length>=3)return{r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2])}}const n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);if(n)return{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16)};const a=/^#?([a-f\d])([a-f\d])([a-f\d])$/i.exec(t);return a?{r:parseInt(a[1]+a[1],16),g:parseInt(a[2]+a[2],16),b:parseInt(a[3]+a[3],16)}:{r:0,g:0,b:0}},B=({attributes:e={},device:t})=>{const{columnBarData:n=[],options:a={},styles:l={}}=e,r=t?t.toLowerCase():u(),o=(0,s.useRef)(null),i=(0,s.useRef)(null),c=(0,s.useRef)(null),[h,g]=(0,s.useState)(0),[x,p]=(0,s.useState)(null),[b,f]=(0,s.useState)(!1),[y,$]=(0,s.useState)(""),v=(0,s.useMemo)(()=>(e=>{const t=(e?.colorScale||"sequential").toLowerCase();return"sequential"===t?["#dbeafe","#93c5fd","#1d4ed8"]:"diverging"===t?["#3b82f6","#D4D4D4","#ef4444"]:"custom"===t?e?.heatmapColors&&e.heatmapColors.length>=3?e.heatmapColors:["#3b82f6","#8EF527","#7043f0"]:["#dbeafe","#93c5fd","#3b82f6","#1d4ed8","#1e3a5f"]})(a),[a?.heatmapColors,a?.colorScale]),j=(0,s.useMemo)(()=>`heatmapGradient-${Math.random().toString(36).substr(2,9)}`,[v]),w="mobile"===r?40:"tablet"===r?50:60,{minValue:S,maxValue:C}=(0,s.useMemo)(()=>{if(!n||0===n.length)return{minValue:0,maxValue:100};const e=n.map(e=>e.value);return{minValue:Math.min(...e),maxValue:Math.max(...e)}},[n]),M=(0,s.useMemo)(()=>{const e={};return(n||[]).map(t=>{const n=`${t.label}__${t.group}`;return e[n]?(e[n]++,{...t,label:`${t.label} (${e[n]})`}):(e[n]=1,t)})},[n]),{xCategories:k,yCategories:N}=(0,s.useMemo)(()=>(e=>{const t=new Set,n=new Set;return(e||[]).forEach(e=>{void 0!==e.label&&t.add(e.label),void 0!==e.group&&n.add(e.group)}),{xCategories:[...t],yCategories:[...n]}})(M),[M]);(0,s.useEffect)(()=>{const e=new ResizeObserver(e=>{e[0]&&g(Math.floor(e[0].contentRect.width))});return o.current&&e.observe(o.current),()=>e.disconnect()},[]),(0,s.useEffect)(()=>{const e=setTimeout(()=>f(!0),100);return()=>clearTimeout(e)},[]);const L=(0,s.useMemo)(()=>{const e=a?.heatmapWidth?.[r],t="string"==typeof e&&e.includes("%"),n=parseInt(e),s=t||isNaN(n)||n<=0?h||600:n,o=l?.legendLabelTypo?.fontSize?.[r]||("desktop"===r?12:"tablet"===r?11:9),i=Math.max(...k.map(e=>e.toString().length),0)*(.6*o),c=k.length>0?(s-100)/k.length:100;return k.length>8||c{if(!L)return null;const e=Math.max(...k.map(e=>e.toString().length),0)*(.65*(l?.legendLabelTypo?.fontSize?.[r]||("desktop"===r?12:"tablet"===r?11:9))),t=Math.ceil(.707*e);return Math.max(t+35,"desktop"===r?100:80)},[k,L,r,l?.legendLabelTypo]),W=(0,s.useMemo)(()=>((e,t=!1,n=null)=>{const a="desktop"===e,l="tablet"===e;return{padding:a?{top:n||(t?100:45),right:30,bottom:10,left:85}:l?{top:n||(t?80:40),right:20,bottom:10,left:65}:{top:n||(t?80:40),right:30,bottom:10,left:50},minCellSize:a?36:l?28:22,maxCellSize:a?60:l?48:36,fontSize:{axisLabel:a?12:l?11:9,cellValue:a?12:l?10:8,title:a?20:l?17:15,subtitle:a?14:l?13:12}}})(r,L,T),[r,L,T]),{needsScroll:R,svgWidth:A,chartHeight:z,cellWidth:P,cellHeight:D,yLabelWidth:E}=(0,s.useMemo)(()=>(({options:e,styles:t,currentDevice:n,containerWidth:a,yCategories:l,xCategories:s,helperMetrics:r,MIN_CELL_WIDTH:o})=>{const i=e?.heatmapWidth?.[n],c="string"==typeof i&&i.includes("%"),d=parseInt(i),h=c||isNaN(d)||d<=0?a||600:d,u=t?.legendLabelTypo?.fontSize?.[n]||r.fontSize.axisLabel,g=[...l].sort((e,t)=>t.length-e.length)[0]||"",x=Math.max(r.padding.left,g.length*(.6*parseInt(u))+20),p=h-x-r.padding.right,m=s.length>0?p/s.length:0,b=m0,f=b?o:m,y=f*s.length,$=b?x+y+r.padding.right:h,v=parseInt(e?.heatmapHeight?.[n]),j=l.length>0?v?(v-r.padding.top-r.padding.bottom)/l.length:Math.min(Math.max(y/(s.length||1),r.minCellSize),r.maxCellSize):40,w=l.length>0?l.length*j:200;return{needsScroll:b,svgWidth:$,chartHeight:v||w+r.padding.top+r.padding.bottom,cellWidth:f,cellHeight:j,innerWidth:y>0?y:Math.max(p,20),innerHeight:Math.max(w,20),yLabelWidth:x}})({options:a,styles:l,currentDevice:r,containerWidth:h,yCategories:N,xCategories:k,helperMetrics:W,MIN_CELL_WIDTH:w}),[h,W,k,N,w,a?.heatmapWidth,a?.heatmapHeight,l,r]),F=(0,s.useMemo)(()=>{const e={};return(M||[]).forEach(t=>{e[`${t.label}__${t.group}`]=t}),e},[M]),B=(e,t,n,a)=>{const l=o.current?.getBoundingClientRect();if(!l)return;const s=a.clientX-l.left,r=a.clientY-l.top;p({x:s,y:r,xCat:e,yCat:t,value:n,isRightSide:s>.7*l.width,isBottomSide:r>.7*l.height,isTopSide:r<40})},G=()=>p(null);if(!n||0===n.length)return null;const O=a?.cellSpacing??2,H="circle"===a?.cellShape,Y="rounded"===a?.cellShape,X=a?.valueFormat||"number",I=e=>{if("percent"===X){const t=C-S,n=t>0?(e-S)/t*100:0;return`${Math.round(n)}%`}return e},_=!1!==a?.showLegend,U=_?z+60:z,J=(0,d.jsxs)("svg",{ref:c,width:A,height:U,viewBox:`0 0 ${A} ${U}`,preserveAspectRatio:"xMinYMid meet",className:"heatmap-chart-svg",style:{minWidth:A},children:[(0,d.jsx)("defs",{children:(0,d.jsx)("linearGradient",{id:j,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:v.map((e,t)=>(0,d.jsx)("stop",{offset:t/(v.length-1)*100+"%",stopColor:e},t))})}),(0,d.jsxs)("g",{transform:`translate(${E}, ${W.padding.top})`,children:[!1!==a?.showYAxis&&N.map((e,t)=>(0,d.jsx)("text",{x:-10,y:t*D+D/2,textAnchor:"end",dominantBaseline:"central",className:"heatmap-y-label",children:e},`y-${t}`)),!1!==a?.showXAxis&&k.map((e,t)=>{const n=e.toString().length,a=l?.legendLabelTypo?.fontSize?.[r]||W.fontSize.axisLabel,s=n*(.6*parseInt(a)),o=k.length>8||Pk.map((n,s)=>{const o=F[`${n}__${e}`];if(!o)return null;const i=((e,t,n,a)=>{const l="object"==typeof e?e.value:e;if(!a||0===a.length)return"#cccccc";if(1===a.length)return a[0];const s=n-t||1,r=Math.max(0,Math.min(1,(l-t)/s)),o=(a.length-1)*r,i=Math.floor(o),c=o-i,d=V(a[Math.min(i,a.length-1)]),h=V(a[Math.min(i+1,a.length-1)]);return`rgb(${Math.round(d.r+(h.r-d.r)*c)}, ${Math.round(d.g+(h.g-d.g)*c)}, ${Math.round(d.b+(h.b-d.b)*c)})`})(o,S,C,v),c=(e=>{const{r:t,g:n,b:a}=V(e);return(.299*t+.587*n+.114*a)/255>.5?"#1f2937":"#ffffff"})(i),h=l?.valueColor||c,u=t*k.length+s,g=P-O,x=D-O,p=H?Math.min(g,x)/2:Y?4:0,m=l?.valueTypo?.fontSize?.[r]||W.fontSize.cellValue,f=parseInt(m),y=I(o.value),$=.7*f*y.toString().length;return(0,d.jsxs)("g",{className:"heatmap-cell-group",style:{opacity:!1===a?.animation||b?1:0,transition:!1!==a?.animation?`opacity 0.4s ease ${15*u}ms`:"none"},onMouseEnter:t=>B(n,e,o.value,t),onMouseMove:t=>B(n,e,o.value,t),onMouseLeave:G,children:[(0,d.jsx)("rect",{x:s*P+O/2,y:t*D+O/2,width:Math.max(g,1),height:Math.max(x,1),rx:p,fill:i,className:"heatmap-cell"}),!1!==a?.showValues&&g>$&&x>f+4&&(0,d.jsx)("text",{x:s*P+P/2,y:t*D+D/2,textAnchor:"middle",dominantBaseline:"central",className:"heatmap-cell-value",style:{fill:h},children:y})]},`cell-${s}-${t}`)})),_&&(0,d.jsxs)("g",{transform:`translate(0, ${N.length*D+40})`,children:[(0,d.jsx)("text",{x:0,y:15,className:"heatmap-x-label",textAnchor:"start",children:S}),(0,d.jsx)("rect",{x:40,y:0,width:Math.max(A-E-120,100),height:15,fill:`url(#${j})`,rx:2}),(0,d.jsx)("text",{x:Math.max(A-E-75,145),y:15,className:"heatmap-x-label",textAnchor:"start",children:C})]})]})]});return(0,d.jsxs)("div",{ref:o,className:"bcHeatmapChartWapper",style:{width:a?.heatmapWidth?.[r]||"100%",backgroundColor:l?.backgroundColor||"transparent",padding:"mobile"===r?"20px":"tablet"===r?"16px":"24px"},children:[(0,d.jsxs)("div",{className:"chart-header",children:[a?.groupChartTitleShow&&(0,d.jsx)("h2",{className:"chart-h2",children:a?.chartTitle}),a?.groupSubTitleShow&&(0,d.jsx)("h3",{className:"chart-subtitle-h3",children:a?.chartSubTitle}),a?.downloadButton&&(0,d.jsxs)("div",{className:"chart-download-row",children:[(0,d.jsxs)("select",{className:"chart-download-select",value:y,onChange:e=>$(e.target.value),children:[(0,d.jsx)("option",{disabled:!0,value:"",children:"Select Format"}),(0,d.jsx)("option",{value:"csv",children:"CSV"}),(0,d.jsx)("option",{value:"png",children:"PNG"}),(0,d.jsx)("option",{value:"json",children:"JSON"})]}),(0,d.jsx)("button",{className:"chart-download-btn",disabled:!y,onClick:()=>((e,t,n)=>{if(e){if("csv"===e){const e=["label","group","value"],n=(t||[]).map(e=>[`"${(e.label||"").toString().replace(/"/g,'""')}"`,`"${(e.group||"").toString().replace(/"/g,'""')}"`,`"${(e.value||"").toString().replace(/"/g,'""')}"`]),a=[e.join(","),...n.map(e=>e.join(","))].join("\n"),l=new Blob([a],{type:"text/csv;charset=utf-8;"}),s=document.createElement("a");s.href=URL.createObjectURL(l),s.setAttribute("download","heatmap-chart.csv"),document.body.appendChild(s),s.click(),document.body.removeChild(s)}if("png"===e&&m(n.current,"heatmap"),"json"===e){const e=new Blob([JSON.stringify({columnBarData:t},null,2)],{type:"application/json"}),n=document.createElement("a");n.href=URL.createObjectURL(e),n.download="heatmap-chart.json",n.click()}}})(y,n,c),children:"Download"})]})]}),R?(0,d.jsx)("div",{ref:i,className:"heatmap-scroll-container",children:J}):J,x&&(0,d.jsxs)("div",{className:"heatmap-tooltip",style:{left:x.x,top:x.y,transform:`translate(${x.isRightSide?"-100%":"0%"}, ${x.isBottomSide?"-100%":"0%"}) translate(${x.isRightSide?-12:12}px, ${x.isBottomSide?-12:x.isTopSide?12:-12}px)`},children:[(0,d.jsxs)("div",{className:"heatmap-tooltip-row",children:[(0,d.jsx)("span",{className:"heatmap-tooltip-label",children:x.xCat}),(0,d.jsx)("span",{className:"heatmap-tooltip-sep",children:"×"}),(0,d.jsx)("span",{className:"heatmap-tooltip-label",children:x.yCat})]}),(0,d.jsx)("div",{className:"heatmap-tooltip-value",children:I(x.value)})]})]})},G=({attributes:e,isBackend:t=!1})=>{const{data:n,type:a,textColor:l,isXScale:r,isXGridLine:o,isYScale:i,isYGridLine:c,gridLineColor:h,isTitle:u,title:g,titleFontSize:x,titleColor:p,isSubtitle:m,subtitle:b,subtitleFontSize:f,subtitleColor:y,isDownload:$}=e,v=(0,s.useRef)(null),j=(0,s.useRef)(null),w=t?[n,a,l,r,o,i,c,h,u,g,x,p,m,b,f,y,$]:[];return(0,s.useEffect)(()=>{t&&(v.current.innerHTML="",v.current.innerHTML="Your browser does not support the canvas element.");const n=v.current.querySelector("canvas"),l=a?e:{...e,type:"line"},s=n&&new Chart(n,(e=>{const{data:t,type:n,textColor:a,isXScale:l,isXGridLine:s,isYScale:r,isYGridLine:o,gridLineColor:i,isTitle:c,title:d,titleFontSize:h,titleColor:u,isSubtitle:g,subtitle:x,subtitleFontSize:p,subtitleColor:m}=e;return{type:n,data:JSON.parse(JSON.stringify(t)),options:{maintainAspectRatio:!1,plugins:{legend:{position:"top",labels:{usePointStyle:!0,color:a}},title:{display:c,text:d,color:u,font:{size:h,family:"Roboto"},padding:{bottom:10}},subtitle:{display:g,text:x,color:m,font:{size:p,family:"Roboto"},padding:{bottom:15}},tooltip:{position:"nearest",usePointStyle:!0}},scales:{x:{display:l,ticks:{color:a},grid:{display:s,color:i}},y:{display:r,beginAtZero:!0,ticks:{color:a},grid:{display:o,color:i}}}}}})(l));$&&j?.current.addEventListener("click",()=>{const e=document.createElement("a");e.href=s.toBase64Image(),e.download="chart-block.png",e.click()})},w),(0,d.jsxs)(d.Fragment,{children:[$&&(0,d.jsx)("div",{className:"downloadArea",children:(0,d.jsx)("div",{className:"downloadChart",ref:j,children:"Download Chart"})}),(0,d.jsx)("div",{className:"bChart",ref:v,children:(0,d.jsx)("canvas",{children:"Your browser does not support the canvas element."})})]})},O=({columnBarData:e,attributes:t,device:n})=>{const{options:a,styles:l,themeStyle:r}=t,o=(0,s.useRef)(null),i=(0,s.useRef)(null),[c,h]=(0,s.useState)(700);(0,s.useEffect)(()=>{if(!o.current)return;const e=new ResizeObserver(e=>{for(let t of e)h(t.contentRect.width)});return e.observe(o.current),()=>e.disconnect()},[]);const g=n?n.toLowerCase():u(),x=Number(a?.multChartHeight?.[g]??400),p=e.length>8?100:50,m=60,b=80*e.length,f=Math.max(c,b),y=x-30-p,w=f-m-50,{minValue:S,maxValue:C}=(0,s.useMemo)(()=>{const t=e?.map(e=>e.value);return{minValue:Math.min(...t,0),maxValue:1.1*Math.max(...t)}},[e]),M=e.length>1?w/(e.length-1):w/2,k=y/(C-S||1),N=()=>{if(0===e.length)return"";const t=e?.map((e,t)=>({x:t*M,y:y-(e.value-S)*k}));if("step"===a?.curveType)return t.map((e,t)=>0===t?`M ${e.x} ${e.y}`:`H ${e.x} V ${e.y}`).join(" ");if("smooth"===a?.curveType){let e=`M ${t[0].x} ${t[0].y}`;const n=a?.tension||.4;for(let a=0;a0===t?`M ${e.x} ${e.y}`:`L ${e.x} ${e.y}`).join(" ")},L=Array.from({length:6},(e,t)=>S+(C-S)/5*t),[T,W]=(0,s.useState)(""),[R,A]=(0,s.useState)({show:!1,x:0,y:0,data:null}),z=t=>{if(!e||0===e.length)return;const n=i.current.getBoundingClientRect(),a=t.clientX-n.left-m,l=Math.round(a/M);if(l>=0&&lW(e.target.value),children:[(0,d.jsx)("option",{disabled:!0,value:"",children:"Select Format"}),(0,d.jsx)("option",{value:"csv",children:"CSV"}),(0,d.jsx)("option",{value:"png",children:"PNG"}),(0,d.jsx)("option",{value:"json",children:"JSON"})]}),(0,d.jsx)("button",{className:"chart-download-btn",disabled:!T,onClick:()=>{if(T)switch(T){case"csv":$(e,r,"single");break;case"json":v(e,"single");break;case"png":j(i,"single")}},children:"Download"})]}),a?.showLegend&&(0,d.jsx)("div",{className:"line-column-legend",children:e?.map((e,t)=>(0,d.jsxs)("div",{className:"column-legend-item",children:[(0,d.jsx)("div",{className:"column-legend-color",style:{backgroundColor:e.color}}),(0,d.jsx)("span",{className:"column-legend-text",children:e.label})]},t))}),(0,d.jsxs)("div",{className:"bcSingleSvgWapper",children:[(0,d.jsx)("svg",{ref:i,width:f,height:x,viewBox:`0 0 ${f} ${x}`,children:(0,d.jsxs)("g",{transform:"translate(60, 30)",children:[L.map((e,t)=>{const n=y-(e-S)*k;return(0,d.jsxs)("g",{children:[(0,d.jsx)("line",{x1:0,y1:n,x2:w,y2:n,stroke:l?.axisLineColor,strokeWidth:"1",opacity:"0.5"}),(0,d.jsx)("text",{className:"bcSingleValue",x:-10,y:n,textAnchor:"end",alignmentBaseline:"middle",children:Math.round(e)})]},t)}),e?.map((t,n)=>{const a=n*M,s=e?.length>8;return(0,d.jsxs)("g",{children:[(0,d.jsx)("line",{x1:Math.round(a)+.5,y1:0,x2:Math.round(a)+.5,y2:y,stroke:l?.axisLineColor,strokeWidth:"1",opacity:"0.5"}),(0,d.jsx)("text",{className:"bcSingleValue",x:a,y:y+25,textAnchor:s?"end":"middle",transform:s?`rotate(-45, ${a}, ${y+25})`:"",children:t.label})]},n)}),"none"!==a?.fillArea&&(0,d.jsx)("path",{d:(()=>{if("none"===a?.fillArea||!e.length)return"";const t=e.map((e,t)=>({x:t*M,y:y-(e.value-S)*k})),n=N(),l=t[0].x,s=t[t.length-1].x;return"start"===a?.fillArea?`\n ${n}\n L ${s} ${y}\n L ${l} ${y}\n Z\n `:"end"===a?.fillArea?`\n ${n}\n L ${s} 0\n L ${l} 0\n Z\n `:""})(),fill:a?.lineColor||"#4f46e5",opacity:a?.fillOpacity}),(0,d.jsx)("path",{d:N(),fill:"none",stroke:a?.lineColor||"#4f46e5",strokeWidth:a?.lineWidth||3,strokeLinecap:"round",vectorEffect:"non-scaling-stroke",strokeDasharray:"dashed"===a?.lineChartStyle?"8,4":"dotted"===a?.lineChartStyle?"2,4":"none"}),e?.map((e,t)=>{const n=Math.round((e=>e*M)(t))+.5;var l;return((e,t,n,l)=>{if("none"===a?.pointStyle)return null;const s=a?.pointSize||5;switch(a?.pointStyle){case"square":return(0,d.jsx)("rect",{x:e-s,y:t-s,width:2*s,height:2*s,fill:n,stroke:"#fff",strokeWidth:"2"},l);case"triangle":{const a=1.5*s,r=`${e},${t-a} ${e-s},${t+a/2} ${e+s},${t+a/2}`;return(0,d.jsx)("polygon",{points:r,fill:n,stroke:"#fff",strokeWidth:"2"},l)}case"plus":return(0,d.jsxs)("g",{children:[(0,d.jsx)("line",{x1:e-s,y1:t,x2:e+s,y2:t,stroke:n,strokeWidth:"3",strokeLinecap:"round"}),(0,d.jsx)("line",{x1:e,y1:t-s,x2:e,y2:t+s,stroke:n,strokeWidth:"3",strokeLinecap:"round"})]},l);case"star":{const a=s,r=.4*s,o=Array.from({length:5},(n,l)=>{const s=2*l*Math.PI/5-Math.PI/2,o=s+Math.PI/5;return[`${e+a*Math.cos(s)},${t+a*Math.sin(s)}`,`${e+r*Math.cos(o)},${t+r*Math.sin(o)}`]}).flat().join(" ");return(0,d.jsx)("polygon",{points:o,fill:n,stroke:n,strokeWidth:"2"},l)}default:return(0,d.jsx)("circle",{cx:e,cy:t,r:s,fill:n,stroke:"#fff",strokeWidth:"2"},l)}})(n,Math.round((l=e.value,y-(l-S)*k))+.5,e.color||"#4f46e5",t)}),(0,d.jsx)("rect",{width:f,height:x,fill:"transparent",onMouseMove:z,onMouseLeave:()=>A({...R,show:!1}),onTouchMove:e=>z(e.touches[0])}),R.show&&(0,d.jsx)("line",{x1:Math.floor(R.x-m),y1:0,x2:Math.floor(R.x-m),y2:y,stroke:"#717176",strokeWidth:"1",strokeDasharray:"4 2",pointerEvents:"none",shapeRendering:"crispEdges",vectorEffect:"non-scaling-stroke"})]})}),R.show&&(0,d.jsxs)("div",{className:"bcSingleToolsWapper",style:{left:`${R.x}px`,top:`${R.y}px`,transform:`translate(\n ${R.x-m>w-100?"-110%":"10%"},\n ${R.y<100?"10%":"-110%"}\n )`,border:`1px solid ${a?.lineColor||"#4f46e5"}`},children:[(0,d.jsx)("div",{className:"bcSingleToolsLabel",children:R.data.label}),(0,d.jsxs)("div",{className:"bcSingleToolsPointWapper",children:[(0,d.jsx)("div",{className:"bcSingleToolsPoint",style:{background:R.data.color||"#4f46e5"}}),(0,d.jsx)("span",{className:"bcSingleToolsValue",children:"Value:"}),(0,d.jsx)("strong",{className:"bcSingleToolsValueText",children:R.data.value})]})]})]})]})},H=({categories:e,series:t,dataPoints:n,attributes:a,device:l})=>{const{options:r={},styles:o={}}=a,i=(0,s.useRef)(null),c=(0,s.useRef)(null),[h,g]=(0,s.useState)({show:!1,x:0,y:0,data:null}),[b,f]=(0,s.useState)(0);(0,s.useEffect)(()=>{if(!i.current)return;const e=new ResizeObserver(e=>{for(let t of e)f(t.contentRect.width)});return e.observe(i.current),()=>e.disconnect()},[]);const y=(0,s.useMemo)(()=>[...e].sort((e,t)=>e.order-t.order).map(e=>{const a=[...t].sort((e,t)=>e.order-t.order).map(t=>{const a=n.find(n=>n.category_id===e.id&&n.series_id===t.id);return a?a.value:0});return{categoryName:e.name,values:a,id:e.id}}),[e,t,n]),$=l?l.toLowerCase():u(),v=Number(r?.multChartHeight?.[$]??400),j="mobile"===$?y.length>=5?110:60:y.length>8?110:60,w=60*y.length,S=Math.max(b,w),C=v-20-j,{minValue:M,maxValue:k}=(0,s.useMemo)(()=>{const e=(n??[])?.map(e=>e.value);return{minValue:Math.min(0,...e),maxValue:Math.max(10,...e)}},[n]),N=S-50-50,L=y.length>1?N/(y.length-1):N/2,T=C/(k-M||1),W=()=>{switch(r?.lineChartStyle){case"dashed":return"8,4";case"dotted":return"2,4";default:return"none"}},R=e=>{if(0===e.length)return"";const t=e.map((e,t)=>({x:t*L,y:C-(e-M)*T}));if("step"===r?.curveType)return t.map((e,t)=>0===t?`M ${e.x} ${e.y}`:`H ${e.x} V ${e.y}`).join(" ");if("smooth"===r?.curveType){let e=`M ${t[0].x} ${t[0].y}`;for(let n=0;n0===t?`M ${e.x} ${e.y}`:`L ${e.x} ${e.y}`).join(" ")},A=(0,s.useMemo)(()=>{const e=(k-M)/5;return Array.from({length:6},(t,n)=>M+e*n)},[M,k]),[z,P]=(0,s.useState)(""),D=e=>{if(!c.current||!i.current||!L||0===y.length)return;const n=c.current.getBoundingClientRect(),a=e.touches?e.touches[0].clientX:e.clientX,l=e.touches?e.touches[0].clientY:e.clientY,s=a-n.left,r=l-n.top;let o=Math.round((s-50)/L);o<0&&(o=0),o>=y.length&&(o=y.length-1);const d=y[o],h=Math.round(o*L)+.5,u=20*t.length+50;let x=s+15,p=r+15;s+150+30>S&&(x=s-150-20),p+u>C+20&&(p=r-u-15),g({show:!0,x,y:p,centerX:h,data:d})},E=()=>{g({...h,show:!1})};return(0,d.jsxs)("div",{className:"bclineChartMinWapper",ref:i,children:[(0,d.jsxs)("div",{className:"line-chart-header",children:[r?.groupChartTitleShow&&(0,d.jsx)(d.Fragment,{children:(0,d.jsx)("h2",{className:"line-chart-h2",children:r?.chartTitle})}),r?.groupSubTitleShow&&(0,d.jsx)("h3",{className:"line-chart-subtitle-h3",children:r?.chartSubTitle})]}),r?.downloadButton&&(0,d.jsxs)("div",{className:"chart-download-row",children:[(0,d.jsxs)("select",{className:"chart-download-select",value:z,onChange:e=>P(e.target.value),children:[(0,d.jsx)("option",{disabled:!0,value:"",children:"Select Format"}),(0,d.jsx)("option",{value:"csv",children:"CSV"}),(0,d.jsx)("option",{value:"png",children:"PNG"}),(0,d.jsx)("option",{value:"json",children:"JSON"})]}),(0,d.jsx)("button",{className:"chart-download-btn",disabled:!z,onClick:()=>{z&&("csv"===z&&x(e,t,n,"multi"),"png"===z&&m(c.current,"multi"),"json"===z&&p({categories:e,series:t,dataPoints:n},"multi"))},children:"Download"})]}),r?.showLegend&&(0,d.jsx)("div",{className:"line-column-legend",children:t?.map((e,t)=>(0,d.jsxs)("div",{className:"column-legend-item",children:[(0,d.jsx)("div",{className:"column-legend-color",style:{backgroundColor:e.color}}),(0,d.jsx)("span",{className:"column-legend-text",children:e.name})]},t))}),(0,d.jsxs)("div",{className:"lineChartSvgWapper",style:{position:"relative",WebkitOverflowScrolling:"touch"},children:[(0,d.jsx)("svg",{ref:c,viewBox:`0 0 ${S} ${v}`,width:S,height:v,preserveAspectRatio:"xMidYMid meet",className:"lineChartSvg",onMouseMove:D,onMouseLeave:E,onTouchMove:D,onTouchStart:D,onTouchEnd:E,children:(0,d.jsxs)("g",{transform:"translate(50, 20)",children:[A.map((e,t)=>{const n=Math.round(C-(e-M)*T+.5);return(0,d.jsxs)("g",{children:[(0,d.jsx)("line",{x1:0,y1:n,x2:Math.round(N),y2:n,stroke:"#a7acb0",strokeWidth:"1",opacity:"1",vectorEffect:"non-scaling-stroke",shapeRendering:"crispEdges",className:"lineChartAxios"}),(0,d.jsx)("text",{x:-15,y:n,textAnchor:"end",alignmentBaseline:"middle",className:"lineChartAxisText",children:Math.round(e)})]},t)}),y.map((e,t)=>{const n=Math.round(t*L)+.5,a="mobile"===$?y.length>=5:y.length>8;return(0,d.jsxs)("g",{children:[(0,d.jsx)("line",{x1:n,y1:0,x2:n,y2:C,stroke:"#a7acb0",strokeWidth:"1",opacity:"1",className:"lineChartAxios",vectorEffect:"non-scaling-stroke",shapeRendering:"crispEdges"}),(0,d.jsx)("text",{x:n,y:C+30,textAnchor:a?"end":"middle",transform:a?`rotate(-45, ${n}, ${C+20})`:"",className:"lineChartAxisText",children:a&&e.categoryName.length>12?`${e.categoryName.substring(0,15)}...`:e.categoryName})]},e.id)}),h.show&&(0,d.jsx)("line",{x1:h.centerX,y1:0,x2:h.centerX,y2:C,stroke:o?.toolTipLineColor,strokeWidth:"1.5",strokeDasharray:"4,1",pointerEvents:"none",shapeRendering:"geometricPrecision"}),"none"!==r?.fillArea&&[...t].map((e,t)=>({...e,originalIdx:t,totalValue:y.reduce((e,n)=>e+n.values[t],0)})).sort((e,t)=>t.totalValue-e.totalValue).map(e=>{const t=((e,t)=>{if("none"===r?.fillArea||!e.length)return"";const n=e.map((e,t)=>({x:t*L,y:C-(e-M)*T})),a=R(e),l=n[n.length-1].x;return"start"===r?.fillArea?`${a} L ${l} ${C} L 0 ${C} Z`:"end"===r?.fillArea?`${a} L ${l} 0 L 0 0 Z`:"between"===r?.fillArea&&t>0?`${a} ${y.map(e=>e.values[t-1]).map((e,t)=>({x:t*L,y:C-(e-M)*T})).reverse().map(e=>`L ${e.x} ${e.y}`).join(" ")} Z`:""})(y.map(t=>t.values[e.originalIdx]),e.originalIdx);return(0,d.jsx)("path",{d:t,fill:e.color,opacity:r?.fillOpacity,pointerEvents:"none"},`fill-${e.id}`)}),t.map((e,t)=>{const n=y.map(e=>e.values[t]),a=R(n);return(0,d.jsxs)("g",{children:[(0,d.jsx)("path",{d:a,fill:"none",stroke:e.color,strokeWidth:r?.lineWidth,strokeDasharray:W(),strokeLinecap:"round",strokeLinejoin:"round"}),n.map((t,n)=>((e,t,n,a)=>{if("none"===r?.pointStyle)return null;const l=r?.pointSize||5;switch(r?.pointStyle){case"square":return(0,d.jsx)("rect",{x:e-l,y:t-l,width:2*l,height:2*l,fill:n,stroke:"#fff",strokeWidth:"2"},a);case"triangle":{const s=1.5*l,r=`${e},${t-s} ${e-l},${t+s/2} ${e+l},${t+s/2}`;return(0,d.jsx)("polygon",{points:r,fill:n,stroke:"#fff",strokeWidth:"2"},a)}case"plus":return(0,d.jsxs)("g",{children:[(0,d.jsx)("line",{x1:e-l,y1:t,x2:e+l,y2:t,stroke:n,strokeWidth:"3",strokeLinecap:"round"}),(0,d.jsx)("line",{x1:e,y1:t-l,x2:e,y2:t+l,stroke:n,strokeWidth:"3",strokeLinecap:"round"})]},a);case"star":{const s=l,r=.4*l,o=Array.from({length:5},(n,a)=>{const l=2*a*Math.PI/5-Math.PI/2,o=l+Math.PI/5;return[`${e+s*Math.cos(l)},${t+s*Math.sin(l)}`,`${e+r*Math.cos(o)},${t+r*Math.sin(o)}`]}).flat().join(" ");return(0,d.jsx)("polygon",{points:o,fill:n,stroke:n,strokeWidth:"2"},a)}default:return(0,d.jsx)("circle",{cx:e,cy:t,r:l,fill:n,stroke:"#fff",strokeWidth:"2"},a)}})(n*L,C-(t-M)*T,e.color,`point-${e.id}-${n}`))]},`series-lines-${e.id}`)})]})}),h?.show&&h?.data&&(0,d.jsx)("div",{style:{top:h.y,left:h.x},className:"bcToolstipShowWapper",children:t.map((e,t)=>(0,d.jsxs)("div",{className:"bctoolstipData",style:{display:"flex",justifyContent:"space-between",fontSize:"12px",gap:"10px"},children:[(0,d.jsxs)("span",{style:{color:e.color},children:["● ",e.name,":"]}),(0,d.jsx)("span",{style:{fontWeight:"600"},children:h.data.values[t]})]},t))})]})]})},Y=({attributes:e,device:t})=>{const{options:n={},columnBarData:a=[],categories:l=[],series:s=[],dataPoints:r=[]}=e;return(0,d.jsx)(d.Fragment,{children:"multi"===n?.lineChartType?(0,d.jsx)(H,{categories:l,series:s,dataPoints:r,attributes:e,device:t}):(0,d.jsx)(O,{columnBarData:a,attributes:e,device:t})})},X=({attributes:e})=>{const t=(0,s.useRef)(null),[n,a]=(0,s.useState)({show:!1,x:0,y:0,data:null}),{options:l={},columnBarData:r=[],styles:o,themeStyle:i}=e,c=l?.pieChartSize||250,h=125,u=2*(c+h),g=c+h,x=c+h,p=c,m=l?.donutMode?p*(l?.donutThickness/100):0,b=(0,s.useMemo)(()=>r?.reduce((e,t)=>e+t.value,0),[r]),f=(e,n)=>{const l=t.current?.closest(".bc-PieChartswrapper");if(!l)return;const s=l.getBoundingClientRect(),r=e.touches?e.touches[0].clientX:e.clientX,o=e.touches?e.touches[0].clientY:e.clientY;a({show:!0,x:r-s.left,y:o-s.top,data:n,color:n.color})},y=()=>{a({...n,show:!1})},w=r?.length,S="inside"===l?.labelPosition&&w>5,C=(0,s.useMemo)(()=>{let e=l?.isSemiCircle?-Math.PI:(l?.startAngle||0)*Math.PI/180;const t=l?.isSemiCircle?Math.PI:2*Math.PI;return r?.map((n,a)=>{const s=b?n.value/b*100:0,r=s/100*t,o=e,i=o+r,c=o+r/2,d=l?.explodedSegments?.includes(a),h=d?l?.explodeDistance:0,u=Math.cos(c)*h,g=Math.sin(c)*h;return e+=r,{...n,percentage:s,startAngle:o,endAngle:i,midAngle:c,offsetX:u,offsetY:g}})},[r,b,l?.startAngle,l?.explodeDistance,l?.explodedSegments,l?.isSemiCircle]),M=(e,t,n,a,l,s)=>{const r=g+l,o=x+s,i=r+n*Math.cos(e),c=o+n*Math.sin(e),d=r+n*Math.cos(t),h=o+n*Math.sin(t),u=t-e>Math.PI?1:0;return a<=0?`M ${r} ${o} L ${i} ${c} A ${n} ${n} 0 ${u} 1 ${d} ${h} Z`:`M ${i} ${c} A ${n} ${n} 0 ${u} 1 ${d} ${h} L ${r+a*Math.cos(t)} ${o+a*Math.sin(t)} A ${a} ${a} 0 ${u} 0 ${r+a*Math.cos(e)} ${o+a*Math.sin(e)} Z`},[k,N]=(0,s.useState)(""),L=l?.isSemiCircle?u/2+h:u;return(0,d.jsxs)("div",{className:"bc-PieChartswrapper",children:[(0,d.jsx)("div",{className:"pieChartSection",style:{maxWidth:`${u}px`},children:(0,d.jsx)("svg",{ref:t,viewBox:`0 0 ${u} ${L}`,className:"pieChartSvg",children:C.map((e,t)=>(0,d.jsxs)("g",{onMouseMove:t=>f(t,e),onMouseLeave:y,onTouchStart:t=>f(t,e),onTouchEnd:y,className:"pieChartSvgbar",children:[(0,d.jsx)("path",{d:M(e.startAngle,e.endAngle,p,m,e.offsetX,e.offsetY),fill:e.color,stroke:"#fff",strokeWidth:l?.borderSpacing,className:"pieChartPath"}),"none"!==l?.labelPosition&&(0,d.jsxs)("g",{children:["outside"===l?.labelPosition&&(0,d.jsx)("line",{x1:g+e.offsetX+.95*p*Math.cos(e.midAngle),y1:x+e.offsetY+.95*p*Math.sin(e.midAngle),x2:g+e.offsetX+(p+25)*Math.cos(e.midAngle),y2:x+e.offsetY+(p+25)*Math.sin(e.midAngle),stroke:e.color,strokeWidth:"2",strokeLinecap:"round"}),(()=>{const t=((e,t,n,a)=>{const s=a?p+45:(p+m)/2;let r=g+t+s*Math.cos(e),o=x+n+s*Math.sin(e);if(l?.isSemiCircle&&!a){const e=x-p+20,t=x-20;o>t&&(o=t),o{const n=l?.pieValueDisplay||"percentage";return"number"===n?e:"both"===n?`${e} (${t.toFixed(1)}%)`:`${t.toFixed(1)}%`})(e.value,e.percentage)})]})})()]})]},t))})}),n.show&&(0,d.jsxs)("div",{className:"pie-custom-tooltip",style:{top:n.y-10,left:n.x},children:[(0,d.jsx)("div",{className:"pie-tooltip-data",children:n.data?.label}),(0,d.jsxs)("div",{className:"tools-top-value-section",children:[(0,d.jsx)("div",{className:"tools-top-value-pie-checkBox",style:{backgroundColor:n.color}}),(0,d.jsx)("div",{className:"toolstip-value",children:(()=>{const e=l?.pieValueDisplay||"percentage";return"number"===e?n.data?.value:"both"===e?`${n.data?.value} (${n.data?.percentage.toFixed(1)}%)`:`${n.data?.percentage.toFixed(1)}%`})()})]})]}),(0,d.jsxs)("div",{className:"bc-PieChartsLegend",children:[(0,d.jsxs)("div",{className:"bc-PieChartsLegendHeader",children:[l?.chartTitleShow&&(0,d.jsxs)("h3",{className:"bc-PieChartsLegendH2",children:[l?.chartTitle," "]}),l?.groupSubTitleShow&&(0,d.jsx)("p",{className:"bc-PieChartsLegendSub",children:l?.chartSubTitle}),l?.downloadButton&&(0,d.jsxs)("div",{className:"chart-download-row row",children:[(0,d.jsxs)("select",{className:"chart-download-select",value:k,onChange:e=>N(e.target.value),children:[(0,d.jsx)("option",{disabled:!0,value:"",children:"Select Format"}),(0,d.jsx)("option",{value:"csv",children:"CSV"}),(0,d.jsx)("option",{value:"png",children:"PNG"}),(0,d.jsx)("option",{value:"json",children:"JSON"})]}),(0,d.jsx)("button",{className:"chart-download-btn",disabled:!k,onClick:()=>{if(k)switch(k){case"csv":$(r,i,"pie");break;case"json":v(r,"pie");break;case"png":j(t,"pie")}},children:"Download"})]})]}),l?.pieShowLegend&&(0,d.jsx)("div",{className:"bc-PieChartsLegendScroll",children:r?.map((e,t)=>(0,d.jsx)("div",{className:"bc-PieChartsLegendlist",children:(0,d.jsxs)("div",{className:"bc-legendSection",children:[(0,d.jsx)("div",{className:"bc-legendSectionColor",style:{backgroundColor:e.color}}),(0,d.jsxs)("div",{className:"bc-legendSectionText",children:[(0,d.jsx)("span",{className:"bc-legendSectionLabel",children:e.label}),(0,d.jsx)("span",{className:"bc-legendSectionValue",children:(()=>{const t=l?.pieValueDisplay||"percentage",n=b?e.value/b*100:0;return"number"===t?e.value:`${n.toFixed(1)}%`})()})]})]})},t))})]})]})},I=({max:e=100,title:t="Radar Chart",attributes:n=[],device:a})=>{const{options:l={},themeStyle:r="",styles:o}=n,{polygonFill:i,radarChartSize:c,pointStyle:h,pointSize:g,radarRotation:x=0,concentricGridLines:p}=l,m=n?.scatterData||[],b=(0,s.useRef)(null),f=(0,s.useRef)(null),y=(0,s.useRef)(null),w=(0,s.useRef)(null),[S,C]=(0,s.useState)(400),[M,k]=(0,s.useState)(!1),N=a?a.toLowerCase():u(),L=Number(c?.[N]),[T,W]=(0,s.useState)(null),[R,A]=(0,s.useState)(null),[z,P]=(0,s.useState)(null),D=(0,s.useMemo)(()=>{let e=0;return null!==z?e=z:null!==R&&(e=R),m[e]?.axiosData?.map(e=>e.axis)||[]},[m,R,z]),E=(0,s.useMemo)(()=>null===z?m:[m[z]],[m,z]),F=D.length,V=S/2,B=V-(S<320?40:S<420?48:56),G=Math.max(9,Math.min(13,Math.round(.03*S))),O=S<320?2.5:3.5,H=F>0?2*Math.PI/F:0,Y=(0,s.useMemo)(()=>t.replace(/\W/g,""),[t]),X=(0,s.useMemo)(()=>{const e=Number(p);return Math.max(1,Math.min(10,Math.round(e)))},[p]),I=(0,s.useCallback)(()=>Number(x)*Math.PI/180,[x]),_=(0,s.useCallback)(e=>e*H-Math.PI/2+I(),[H,I]),U=(0,s.useMemo)(()=>{const t=E.flatMap(e=>e.data?.map(e=>e.value)||[]),n=Math.max(...t,e);return 10*Math.ceil(n/10)},[E,e]),J=(0,s.useCallback)((e,t)=>{const n=_(t),a=e/U*B;return{x:V+a*Math.cos(n),y:V+a*Math.sin(n)}},[_,U,B,V]),Z=(0,s.useCallback)(e=>e&&0!==e.length?`M ${e[0].x},${e[0].y} `+e.slice(1).map(e=>`L ${e.x},${e.y}`).join(" ")+" Z":"",[]),q=(0,s.useMemo)(()=>0===F?[]:Array.from({length:X},(e,t)=>{const n=B/X*(t+1),a=Math.round(U/X*(t+1)),l=Array.from({length:F},(e,t)=>{const a=_(t);return{x:V+n*Math.cos(a),y:V+n*Math.sin(a)}});return{path:Z(l),radius:n,value:a}}),[B,F,_,V,Z,U,X]),K=(0,s.useMemo)(()=>E?.map(e=>{const t=e.data?.map((e,t)=>J(e.value,t))||[];return Z(t)}),[E,J,Z]);(0,s.useEffect)(()=>{if(L>0)return void C(L);const e=new ResizeObserver(e=>{for(let t of e)C(Math.max(220,Math.floor(t.contentRect.width)))});return b.current&&e.observe(b.current),()=>e.disconnect()},[N,L]),(0,s.useEffect)(()=>(k(!1),w.current=setTimeout(()=>k(!0),150),()=>clearTimeout(w.current)),[S]);const Q=(0,s.useCallback)((e,t)=>{if(!f.current)return{mx:0,my:0};const n=f.current.getBoundingClientRect();return{mx:(e-n.left)*(S/n.width),my:(t-n.top)*(S/n.height)}},[S]),ee=(0,s.useCallback)((e,t)=>{y.current||(y.current=requestAnimationFrame(()=>{let n=null,a=30;E?.forEach((l,s)=>{l.data?.forEach((r,o)=>{const i=J(r.value,o),c=Math.hypot(i.x-e,i.y-t);c{const{mx:t,my:n}=Q(e.clientX,e.clientY);ee(t,n)},[Q,ee]);if(!m.length)return null;const ne=(0,s.useCallback)((e,t,n,a)=>{const l=Number.isFinite(Number(g))?Number(g):O,s=n?l+1.5:l,r=n?"#fff":"rgb(244, 239, 237)",o={key:a,fill:e.color,stroke:r,strokeWidth:n?2:1.5,opacity:M?1:0,style:{transition:"r 0.15s, stroke 0.15s, stroke-width 0.15s, transform 0.15s"}};switch(h){case"square":return(0,d.jsx)("rect",{...o,x:t.x-s,y:t.y-s,width:2*s,height:2*s});case"triangle":{const e=1.6*s,n=`${t.x},${t.y-e} ${t.x-s},${t.y+e/2} ${t.x+s},${t.y+e/2}`;return(0,d.jsx)("polygon",{...o,points:n})}case"star":{const e=s,n=.45*s,a=Array.from({length:5},(a,l)=>{const s=2*l*Math.PI/5-Math.PI/2,r=s+Math.PI/5;return[`${t.x+e*Math.cos(s)},${t.y+e*Math.sin(s)}`,`${t.x+n*Math.cos(r)},${t.y+n*Math.sin(r)}`]}).flat().join(" ");return(0,d.jsx)("polygon",{...o,points:a})}default:return(0,d.jsx)("circle",{...o,cx:t.x,cy:t.y,r:s})}},[M,O,h,g]),[ae,le]=(0,s.useState)(""),se=(e,t=13)=>{if(!e)return"";const n=String(e);return n.length>t?n.slice(0,t)+"...":n};return(0,d.jsx)("div",{className:"bcRadarChartMainWapper",children:(0,d.jsxs)("div",{ref:b,className:"bcSVGMainWapper",style:{padding:S<360?"6px":"10px 12px"},children:[(0,d.jsxs)("div",{className:"radarScatter-chart-header",children:[l?.groupChartTitleShow&&(0,d.jsx)(d.Fragment,{children:(0,d.jsx)("h2",{className:"line-chart-h2",children:l?.chartTitle})}),l?.groupSubTitleShow&&(0,d.jsx)("h3",{className:"line-chart-subtitle-h3",children:l?.chartSubTitle})]}),l?.downloadButton&&(0,d.jsxs)("div",{className:"chart-download-row",children:[(0,d.jsxs)("select",{className:"chart-download-select",value:ae,onChange:e=>le(e.target.value),children:[(0,d.jsx)("option",{disabled:!0,value:"",children:"Select Format"}),(0,d.jsx)("option",{value:"csv",children:"CSV"}),(0,d.jsx)("option",{value:"png",children:"PNG"}),(0,d.jsx)("option",{value:"json",children:"JSON"})]}),(0,d.jsx)("button",{className:"chart-download-btn",disabled:!ae,onClick:()=>{if(ae)switch(ae){case"csv":$(m,r,"radar");break;case"json":v(m,"radar");break;case"png":j(f,"radar")}},children:"Download"})]}),(0,d.jsxs)("svg",{ref:f,viewBox:`0 0 ${S} ${S}`,width:"100%",height:S,className:"bcSVGRanderMainWapper",onMouseMove:te,onMouseLeave:()=>{W(null),A(null)},children:[(0,d.jsx)("defs",{children:E?.map((e,t)=>(0,d.jsxs)("filter",{id:`glow-${t}-${Y}`,x:"-40%",y:"-40%",width:"180%",height:"180%",children:[(0,d.jsx)("feGaussianBlur",{stdDeviation:"3",result:"blur"}),(0,d.jsxs)("feMerge",{children:[(0,d.jsx)("feMergeNode",{in:"blur"}),(0,d.jsx)("feMergeNode",{in:"SourceGraphic"})]})]},t))}),l?.showGridY&&(0,d.jsx)(d.Fragment,{children:q.map((e,t)=>(0,d.jsxs)("g",{children:[(0,d.jsx)("path",{d:e.path,fill:t%2==0?"rgba(255,255,255,0.02)":"rgba(255,255,255,0.04)",stroke:o?.axisLineColor,strokeWidth:1}),(0,d.jsx)("text",{x:V+e.radius*Math.cos(_(0))+4,y:V+e.radius*Math.sin(_(0))-3,fontSize:Math.max(7,G-2),fill:"rgba(9, 8, 8, 0.66)",textAnchor:"start",children:e.value})]},t))}),l?.showGridX&&(0,d.jsx)(d.Fragment,{children:D.map((e,t)=>{const n=_(t);return(0,d.jsx)("line",{x1:V,y1:V,x2:V+B*Math.cos(n),y2:V+B*Math.sin(n),stroke:o?.axisLineColor,strokeWidth:1},t)})}),E?.map((e,t)=>{const n=R===t,a=i?.5:.2;return(0,d.jsx)("path",{d:K[t],fill:e.color,fillOpacity:a,stroke:e.color,strokeWidth:n?2.5:1.8,opacity:null===R||n?1:.3,style:{transition:"opacity 0.2s, stroke-width 0.2s",transformOrigin:`${V}px ${V}px`,transform:`scale(${M?1:0})`,transformBox:"fill-box"},onMouseEnter:()=>A(t)},t)}),E.map((e,t)=>e.data.map((n,a)=>{const l=J(n.value,a),s=T?.si===t&&T?.i===a;return(0,d.jsx)("g",{style:{transition:"opacity 0.6s",transitionDelay:M?`${Math.min(5*(t*F+a),250)}ms`:"0ms",filter:s?`url(#glow-${t}-${Y})`:"none"},children:ne(e,l,s,`${t}-${a}`)},`${t}-${a}`)})),D.map((e,t)=>{const n=_(t),a=B+(S<320?18:26),l=String(e);return(0,d.jsxs)("text",{x:V+a*Math.cos(n),y:V+a*Math.sin(n),textAnchor:"middle",dominantBaseline:"middle",className:"bcAxiosLabelName",children:[(0,d.jsx)("title",{children:l}),se(l,13)]},t)}),T&&(()=>{const e=E[T.si]||{},t=Math.min(150,.5*S);let n=T.x+14,a=T.y-40;return n+t>S-4&&(n=T.x-t-14),a<2&&(a=2),(0,d.jsx)("foreignObject",{x:n,y:a,width:t,height:150,children:(0,d.jsxs)("div",{className:"bcTooltipWapper",style:{border:`2px solid ${e.color||"#999"}`,padding:"8px"},children:[null!==T.v&&void 0!==T.v&&(0,d.jsxs)("span",{style:{color:e.color,fontSize:"14px",fontWeight:"600"},children:[e.name,": ",T.v]}),(0,d.jsx)("span",{style:{color:e.color,fontSize:"12px",fontWeight:"600"},children:T.label})]})})})()]}),(0,d.jsx)("div",{className:"bcLegendMainWapper",style:{gap:S<360?10:16},children:m.map((e,t)=>(0,d.jsxs)("div",{className:"bcLegendNameText",style:{opacity:null!==R&&R!==t?.35:1},onMouseEnter:()=>A(t),onMouseLeave:()=>A(null),onClick:()=>P(z===t?null:t),children:[(0,d.jsx)("div",{className:"bcLegendPonit",style:{background:e.color,boxShadow:`0 0 5px ${e.color}90`}}),(0,d.jsx)("span",{className:"bcLegendText",children:e.name})]},t))})]})})},_=({attributes:e,device:t})=>{const{options:n={},scatterData:a=[],themeStyle:l=""}=e,r=(0,s.useRef)(null),o=(0,s.useRef)(null),[i,c]=(0,s.useState)(0),[h,g]=(0,s.useState)(null),[x,p]=(0,s.useState)({x:0,y:0}),m=t?t.toLowerCase():u(),b=Number(n?.multChartHeight?.[m]??400);(0,s.useEffect)(()=>{if(!r.current)return;const e=new ResizeObserver(e=>{for(let t of e)c(t.contentRect.width)});return e.observe(r.current),()=>e.disconnect()},[]);const f=i-80-40,y=b-20-70,{xMin:w,xMax:S,yMin:C,yMax:M}=(0,s.useMemo)(()=>{const e=a?.flatMap(e=>e.data);return{xMin:Math.min(...e.map(e=>e.x)),xMax:Math.max(...e.map(e=>e.x)),yMin:Math.min(...e.map(e=>e.y)),yMax:Math.max(...e.map(e=>e.y))}},[a]),k=e=>{if("logarithmic"===n?.xAxisType){const t=Math.log10(w||1),n=Math.log10(S||1);return(Math.log10(e||1)-t)/(n-t)*f}return(e-w)/(S-w)*f},N=e=>{if("logarithmic"===n?.yAxisType){const t=Math.log10(C||1),n=Math.log10(M||1),a=Math.log10(e||1);return y-(a-t)/(n-t)*y}return y-(e-C)/(M-C)*y},L=(0,s.useMemo)(()=>n?.showLines?a.flatMap(e=>e.data.map(t=>({...t,seriesName:e.name,seriesColor:e.color}))).sort((e,t)=>e.x-t.x):[],[a,n?.showLines]),T=(e,t,a,l)=>{const s=n?.bubbleMode&&l?l*n?.bubbleScale:n?.pointSize;switch(n?.pointStyle){case"circle":return(0,d.jsx)("circle",{cx:e,cy:t,r:s,fill:a,fillOpacity:.8,stroke:"white",strokeWidth:"2"});case"square":return(0,d.jsx)("rect",{x:e-s,y:t-s,width:2*s,height:2*s,fill:a,fillOpacity:.8,stroke:"white",strokeWidth:"2"});case"triangle":{const n=1.5*s;return(0,d.jsx)("polygon",{points:`${e},${t-n} ${e-s},${t+n/2} ${e+s},${t+n/2}`,fill:a,fillOpacity:.8,stroke:"white",strokeWidth:"2"})}case"plus":return(0,d.jsxs)("g",{children:[(0,d.jsx)("line",{x1:e-s,y1:t,x2:e+s,y2:t,stroke:a,strokeWidth:"3",strokeLinecap:"round"}),(0,d.jsx)("line",{x1:e,y1:t-s,x2:e,y2:t+s,stroke:a,strokeWidth:"3",strokeLinecap:"round"})]});case"star":{const n=s,l=1.8*s,r=Array.from({length:5},(a,s)=>{const r=4*s*Math.PI/5-Math.PI/2,o=(4*s+2)*Math.PI/5-Math.PI/2;return[`${e+n*Math.cos(r)},${t+n*Math.sin(r)}`,`${e+l*Math.cos(o)},${t+l*Math.sin(o)}`]}).flat().join(" ");return(0,d.jsx)("polygon",{points:r,fill:a,fillOpacity:.8,stroke:"white",strokeWidth:"2"})}case"diamond":return(0,d.jsx)("polygon",{points:`${e},${t-s} ${e+s},${t} ${e},${t+s} ${e-s},${t}`,fill:a,fillOpacity:.8,stroke:"white",strokeWidth:"2"});default:return null}},W=(0,s.useMemo)(()=>Array.from({length:6},(e,t)=>w+(S-w)/5*t),[w,S]),R=(0,s.useMemo)(()=>Array.from({length:6},(e,t)=>C+(M-C)/5*t),[C,M]),A=e=>e>=1e6?(e/1e6).toFixed(0)+"M":e>=1e3?(e/1e3).toFixed(0)+"K":e.toFixed(0),[z,P]=(0,s.useState)(""),D=(e,t,n=200,a=100)=>{const l=15;let s=e+l,o=t-l;const i=r.current;if(!i)return{x:s,y:o};const c=i.getBoundingClientRect(),d=o+a;return s+n>c.width&&(s=e-n-l),d>c.height&&(o=t-a-l),s<0&&(s=l),o<0&&(o=l),{x:Math.max(0,s),y:Math.max(0,o)}},E=()=>{g(null)};return(0,d.jsxs)("div",{className:"bcScatterChartMainWapper",children:[(0,d.jsxs)("div",{className:"scatter-chart-header",children:[n?.groupChartTitleShow&&(0,d.jsx)(d.Fragment,{children:(0,d.jsx)("h2",{className:"line-chart-h2",children:n?.chartTitle})}),n?.groupSubTitleShow&&(0,d.jsx)("h3",{className:"line-chart-subtitle-h3",children:n?.chartSubTitle})]}),n?.downloadButton&&(0,d.jsxs)("div",{className:"chart-download-row",children:[(0,d.jsxs)("select",{className:"chart-download-select",value:z,onChange:e=>P(e.target.value),children:[(0,d.jsx)("option",{disabled:!0,value:"",children:"Select Format"}),(0,d.jsx)("option",{value:"csv",children:"CSV"}),(0,d.jsx)("option",{value:"png",children:"PNG"}),(0,d.jsx)("option",{value:"json",children:"JSON"})]}),(0,d.jsx)("button",{className:"chart-download-btn",disabled:!z,onClick:()=>{if(z)switch(z){case"csv":$(a,l,"scatter");break;case"json":v(a,"scatter");break;case"png":j(o,"scatter")}},children:"Download"})]}),n?.showLegend&&(0,d.jsx)("div",{className:"bcScatterColumnlegend",children:a?.map((e,t)=>(0,d.jsxs)("div",{className:"column-legend-item",children:[(0,d.jsx)("div",{className:"column-legend-color",style:{backgroundColor:e.color}}),(0,d.jsx)("span",{className:"column-legend-text",children:e.name}),e?.data?.map((e,t)=>(0,d.jsxs)("span",{className:"column-legend-text",children:["(",e.x,", ",e.y,")"]},t))]},t))}),(0,d.jsxs)("div",{ref:r,className:"bcSvgScatterMainWapper",style:{position:"relative"},children:[(0,d.jsxs)("svg",{viewBox:`0 0 ${i} ${b}`,width:i,height:b,ref:o,className:"bcSvgSection",children:[(0,d.jsxs)("g",{transform:"translate(80, 20)",children:[R?.map((e,t)=>{const a=N(e);return(0,d.jsxs)("g",{children:[n?.showGridY&&(0,d.jsx)("line",{className:"bcScatterGridLine",x1:0,y1:a,x2:f,y2:a,stroke:"#e5e7eb"}),(0,d.jsx)("text",{x:-15,y:a,textAnchor:"end",alignmentBaseline:"middle",fontSize:"12",className:"bcScatterLabelText",children:A(e)})]},t)}),W.map((e,t)=>{const a=k(e);return(0,d.jsxs)("g",{children:[n?.showGridX&&(0,d.jsx)("line",{className:"bcScatterGridLine",x1:a,y1:0,x2:a,y2:y,stroke:"#e5e7eb"}),(0,d.jsx)("text",{x:a,y:y+25,textAnchor:"middle",fontSize:"12",className:"bcScatterLabelText",children:A(e)})]},t)}),a?.map((e,t)=>{const a=n?.showLines?[...e.data].sort((e,t)=>e.x-t.x):e.data;return(0,d.jsxs)("g",{children:[!0===n?.showLines&&!0===n?.lineShow&&a.length>1&&(0,d.jsx)("path",{d:a.map((e,t)=>`${0===t?"M":"L"} ${k(e.x)} ${N(e.y)}`).join(" "),fill:"none",stroke:e.color,strokeWidth:n?.lineWidth||2,strokeOpacity:.5}),e?.data.map((t,a)=>(0,d.jsx)("g",{style:{cursor:"pointer"},onMouseMove:n=>((e,t,n,a)=>{const l=e.currentTarget.getBoundingClientRect(),s=r.current?.getBoundingClientRect();if(!s)return;const o=l.left-s.left+l.width/2,i=l.top-s.top+l.height/2,c=D(o,i);g({x:t.x,y:t.y,label:t.label,seriesName:n,seriesColor:a}),p(c)})(n,t,e.name,e.color),onMouseLeave:E,onTouchMove:n=>{const a=n.touches[0],l=r.current?.getBoundingClientRect();if(l&&a){const n=a.clientX-l.left,s=a.clientY-l.top,r=D(n,s);g({x:t.x,y:t.y,seriesName:e.name,seriesColor:e.color}),p(r)}},onTouchEnd:E,children:T(k(t.x),N(t.y),!0===n?.pointColor&&t.singleColor?t.singleColor:e.color,t.size||1)},a))]},t)}),!0===n?.showLines&&!1===n?.lineShow&&L.length>1&&(0,d.jsx)("path",{d:L.map((e,t)=>`${0===t?"M":"L"} ${k(e.x)} ${N(e.y)}`).join(" "),fill:"none",stroke:n?.singleLinecolor,strokeWidth:n?.lineWidth||2,strokeOpacity:.5})]}),(0,d.jsx)("text",{x:10,y:20+y/2,textAnchor:"middle",transform:`rotate(-90, 10, ${20+y/2})`,className:"bcScatterYAxisLabel",children:n?.yAxisLabel}),(0,d.jsx)("text",{x:80+f/2,y:b-10,textAnchor:"middle",className:"bcScatterXAxisLabel",children:n?.xAxisLabel})]}),h&&(0,d.jsx)("div",{className:"scatter-tooltip",style:{position:"absolute",left:`${x.x+10}px`,top:`${x.y}px`,pointerEvents:"none"},children:(0,d.jsxs)("div",{className:"scatter-tooltip-content",children:[(0,d.jsxs)("div",{className:"scatter-tooltip-series",children:[(0,d.jsx)("span",{className:"scatter-tooltip-color",style:{backgroundColor:h.seriesColor}}),(0,d.jsxs)("span",{className:"scatter-tooltip-name",children:[" ",h.seriesName]}),(0,d.jsx)("span",{className:"scatter-tooltip-name",children:h.label})]}),(0,d.jsxs)("div",{className:"scatter-tooltip-values",children:[(0,d.jsxs)("div",{className:"scatter-tooltip-row",children:[(0,d.jsx)("span",{className:"scatter-tooltip-label",children:"X:"}),(0,d.jsx)("span",{className:"scatter-tooltip-value",children:A(h.x)})]}),(0,d.jsxs)("div",{className:"scatter-tooltip-row",children:[(0,d.jsx)("span",{className:"scatter-tooltip-label",children:"Y:"}),(0,d.jsx)("span",{className:"scatter-tooltip-value",children:A(h.y)})]})]})]})})]})]})},U=e=>{const{attributes:t}=e,{themeStyle:n}=t;switch(n){case"themeOne":return(0,d.jsx)(M,{...e});case"themeTwo":return(0,d.jsx)(X,{...e});case"themeThree":return(0,d.jsx)(Y,{...e});case"themeFour":return(0,d.jsx)(_,{...e});case"themeFive":return(0,d.jsx)(I,{...e});case"themeSix":return(0,d.jsx)(F,{...e});case"themeSeven":return(0,d.jsx)(E,{...e});case"themeEight":return(0,d.jsx)(B,{...e});case"themeNine":return(0,d.jsx)(L,{...e});case"themeTen":return(0,d.jsx)(G,{...e});default:return(0,d.jsx)("h2",{children:"Select a theme"})}},J=["line","bar","horizontalBar","pie","radar","doughnut","polarArea"];document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll(".wp-block-b-chart-chart").forEach(e=>{const n=function(e){const{themeStyle:t,type:n}=e;return"themeOne"===t&&J.includes(n)?{...e,themeStyle:"themeTen"}:e}(JSON.parse(e.dataset.attributes));(0,t.createRoot)(e).render((0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h,{attributes:n,id:e.id}),(0,d.jsx)("div",{className:"bp-bchart-block",children:(0,d.jsx)(U,{attributes:n})})]})),e?.removeAttribute("data-attributes")})})})();