{"version":3,"file":"js/chunk.3710.33a28c9c.js","mappings":"yMAGA,IAAMA,EAAgB,CACpB,aACA,aACA,cACA,aACA,cACA,OACA,aACA,aACD,CAEKC,EAAS,IAAIC,EAAAA,CAAWA,CAAC,kBAElBC,EAAyB,MAAO,CAAEC,QAAAA,CAAO,CAAE,IAGtD,IAAMC,EAAcC,IAFJC,IAAIH,EAAQI,GAAG,EACNF,YAAY,CACJG,GAAG,CAAC,gBAErC,GAAI,CAACJ,EACH,MAAO,CAAEK,MAAO,EAAM,EAGxB,GAAI,CACF,IAAMC,EAAS,IAAIJ,IAAIF,GAGrBM,CAAAA,EAAOC,QAAQ,GAAKC,OAAOC,QAAQ,CAACF,QAAQ,EAC5CZ,EAAce,IAAI,CAACC,GACjB,OAAW,CAAC,EAAE,EAAEA,EAAO,CAAC,CAAC,EAAEC,IAAI,CAACN,EAAOC,QAAQ,EAAC,GAGlDE,CAAAA,SAASI,IAAI,CAAGb,CAAU,CAG9B,CAAE,MAAOc,EAAG,CAEV,OADAlB,EAAOmB,KAAK,CAAC,+BAAgCD,GACtC,CAAET,MAAO,EAAM,CACxB,CAEA,MAAO,CAAEA,MAAO,EAAK,CACvB,EAEaW,EAAY,KACvB,GAAM,CAAEX,MAAAA,CAAK,CAAE,CAAGY,CAAAA,EAAAA,EAAAA,EAAAA,WAElB,EACS,KAGF,UAACC,EAAAA,EAAQA,CAAAA,CAACC,GAAG,M,EACtB,C","sources":["webpack://@affine/web/../core/src/pages/redirect.tsx"],"sourcesContent":["import { DebugLogger } from '@affine/debug';\nimport { type LoaderFunction, Navigate, useLoaderData } from 'react-router-dom';\n\nconst trustedDomain = [\n 'stripe.com',\n 'github.com',\n 'twitter.com',\n 'discord.gg',\n 'youtube.com',\n 't.me',\n 'reddit.com',\n 'affine.pro',\n];\n\nconst logger = new DebugLogger('redirect_proxy');\n\nexport const loader: LoaderFunction = async ({ request }) => {\n const url = new URL(request.url);\n const searchParams = url.searchParams;\n const redirectUri = searchParams.get('redirect_uri');\n\n if (!redirectUri) {\n return { allow: false };\n }\n\n try {\n const target = new URL(redirectUri);\n\n if (\n target.hostname === window.location.hostname ||\n trustedDomain.some(domain =>\n new RegExp(`.?${domain}$`).test(target.hostname)\n )\n ) {\n location.href = redirectUri;\n return { allow: true };\n }\n } catch (e) {\n logger.error('Failed to parse redirect uri', e);\n return { allow: false };\n }\n\n return { allow: true };\n};\n\nexport const Component = () => {\n const { allow } = useLoaderData() as { allow: boolean };\n\n if (allow) {\n return null;\n }\n\n return ;\n};\n"],"names":["trustedDomain","logger","DebugLogger","loader","request","redirectUri","searchParams","URL","url","get","allow","target","hostname","window","location","some","domain","test","href","e","error","Component","useLoaderData","Navigate","to"],"sourceRoot":""}