(window["aioseopjsonp"]=window["aioseopjsonp"]||[]).push([["tools-RobotsEditor-vue"],{"5d3c":function(t,s,e){"use strict";e("c55f")},c55f:function(t,s,e){},e4d8:function(t,s,e){"use strict";e.r(s);var o=function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("div",{staticClass:"aioseo-tools-robots-editor"},[e("core-card",{attrs:{slug:"robotsEditor","header-text":t.strings.robotsEditor}},[e("div",{staticClass:"aioseo-settings-row aioseo-section-description"},[t._v(" "+t._s(t.strings.description)+" "),e("br"),e("br"),t._v(" "+t._s(t.strings.description2)+" "),e("span",{domProps:{innerHTML:t._s(t.$links.getDocLink(t.$constants.GLOBAL_STRINGS.learnMore,"robotsEditor",!0))}})]),t.$aioseo.data.robots.hasPhysicalRobots&&t.options.tools.robots.robotsDetected?e("div",{staticClass:"aioseo-settings-row physical-robots"},[e("core-alert",{attrs:{type:"red","show-close":""},on:{"close-alert":t.hideRobotsDetected}},[t._v(" "+t._s(t.strings.physicalRobotsFound)+" "),e("div",{staticClass:"buttons"},[e("base-button",{attrs:{type:"blue",size:"medium",loading:t.importLoading},on:{click:t.importAndDeleteRobots}},[t._v(" "+t._s(t.strings.importAndDelete)+" ")]),e("base-button",{attrs:{type:"blue",size:"medium",loading:t.deleteLoading},on:{click:t.deleteRobots}},[t._v(" "+t._s(t.strings.delete)+" ")])],1)])],1):t._e(),t.$aioseo.data.robots.rewriteExists?t._e():e("div",{staticClass:"aioseo-settings-row rewrite-exists"},[e("core-alert",{attrs:{type:"red"},domProps:{innerHTML:t._s(t.missingRewriteRules)}})],1),e("core-settings-row",{attrs:{name:t.$constants.GLOBAL_STRINGS.preview,align:""},scopedSlots:t._u([{key:"content",fn:function(){return[e("div",{staticClass:"aioseo-sitemap-preview"},[e("base-button",{attrs:{size:"medium",type:"blue",tag:"a",href:t.$aioseo.urls.robotsTxtUrl,target:"_blank"}},[e("svg-external"),t._v(" "+t._s(t.strings.openRobotsTxt)+" ")],1)],1)]},proxy:!0}])}),t.$aioseo.data.subdomain||t.$aioseo.data.mainSite?e("core-settings-row",{attrs:{name:t.strings.enableCustomRobots},scopedSlots:t._u([{key:"content",fn:function(){return[e("base-toggle",{model:{value:t.options.tools.robots.enable,callback:function(s){t.$set(t.options.tools.robots,"enable",s)},expression:"options.tools.robots.enable"}})]},proxy:!0}],null,!1,1538436598)}):t._e(),t.$aioseo.data.subdomain||t.$aioseo.data.mainSite?t._e():e("core-alert",{attrs:{type:"blue"},domProps:{innerHTML:t._s(t.subdirectoryAlert)}}),t.$aioseo.data.subdomain||t.$aioseo.data.mainSite?e("div",{staticClass:"aioseo-settings-row"},[e("div",{staticClass:"settings-content"},[this.hasErrors?e("core-alert",{attrs:{type:"red"}},[t._v(" "+t._s(t.strings.duplicateOrInvalid)+" ")]):t._e(),e("div",{staticClass:"robots-table"},[e("div",{staticClass:"robots-header"},[e("div",{staticClass:"robots-user-agent"},[t._v(t._s(t.strings.userAgent))]),e("div",{staticClass:"robots-rule"},[t._v(t._s(t.strings.rule))]),e("div",{staticClass:"robots-directory-path"},[t._v(t._s(t.strings.directoryPath))]),e("div",{staticClass:"robots-actions"})]),e("div",{staticClass:"robots-rows"},t._l(t.parsedRules,(function(s,o){return e("div",{key:o,staticClass:"robots-row",class:{even:0===o%2}},[e("div",{staticClass:"robots-user-agent"},[e("base-input",{ref:"userAgent",refInFor:!0,class:t.hasError(s.userAgent+s.rule+s.directoryPath),attrs:{value:s.userAgent,size:"medium",placeholder:t.strings.userAgentPlaceholder,disabled:!t.options.tools.robots.enable},on:{blur:function(s){return t.updateRule("userAgent",s,o)}}})],1),e("div",{staticClass:"robots-rule"},[e("base-radio",{ref:"allow",refInFor:!0,attrs:{name:"rule-"+o,value:"allow"===s.rule,disabled:!t.options.tools.robots.enable,size:"medium",type:2},on:{input:function(s){return t.updateRule("rule","allow",o)}}},[t._v(" "+t._s(t.strings.allow)+" ")]),e("base-radio",{ref:"disallow",refInFor:!0,attrs:{name:"rule-"+o,value:"disallow"===s.rule,disabled:!t.options.tools.robots.enable,size:"medium",type:2},on:{input:function(s){return t.updateRule("rule","disallow",o)}}},[t._v(" "+t._s(t.strings.disallow)+" ")])],1),e("div",{staticClass:"robots-directory-path"},[e("base-input",{class:t.hasError(s.userAgent+s.rule+s.directoryPath),attrs:{value:s.directoryPath,size:"medium",placeholder:t.strings.directoryPathPlaceholder,disabled:!t.options.tools.robots.enable},on:{blur:function(s){return t.updateRule("directoryPath",s,o)}}})],1),e("div",{staticClass:"robots-actions"},[t.options.tools.robots.enable?e("core-tooltip",{attrs:{type:"action"},scopedSlots:t._u([{key:"tooltip",fn:function(){return[t._v(" "+t._s(t.strings.deleteRule)+" ")]},proxy:!0}],null,!0)},[e("svg-trash",{nativeOn:{click:function(s){return t.removeRow(o)}}})],1):t._e()],1)])})),0)]),e("base-button",{attrs:{type:"blue",size:"medium",disabled:!t.options.tools.robots.enable},on:{click:t.addRow}},[e("svg-circle-plus"),t._v(" "+t._s(t.strings.addRule)+" ")],1)],1)]):t._e(),t.$aioseo.data.subdomain||t.$aioseo.data.mainSite?e("div",{staticClass:"aioseo-settings-row"},[e("div",{staticClass:"settings-name"},[e("div",{staticClass:"name"},[t._v(t._s(t.strings.robotsPreview))])]),e("div",{staticClass:"settings-content"},[e("base-editor",{attrs:{value:t.robotsTxt,"line-numbers":!0,"minimum-line-numbers":13,disabled:"","force-updates":"",monospace:""}})],1)]):t._e()],1)],1)},i=[],r=e("5530"),a=(e("d81d"),e("a15b"),e("4de4"),e("b64b"),e("fb6a"),e("caad"),e("2532"),e("159b"),e("ac1f"),e("5319"),e("466d"),e("40d1")),n=e("9c0e"),l=e("2f62"),d={userAgent:null,rule:"allow",directoryPath:null},u={mixins:[n["i"]],data:function(){return{importLoading:!1,deleteLoading:!1,errors:{},strings:{robotsEditor:this.$t.__("Robots.txt Editor",this.$td),description:this.$t.sprintf(this.$t.__("The robots.txt editor in %1$s allows you to set up a robots.txt file for your site that will override the default robots.txt file that WordPress creates. By creating a robots.txt file with %2$s you have greater control over the instructions you give web crawlers about your site.",this.$td),"AIOSEO","AIOSEO"),description2:this.$t.sprintf(this.$t.__("Just like WordPress, %1$s generates a dynamic file so there is no static file to be found on your server. The content of the robots.txt file is stored in your WordPress database.",this.$td),"All in One SEO"),enableCustomRobots:this.$t.__("Enable Custom Robots.txt",this.$td),duplicateOrInvalid:this.$t.__("Duplicate or invalid entries have been detected! Please check your rules and try again.",this.$td),userAgent:this.$t.__("User Agent",this.$td),rule:this.$t.__("Rule",this.$td),directoryPath:this.$t.__("Directory Path",this.$td),allow:this.$t.__("Allow",this.$td),disallow:this.$t.__("Disallow",this.$td),addRule:this.$t.__("Add Rule",this.$td),deleteRule:this.$t.__("Delete Rule",this.$td),robotsPreview:this.$t.__("Robots.txt Preview:",this.$td),openRobotsTxt:this.$t.__("Open Robots.txt",this.$td),physicalRobotsFound:this.$t.sprintf(this.$t.__("%1$s has detected a physical robots.txt file in the root folder of your WordPress installation. We recommend removing this file as it could cause conflicts with WordPress' dynamically generated one. %2$s can import this file and delete it, or you can simply delete it.",this.$td),"AIOSEO","AIOSEO"),importAndDelete:this.$t.__("Import and Delete",this.$td),delete:this.$t.__("Delete",this.$td)}}},watch:{options:{deep:!0,handler:function(){this.validateRules()}}},computed:Object(r["a"])(Object(r["a"])(Object(r["a"])({},Object(l["e"])(["options"])),Object(l["c"])(["getNetworkRobotsRules"])),{},{parsedRules:function(){return this.options.tools.robots.rules.map((function(t){return JSON.parse(t)}))},robotsTxt:function(){var t=JSON.parse(JSON.stringify(this.$aioseo.data.multisite&&!this.$aioseo.data.network?this.getNetworkRobotsRules:{})),s=JSON.parse(JSON.stringify(this.$aioseo.data.robots.defaultRules)),e="\r\n"+this.$aioseo.data.robots.sitemapUrls.filter((function(t){return 0'+this.$aioseo.urls.mainSiteUrl+"")},missingRewriteRules:function(){var t=this.$t.__("It looks like you are missing the proper rewrite rules for the robots.txt file.",this.$td),s="";return this.$aioseo.data.server.apache?s=this.$t.sprintf(this.$t.__("It appears that your server is running on Apache, so the fix should be as simple as checking the %1$scorrect .htaccess implementation on wordpress.org%2$s.",this.$td),'',""):this.$aioseo.data.server.nginx&&(s=s=this.$t.sprintf(this.$t.__("It appears that your server is running on nginx, so the fix will most likely require adding the correct rewrite rules to our nginx configuration. %1$sCheck our documentation for more information%2$s.",this.$td),'',"")),t+" "+s}}),methods:Object(r["a"])(Object(r["a"])({},Object(l["b"])(["processButtonAction"])),{},{removeRow:function(t){this.$delete(this.options.tools.robots.rules,t),this.options.tools.robots.rules.length||this.addRow(),this.validateRules()},addRow:function(){var t=this;this.options.tools.robots.rules.push(JSON.stringify(Object(r["a"])({},d))),this.$nextTick((function(){t.$refs.userAgent[t.options.tools.robots.rules.length-1].$el.querySelector(".robots-user-agent input").focus()}))},updateRule:function(t,s,e){var o=this,i=JSON.parse(this.options.tools.robots.rules[e]);i[t]=s,this.$set(this.options.tools.robots.rules,e,JSON.stringify(i)),"directoryPath"===t&&(i[t]=this.sanitizePath(s),this.$set(this.options.tools.robots.rules,e,JSON.stringify(i))),this.validateRules(),"rule"===t&&this.$nextTick((function(){return o.$refs[s][e].$el.querySelector("input").focus()}))},sanitizePath:function(t){return"*"===t.slice(t.length-1)||t.includes(".")||(t=this.$links.trailingSlashIt(t)),"/"!==t.charAt(0)&&(t="/"+t),t.toLowerCase()},hasError:function(t){return this.errors[t]?"aioseo-error":""},validateRules:function(){var t=this;if(this.errors={},this.options.tools.robots.enable){var s={},e=JSON.parse(JSON.stringify(this.$aioseo.data.multisite&&!this.$aioseo.data.network?this.getNetworkRobotsRules:{})),o=JSON.parse(JSON.stringify(this.$aioseo.data.robots.defaultRules)),i=Object(a["a"])(Object(r["a"])({},o),Object(a["b"])(this.options.tools.robots.rules,!0),!0);Object.keys(i).forEach((function(e){var o=i[e];s[e]||(s[e]={allow:[],disallow:[]}),o.allow.forEach((function(o){s[e].allow.includes(o)?t.errors[e+"allow"+o]=!0:s[e].allow.push(o)})),o.disallow.forEach((function(o){s[e].disallow.includes(o)?t.errors[e+"disallow"+o]=!0:s[e].disallow.push(o)}))}));var n={},l=Object(a["a"])(Object(r["a"])({},e),Object(a["b"])(this.options.tools.robots.rules,!0),!0);Object.keys(l).forEach((function(s){var e=l[s];n[s]||(n[s]={allow:[],disallow:[]}),e.allow.forEach((function(e){if(n[s].allow.includes(e))t.errors[s+"allow"+e]=!0;else{if(n[s].disallow.includes(e))return t.errors[s+"allow"+e]=!0,void(t.errors[s+"disallow"+e]=!0);var o="^"+e.replace(".","\\.").replace("/","\\/").replace("*","(.*)")+"$",i=n[s].allow.some((function(t){return t&&t.match(o)}))||n[s].disallow.some((function(t){return t&&t.match(o)}));if(i)return t.errors[s+"allow"+e]=!0,void(t.errors[s+"disallow"+e]=!0);n[s].allow.push(e)}})),e.disallow.forEach((function(e){if(n[s].disallow.includes(e))t.errors[s+"disallow"+e]=!0;else{if(n[s].allow.includes(e))return t.errors[s+"allow"+e]=!0,void(t.errors[s+"disallow"+e]=!0);var o="^"+e.replace(".","\\.").replace("/","\\/").replace("*","(.*)")+"$",i=n[s].allow.some((function(t){return t&&t.match(o)}))||n[s].disallow.some((function(t){return t&&t.match(o)}));if(i)return t.errors[s+"allow"+e]=!0,void(t.errors[s+"disallow"+e]=!0);n[s].disallow.push(e)}}))}))}},importAndDeleteRobots:function(){this.importLoading=!0,this.processButtonAction("tools/import-robots-txt").then((function(){window.location.reload()}))},deleteRobots:function(){this.deleteLoading=!0,this.processButtonAction("tools/delete-robots-txt").then((function(){window.location.reload()}))},hideRobotsDetected:function(){this.options.tools.robots.robotsDetected=!1,this.saveChanges()}}),mounted:function(){this.validateRules(),this.options.tools.robots.rules.length||this.addRow()}},c=u,h=(e("5d3c"),e("2877")),b=Object(h["a"])(c,o,i,!1,null,null,null);s["default"]=b.exports}}]);