{"version":3,"file":"handleSignInSignUpRequest.mjs","sources":["../../../../src/auth/handlers/handleSignInSignUpRequest.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { appendSetCookieHeaders, createAuthFlowProofCookiesSetOptions, createAuthFlowProofs, createAuthorizeEndpoint, createSignInFlowProofCookies, createSignUpEndpoint, createUrlSearchParamsForSignInSignUp, } from '../utils';\nexport const handleSignInSignUpRequest = ({ request, userPoolClientId, oAuthConfig, customState, origin, setCookieOptions, type, }) => {\n    const { codeVerifier, state } = createAuthFlowProofs({ customState });\n    const redirectUrlSearchParams = createUrlSearchParamsForSignInSignUp({\n        url: request.url,\n        oAuthConfig,\n        userPoolClientId,\n        state,\n        origin,\n        codeVerifier,\n    });\n    const headers = new Headers();\n    headers.set('Location', type === 'signIn'\n        ? createAuthorizeEndpoint(oAuthConfig.domain, redirectUrlSearchParams)\n        : createSignUpEndpoint(oAuthConfig.domain, redirectUrlSearchParams));\n    appendSetCookieHeaders(headers, createSignInFlowProofCookies({ state, pkce: codeVerifier.value }), createAuthFlowProofCookiesSetOptions(setCookieOptions, origin));\n    return new Response(null, {\n        status: 302,\n        headers,\n    });\n};\n"],"names":[],"mappings":";;;;;;;;;AAAA;AACA;AAEY,MAAC,yBAAyB,GAAG,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,IAAI,GAAG,KAAK;AACvI,IAAI,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,oBAAoB,CAAC,EAAE,WAAW,EAAE,CAAC;AACzE,IAAI,MAAM,uBAAuB,GAAG,oCAAoC,CAAC;AACzE,QAAQ,GAAG,EAAE,OAAO,CAAC,GAAG;AACxB,QAAQ,WAAW;AACnB,QAAQ,gBAAgB;AACxB,QAAQ,KAAK;AACb,QAAQ,MAAM;AACd,QAAQ,YAAY;AACpB,KAAK,CAAC;AACN,IAAI,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE;AACjC,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,KAAK;AACrC,UAAU,uBAAuB,CAAC,WAAW,CAAC,MAAM,EAAE,uBAAuB;AAC7E,UAAU,oBAAoB,CAAC,WAAW,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;AAC5E,IAAI,sBAAsB,CAAC,OAAO,EAAE,4BAA4B,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,CAAC,KAAK,EAAE,CAAC,EAAE,oCAAoC,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;AACtK,IAAI,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE;AAC9B,QAAQ,MAAM,EAAE,GAAG;AACnB,QAAQ,OAAO;AACf,KAAK,CAAC;AACN;;;;"}