"use strict";(globalThis.webpackChunkwp_seopress_pro=globalThis.webpackChunkwp_seopress_pro||[]).push([[449],{313:(e,t,a)=>{a.r(t),a.d(t,{default:()=>p});var r=a(609),s=a(723),o=a(87),l=a(427),n=a(206),c=a.n(n);const i=e=>{const t=(0,o.useRef)(null),a=(0,o.useRef)(null);return(0,o.useEffect)((()=>{if(t.current)return a.current=new(c())(t.current,e),()=>{a.current&&(a.current.destroy(),a.current=null)}}),[e]),t},p=({chartData:e})=>{const t=(0,o.useMemo)((()=>e.map((e=>e.label))),[e]),a=(0,o.useMemo)((()=>(()=>{const e=document.documentElement;return{color:getComputedStyle(e).getPropertyValue("--wp-admin-theme-color").trim()||"#2271b1",rgb:getComputedStyle(e).getPropertyValue("--wp-admin-theme-color--rgb").trim()||"34, 113, 177"}})()),[]),n=(0,o.useMemo)((()=>({type:"line",data:{labels:t,datasets:[{label:(0,s.__)("Score","wp-seopress-pro"),data:e.map((e=>e.score)),borderColor:a.color,backgroundColor:`rgba(${a.rgb}, 0.08)`,borderWidth:2,pointRadius:3,pointBackgroundColor:a.color,tension:.25,fill:!0}]},options:{responsive:!0,maintainAspectRatio:!1,scales:{y:{min:0,max:100,ticks:{font:{size:11}},grid:{color:"#f0f0f1"}},x:{ticks:{font:{size:11}},grid:{display:!1}}},plugins:{legend:{display:!1}}}})),[e,t,a]),c=(0,o.useMemo)((()=>({type:"bar",data:{labels:t,datasets:[{label:(0,s.__)("High","wp-seopress-pro"),data:e.map((e=>e.high)),backgroundColor:"#eb0f00",stack:"a"},{label:(0,s.__)("Medium","wp-seopress-pro"),data:e.map((e=>e.medium)),backgroundColor:"#e39f48",stack:"a"},{label:(0,s.__)("Low","wp-seopress-pro"),data:e.map((e=>e.low)),backgroundColor:"#ffba00",stack:"a"}]},options:{responsive:!0,maintainAspectRatio:!1,scales:{y:{stacked:!0,ticks:{font:{size:11}},grid:{color:"#f0f0f1"}},x:{stacked:!0,ticks:{font:{size:11}},grid:{display:!1}}},plugins:{legend:{position:"bottom",labels:{font:{size:12},boxWidth:12}}}}})),[e,t]),p=i(n),d=i(c);return(0,r.createElement)(l.__experimentalHStack,{spacing:4,wrap:!0,alignment:"stretch"},(0,r.createElement)(l.Card,{size:"small",className:"seopress-site-audit-chart-card"},(0,r.createElement)(l.CardBody,null,(0,r.createElement)(l.__experimentalVStack,{spacing:2},(0,r.createElement)(l.__experimentalText,{weight:500},(0,s.__)("Site health score","wp-seopress-pro")),(0,r.createElement)("div",{className:"seopress-site-audit-chart"},(0,r.createElement)("canvas",{ref:p}))))),(0,r.createElement)(l.Card,{size:"small",className:"seopress-site-audit-chart-card"},(0,r.createElement)(l.CardBody,null,(0,r.createElement)(l.__experimentalVStack,{spacing:2},(0,r.createElement)(l.__experimentalText,{weight:500},(0,s.__)("Issues by priority","wp-seopress-pro")),(0,r.createElement)("div",{className:"seopress-site-audit-chart"},(0,r.createElement)("canvas",{ref:d}))))))}}}]);