import{a as e,c as d}from"./js/runtime-dom.esm-bundler.dc49ee3e.js";import{l as p}from"./js/index.b24095c1.js";import{l as k}from"./js/index.6dbf4bd7.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.e0fdfdc6.js";import{e as w}from"./js/elemLoaded.2921fc72.js";import{G as A}from"./js/constants.cb29e214.js";import{a as y}from"./js/addons.9f9e1bb8.js";import{u as v}from"./js/url.6ec249cb.js";import{S as C}from"./js/Information.98ebb530.js";import{S as F}from"./js/Close.ccd53ef3.js";import"./js/translations.5e539ab1.js";import{_ as x}from"./js/_plugin-vue_export-helper.eefbdd86.js";import{s as E,_ as V}from"./js/default-i18n.368c2d5c.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.277f0e3d.js";import"./js/Input.94feb999.js";import"./js/Index.2a391835.js";import"./js/Pencil.d82df6a1.js";import"./js/Trash.87a7d946.js";import"./js/Select.2339c1ce.js";import"./js/Caret.cd869c5d.js";import"./js/Toggle.78d1886d.js";import"./js/helpers.b1696305.js";import"./js/upperFirst.f1673ffa.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})));
