(()=>{"use strict";var t={5338:(t,e,n)=>{var r=n(5795);e.H=r.createRoot,r.hydrateRoot},5795:t=>{t.exports=window.ReactDOM}},e={};const n=window.React;var r=function n(r){var o=e[r];if(void 0!==o)return o.exports;var a=e[r]={exports:{}};return t[r](a,a.exports,n),a.exports}(5338);const o="linear-gradient(135deg, #0040E3, #18D4FD)",a=(t,e,n=!1)=>{return null==(r=e)||""===r||Array.isArray(r)&&0===r.length||"object"==typeof r&&0===Object.keys(r).length||"string"==typeof r&&""===r.trim()||"number"==typeof r&&0===r?"":`${t}: ${e}${n?" !important":""};`;var r},i=(t,e=!0,n=!0,r=!0)=>{const{type:i="solid",color:l="",gradient:s=o,image:c={},position:d="center center",attachment:u="",repeat:b="no-repeat",size:p="",overlayColor:g=""}=t||{};return"gradient"===i&&n?a("background",s):"image"===i&&r?`background: url(${c?.url});\n\t\t\t\t${a("background-color",g)}\n\t\t\t\t${a("background-position",d)}\n\t\t\t\t${a("background-size",p)}\n\t\t\t\t${a("background-repeat",b)}\n\t\t\t\t${a("background-attachment",u)}\n\t\t\t\t${a("background-repeat",b)}\n\t\t\t\tbackground-blend-mode: overlay;`:e&&a("background",l)},l="bBlocksChart",s=({attributes:t,id:e})=>{const{background:r,width:o,height:a,alignment:s}=t,c=`#${e}`,d=`${c} .${l}`;return(0,n.createElement)("style",{dangerouslySetInnerHTML:{__html:`\n\t\t${c}{\n\t\t\ttext-align: ${s};\n\t\t}\n\t\t${d}{\n\t\t\theight: ${a};\n\t\t}\n\t\t${d},\n\t\t${c} .downloadArea{\n\t\t\twidth: ${o};\n\t\t}\n\t\t${d} canvas{\n\t\t\t${i(r)};\n\t\t}\n\t\t`.replace(/\s+/g," ")}})},c=({attributes:t,id:e,isBackend:r=!1})=>{const{data:o,type:a,textColor:i,isXScale:s,isXGridLine:c,isYScale:d,isYGridLine:u,gridLineColor:b,isTitle:p,title:g,titleFontSize:m,titleColor:y,isSubtitle:$,subtitle:h,subtitleFontSize:v,subtitleColor:k,isDownload:f}=t,w=(0,n.useRef)(null),S=(0,n.useRef)(null),E=r?[o,a,i,s,c,d,u,b,p,g,m,y,$,h,v,k,f,w.current]:[];return(0,n.useEffect)((()=>{r&&(w.current.innerHTML="",w.current.innerHTML="<canvas>Your browser does not support the canvas element.</canvas>");const n=w.current.ownerDocument,o=n.querySelector(`#${e} .${l} canvas`),a=o&&new Chart(o,(t=>{const{data:e,type:n,textColor:r,isXScale:o,isXGridLine:a,isYScale:i,isYGridLine:l,gridLineColor:s,isTitle:c,title:d,titleFontSize:u,titleColor:b,isSubtitle:p,subtitle:g,subtitleFontSize:m,subtitleColor:y}=t;return{type:n,data:e,options:{maintainAspectRatio:!1,plugins:{legend:{position:"top",labels:{usePointStyle:!0,color:r}},title:{display:c,text:d,color:b,font:{size:u,family:"Roboto"},padding:{bottom:10}},subtitle:{display:p,text:g,color:y,font:{size:m,family:"Roboto"},padding:{bottom:15}},tooltip:{position:"nearest",usePointStyle:!0}},scales:{x:{display:o,ticks:{color:r},grid:{display:a,color:s}},y:{display:i,beginAtZero:!0,ticks:{color:r},grid:{display:l,color:s}}}}}})(t));f&&S?.current.addEventListener("click",(()=>{const t=n.createElement("a");t.href=a.toBase64Image(),t.download="b-chart.png",t.click()}))}),E),(0,n.createElement)(n.Fragment,null,f&&(0,n.createElement)("div",{className:"downloadArea"},(0,n.createElement)("div",{className:"downloadChart",ref:S},"Download Chart")),(0,n.createElement)("div",{className:l,ref:w},(0,n.createElement)("canvas",null,"Your browser does not support the canvas element.")))};document.addEventListener("DOMContentLoaded",(()=>{document.querySelectorAll(".wp-block-b-blocks-chart").forEach((t=>{const e=JSON.parse(t.dataset.attributes);(0,r.H)(t).render((0,n.createElement)(n.Fragment,null,(0,n.createElement)(s,{attributes:e,id:t.id}),(0,n.createElement)(c,{attributes:e,id:t.id}))),t?.removeAttribute("data-attributes")}))}))})();