import{c as _}from"./js/runtime-dom.esm-bundler.f6259c83.js";import{l as g}from"./js/index.7c01c5f2.js";import{l as y}from"./js/index.e8c482d5.js";import{a as R,h as C,l as w,m as A}from"./js/index.ed1fc0db.js";/* empty css                */import{a as k}from"./js/addons.edaa5cfa.js";import{C as S}from"./js/Index.f8f0baa8.js";import{C as v}from"./js/Index.82ced936.js";import"./js/translations.d159963e.js";import{_ as E}from"./js/_plugin-vue_export-helper.eefbdd86.js";import{i as L}from"./js/isEmpty.42fb60ee.js";import{_ as a,s as x}from"./js/default-i18n.20001971.js";import{c as H,m as b,a2 as n,a4 as c,a6 as d,o as l,a7 as B,$ as T,a as N,a1 as P}from"./js/runtime-core.esm-bundler.4f558f23.js";import"./js/Button.e237bb50.js";import"./js/Input.d9e61fc6.js";import"./js/Index.504e4ac6.js";import"./js/Close.8fb798f7.js";import"./js/Pencil.b89246dd.js";import"./js/Trash.263ee9c7.js";import"./js/Select.4ddf605b.js";import"./js/Caret.b694929e.js";import"./js/Toggle.61ecb096.js";import"./js/helpers.2a6f0df7.js";import"./js/upperFirst.3f8e52b4.js";import"./js/constants.fe8bda37.js";import"./js/JsonValues.a0694556.js";import"./js/Url.5bd27f81.js";import"./js/ProBadge.e183057c.js";import"./js/External.6c86fb0e.js";import"./js/escapeRegExp.1558744f.js";import"./js/Exclamation.fb1e454f.js";import"./js/Checkbox.b57a023c.js";import"./js/Checkmark.8c62b4d7.js";import"./js/Gear.2de185a5.js";import"./js/Slide.3e3dec13.js";import"./js/date.b84c8300.js";import"./js/datetime.f197aeae.js";import"./js/DatePicker.48f10404.js";import"./js/Calendar.84824d39.js";import"./js/pick.6add30b1.js";import"./js/_getTag.325cf680.js";import"./js/debounce.af20df25.js";import"./js/toNumber.f2e9bc9b.js";import"./js/isEqual.78f19070.js";import"./js/_baseIsEqual.51c85fd4.js";import"./js/Tooltip.447e44bb.js";import"./js/Plus.ff4b71e3.js";const p="all-in-one-seo-pack",U={setup(){return{rootStore:R()}},components:{CoreModal:S,CoreAddRedirection:v},data(){return{addons:k,urls:[],display:!1,target:null,loading:!1,strings:{modalHeader:a("Add a Redirect",p),redirectAdded:x(a('%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 e,o;this.display=!1;const t=(o=(e=this.target)==null?void 0:e.parentElement)==null?void 0:o.parentElement;if(t&&(t.classList.contains("components-notice__content")||t.classList.contains("notice"))){t.innerHTML="<p>"+this.strings.redirectAdded+"</p>";return}this.target.outerHTML=this.strings.redirectAdded},loadRedirect(t){this.loading=!0,C.get(w.restUrl("redirects/manual-redirects/"+t)).then(e=>{this.urls=e.body.redirects,this.loading=!1}).catch(e=>console.error("Redirect modal failed to load the redirect data.",e))},preloadRedirect(){const t=document.querySelector(this.classSelectors);if(t){const e=this.getElementRedirectHash(t);if(!e)return;this.loadRedirect(e)}},watchClicks(){document.body.onclick=t=>{var o;if(!((o=t.target)!=null&&o.classList))return;let e=!1;this.watchClasses.forEach(i=>{t.target.classList.contains(i)&&(e=!0)}),e&&(t.preventDefault(),this.target=t.target,this.display=!0,L(this.urls)&&this.loadRedirect(this.getElementRedirectHash(this.target)))}},getElementRedirectHash(t){return new URLSearchParams(t.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(t,e,o,i,r,u){const h=d("core-add-redirection"),f=d("core-modal");return r.addons.isActive("aioseo-redirects")?(l(),H("div",V,[b(f,{show:r.display,classes:["aioseo-redirects"],onClose:e[0]||(e[0]=j=>r.display=!1),"allow-overflow":""},{headerTitle:n(()=>[B(T(r.strings.modalHeader),1)]),body:n(()=>[N("div",D,[r.loading?c("",!0):(l(),P(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"])])):c("",!0)}const $=E(U,[["render",M]]),m=document.createElement("div");m.id="aioseo-redirects-add-redirect-standalone";document.body.appendChild(m);let s=_({...$,name:"Standalone/Redirects/AddRedirect"});s=g(s);s=y(s);A(s);s.mount("#aioseo-redirects-add-redirect-standalone");
