1 line
12 KiB
JavaScript
1 line
12 KiB
JavaScript
|
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8261],{489:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function({clientId:e,redirectUrl:t,setLoading:n,scopes:i}){n&&n(!0);let a=i?i.join("%20"):"read:user",o=`https://github.com/login/oauth/authorize?client_id=${e}&scope=${a}&redirect_uri=${t}`;window.location.assign(o)}},8557:function(e,t){let n;var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(a,o){function r(e){try{u(i.next(e))}catch(e){o(e)}}function l(e){try{u(i.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?a(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(r,l)}u((i=i.apply(e,t||[])).next())})};function a({google:e,clientId:t,setLoading:n,triggerPrompt:i}){return setTimeout(()=>{null==n||n(!1)},3e3),new Promise((n,a)=>{e.accounts.oauth2.initTokenClient({client_id:t,scope:"email profile",callback:function(e){n(e.access_token)}}).requestAccessToken(),i&&e.accounts.id.prompt(function(e){console.log(e)})})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return i(this,void 0,void 0,function*(){var t,i;null===(t=e.setLoading)||void 0===t||t.call(e,!0);let o=yield new Promise((t,i)=>{n=setInterval(()=>{let i=window.google;i&&(window.clearInterval(n),t(a(Object.assign(Object.assign({},e),{google:i}))))},500)});return null===(i=e.setLoading)||void 0===i||i.call(e,!1),o})},t.googleLogin=a},7946:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(a,o){function r(e){try{u(i.next(e))}catch(e){o(e)}}function l(e){try{u(i.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?a(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(r,l)}u((i=i.apply(e,t||[])).next())})},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return i(this,void 0,void 0,function*(){try{let t;let n=localStorage.getItem("user");try{t=JSON.parse(n||"")}catch(e){console.log(e)}if(!t)return!1;let i=(0,o.default)(),a=(null==i?void 0:i.datasquirel_social_id)&&"string"==typeof i.datasquirel_social_id&&!i.datasquirel_social_id.match(/^null$/i)?i.datasquirel_social_id:null;return localStorage.setItem("user","{}"),localStorage.removeItem("csrf"),document.cookie="datasquirel_social_id=null;samesite=strict;path=/",yield new Promise((t,n)=>{if(!a||(null==a?void 0:a.match(/^null$/i)))t(!0);else{let n=null==e?void 0:e.googleClientId;if(n){let e=document.createElement("script");e.src="https://accounts.google.com/gsi/client",e.className="social-script-tag",document.body.appendChild(e),e.onload=function(e){let i=window.google;i&&(i.accounts.id.initialize({client_id:n}),i.accounts.id.revoke(a,e=>{console.log(e.error),t(!0)}))}}else t(!0)}})}catch(e){return!1}})};let o=a(n(2406))},1335:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});let a=i(n(8753)),o=i(n(4715)),r=i(n(1168)),l=i(n(8557)),u=i(n(489)),c=i(n(7946)),s=i(n(1028)),d=i(n(1028)),f=i(n(4727)),h=i(n(8168)),p=i(n(834)),y=i(n(8226)),g=i(n(4567)),m={imageInputToBase64:o.default,imageInputFileToBase64:a.default,inputFileToBase64:r.default},v={google:{getAccessToken:l.default},github:{getAccessToken:u.default},logout:c.default},_={serializeQuery:f.default,serializeCookies:h.default,EJSON:p.default,numberfy:y.default,slugify:g.default},w={fetchApi:s.default,clientFetch:d.default};t.default={media:m,auth:v,fetch:w,utils:_}},8753:function(e,t){var n=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(a,o){function r(e){try{u(i.next(e))}catch(e){o(e)}}function l(e){try{u(i.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?a(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(r,l)}u((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return n(this,arguments,void 0,function*({imageInputFile:e,maxWidth:t,imagePreviewNode:n}){try{let i,a,o=e.name.replace(/\..*/,""),r
|