import{c as y}from"./js/runtime-dom.esm-bundler.dc49ee3e.js";import{l as R}from"./js/index.b24095c1.js";import{l as C}from"./js/index.6dbf4bd7.js";import{a as w,g as S,h as k,l as A,m as L}from"./js/index.e0fdfdc6.js";/* empty css                */import{C as E}from"./js/Index.2713d4dd.js";import{C as v}from"./js/Index.b4d0090f.js";import"./js/translations.5e539ab1.js";import{_ as x}from"./js/_plugin-vue_export-helper.eefbdd86.js";import{i as H}from"./js/isEmpty.41cbef07.js";import{_ as c,s as b}from"./js/default-i18n.368c2d5c.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.277f0e3d.js";import"./js/Input.94feb999.js";import"./js/Index.2a391835.js";import"./js/Close.ccd53ef3.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/constants.cb29e214.js";import"./js/JsonValues.a0694556.js";import"./js/Index.b6404baa.js";import"./js/Url.1c574b17.js";import"./js/Exclamation.fc507dc9.js";import"./js/Checkbox.e1f30786.js";import"./js/Checkmark.762f711e.js";import"./js/ProBadge.e6ec5f9a.js";import"./js/External.641efa63.js";import"./js/escapeRegExp.565287d4.js";import"./js/Gear.0f79dbf5.js";import"./js/Slide.3003ef51.js";import"./js/date.bb1bcec3.js";import"./js/datetime.f197aeae.js";import"./js/DatePicker.14dbede9.js";import"./js/Calendar.9a717949.js";import"./js/pick.d8956d6e.js";import"./js/_getTag.e070317d.js";import"./js/debounce.e3ec254d.js";import"./js/toNumber.aa196b9c.js";import"./js/isEqual.657ec1c5.js";import"./js/_baseIsEqual.bda31e23.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:v},data(){return{urls:[],display:!1,target:null,loading:!1,strings:{modalHeader:c("Add a Redirect",u),redirectAdded:b(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,H(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=x(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");
