@clerk/shared
Version:
Internal package utils used by the Clerk SDKs
1 lines • 1.22 kB
Source Map (JSON)
{"version":3,"file":"oauthConsent.mjs","names":[],"sources":["../../../src/internal/clerk-js/oauthConsent.ts"],"sourcesContent":["const IPV4_REGEX = /^(\\d{1,3}\\.){3}\\d{1,3}$/;\n\nexport function getRedirectDisplay(url: string): string {\n let hostname: string;\n try {\n hostname = new URL(url).hostname;\n } catch {\n return '';\n }\n if (!hostname) {\n return '';\n }\n\n // WHATWG URL.hostname includes surrounding brackets for IPv6 literals on some\n // platforms; strip them so detection and output formatting are uniform.\n const host = hostname.startsWith('[') && hostname.endsWith(']') ? hostname.slice(1, -1) : hostname;\n\n if (IPV4_REGEX.test(host)) {\n return host;\n }\n if (host.includes(':')) {\n return `[${host}]`;\n }\n return host.split('.').slice(-2).join('.');\n}\n"],"mappings":";AAAA,MAAM,aAAa;AAEnB,SAAgB,mBAAmB,KAAqB;CACtD,IAAI;CACJ,IAAI;EACF,WAAW,IAAI,IAAI,GAAG,CAAC,CAAC;CAC1B,QAAQ;EACN,OAAO;CACT;CACA,IAAI,CAAC,UACH,OAAO;CAKT,MAAM,OAAO,SAAS,WAAW,GAAG,KAAK,SAAS,SAAS,GAAG,IAAI,SAAS,MAAM,GAAG,EAAE,IAAI;CAE1F,IAAI,WAAW,KAAK,IAAI,GACtB,OAAO;CAET,IAAI,KAAK,SAAS,GAAG,GACnB,OAAO,IAAI,KAAK;CAElB,OAAO,KAAK,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,GAAG;AAC3C"}