관리-도구
편집 파일: SeoStatisticsOverview.jwyzj7ao.js
import{u as T,f as $,x as D}from"./index.nsvc8vqf.js";import{S as A,u as G}from"./Statistic.fg4v8ois.js";import{b as L}from"./Caret.hnvbzqgq.js";import{C as M}from"./Tooltip.jx4casvt.js";import{G as B}from"./Graph.dm4w1ra9.js";import{a as N}from"./index.h076fivy.js";import"./translations.lf9cwm9a.js";import{_ as V}from"./_plugin-vue_export-helper.oebm7xum.js";import{_ as a,a as u}from"./default-i18n.hohxoesu.js";import{v as d,o as n,c as m,F as j,J as F,a as h,x as O,t as y,k as v,l as w,C as _,b as g,G as S,j as R}from"./runtime-dom.esm-bundler.h3clfjuw.js";const r="all-in-one-seo-pack",q={setup(){const{formatStatistic:t}=G();return{formatStatistic:t,rootStore:T(),searchStatisticsStore:$()}},components:{CoreLoader:L,CoreTooltip:M,Graph:B,Statistic:A,SvgCircleQuestionMark:N},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:a("Search Impressions",r),tooltip:u(a("The %1$stotal number of times your website appeared in search results%2$s within the selected timeframe.",r),"<strong>","</strong>")},{name:"clicks",label:a("Total Clicks",r),tooltip:u(a("The %1$stotal number of clicks that your website received from search results%2$s within the selected timeframe.",r),"<strong>","</strong>")},{name:"ctr",label:a("Avg. CTR",r),tooltip:u(a("The %1$saverage click-through rate of your content in search results%2$s within the selected timeframe.",r),"<strong>","</strong>")},{name:"position",label:a("Avg. Position",r),tooltip:u(a("The %1$saverage position of your content in search results%2$s within the selected timeframe.",r),"<strong>","</strong>")},{name:"keywords",label:a("Total Keywords",r),tooltip:u(a("The %1$stotal number of keywords that your website ranks for in search results%2$s within the selected timeframe.",r),"<strong>","</strong>")}]}},computed:{seoStatistics(){const t=[];return this.statistics.forEach(s=>{const o=this.statisticsStrings.find(i=>i.name===s);o&&t.push({...o,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){var o,i,f,c,p;const s=this.statisticsData?this.statisticsData:(i=(o=this.searchStatisticsStore.data)==null?void 0:o.seoStatistics)==null?void 0:i.statistics;return s?{total:s[t]||0,difference:s.difference&&Math.abs(s.difference[t])||0,direction:s.difference&&0>s.difference[t]?"down":"up",chart:(p=(c=(f=this.searchStatisticsStore.data)==null?void 0:f.seoStatistics)==null?void 0:c.intervals)==null?void 0:p.map(l=>({x:D(new Date(l.date+" 00:00:00"),this.rootStore.aioseo.data.dateFormat),y:l[t]?l[t]:0}))}:{total:0,difference:0,direction:"up",chart:[]}}}},z={class:"statistics-title"},E=["innerHTML"],H={class:"statistics-current"},P={class:"statistics-current-total"},I={key:0,class:"statistics-chart"};function J(t,s,o,i,f,c){const p=d("svg-circle-question-mark"),l=d("core-tooltip"),b=d("statistic"),k=d("graph"),x=d("core-loader");return n(),m("div",{class:S(["aioseo-seo-statistics-overview",{[o.view]:!0,"hide-graph":!o.showGraph}]),style:R(c.style)},[(n(!0),m(j,null,F(c.seoStatistics,(e,C)=>(n(),m("div",{key:C,class:"statistics"},[h("div",{class:S([{blurred:i.searchStatisticsStore.loading.seoStatistics}])},[h("div",z,[O(y(e.label)+" ",1),e.tooltip?(n(),v(l,{key:0},{tooltip:w(()=>[h("span",{innerHTML:e.tooltip},null,8,E)]),default:w(()=>[_(p)]),_:2},1024)):g("",!0)]),h("div",H,[h("div",P,y(i.formatStatistic(e.name,e.data.total)),1),_(b,{class:S(["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"])]),o.showGraph?(n(),m("div",I,[_(k,{series:[{name:e.label,data:e.data.chart}],height:60,preset:"overview","invert-y-axis":e.name==="position"},null,8,["series","invert-y-axis"])])):g("",!0)],2),i.searchStatisticsStore.loading.seoStatistics?(n(),v(x,{key:0,dark:""})):g("",!0)]))),128))],6)}const at=V(q,[["render",J]]);export{at as S};