import{R,C as T,L as C}from"./Redirects.a4c01581.js";import{r as w,a as x,b as U}from"./index.684c656d.js";import{C as k}from"./Index.13d8541a.js";import{C as A}from"./Card.bf13def3.js";import{G as L}from"./constants.ee441da2.js";import{C as $}from"./Caret.2e43336b.js";import"./translations.d159963e.js";import{_ as S}from"./_plugin-vue_export-helper.eefbdd86.js";import{s as B,_ as u}from"./default-i18n.20001971.js";import{y as s,o as n,c as l,w as g,e as y,H as c,a as N,t as M,b as _,d as v,u as o}from"./runtime-dom.esm-bundler.d8b05b6d.js";import{u as H}from"./AddonConditions.14b242fa.js";const f="aioseo-pro",P={setup(){return{redirectsStore:w(),rootStore:x()}},components:{CoreAlert:$},data(){return{strings:{nginxReload:B(u("Your redirect settings have been updated. In order for them to work properly you may need to reload your %1$s configuration. %2$s",f),this.detectedServer(),U.getDocLink(L.learnMore,"redirectServerConfigReload",!0)),dontKnow:u("If you don't know how to do that please revert your Redirect Method to PHP.",f),checkAgain:u("Check Again",f)}}},methods:{maybeTest(){this.redirectsStore.testServerRedirects()},detectedServer(){switch(this.rootStore.aioseo.data.server){case"apache":return"Apache";case"nginx":return"NGINX";case"litespeed":return"LiteSpeed";default:return""}}},mounted(){this.maybeTest(),window.aioseoBus.$on("changes-saved",this.maybeTest),window.aioseoBus.$on("added-redirect",this.maybeTest),window.aioseoBus.$on("redirect-updated",this.maybeTest)},beforeUnmount(){window.aioseoBus.$off("changes-saved",this.maybeTest),window.aioseoBus.$off("added-redirect",this.maybeTest),window.aioseoBus.$off("redirect-updated",this.maybeTest)}},q=["innerHTML"],I=["innerHTML"];function G(e,i,p,t,r,a){const d=s("base-button"),m=s("core-alert");return t.redirectsStore.server.redirectTest.failed&&t.redirectsStore.options.main.method==="server"?(n(),l(m,{key:0,size:"small",type:"yellow"},{default:g(()=>[y("div",{innerHTML:r.strings.nginxReload},null,8,q),y("div",{innerHTML:r.strings.dontKnow},null,8,I),c(d,{type:"blue",size:"small",onClick:i[0]||(i[0]=h=>t.redirectsStore.testServerRedirects()),loading:t.redirectsStore.server.redirectTest.testing},{default:g(()=>[N(M(r.strings.checkAgain),1)]),_:1},8,["loading"])]),_:1})):_("",!0)}const V=S(P,[["render",G],["__scopeId","data-v-af1db2ac"]]),z="aioseo-pro",O={setup(){return{redirectsStore:w()}},components:{CoreAddRedirection:k,CoreCard:A,ServerConfigReloadWarning:V,RedirectsTable:R},data(){return{queryUrls:[],targetUrl:"",type:0,strings:{addNewRedirection:u("Add New Redirection",z)}}},computed:{getType(){return this.type?this.type:-1},getTarget(){return this.targetUrl?this.targetUrl:this.queryUrls.length?"/":""},getUrls(){return this.redirectsStore.manualUrls.length?(this.redirectsStore.manualUrls.forEach(e=>{this.queryUrls.push({url:e.url,regex:e.regex||!1,ignoreSlash:e.slash||!1,ignoreCase:e.case||!1,errors:[],warnings:[]}),e.target&&(this.targetUrl=e.target),e.type&&(this.type=e.type)}),this.queryUrls):this.queryUrls}}},j={class:"aioseo-redirects"};function D(e,i,p,t,r,a){const d=s("server-config-reload-warning"),m=s("core-add-redirection"),h=s("core-card"),b=s("redirects-table");return n(),v("div",j,[c(d),c(h,{slug:"addNewRedirection","header-text":r.strings.addNewRedirection},{default:g(()=>[c(m,{urls:a.getUrls,target:a.getTarget,type:a.getType},null,8,["urls","target","type"])]),_:1},8,["header-text"]),c(b)])}const E=S(O,[["render",D]]),K={class:"aioseo-redirects-main"},W={__name:"Redirects",setup(e){const{shouldShowActivate:i,shouldShowLite:p,shouldShowMain:t,shouldShowUpdate:r}=H({addonSlug:"aioseo-redirects"});return(a,d)=>(n(),v("div",K,[o(t)?(n(),l(o(E),{key:0})):_("",!0),o(r)||o(i)?(n(),l(o(T),{key:1})):_("",!0),o(p)?(n(),l(o(C),{key:2})):_("",!0)]))}},ne=Object.freeze(Object.defineProperty({__proto__:null,default:W},Symbol.toStringTag,{value:"Module"}));export{ne as R,V as S,W as _};
