import{a as e,c as d}from"./js/runtime-dom.esm-bundler.dc49ee3e.js";import{l as p}from"./js/index.20093c86.js";import{l as k}from"./js/index.f5fa0cce.js";import{l as f}from"./js/index.d80c2c2c.js";import{i as _,u as h,a as L,b as S,l as g}from"./js/index.4b887428.js";import{e as w}from"./js/elemLoaded.2921fc72.js";import{G as A}from"./js/constants.bc5863fe.js";import{a as y}from"./js/addons.9cee8bbb.js";import{u as v}from"./js/url.a852f015.js";import{S as C}from"./js/Information.98ebb530.js";import{S as F}from"./js/Close.ccd53ef3.js";import"./js/translations.e71e2202.js";import{_ as x}from"./js/_plugin-vue_export-helper.eefbdd86.js";import{a as E,_ as V}from"./js/default-i18n.65d58dd6.js";import{a6 as a,o as P,c as D,l as r,_ as I,a4 as N}from"./js/runtime-core.esm-bundler.ce5add0b.js";import"./js/Button.9a301412.js";import"./js/Input.f04bee4d.js";import"./js/Index.2a391835.js";import"./js/Pencil.d82df6a1.js";import"./js/Trash.87a7d946.js";import"./js/Select.f950b4c6.js";import"./js/Caret.cd869c5d.js";import"./js/Toggle.11571651.js";import"./js/helpers.633a054c.js";import"./js/upperFirst.5dc701f8.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)}},B={key:0,class:"aioseo-link-assistant-did-you-know"},O=["innerHTML"];function T(o,t,i,n,s,u){const c=a("svg-circle-information"),m=a("svg-close");return u.canShowUpsell?(P(),D("div",B,[r(c),I("span",{onClick:t[0]||(t[0]=e(G=>s.disabled=!0,["stop"])),innerHTML:s.strings.upsell},null,8,O),r(m,{onClick:e(n.postEditorStore.disableLinkAssistantEducation,["stop"])},null,8,["onClick"])])):N("",!0)}const M=x(b,[["render",T]]),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})));
