import"./js/vue2.RHmKp0B5.js";import{x as a,c as h,C as f,m as n,d,o as c,D as _,t as g,a as y,l as R,X as C}from"./js/vue.esm-bundler.CWQFYt9y.js";import{l as A}from"./js/index.C4O-AIFy.js";import{l as w}from"./js/index.BQgiQQKQ.js";import{u as k,z as S,l as E}from"./js/links.rndHrQjc.js";/* empty css                */import{a as L}from"./js/addons.CFb2IwD4.js";import{C as v}from"./js/Index.B2NJt47b.js";import{C as x}from"./js/Index.D1m9m0C0.js";import{_ as H}from"./js/_plugin-vue_export-helper.BN1snXvA.js";import{i as b}from"./js/isEmpty.CAtVAQhZ.js";import"./js/translations.Buvln_cw.js";import"./js/default-i18n.Bd0Z306Z.js";import"./js/constants.DpuIWwJ9.js";import"./js/Caret.iRBf3wcH.js";import"./js/helpers.BYd0a-KO.js";import"./js/upperFirst.cYf2npu2.js";import"./js/_stringToArray.DnK4tKcY.js";import"./js/toString.CPCYjjV1.js";import"./js/JsonValues.D25FTfEu.js";import"./js/ProBadge.WwPkDor4.js";import"./js/External.Bfg4674G.js";import"./js/escapeRegExp.BuzXJaSD.js";import"./js/Exclamation.DKtT8kuH.js";import"./js/Checkbox.D2dfpbIi.js";import"./js/Checkmark.pCOnqh_g.js";import"./js/Gear.aQH8e4fl.js";import"./js/Slide.CRIn0kdn.js";import"./js/Date.CjYsJ2CI.js";import"./js/DatePicker.C-rlnu6V.js";import"./js/get.DIB3XzO8.js";import"./js/isUndefined.BfCcsn7d.js";import"./js/_getTag.BeKoR84b.js";import"./js/debounce.DYc_Fe3x.js";import"./js/toNumber.ai1CpWpw.js";import"./js/_baseTrim.BYZhh0MR.js";import"./js/Tooltip.Jp05nfCy.js";import"./js/Plus.DrDYrwHh.js";const $={setup(){return{rootStore:k()}},components:{CoreModal:v,CoreAddRedirection:x},data(){return{addons:L,urls:[],display:!1,target:null,loading:!1,strings:{modalHeader:this.$t.__("Add a Redirect",this.$td),redirectAdded:this.$t.sprintf(this.$t.__('%2$sYour redirect was added and you may edit it <a href="%1$s" target="_blank">here</a>.%3$s',this.$td),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,S.get(this.$links.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,b(this.url)&&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.preloadRedirect()})}},B={key:0,class:"aioseo-redirects-add-redirect-standalone"},D={class:"bd"};function N(t,e,o,i,r,p){const m=a("core-add-redirection"),u=a("core-modal");return r.addons.isActive("aioseo-redirects")?(c(),h("div",B,[f(u,{show:r.display,classes:["aioseo-redirects"],onClose:e[0]||(e[0]=T=>r.display=!1)},{headerTitle:n(()=>[_(g(r.strings.modalHeader),1)]),body:n(()=>[y("div",D,[r.loading?d("",!0):(c(),R(m,{key:0,urls:r.urls,target:r.urls[0].target?r.urls[0].target:"/",disableSource:!0,onAddedRedirect:p.reload},null,8,["urls","target","onAddedRedirect"]))])]),_:1},8,["show"])])):d("",!0)}const P=H($,[["render",N]]),l=document.createElement("div");l.id="aioseo-redirects-add-redirect-standalone";document.body.appendChild(l);let s=C({...P,name:"Standalone/Redirects/AddRedirect"});s=A(s);s=w(s);E(s);s.mount("#aioseo-redirects-add-redirect-standalone");
