import{as as a,f as n,i as _,a0 as g,R as c,j as y,Q as R,M as d,ae as C,U as w,ap as S}from"./js/vendor-vue-ui.02763c14.js";import{l as k}from"./js/index.01468dbf.js";import{l as A}from"./js/index.aa890c6d.js";import{X as L,d as E,k as b,b as v,l as x}from"./js/app-core.82d0a9b8.js";/* empty css                */import{C as H}from"./js/Index.a7b56d13.js";import{C as U}from"./js/Index.0c668a12.js";import{_ as B}from"./js/_plugin-vue_export-helper.eefbdd86.js";import{q as P}from"./js/vendor-lodash.f9514987.js";import{a as T,_ as l}from"./js/vendor-other.2cdd5822.js";import"./js/Button.b03184b6.js";import"./js/Input.07427c66.js";import"./js/Index.ab3a7ebe.js";import"./js/Close.ed64f0a2.js";import"./js/Pencil.b091de6b.js";import"./js/Trash.9c01fca5.js";import"./js/Select.30909b5d.js";import"./js/Caret.1dd03f59.js";import"./js/Toggle.a8bd36f4.js";import"./js/vendor-datetime.430013a3.js";import"./js/JsonValues.a0694556.js";import"./js/Index.e719a21f.js";import"./js/Url.98506653.js";import"./js/Exclamation.d17923b5.js";import"./js/Checkbox.e9c7109b.js";import"./js/Checkmark.27028b68.js";import"./js/ProBadge.e8abb23c.js";import"./js/External.01278971.js";import"./js/Gear.d72a2a25.js";import"./js/Slide.59825bf3.js";import"./js/DatePicker.52e3cbe1.js";import"./js/Calendar.6723ace6.js";import"./js/vendor-date-picker.f5050174.js";import"./js/Tooltip.16bec62e.js";import"./js/Plus.1acb1230.js";const p="all-in-one-seo-pack",M={setup(){return{rootStore:v(),licenseStore:b()}},components:{CoreModal:H,CoreAddRedirection:U},data(){return{urls:[],display:!1,target:null,loading:!1,strings:{modalHeader:l("Add a Redirect",p),redirectAdded:T(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(){this.display=!1;const e=this.target?.parentElement?.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,L.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=>{if(!e.target?.classList)return;let t=!1;this.watchClasses.forEach(s=>{e.target.classList.contains(s)&&(t=!0)}),t&&(e.preventDefault(),this.target=e.target,this.display=!0,P(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()})})}},N={key:0,class:"aioseo-redirects-add-redirect-standalone"},V={class:"bd"};function D(e,t,s,i,r,u){const h=a("core-add-redirection"),f=a("core-modal");return!i.licenseStore.isUnlicensed&&i.rootStore.isPro?(n(),_("div",N,[g(f,{show:r.display,classes:["aioseo-redirects"],onClose:t[0]||(t[0]=q=>r.display=!1),"allow-overflow":""},{headerTitle:c(()=>[C(w(r.strings.modalHeader),1)]),body:c(()=>[y("div",V,[r.loading?d("",!0):(n(),R(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"])])):d("",!0)}const j=B(M,[["render",D]]),m=document.createElement("div");m.id="aioseo-redirects-add-redirect-standalone";document.body.appendChild(m);let o=S({...j,name:"Standalone/Redirects/AddRedirect"});o=k(o);o=A(o);x(o);o.mount("#aioseo-redirects-add-redirect-standalone");
