wp_back/wp-content/plugins/wordpress-seo/js/dist/import.js

1 line
6.8 KiB
JavaScript
Raw Normal View History

2024-05-20 15:37:46 +03:00
!function(t){var e={};function n(s){if(e[s])return e[s].exports;var i=e[s]={i:s,l:!1,exports:{}};return t[s].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,s){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(s,i,function(e){return t[e]}.bind(null,i));return s},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=300)}({1:function(t,e){t.exports=window.wp.i18n},124:function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));class s extends Error{constructor(t,e,n,s,i){super(t),this.name="RequestError",this.url=e,this.method=n,this.statusCode=s,this.stackTrace=i}}},167:function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));class s extends Error{constructor(t,e){super(t),this.name="ParseError",this.parseString=e}}},21:function(t,e){t.exports=window.jQuery},300:function(t,e,n){"use strict";n.r(e);var s=n(21),i=n.n(s),o=n(1);class a extends Error{constructor(t){super(t),this.name="ImportValidationError"}}var r=n(4),c=n(124),d=n(167);class p{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];this.settings=t,Object(r.isObject)(e)?this.preIndexingActions=Object(r.pickBy)(e,r.isFunction):this.preIndexingActions={},Object(r.isObject)(n)?this.postIndexingActions=Object(r.pickBy)(n,r.isFunction):this.postIndexingActions={}}async index(t,e){if(!Object(r.isObject)(t))return 0;let n=0;for(const s of Object.keys(t)){const i=t[s];n=await this.handleEndpoint(s,i,n,e)}return n}async handleEndpoint(t,e,n,s){let i=this.settings.restApi.root+e;for(;!1!==i;){await this.doPreIndexingAction(t);const e=await this.doIndexingRequest(i);await this.doPostIndexingAction(t,e),s(n+=e.objects.length),i=!!e.next_url&&this.settings.restApi.root+e.next_url}return n}async doIndexingRequest(t){const e=await fetch(t,{method:"POST",headers:{"X-WP-Nonce":this.settings.restApi.nonce}}),n=await e.text();let s;try{s=JSON.parse(n)}catch(t){throw new d.a("Error parsing the response to JSON.",n)}if(!e.ok){const n=s.data?s.data.stackTrace:"";throw"wpseo_error_validation"===(s.code?s.code:"")?new a(s.message):new c.a(s.message,t,"POST",e.status,n)}return s}async doPreIndexingAction(t){this.preIndexingActions[t]&&await this.preIndexingActions[t](this.settings)}async doPostIndexingAction(t,e){this.postIndexingActions[t]&&await this.postIndexingActions[t](e.objects,this.settings)}}const l="WPSEO_Import_AIOSEO_V4";let u,m,f,h,g,w,y,x,_,b,v,I;function O(t){var e=f,n=x,s=u;"import"===t&&(e=w,n=_,s=h),e.children(".yoast-import-spinner").show(),n.show(),e.closest("div").find(".yoast-import-failure").remove(),s.prop("disabled",!0)}function D(t){O("import")}function A(t){O("cleanup")}function j(t){var e=f,n=x,s=u,o=m;"import"===t&&(e=w,n=_,s=h,o=g),e.children(".yoast-import-spinner").hide(),n.hide(),e.children(".yoast-import-success-mark").show(),e.closest("div").find(".yoast-import-failure").remove(),s.prop("disabled",!1),i()("option:selected",o).remove(),i()("option[value='']",o).prop("selected",!0),o.trigger("change"),o.children("option").length<2&&(o.prop("disabled",!0),e.after(i()("<p></p>").text(window.yoastImportData.assets.no_data_msg)))}function P(){j("import")}function E(){j("cleanup")}function S(t,e){var n,s=f,r=x,c=u,d=window.yoastImportData.assets.cleanup_failure;"import"===e&&(s=w,r=_,c=h,d=window.yoastImportData.assets.import_failure),s.children(".yoast-import-spinner").hide(),r.hide(),c.prop("disabled",!1),n=t instanceof a?window.yoastImportData.assets.validation_failure:Object(o.spri