laipower/wp-content/plugins/jetpack-protect/jetpack_vendor/automattic/jetpack-identity-crisis/build/index.js

5 lines
47 KiB
JavaScript
Raw Normal View History

/*! For license information please see index.js.LICENSE.txt */
!function(){var e={5235:function(e,t){var n;!function(){"use strict";var r={}.hasOwnProperty;function s(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var i=typeof n;if("string"===i||"number"===i)e.push(n);else if(Array.isArray(n)){if(n.length){var o=s.apply(null,n);o&&e.push(o)}}else if("object"===i)if(n.toString===Object.prototype.toString)for(var a in n)r.call(n,a)&&n[a]&&e.push(a);else e.push(n.toString())}}return e.join(" ")}e.exports?(s.default=s,e.exports=s):void 0===(n=function(){return s}.apply(t,[]))||(e.exports=n)}()},951:function(e,t,n){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,s=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(s=r))})),t.splice(s,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=n(1741)(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},1741:function(e,t,n){e.exports=function(e){function t(e){let n,s,i,o=null;function a(...e){if(!a.enabled)return;const r=a,s=Number(new Date),i=s-(n||s);r.diff=i,r.prev=n,r.curr=s,n=s,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,s)=>{if("%%"===n)return"%";o++;const i=t.formatters[s];if("function"==typeof i){const t=e[o];n=i.call(r,t),e.splice(o,1),o--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(s!==t.namespaces&&(s=t.namespaces,i=t.enabled(e)),i),set:e=>{o=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function s(e){return e.toString().substring(2,e.toString().le
__("<hostname>%1$s</hostname> settings, stats, and subscribers will start fresh. <hostname>%2$s</hostname> will keep its data as is.","jetpack-idc"),h,d),{hostname:p().createElement("strong",null),em:p().createElement("em",null),strong:p().createElement("strong",null)}))),p().createElement("div",{className:"jp-idc__idc-screen__card-action-bottom"},p().createElement("div",{className:"jp-idc__idc-screen__card-action-sitename"},d),p().createElement(i.Dashicon,{icon:"minus",className:"jp-idc__idc-screen__card-action-separator"}),p().createElement("div",{className:"jp-idc__idc-screen__card-action-sitename"},h),p().createElement(i.Button,{className:"jp-idc__idc-screen__card-action-button",label:k,onClick:n,disabled:y},t?p().createElement(s.Z,null):k),u&&(v=l.supportURL,p().createElement(f.Z,null,(0,a.createInterpolateElement)(__("Could not create the connection. Retry or find out more <a>here</a>.","jetpack-idc"),{a:p().createElement("a",{href:v||(0,r.Z)("jetpack-support-safe-mode"),rel:"noopener noreferrer",target:"_blank"})})))));var v};y.propTypes={wpcomHomeUrl:u().string.isRequired,currentUrl:u().string.isRequired,isStartingFresh:u().bool.isRequired,startFreshCallback:u().func.isRequired,customContent:u().shape(h.Z),hasError:u().bool.isRequired},y.defaultProps={isStartingFresh:!1,startFreshCallback:()=>{},customContent:{},hasError:!1},t.Z=y},6596:function(e,t,n){"use strict";var r=n(6895),s=n(5033),i=n(5609),o=n(9818),a=n(9307),c=n(5736),l=n(5162),u=n.n(l),d=n(9196),p=n.n(d),m=n(2678),h=n(7144),g=n(2115),f=n(6637);const __=c.__,y=e=>{const t=(0,g.Z)(e.wpcomHomeUrl),n=(0,g.Z)(e.currentUrl),l=(0,o.useSelect)((e=>e(m.t).getIsActionInProgress()),[]),{isMigrating:u,migrateCallback:d,customContent:h,hasError:y}=e,k=h.migrateButtonLabel||__("Move your settings","jetpack-idc");return p().createElement("div",{className:"jp-idc__idc-screen__card-action-base"+(y?" jp-idc__idc-screen__card-action-error":"")},p().createElement("div",{className:"jp-idc__idc-screen__card-action-top"},p().createElement("h4",null,h.migrateCardTitle?(0,a.createInterpolateElement)(h.migrateCardTitle,{em:p().createElement("em",null)}):__("Move Jetpack data","jetpack-idc")),p().createElement("p",null,(0,a.createInterpolateElement)(h.migrateCardBodyText||(0,c.sprintf)(/* translators: %1$s: The current site domain name. %2$s: The original site domain name. */
__("Move all your settings, stats and subscribers to your other URL, <hostname>%1$s</hostname>. <hostname>%2$s</hostname> will be disconnected from Jetpack.","jetpack-idc"),n,t),{hostname:p().createElement("strong",null),em:p().createElement("em",null),strong:p().createElement("strong",null)}))),p().createElement("div",{className:"jp-idc__idc-screen__card-action-bottom"},p().createElement("div",{className:"jp-idc__idc-screen__card-action-sitename"},t),p().createElement(i.Dashicon,{icon:"arrow-down-alt",className:"jp-idc__idc-screen__card-action-separator"}),p().createElement("div",{className:"jp-idc__idc-screen__card-action-sitename"},n),p().createElement(i.Button,{className:"jp-idc__idc-screen__card-action-button",label:k,onClick:d,disabled:l},u?p().createElement(s.Z,null):k),y&&(v=h.supportURL,p().createElement(f.Z,null,(0,a.createInterpolateElement)(__("Could not move your settings. Retry or find out more <a>here</a>.","jetpack-idc"),{a:p().createElement("a",{href:v||(0,r.Z)("jetpack-support-safe-mode"),rel:"noopener noreferrer",target:"_blank"})})))));var v};y.propTypes={wpcomHomeUrl:u().string.isRequired,currentUrl:u().string.isRequired,isMigrating:u().bool.isRequired,migrateCallback:u().func.isRequired,customContent:u().shape(h.Z),hasError:u().bool.isRequired},y.defaultProps={isMigrating:!1,migrateCallback:()=>{},customContent:{},hasError:!1},t.Z=y},5489:function(e,t,n){"use strict";var r=n(9196),s=n.n(r);t.Z=()=>s().createElement("svg",{className:"error-gridicon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",height:24},s().createElement("rect",{x:"0",fill:"none",width:"24",height:"24"}),s().createElement("g",null,s().createElement("path",{d:"M12 4c4.411 0 8 3.589 8 8s-3.589 8-8 8-8-3.589-8-8 3.589-8 8-8m0-2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 13h-2v2h2v-2zm-2-2h2l.5-6h-3l.5 6z"})))},6637:function(e,t,n){"use strict";var r=n(9196),s=n.n(r),i=n(5489);n(6611);t.Z=e=>{const{children:t}=e;return s().createElement("div",{className:"jp-idc__error-message"},s().createElement(i.Z,null),s().createElement("span",null,t))}},7381:function(e,t,n){"use strict";var r=n(4743),s=n(9818),i=n(5162),o=n.n(i),a=n(9196),c=n.n(a),l=n(970),u=n(1272),d=n(3105),p=n(2678),m=n(7144),h=n(6521),g=n(567);const f=e=>{const{logo:t,customContent:n,wpcomHomeUrl:i,currentUrl:o,apiNonce:m,apiRoot:f,redirectUri:y,tracksUserData:k,tracksEventData:v,isAdmin:C,possibleDynamicSiteUrlDetected:_}=e,[b,E]=(0,a.useState)(!1),w=(0,s.useSelect)((e=>e(p.t).getErrorType()),[]),{isMigrating:j,migrateCallback:S}=(0,l.Z)((0,a.useCallback)((()=>{E(!0)}),[E])),{isStartingFresh:F,startFreshCallback:I}=(0,d.Z)(y),{isFinishingMigration:U,finishMigrationCallback:R}=(0,u.Z)();return(0,a.useEffect)((()=>{r.ZP.setApiRoot(f),r.ZP.setApiNonce(m),(0,h.M)(v,k),v&&(v.hasOwnProperty("isAdmin")&&v.isAdmin?(0,h.Z)("notice_view"):(0,h.Z)("non_admin_notice_view",{page:!!v.hasOwnProperty("currentScreen")&&v.currentScreen}))}),[f,m,k,v]),c().createElement(g.Z,{logo:t,customContent:n,wpcomHomeUrl:i,currentUrl:o,redirectUri:y,isMigrating:j,migrateCallback:S,isMigrated:b,finishMigrationCallback:R,isFinishingMigration:U,isStartingFresh:F,startFreshCallback:I,isAdmin:C,hasStaySafeError:"safe-mode"===w,hasFreshError:"start-fresh"===w,hasMigrateError:"migrate"===w,possibleDynamicSiteUrlDetected:_})};f.propTypes={logo:o().object,customContent:o().shape(m.Z),wpcomHomeUrl:o().string.isRequired,currentUrl:o().string.isRequired,redirectUri:o().string.isRequired,apiRoot:o().string.isRequired,apiNonce:o().string.isRequired,tracksUserData:o().object,tracksEventData:o().object,isAdmin:o().bool.isRequired,possibleDynamicSiteUrlDetected:o().bool},f.defaultProps={customContent:{}},t.Z=f},5533:function(e,t,n){"use strict";var r=n(6895),s=n(9307),i=n(5736),o=n(5162),a=n.n(o),c=n(9196),l=n.n(c),u=n(7144),d=n(9477),p=n(6596),m=n(2533);const __=i.__,h=e=>{const{wpcomHomeUrl:t,currentUrl:n,isMigrating:i,migrateCallback:o,isStartingFresh:a,startFreshCallback:c,customContent:u,hasMigrateError:h,hasFreshError:g,hasStaySafeError:f,possibleDynamicSiteUrlDetected:y}=e;return l
__("Safe Mode has been switched off for <hostname>%1$s</hostname> website and Jetpack is fully functional.","jetpack-idc"),l),{hostname:u().createElement("strong",null),em:u().createElement("em",null),strong:u().createElement("strong",null)})),u().createElement("div",{className:"jp-idc__idc-screen__card-migrated"},u().createElement("div",{className:"jp-idc__idc-screen__card-migrated-hostname"},c),u().createElement(s.Dashicon,{icon:"arrow-down-alt",className:"jp-idc__idc-screen__card-migrated-separator"}),u().createElement(s.Dashicon,{icon:"arrow-right-alt",className:"jp-idc__idc-screen__card-migrated-separator-wide"}),u().createElement("div",{className:"jp-idc__idc-screen__card-migrated-hostname"},l)),u().createElement(s.Button,{className:"jp-idc__idc-screen__card-action-button jp-idc__idc-screen__card-action-button-migrated",onClick:t,label:d},n?u().createElement(r.Z,null):d))};m.propTypes={wpcomHomeUrl:c().string.isRequired,currentUrl:c().string.isRequired,finishCallback:c().func,isFinishing:c().bool.isRequired,customContent:c().shape(d.Z)},m.defaultProps={finishCallback:()=>{},isFinishing:!1,customContent:{}},t.Z=m},1064:function(e,t,n){"use strict";var r=n(6895),s=n(9307),i=n(5736),o=n(5162),a=n.n(o),c=n(9196),l=n.n(c),u=n(7144);const __=i.__,d=e=>{const{customContent:t}=e;return l().createElement(l().Fragment,null,l().createElement("h2",null,t.nonAdminTitle?(0,s.createInterpolateElement)(t.nonAdminTitle,{em:l().createElement("em",null)}):__("Safe Mode has been activated","jetpack-idc")),l().createElement("p",null,(0,s.createInterpolateElement)(t.nonAdminBodyText||__("This site is in Safe Mode because there are 2 Jetpack-powered sites that appear to be duplicates. 2 sites that are telling Jetpack theyre the same site. <safeModeLink>Learn more about safe mode.</safeModeLink>","jetpack-idc"),{safeModeLink:l().createElement("a",{href:t.supportURL||(0,r.Z)("jetpack-support-safe-mode"),rel:"noopener noreferrer",target:"_blank"}),em:l().createElement("em",null),strong:l().createElement("strong",null)})),t.nonAdminBodyText?"":l().createElement("p",null,__("An administrator of this site can take Jetpack out of Safe Mode.","jetpack-idc")))};d.propTypes={customContent:a().shape(u.Z)},d.defaultProps={customContent:{}},t.Z=d},567:function(e,t,n){"use strict";var r=n(8868),s=n(9307),i=n(5736),o=n(5162),a=n.n(o),c=n(9196),l=n.n(c),u=n(7144),d=n(5533),p=n(1052),m=n(1064);n(7724);const __=i.__,h=e=>{const{logo:t,customContent:n,wpcomHomeUrl:r,currentUrl:i,redirectUri:o,isMigrating:a,migrateCallback:c,isMigrated:u,finishMigrationCallback:h,isFinishingMigration:g,isStartingFresh:f,startFreshCallback:y,isAdmin:k,hasMigrateError:v,hasFreshError:C,hasStaySafeError:_,possibleDynamicSiteUrlDetected:b}=e,E=k?"":l().createElement(m.Z,{customContent:n});let w="";return k&&(w=u?l().createElement(p.Z,{wpcomHomeUrl:r,currentUrl:i,finishCallback:h,isFinishing:g,customContent:n}):l().createElement(d.Z,{wpcomHomeUrl:r,currentUrl:i,redirectUri:o,customContent:n,isMigrating:a,migrateCallback:c,isStartingFresh:f,startFreshCallback:y,hasMigrateError:v,hasFreshError:C,hasStaySafeError:_,possibleDynamicSiteUrlDetected:b})),l().createElement("div",{className:"jp-idc__idc-screen"+(u?" jp-idc__idc-screen__success":"")},l().createElement("div",{className:"jp-idc__idc-screen__header"},l().createElement("div",{className:"jp-idc__idc-screen__logo"},((e,t)=>"string"==typeof e||e instanceof String?l().createElement("img",{src:e,alt:t,className:"jp-idc__idc-screen__logo-image"}):e)(t,n.logoAlt||"")),l().createElement("div",{className:"jp-idc__idc-screen__logo-label"},n.headerText?(0,s.createInterpolateElement)(n.headerText,{em:l().createElement("em",null),strong:l().createElement("strong",null)}):__("Safe Mode","jetpack-idc"))),E,w)};h.propTypes={logo:a().object.isRequired,customContent:a().shape(u.Z),wpcomHomeUrl:a().string.isRequired,currentUrl:a().string.isRequired,redirectUri:a().string.isRequired,isMigrating:a().bool.isRequired,migrateCallback:a().func,isMigrated:a().bool.isRequired,finishMigrationCallback:a().func,isFinishingMigration:a().bool.isRequired