import{d as _,H as g,w as a,b as n,y as c,o as d,a as y,t as R,e as w,c as C,Y as A}from"./js/runtime-dom.esm-bundler.d8b05b6d.js";import{l as k}from"./js/index.1e409735.js";import{l as S}from"./js/index.62c20ef8.js";import{a as b,h as v,b as E,l as H}from"./js/index.684c656d.js";/* empty css                */import{a as L}from"./js/addons.20532c13.js";import{C as x}from"./js/Index.f979fbbe.js";import{C as B}from"./js/Index.13d8541a.js";import"./js/translations.d159963e.js";import{_ as T}from"./js/_plugin-vue_export-helper.eefbdd86.js";import{i as N}from"./js/isEmpty.3ae5d872.js";import{_ as l,s as P}from"./js/default-i18n.20001971.js";import"./js/Caret.2e43336b.js";import"./js/helpers.2304d5ee.js";import"./js/upperFirst.d10eb25f.js";import"./js/toString.ddc58e67.js";import"./js/constants.ee441da2.js";import"./js/JsonValues.3fcfec97.js";import"./js/Url.ee93195e.js";import"./js/ProBadge.e29f5c16.js";import"./js/External.9019c3ac.js";import"./js/escapeRegExp.80171632.js";import"./js/Exclamation.e58309d9.js";import"./js/Checkbox.a4e60e91.js";import"./js/Checkmark.39dd9d2f.js";import"./js/Gear.532438a0.js";import"./js/Slide.53cdbff7.js";import"./js/date.10ef6814.js";import"./js/datetime.f197aeae.js";import"./js/DatePicker.4947f855.js";import"./js/Calendar.ab3812e2.js";import"./js/pick.64ebc447.js";import"./js/_basePickBy.a75ee359.js";import"./js/_baseSet.a2dfaed5.js";import"./js/_getTag.f48446e8.js";import"./js/debounce.36488f98.js";import"./js/toNumber.cb55aa76.js";import"./js/isEqual.4ddce6d4.js";import"./js/_baseIsEqual.fbe0f200.js";import"./js/Tooltip.f699c54b.js";import"./js/Plus.4801a669.js";const p="all-in-one-seo-pack",U={setup(){return{rootStore:b()}},components:{CoreModal:x,CoreAddRedirection:B},data(){return{addons:L,urls:[],display:!1,target:null,loading:!1,strings:{modalHeader:l("Add a Redirect",p),redirectAdded:P(l('%2$sYour redirect was added and you may edit it <a href="%1$s" target="_blank">here</a>.%3$s',p),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,v.get(E.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,N(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()})})}},V={key:0,class:"aioseo-redirects-add-redirect-standalone"},D={class:"bd"};function M(e,t,o,i,r,u){const h=c("core-add-redirection"),f=c("core-modal");return r.addons.isActive("aioseo-redirects")?(d(),_("div",V,[g(f,{show:r.display,classes:["aioseo-redirects"],onClose:t[0]||(t[0]=j=>r.display=!1),"allow-overflow":""},{headerTitle:a(()=>[y(R(r.strings.modalHeader),1)]),body:a(()=>[w("div",D,[r.loading?n("",!0):(d(),C(h,{key:0,urls:r.urls,target:r.urls[0].target?r.urls[0].target:"/",disableSource:!0,onAddedRedirect:u.reload},null,8,["urls","target","onAddedRedirect"]))])]),_:1},8,["show"])])):n("",!0)}const Y=T(U,[["render",M]]),m=document.createElement("div");m.id="aioseo-redirects-add-redirect-standalone";document.body.appendChild(m);let s=A({...Y,name:"Standalone/Redirects/AddRedirect"});s=k(s);s=S(s);H(s);s.mount("#aioseo-redirects-add-redirect-standalone");
