1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8611],{581:function(e,t,n){"use strict";n.r(t);var r=n(92809),o=n(30266),i=n(809),a=n.n(i),s=n(67294),u=n(11163),c=n(54714),l=n(7711),d=n(9669),f=n.n(d),p=n(16999),v=n(60656),w=n(40465),h=n(98284),g=n(85893);function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?b(Object(n),!0).forEach((function(t){(0,r.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var O=c.default.div.withConfig({componentId:"sc-1tou2tt-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:100vh;padding:20px;"]),m=c.default.div.withConfig({componentId:"sc-1tou2tt-1"})(["color:",";margin-top:20px;text-align:center;"],(function(e){return e.theme.colors.error||"#ff4444"}));t.default=function(){var e=(0,u.useRouter)(),t=(0,h.lM)(),n=(0,s.useState)(null),r=n[0],i=n[1];return(0,s.useEffect)((function(){var n=function(){var n=(0,o.Z)(a().mark((function n(){var r,o,s,c,l,d,h,g,b,O,m,_,j,k,x,P,S,E,D,T,I,N,A,q,C,M,L,Z,K,R;return a().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r="yandex",n.prev=1,O=e.query,m=O.code,_=O.state,j=O.cid,m){n.next=5;break}throw new Error("\u041a\u043e\u0434 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d");case 5:if(k=(0,p.SV)(r)){n.next=8;break}throw new Error("\u0412\u0440\u0435\u043c\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u0441\u0442\u0435\u043a\u043b\u043e. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0451 \u0440\u0430\u0437.");case 8:if(!(x=k.state)||_===x){n.next=12;break}throw(0,p.f_)(r),new Error("\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0439 state \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440");case 12:if(P={provider:r,code:m},j&&(P.cid=j),(S=(0,v.e)("ref_code"))&&(P.referral_code=S),null===k||void 0===k||!k.link){n.next=22;break}return n.next=19,(0,w.b)(r);case 19:n.t0=n.sent,n.next=23;break;case 22:n.t0=null;case 23:return E=n.t0,n.next=26,f().post("/api/oauth/login",P,y({withCredentials:!0},E?{headers:{"Content-Type":"application/json","Accept-Language":"ru",Authorization:"Bearer ".concat(E)}}:{}));case 26:if(D=n.sent,T=null!==(o=null===(s=D.data)||void 0===s?void 0:s.preKey)&&void 0!==o?o:null===(c=D.data)||void 0===c?void 0:c.pre_key,I=T&&("require_password"===(null===(l=D.data)||void 0===l?void 0:l.action)||"requirePassword"===(null===(d=D.data)||void 0===d?void 0:d.action)||"full"===(null===(h=D.data)||void 0===h?void 0:h.auth_level)&&(null===(g=D.data)||void 0===g?void 0:g.access)),200!==D.status||!D.data||!I){n.next=32;break}return window.opener&&!window.opener.closed?(window.opener.postMessage({type:"oauth_require_password",provider:r,preKey:T},window.location.origin),setTimeout((function(){window.close()}),100)):(null===t||void 0===t||null===(N=t.authStore)||void 0===N||N.setOAuthPreKey(T),u.default.push("/auth")),n.abrupt("return");case 32:if(!(E?200===D.status:200===D.status&&(null===(b=D.data)||void 0===b?void 0:b.access))){n.next=38;break}(0,p.f_)(r),window.opener&&!window.opener.closed?(window.opener.postMessage({type:"oauth_success",provider:r},window.location.origin),setTimeout((function(){return window.close()}),100)):(q=null===t||void 0===t||null===(A=t.authStore)||void 0===A?void 0:A.nextUrl,u.default.push(q||"/"),q&&t.authStore.setNextUrl("")),n.next=39;break;case 38:throw new Error(E?"\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u0442\u044c \u0430\u043a\u043a\u0430\u0443\u043d\u0442":"\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u043e\u043a\u0435\u043d\u044b");case 39:n.next=48;break;case 41:n.prev=41,n.t1=n.catch(1),console.error("OAuth callback error:",n.t1),K=(null===(C=n.t1.response)||void 0===C||null===(M=C.data)||void 0===M||null===(L=M.errors)||void 0===L?void 0:L[0])||n.t1.message||"\u041f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438",R=(null===(Z=n.t1.response)||void 0===Z?void 0:Z.status)||n.t1.code||null,i(K),window.opener&&!window.opener.closed?(window.opener.postMessage({type:"oauth_error",provider:r,error_code:R,error_message:K},window.location.origin),setTimeout((function(){window.close()}),100)):setTimeout((function(){u.default.push("/")}),3e3);case 48:case"end":return n.stop()}}),n,null,[[1,41]])})));return function(){return n.apply(this,arguments)}}();e.isReady&&n()}
1),[e.isReady,e.query]),r?(0,g.jsx)(O,{children:(0,g.jsx)(m,{children:r})}):(0,g.jsxs)(O,{children:[(0,g.jsx)(l.Z,{big:!0}),(0,g.jsx)("div",{style:{marginTop:"20px"},children:"\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438..."})]})}},60656:function(e,t,n){"use strict";function r(e){for(var t=e+"=",n=document.cookie.split(";"),r=0;r<n.length;r++){for(var o=n[r];" "==o.charAt(0);)o=o.substring(1,o.length);if(0==o.indexOf(t))return o.substring(t.length,o.length)}return null}n.d(t,{e:function(){return r}})},16999:function(e,t,n){"use strict";n.d(t,{il:function(){return s},SV:function(){return u},f_:function(){return c}});var r=n(92809);function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){(0,r.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var a=function(e){return"oauth_flow_".concat(e)},s=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=r.link,s=void 0!==o&&o,u=i({state:t,code_verifier:n,createdAt:Date.now()},s?{link:!0}:{});sessionStorage.setItem(a(e),JSON.stringify(u))},u=function(e){var t=a(e),n=sessionStorage.getItem(t);if(!n)return null;try{var r=JSON.parse(n);return Date.now()-r.createdAt>6e5?(c(e),null):r}catch(o){return c(e),null}},c=function(e){var t=a(e);sessionStorage.removeItem(t),sessionStorage.removeItem("oauth_code_verifier"),sessionStorage.removeItem("oauth_state"),sessionStorage.removeItem("oauth_provider")}},40465:function(e,t,n){"use strict";n.d(t,{b:function(){return r}});var r=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2e3;return new Promise((function(n){if(window.opener&&!window.opener.closed){var r=setTimeout((function(){window.removeEventListener("message",o),n(null)}),t),o=function t(o){var i,a;o.origin===window.location.origin&&"link_token"===(null===(i=o.data)||void 0===i?void 0:i.type)&&(null===(a=o.data)||void 0===a?void 0:a.provider)===e&&(clearTimeout(r),window.removeEventListener("message",t),n(o.data.token||null))};window.addEventListener("message",o),window.opener.postMessage({type:"request_link_token",provider:e},window.location.origin)}else n(null)}))}},14887:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/oauth/yandex/callback",function(){return n(581)}])}},function(e){e.O(0,[9351,9774,2888,179],(function(){return t=14887,e(e.s=t);var t}));var t=e.O();_N_E=t}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.