import{a as e,c as d}from"./js/runtime-dom.esm-bundler.f6259c83.js";import{l as p}from"./js/index.7c01c5f2.js";import{l as k}from"./js/index.e8c482d5.js";import{l as f}from"./js/index.d80c2c2c.js";import{g as _,u as h,a as L,l as S,m as g}from"./js/index.ed1fc0db.js";import{e as w}from"./js/elemLoaded.2921fc72.js";import{G as A}from"./js/constants.fe8bda37.js";import{a as y}from"./js/addons.edaa5cfa.js";import{u as v}from"./js/url.f8a3cb5f.js";import{S as C}from"./js/Information.2e3d122e.js";import{S as F}from"./js/Close.8fb798f7.js";import"./js/translations.d159963e.js";import{_ as x}from"./js/_plugin-vue_export-helper.eefbdd86.js";import{s as E,_ as V}from"./js/default-i18n.20001971.js";import{a6 as a,o as P,c as D,m as r,a as I,a4 as N}from"./js/runtime-core.esm-bundler.4f558f23.js";import"./js/Button.e237bb50.js";import"./js/Input.d9e61fc6.js";import"./js/Index.504e4ac6.js";import"./js/Pencil.b89246dd.js";import"./js/Trash.263ee9c7.js";import"./js/Select.4ddf605b.js";import"./js/Caret.b694929e.js";import"./js/Toggle.61ecb096.js";import"./js/helpers.2a6f0df7.js";import"./js/upperFirst.3f8e52b4.js";const U="all-in-one-seo-pack",B={setup(){return{licenseStore:_(),postEditorStore:h(),rootStore:L()}},components:{SvgCircleInformation:C,SvgClose:F},data(){return{linkFormatValue:{},disabled:!1,url:null,strings:{upsell:E(V("Did you know you can automatically add internal links using Link Assistant? %1$s",U),S.getPlainLink(A.learnMore,this.rootStore.aioseo.urls.aio.linkAssistant,!0))}}},computed:{canShowUpsell(){const o=y.getAddon("aioseo-link-assistant"),{options:t}=this.postEditorStore.currentPost,i=t.linkFormat.internalLinkCount,n=t.linkFormat.linkAssistantDismissed;return(this.licenseStore.isUnlicensed||!o||!o.isActive||o.requiresUpgrade)&&2<i&&!n&&!this.disabled&&this.linkFormatValue.url&&this.isInternalLink(this.linkFormatValue.url)}},methods:{async linkAdded(o){var s;await this.$nextTick();const{options:t}=this.postEditorStore.currentPost,i=t.linkFormat.internalLinkCount,n=t.linkFormat.linkAssistantDismissed;2<i||n||this.isInternalLink(o.url||((s=o.suggestion)==null?void 0:s.url)||null)&&this.postEditorStore.incrementInternalLinkCount()},async setLinkFormatValue(){await this.$nextTick();const o=document.querySelector("#aioseo-link-assistant-education input");!this.linkFormatValue.url&&(o!=null&&o.value)&&(this.linkFormatValue=JSON.parse(o.value))},isInternalLink(o){const t=v.parse(o,!1,!0);return o.indexOf("//")===-1&&o.indexOf("/")===0?!0:o.indexOf("#")===0?!1:t.host?t.host===this.rootStore.aioseo.urls.domain:!0}},created(){this.setLinkFormatValue();const{addAction:o,hasAction:t}=window.wp.hooks;t("aioseo-link-format-link-added","aioseo")||o("aioseo-link-format-link-added","aioseo",this.linkAdded)}},O={key:0,class:"aioseo-link-assistant-did-you-know"},T=["innerHTML"];function b(o,t,i,n,s,u){const c=a("svg-circle-information"),m=a("svg-close");return u.canShowUpsell?(P(),D("div",O,[r(c),I("span",{onClick:t[0]||(t[0]=e(G=>s.disabled=!0,["stop"])),innerHTML:s.strings.upsell},null,8,T),r(m,{onClick:e(n.postEditorStore.disableLinkAssistantEducation,["stop"])},null,8,["onClick"])])):N("",!0)}const M=x(B,[["render",b]]),l=()=>{let o=d({...M,name:"Standalone/LinkFormat"});o=p(o),o=k(o),o=f(o),g(o),o.mount("#aioseo-link-assistant-education-mount")};window.aioseo&&window.aioseo.currentPost&&window.aioseo.currentPost.context==="post"&&(document.getElementById("aioseo-link-assistant-education")?l():(w("#aioseo-link-assistant-education","aioseoLaDidYouKnow"),document.addEventListener("animationstart",function(t){t.animationName==="aioseoLaDidYouKnow"&&l()},{passive:!0})));
