import{W as C,v as T,b as $}from"./app-core.a6d808ce.js";import{S as D,u as A}from"./Statistic.1bc918cc.js";import{C as L}from"./Button.a549093d.js";import{C as M}from"./Tooltip.ae7a1028.js";import{G as B}from"./Graph.29b90f7f.js";import{S as G}from"./Trash.d35f8063.js";import{_ as N}from"./_plugin-vue_export-helper.eefbdd86.js";import{a as c,_ as r}from"./vendor-other.7b559694.js";import{aq as l,f as i,i as d,O as V,ad as O,j as u,ae as R,U as _,Q as g,R as S,a0 as h,M as m,P as p,V as j}from"./vendor-vue-ui.de3ab35f.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:p(["aioseo-seo-statistics-overview",{[a.view]:!0,"hide-graph":!a.showGraph}]),style:j(f.style)},[(i(!0),d(V,null,O(f.seoStatistics,(e,x)=>(i(),d("div",{key:x,class:"statistics"},[u("div",{class:p([{blurred:n.searchStatisticsStore.loading.seoStatistics}])},[u("div",P,[R(_(e.label)+" ",1),e.tooltip?(i(),g(v,{key:0},{tooltip:S(()=>[u("span",{innerHTML:e.tooltip},null,8,z)]),default:S(()=>[h(y)]),_:2},1024)):m("",!0)]),u("div",E,[u("div",F,_(n.formatStatistic(e.name,e.data.total)),1),h(w,{class:p(["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,[h(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"])])):m("",!0)],2),n.searchStatisticsStore.loading.seoStatistics?(i(),g(k,{key:0,dark:""})):m("",!0)]))),128))],6)}const st=N(q,[["render",Q]]);export{st as S};
