{"version":3,"file":"authorization-errors-CBHAr6Ld.mjs","names":[],"sources":["../../src/authorization-errors.ts"],"sourcesContent":["import type { ReverificationConfig } from './types';\n\ntype ClerkError = {\n clerk_error: T;\n};\n\nconst REVERIFICATION_REASON = 'reverification-error';\n\ntype ReverificationError = ClerkError<\n {\n type: 'forbidden';\n reason: typeof REVERIFICATION_REASON;\n } & M\n>;\n\nconst reverificationError = (\n missingConfig?: MC,\n): ReverificationError<{\n metadata?: {\n reverification?: MC;\n };\n}> => ({\n clerk_error: {\n type: 'forbidden',\n reason: REVERIFICATION_REASON,\n metadata: {\n reverification: missingConfig,\n },\n },\n});\n\nconst reverificationErrorResponse = (...args: Parameters) =>\n new Response(JSON.stringify(reverificationError(...args)), {\n status: 403,\n });\n\nconst isReverificationHint = (result: any): result is ReturnType => {\n return (\n result &&\n typeof result === 'object' &&\n 'clerk_error' in result &&\n result.clerk_error?.type === 'forbidden' &&\n result.clerk_error?.reason === REVERIFICATION_REASON\n );\n};\n\nexport { isReverificationHint, reverificationError, reverificationErrorResponse };\n"],"mappings":";AAMA,MAAM,wBAAwB;AAS9B,MAAM,uBACJ,mBAKK,EACL,aAAa;CACX,MAAM;CACN,QAAQ;CACR,UAAU,EACR,gBAAgB,eACjB;CACF,EACF;AAED,MAAM,+BAA+B,GAAG,SACtC,IAAI,SAAS,KAAK,UAAU,oBAAoB,GAAG,KAAK,CAAC,EAAE,EACzD,QAAQ,KACT,CAAC;AAEJ,MAAM,wBAAwB,WAAkE;AAC9F,QACE,UACA,OAAO,WAAW,YAClB,iBAAiB,UACjB,OAAO,aAAa,SAAS,eAC7B,OAAO,aAAa,WAAW"}