(window.webpackJsonp=window.webpackJsonp||[]).push([[10],{"2F5Z":function(t,e,i){"use strict";i.r(e);var n=i("q1tI"),o=i.n(n),a=i("LG7s"),r=i("0iUn"),c=i("sLSF"),s=i("MI3g"),l=i("a7VT"),d=i("AT/M"),u=i("Tit0"),h=i("vYYK"),w=(i("aoqs"),i("cBaE")),g=o.a.createElement,k=function(t){function e(){var t,i;Object(r.a)(this,e);for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return i=Object(s.a)(this,(t=Object(l.a)(e)).call.apply(t,[this].concat(o))),Object(h.a)(Object(d.a)(i),"state",{loading:!0,error:""}),i}return Object(u.a)(e,t),Object(c.a)(e,[{key:"componentDidMount",value:function(){var t=this;w.a.whoami().then(function(e){t.setState({whoami:e,loading:!1})}).catch(function(e){console.error(e),t.setState({loading:!1,error:"Failed to load status. Try to reload the page."})})}},{key:"tetherAccount",value:function(){var t=this;this.setState({loading:!0}),w.a.tetherWikidotAccount().then(function(e){switch(e){case"PageNotFound":t.setState({error:"Cannot find created page on the migration wiki. Reload and proceed with instructions."});break;case"WikidotUserAlreadyTethered":t.setState({error:"This wikidot account already was connected to another user."});break;case"Ok":window.location.reload();break;default:t.setState({error:"Unknown response status. Please contact developers."})}}).catch(function(e){console.error(e),t.setState({error:"Failed to connect account. Reload the page and try again."})})}},{key:"renderActionBlock",value:function(){var t=this;if(this.state.error)return g("div",{className:"wikidot-tethering__error"},this.state.error);if(this.state.loading)return g("div",{className:"wikidot-tethering__loading"},"Loading");var e=this.state.whoami;return null===e.id?g("div",null,g("a",{href:"/auth/google?returnPath=%2Fwikidot%2Ftethering",className:"wikidot-tethering__button"},"Sign in with Google")):e.wikidotUid?g("div",{className:"wikidot-tethering__success"},'This account was successfully connected to the Wikidot user "',e.username,'"'):g("div",{className:"wikidot-tethering__instructions"},g("div",{className:"wikidot-tethering__howto"},g("ol",null,g("li",null,"Navigate to the\xa0",g("a",{className:"wikidot-tethering__link",href:"http://wikidot-migration.scpfoundation.net/scp-id-".concat(e.id),target:"_blank",rel:"noreferrer"},"migration wiki"),"\xa0and create an empty page with specified name"),g("li",null,"Return to this page and press the button below"))),g("a",{href:"#",onClick:function(){t.tetherAccount()},className:"wikidot-tethering__button"},"Connect your account"))}},{key:"render",value:function(){return g("div",{className:"wikidot-tethering"},g("div",{className:"wikidot-tethering__content"},g("div",{className:"wikidot-tethering__title"},"Wikidot Account Tethering"),g("div",{className:"wikidot-tethering__welcome"},"This page allows you to tether your Wikidot Account to the account on this site.",g("br",null),"In order to do that we'll ask you to create a page with special name that corresponds to your uniq account identificator.",g("br",null),g("br",null),g("br",null),g("div",{className:"wikidot-tethering__action-block"},this.renderActionBlock()))))}}]),e}(o.a.Component),_=o.a.createElement;e.default=function(){return _(a.a,null,_(k,null))}},"p+LC":function(t,e,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/wikidot/tethering",function(){return i("2F5Z")}])}},[["p+LC",0,1,2]]]);