{"version":3,"file":"js/chunk.3749.907ab525.js","mappings":"mLAIA,IAAMA,EAAoBC,E,OAAAA,CAACA,CAACC,IAAI,CAAC,CAC/B,YACGC,OAAOC,MAAM,CAACC,EAAAA,EAAiBA,EACnC,EAEYC,EAAyB,MAAO,CAAEC,QAAAA,CAAO,CAAE,IAEtD,IAAMC,EAAeC,IADLC,IAAIH,EAAQE,GAAG,EACND,YAAY,CAC/BG,EAAWH,EAAaI,GAAG,CAAC,YAC5BC,EACJL,EAAaI,GAAG,CAAC,iBACYJ,EAAaI,GAAG,CAAC,gBAEhD,GAAI,CAACC,EACH,OAAO,IAIT,OAAMC,MAAM,sBAEZ,IAAMC,EAAgBf,EAAkBgB,SAAS,CAACL,GAClD,GAAII,EAAcE,OAAO,CAAE,CACzB,IAAIN,EAAWI,EAAcG,IAAI,CAEhB,WAAbP,GACFA,CAAAA,EAAWN,EAAAA,EAAiBA,CAACc,MAAM,EAErCC,SAASC,IAAI,CAAG,mDAESV,kBAAyBW,mBAChDT,IACC,CAEL,OAAO,IACT,EAEaU,EAAY,IAChB,I","sources":["webpack://@affine/web/../core/src/pages/desktop-signin.tsx"],"sourcesContent":["import { OAuthProviderType } from '@affine/graphql';\nimport type { LoaderFunction } from 'react-router-dom';\nimport { z } from 'zod';\n\nconst supportedProvider = z.enum([\n 'google',\n ...Object.values(OAuthProviderType),\n]);\n\nexport const loader: LoaderFunction = async ({ request }) => {\n const url = new URL(request.url);\n const searchParams = url.searchParams;\n const provider = searchParams.get('provider');\n const redirectUri =\n searchParams.get('redirect_uri') ??\n /* backward compatibility */ searchParams.get('callback_url');\n\n if (!redirectUri) {\n return null;\n }\n\n // sign out first\n await fetch('/api/auth/sign-out');\n\n const maybeProvider = supportedProvider.safeParse(provider);\n if (maybeProvider.success) {\n let provider = maybeProvider.data;\n // BACKWARD COMPATIBILITY\n if (provider === 'google') {\n provider = OAuthProviderType.Google;\n }\n location.href = `${\n runtimeConfig.serverUrlPrefix\n }/oauth/login?provider=${provider}&redirect_uri=${encodeURIComponent(\n redirectUri\n )}`;\n }\n return null;\n};\n\nexport const Component = () => {\n return null;\n};\n"],"names":["supportedProvider","z","enum","Object","values","OAuthProviderType","loader","request","searchParams","url","URL","provider","get","redirectUri","fetch","maybeProvider","safeParse","success","data","Google","location","href","encodeURIComponent","Component"],"sourceRoot":""}