import{R as C,p as T,b as $}from"./app-core.3e3b5f4b.js";import{S as D,u as A}from"./Statistic.8dfe353c.js";import{C as L}from"./Button.60477c93.js";import{C as M}from"./Tooltip.83c2998c.js";import{G as B}from"./Graph.b9c2a8d8.js";import{S as G}from"./Trash.c607f240.js";import{_ as N}from"./_plugin-vue_export-helper.eefbdd86.js";import{a as c,_ as r}from"./vendor-other.ac1169a2.js";import{aq as l,f as i,i as d,O as R,ad as V,j as u,ae as O,U as _,Q as g,R as S,a0 as p,M as h,P as m,V as j}from"./vendor-vue-ui.65fbb3e9.js";const o="all-in-one-seo-pack",q={setup(){const{formatStatistic:t}=A();return{formatStatistic:t,rootStore:$(),searchStatisticsStore:T()}},components:{CoreLoader:L,CoreTooltip:M,Graph:B,Statistic:D,SvgCircleQuestionMark:G},props:{statistics:{type:Array,default(){return[]}},statisticsData:{type:Object,default(){return null}},view:{type:String,default:"grid"},showGraph:{type:Boolean,default:!0}},data(){return{statisticsStrings:[{name:"impressions",label:r("Search Impressions",o),tooltip:c(r("The %1$stotal number of times your website appeared in search results%2$s within the selected timeframe.",o),"<strong>","</strong>")},{name:"clicks",label:r("Total Clicks",o),tooltip:c(r("The %1$stotal number of clicks that your website received from search results%2$s within the selected timeframe.",o),"<strong>","</strong>")},{name:"ctr",label:r("Avg. CTR",o),tooltip:c(r("The %1$saverage click-through rate of your content in search results%2$s within the selected timeframe.",o),"<strong>","</strong>")},{name:"position",label:r("Avg. Position",o),tooltip:c(r("The %1$saverage position of your content in search results%2$s within the selected timeframe.",o),"<strong>","</strong>")},{name:"keywords",label:r("Total Keywords",o),tooltip:c(r("The %1$stotal number of keywords that your website ranks for in search results%2$s within the selected timeframe.",o),"<strong>","</strong>")}]}},computed:{seoStatistics(){const t=[];return this.statistics.forEach(s=>{const a=this.statisticsStrings.find(n=>n.name===s);a&&t.push({...a,data:this.getData(s)})}),t},style(){const t=[];switch(this.view){case"side-by-side":t.push({"grid-template-columns":`repeat(${this.statistics.length}, 1fr)`});break;case"grid":t.push({"grid-template-columns":`repeat(${Math.ceil(this.statistics.length/2)}, 1fr)`,"grid-template-rows":`repeat(${Math.ceil(this.statistics.length/2)}, 1fr)`});break}return t}},methods:{getData(t){const s=this.statisticsData?this.statisticsData:this.searchStatisticsStore.data?.seoStatistics?.statistics;return s?{total:s[t]||0,difference:s.difference&&Number(s.difference[t])||0,direction:s.difference&&0>s.difference[t]?"down":"up",chart:this.searchStatisticsStore.data?.seoStatistics?.intervals?.map(a=>({x:C(new Date(a.date+" 00:00:00"),this.rootStore.aioseo.data.dateFormat),y:a[t]?a[t]:0}))}:{total:0,difference:0,direction:"up",chart:[]}}}},P={class:"statistics-title"},z=["innerHTML"],E={class:"statistics-current"},F={class:"statistics-current-total"},H={key:0,class:"statistics-chart"};function Q(t,s,a,n,U,f){const y=l("svg-circle-question-mark"),v=l("core-tooltip"),w=l("statistic"),b=l("graph"),k=l("core-loader");return i(),d("div",{class:m(["aioseo-seo-statistics-overview",{[a.view]:!0,"hide-graph":!a.showGraph}]),style:j(f.style)},[(i(!0),d(R,null,V(f.seoStatistics,(e,x)=>(i(),d("div",{key:x,class:"statistics"},[u("div",{class:m([{blurred:n.searchStatisticsStore.loading.seoStatistics}])},[u("div",P,[O(_(e.label)+" ",1),e.tooltip?(i(),g(v,{key:0},{tooltip:S(()=>[u("span",{innerHTML:e.tooltip},null,8,z)]),default:S(()=>[p(y)]),_:2},1024)):h("",!0)]),u("div",E,[u("div",F,_(n.formatStatistic(e.name,e.data.total)),1),p(w,{class:m(["statistics-current-difference","statistics-current-difference--"+e.data.direction]),difference:e.data.difference,type:e.name,showCurrent:!1,"tooltip-offset":"-90px,0"},null,8,["class","difference","type"])]),a.showGraph?(i(),d("div",H,[p(b,{series:[{name:e.label,data:e.data.chart}],height:60,preset:"overview","invert-y-axis":e.name==="position"},null,8,["series","invert-y-axis"])])):h("",!0)],2),n.searchStatisticsStore.loading.seoStatistics?(i(),g(k,{key:0,dark:""})):h("",!0)]))),128))],6)}const st=N(q,[["render",Q]]);export{st as S};
