관리-도구
편집 파일: GoogleSearchPreview.mmblg2b4.js
import{u as d,p as x,q as N}from"./index.ba51ghj9.js";import{g as q,t as V}from"./postSlug.ms4f44w2.js";import{C as H}from"./constants.hcfrsngk.js";import{a as M}from"./Caret.dwp6xpza.js";import"./translations.b896ab1m.js";import{D as j,v as A,o,c as n,a as s,t as a,x as F,F as v,J as w,b as h,C as B,G as D,K as I,L as O}from"./runtime-dom.esm-bundler.h3clfjuw.js";import{_ as P}from"./_plugin-vue_export-helper.oebm7xum.js";import{_ as g,b as L,a as U}from"./default-i18n.hohxoesu.js";const c="all-in-one-seo-pack",f={components:{SvgCaret:M},props:{focusKeyphrase:String,device:{type:String,default:"desktop"},favicon:String,hostname:{type:String,default(){const e=d();return e.aioseo.data.siteName||e.aioseo.urls.domain}},url:{type:String,default(){return d().aioseo.urls.home}},title:String,description:String,richResults:Object},data(){return{strings:{free:g("Free",c),rating:g("Rating",c),prosCons:g("Pros and cons include",c),viewFullList:g("View full list",c)}}},computed:{faq(){var t;const e=((t=this.richResults)==null?void 0:t.faq)||[];return Array.isArray(e)&&e.length?e:[]},reviewSnippet(){var r;const t={...{bestRating:null,ratingValue:null,reviewCount:null,ratingCount:null,priceCurrency:null,price:null,priceFrom:null,priceTo:null,prosConsNotes:[]},...((r=this.richResults)==null?void 0:r.reviewSnippet)||{}};if(Object.values(t).every(l=>l===null)||!t.reviewCount&&!t.ratingCount)return{};for(const[l,p]of Object.entries(t))if(["bestRating","ratingValue"].includes(l)&&(5<p||p===null))return{};return t.price=isNaN(parseFloat(t.price))?null:parseFloat(t.price).toFixed(2),t.priceFrom=isNaN(parseFloat(t.priceFrom))?null:parseFloat(t.priceFrom).toFixed(2),t.priceTo=isNaN(parseFloat(t.priceTo))?null:parseFloat(t.priceTo).toFixed(2),t},yellowStarsWidth(){return`${this.reviewSnippet.ratingValue*100/5}%`},urlBreadcrumbs(){try{const e=new URL(this.url);let t=e.hostname+e.pathname.replace(/\/$/,"");return t=t.substring(0,50).trim()+(50<t.length?"...":""),`${e.protocol}//`+t.replaceAll("/"," › ")}catch{return""}},parseFavicon(){var r;const e=d();let t=`https://www.google.com/s2/favicons?sz=64&domain=${e.aioseo.urls.domain}`;try{t=new URL(this.favicon||"").href}catch{(r=e.aioseo.data)!=null&&r.isDev&&(t=`${e.aioseo.urls.home}/favicon.ico`)}return t},parseDescription(){let e=q(this.description.substring(0,160).trim()+(160<this.description.length?" ...":""),!1);if(e=x(e),!this.focusKeyphrase)return e;const t=this.focusKeyphrase.split(" "),r=new RegExp("\\b"+t.join("\\b|\\b")+"\\b","gi");return e.replace(r,"<strong>$&</strong>")}},methods:{stripTags:N,getReviewSnippetPriceLabel(){if(parseFloat(this.reviewSnippet.price)===0&&!this.reviewSnippet.priceTo)return this.strings.free;if(this.reviewSnippet.priceCurrency){const e=H.find(t=>t.value===this.reviewSnippet.priceCurrency)||{};return this.reviewSnippet.priceFrom&&this.reviewSnippet.priceTo?`${e==null?void 0:e.symbol}${this.reviewSnippet.priceFrom} - ${e==null?void 0:e.symbol}${this.reviewSnippet.priceTo}`:`${e==null?void 0:e.symbol}${this.reviewSnippet.price}`}return`$${this.reviewSnippet.price}`},getReviewSnippetCountLabel(){if(this.device==="desktop"){const e=this.reviewSnippet.ratingCount||this.reviewSnippet.reviewCount,t=this.reviewSnippet.ratingCount?L("vote","votes",e,c):L("review","reviews",e,c);return U(g("%1$s %2$s",c),e,t)}return`(${this.reviewSnippet.ratingCount||this.reviewSnippet.reviewCount})`},truncate:V}},R=()=>{j(e=>({ee980a1a:e.yellowStarsWidth}))},T=f.setup;f.setup=T?(e,t)=>(R(),T(e,t)):R;const m=e=>(I("data-v-0e1f38b7"),e=e(),O(),e),z={class:"aioseo-google-search-preview__main"},K={class:"aioseo-google-search-preview__favicon"},E={class:"favicon-wrapper"},G=["src"],W={class:"aioseo-google-search-preview__location"},J={class:"hostname text-truncate"},Y=["innerHTML"],Q={class:"aioseo-google-search-preview__title"},X=["innerHTML"],Z={key:0,class:"aioseo-google-search-preview__pros-cons"},$={class:"aioseo-google-search-preview__pros-cons__description"},ee=m(()=>s("span",null," ",-1)),te=m(()=>s("span",{class:"bullet"},null,-1)),se={class:"aioseo-google-search-preview__pros-cons__view-full-list"},ie={key:1,class:"aioseo-google-search-preview__review-snippet"},re=m(()=>s("div",{class:"aioseo-google-search-preview__review-snippet__stars"},[s("div")],-1)),oe={class:"aioseo-google-search-preview__review-snippet__rating"},ne={class:"aioseo-google-search-preview__review-snippet__count bullet"},ae={key:0,class:"aioseo-google-search-preview__review-snippet__price bullet"},ce={key:2,class:"aioseo-google-search-preview__anchor"},le={class:"aioseo-google-search-preview__anchor__link"},pe={key:0,class:"aioseo-google-search-preview__anchor__bullet"},ue={key:3,class:"aioseo-google-search-preview__faq"},_e={class:"aioseo-google-search-preview__faq__question",role:"button"},he=["innerHTML"],ve=["innerHTML"];function ge(e,t,r,l,p,i){var S,y,b,C;const k=A("svg-caret");return o(),n("div",{class:D(["aioseo-google-search-preview",`aioseo-google-search-preview--${r.device}`])},[s("div",z,[s("div",K,[s("div",E,[s("img",{src:i.parseFavicon,alt:"Favicon",loading:"lazy",decoding:"async",height:"18",width:"18"},null,8,G)])]),s("div",W,[s("div",J,a(r.hostname.replace(/^(m|www)\./,"")),1),s("div",{class:"url text-truncate",innerHTML:i.urlBreadcrumbs},null,8,Y)]),s("div",Q,a(r.title.substring(0,70).trim()+(r.title.length>70?" ...":"")),1),s("div",{class:"aioseo-google-search-preview__description",innerHTML:i.parseDescription},null,8,X)]),(S=i.reviewSnippet.prosConsNotes||[])!=null&&S.length?(o(),n("div",Z,[F(a(p.strings.prosCons)+": ",1),(o(!0),n(v,null,w(i.reviewSnippet.prosConsNotes.slice(0,10),(u,_)=>(o(),n(v,{key:`pros-cons-${_}`},[s("span",$,a(u),1),ee,te],64))),128)),s("span",se,a(p.strings.viewFullList),1)])):h("",!0),Object.values(i.reviewSnippet).length?(o(),n("div",ie,[re,s("div",oe,[s("span",null,a(p.strings.rating)+":",1),F(" "+a(parseFloat(i.reviewSnippet.ratingValue).toFixed(2)),1)]),s("div",ne,a(i.getReviewSnippetCountLabel()),1),((y=i.reviewSnippet)==null?void 0:y.price)!==null?(o(),n("div",ae,a(i.getReviewSnippetPriceLabel()),1)):h("",!0)])):h("",!0),(C=(b=r.richResults)==null?void 0:b.anchorLinks)!=null&&C.length?(o(),n("div",ce,[(o(!0),n(v,null,w(r.richResults.anchorLinks,(u,_)=>(o(),n(v,{key:`anchor-${_}`},[s("span",le,a(i.truncate(u,30)),1),_!==r.richResults.anchorLinks.length-1?(o(),n("span",pe," • ")):h("",!0)],64))),128))])):h("",!0),Object.values(i.faq).length?(o(),n("div",ue,[(o(!0),n(v,null,w(i.faq.slice(0,3),(u,_)=>(o(),n("details",{key:`faq-${_}`,class:"aioseo-google-search-preview__faq__container"},[s("summary",_e,[s("span",{class:"text-truncate",innerHTML:i.truncate(i.stripTags(u.question),60)},null,8,he),B(k,{width:"20"})]),s("span",{class:"aioseo-google-search-preview__faq__answer",innerHTML:i.stripTags(u.answer)},null,8,ve)]))),128))])):h("",!0)],2)}const Fe=P(f,[["render",ge],["__scopeId","data-v-0e1f38b7"]]);export{Fe as C};