import{c as y}from"./js/runtime-dom.esm-bundler.dc49ee3e.js";import{l as R}from"./js/index.20093c86.js";import{l as C}from"./js/index.f5fa0cce.js";import{a as w,i as S,h as k,b as A,l as L}from"./js/index.4b887428.js";/* empty css                */import{C as E}from"./js/Index.25ae8dfb.js";import{C as b}from"./js/Index.9e9d564d.js";import"./js/translations.e71e2202.js";import{_ as v}from"./js/_plugin-vue_export-helper.eefbdd86.js";import{i as x}from"./js/isEmpty.15767c6b.js";import{_ as c,a as H}from"./js/default-i18n.65d58dd6.js";import{c as B,l as P,a2 as d,a4 as l,a6 as p,o as m,a7 as T,$ as U,_ as N,a1 as V}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/Close.ccd53ef3.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/constants.bc5863fe.js";import"./js/JsonValues.a0694556.js";import"./js/Index.778efbec.js";import"./js/Url.9f0afcb2.js";import"./js/Exclamation.fc507dc9.js";import"./js/Checkbox.6a913600.js";import"./js/Checkmark.762f711e.js";import"./js/ProBadge.e6ec5f9a.js";import"./js/External.641efa63.js";import"./js/escapeRegExp.39041b6f.js";import"./js/Gear.0f79dbf5.js";import"./js/Slide.3003ef51.js";import"./js/date.f7db1924.js";import"./js/datetime.f197aeae.js";import"./js/DatePicker.36e9e18f.js";import"./js/Calendar.9a717949.js";import"./js/pick.25b3ec2e.js";import"./js/_getTag.6fb74b2e.js";import"./js/debounce.652fa24c.js";import"./js/toNumber.ad9dffac.js";import"./js/isEqual.59768dc1.js";import"./js/_baseIsEqual.c0ca09f7.js";import"./js/Tooltip.23c7170d.js";import"./js/Plus.c9b03af8.js";const u="all-in-one-seo-pack",D={setup(){return{rootStore:w(),licenseStore:S()}},components:{CoreModal:E,CoreAddRedirection:b},data(){return{urls:[],display:!1,target:null,loading:!1,strings:{modalHeader:c("Add a Redirect",u),redirectAdded:H(c('%2$sYour redirect was added and you may edit it <a href="%1$s" target="_blank">here</a>.%3$s',u),this.rootStore.aioseo.urls.aio.redirects,"<strong>","</strong>")},watchClasses:["aioseo-redirects-slug-changed","aioseo-redirects-trashed-post"]}},computed:{classSelectors(){return"."+this.watchClasses.join(", .")}},methods:{reload(){var t,o;this.display=!1;const e=(o=(t=this.target)==null?void 0:t.parentElement)==null?void 0:o.parentElement;if(e&&(e.classList.contains("components-notice__content")||e.classList.contains("notice"))){e.innerHTML="<p>"+this.strings.redirectAdded+"</p>";return}this.target.outerHTML=this.strings.redirectAdded},loadRedirect(e){this.loading=!0,k.get(A.restUrl("redirects/manual-redirects/"+e)).then(t=>{this.urls=t.body.redirects,this.loading=!1}).catch(t=>console.error("Redirect modal failed to load the redirect data.",t))},preloadRedirect(){const e=document.querySelector(this.classSelectors);if(e){const t=this.getElementRedirectHash(e);if(!t)return;this.loadRedirect(t)}},watchClicks(){document.body.onclick=e=>{var o;if(!((o=e.target)!=null&&o.classList))return;let t=!1;this.watchClasses.forEach(i=>{e.target.classList.contains(i)&&(t=!0)}),t&&(e.preventDefault(),this.target=e.target,this.display=!0,x(this.urls)&&this.loadRedirect(this.getElementRedirectHash(this.target)))}},getElementRedirectHash(e){return new URLSearchParams(e.href).get("aioseo-manual-urls")}},async created(){this.preloadRedirect(),this.watchClicks(),window.aioseoBus.$on("wp-core-notice-created",()=>{this.$nextTick(()=>{this.preloadRedirect()})})}},M={key:0,class:"aioseo-redirects-add-redirect-standalone"},j={class:"bd"};function q(e,t,o,i,r,f){const _=p("core-add-redirection"),g=p("core-modal");return!i.licenseStore.isUnlicensed&&i.rootStore.isPro?(m(),B("div",M,[P(g,{show:r.display,classes:["aioseo-redirects"],onClose:t[0]||(t[0]=a=>r.display=!1),"allow-overflow":""},{headerTitle:d(()=>[T(U(r.strings.modalHeader),1)]),body:d(()=>{var a,n;return[N("div",j,[r.loading?l("",!0):(m(),V(_,{key:0,urls:r.urls,target:(a=r.urls[0])!=null&&a.target?(n=r.urls[0])==null?void 0:n.target:"/",disableSource:!0,onAddedRedirect:f.reload},null,8,["urls","target","onAddedRedirect"]))])]}),_:1},8,["show"])])):l("",!0)}const Y=v(D,[["render",q]]),h=document.createElement("div");h.id="aioseo-redirects-add-redirect-standalone";document.body.appendChild(h);let s=y({...Y,name:"Standalone/Redirects/AddRedirect"});s=R(s);s=C(s);L(s);s.mount("#aioseo-redirects-add-redirect-standalone");
