import{v as a,c as _,C as g,l as n,b as c,o as d,x as y,t as R,a as C,k as w,Y as k}from"./js/runtime-dom.esm-bundler.h3clfjuw.js";import{l as A}from"./js/index.nd8elblc.js";import{l as S}from"./js/index.h076fivy.js";import{u as v,B as x,e as E,l as L}from"./js/index.nsvc8vqf.js";/* empty css                */import{a as b}from"./js/addons.foby19s7.js";import{C as H}from"./js/Index.fywmukpg.js";import{C as B}from"./js/Index.liespbtj.js";import"./js/translations.lf9cwm9a.js";import{_ as T}from"./js/_plugin-vue_export-helper.oebm7xum.js";import{i as N}from"./js/isEmpty.e11j26lh.js";import{_ as l,a as P}from"./js/default-i18n.hohxoesu.js";import"./js/Caret.hnvbzqgq.js";import"./js/helpers.fdpg7vgg.js";import"./js/upperFirst.mzmrvvb6.js";import"./js/_stringToArray.mpukyt2g.js";import"./js/toString.g0kcp64r.js";import"./js/constants.fxxegv78.js";import"./js/JsonValues.g6ep3o3z.js";import"./js/ProBadge.ab6jhp8x.js";import"./js/External.h5te4wqm.js";import"./js/escapeRegExp.cd9ew2v1.js";import"./js/Exclamation.f0pmbpi9.js";import"./js/Checkbox.fww0datn.js";import"./js/Checkmark.d5kkjaf5.js";import"./js/Gear.dx9icaxx.js";import"./js/Slide.dop8j51m.js";import"./js/date.ecds9xx3.js";import"./js/DatePicker.odhs29tp.js";import"./js/Calendar.fbofsn3b.js";import"./js/pick.dywdbgah.js";import"./js/_baseSet.lqwmtpeb.js";import"./js/_getTag.h6v5trhq.js";import"./js/debounce.paenkskr.js";import"./js/toNumber.lmnvj60l.js";import"./js/_baseTrim.ohbpllmu.js";import"./js/isEqual.gulmggc8.js";import"./js/_baseIsEqual.hstd7xe6.js";import"./js/Tooltip.jx4casvt.js";import"./js/Plus.e1tf1dpc.js";const p="all-in-one-seo-pack",U={setup(){return{rootStore:v()}},components:{CoreModal:H,CoreAddRedirection:B},data(){return{addons:b,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,x.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=a("core-add-redirection"),f=a("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:n(()=>[y(R(r.strings.modalHeader),1)]),body:n(()=>[C("div",D,[r.loading?c("",!0):(d(),w(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 Y=T(U,[["render",M]]),m=document.createElement("div");m.id="aioseo-redirects-add-redirect-standalone";document.body.appendChild(m);let s=k({...Y,name:"Standalone/Redirects/AddRedirect"});s=A(s);s=S(s);L(s);s.mount("#aioseo-redirects-add-redirect-standalone");
