anonyma 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/detectors/email.ts","../../src/detectors/phone.ts","../../src/detectors/ssn.ts","../../src/detectors/credit-card.ts","../../src/detectors/ip-address.ts","../../src/detectors/url.ts","../../src/detectors/iban.ts","../../src/detectors/date-of-birth.ts","../../src/detectors/name.ts","../../src/detectors/address.ts","../../src/detectors/passport.ts","../../src/detectors/drivers-license.ts","../../src/detectors/national-id.ts","../../src/detectors/bank-account.ts","../../src/detectors/cryptocurrency.ts","../../src/detectors/tax-id.ts","../../src/validators.ts","../../src/detectors/medical-record.ts","../../src/detectors/health-insurance.ts","../../src/detectors/prescription.ts","../../src/detectors/api-key.ts","../../src/detectors/social-media.ts","../../src/detectors/vin.ts","../../src/detectors/license-plate.ts","../../src/detectors/tracking-number.ts","../../src/detectors/case-number.ts","../../src/detectors/company-registration.ts","../../src/detectors/index.ts"],"names":["luhn","DEA_PATTERN","m","US_EIN_PATTERN"],"mappings":";AAaA,IAAM,aAAA,GACJ,uJAAA;AAUF,IAAM,wBAAA,GACJ,yGAAA;AAgBK,SAAS,YAAY,IAAA,EAA0B;AACpD,EAAA,MAAM,UAAsB,EAAC;AAC7B,EAAA,MAAM,OAAA,GAAU,IAAI,MAAA,CAAO,aAAA,CAAc,QAAQ,GAAG,CAAA;AACpD,EAAA,IAAI,KAAA;AAEJ,EAAA,OAAA,CAAQ,KAAA,GAAQ,OAAA,CAAQ,IAAA,CAAK,IAAI,OAAO,IAAA,EAAM;AAC5C,IAAA,OAAA,CAAQ,IAAA,CAAK;AAAA,MACX,QAAA,EAAU,OAAA;AAAA,MACV,KAAA,EAAO,MAAM,CAAC,CAAA;AAAA,MACd,OAAO,KAAA,CAAM,KAAA;AAAA,MACb,GAAA,EAAK,KAAA,CAAM,KAAA,GAAQ,KAAA,CAAM,CAAC,CAAA,CAAE,MAA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AA,EAChB,cAAA,EAAgB,oBAAA;AAAA,EAChB,QAAA,EAAU,WAAA;AAAA;AAAA,EAEV,gBAAA,EAAkB,mBAAA;AAAA,EAClB,kBAAA,EAAoB,qBAAA;AAAA,EACpB,YAAA,EAAc,kBAAA;AAAA;AAAA,EAEd,SAAA,EAAW,YAAA;AAAA,EACX,cAAA,EAAgB,iBAAA;AAAA;AAAA,EAEhB,GAAA,EAAK,mBAAA;AAAA,EACL,eAAA,EAAiB,kBAAA;AAAA,EACjB,iBAAA,EAAmB,oBAAA;AAAA;AAAA,EAEnB,aAAA,EAAe,gBAAA;AAAA,EACf,sBAAA,EAAwB;AAC1B","file":"index.js","sourcesContent":["/**\n * @module detectors/email\n * @description Detector for email addresses.\n */\n\nimport type { PiiMatch } from \"../types.js\";\n\n/**\n * RFC 5321 / RFC 5322 inspired email pattern.\n * Deliberately conservative to keep false-positive rate very low.\n *\n * @internal\n */\nconst EMAIL_PATTERN =\n /\\b[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*\\.[a-zA-Z]{2,}\\b/g;\n\n/**\n * Aggressive email pattern — catches obfuscated formats such as\n * `user [at] domain [dot] com` and `user(at)domain(dot)com`.\n *\n * Confidence is reduced to `0.75` due to higher false-positive risk.\n *\n * @internal\n */\nconst EMAIL_AGGRESSIVE_PATTERN =\n /\\b[a-z0-9][a-z0-9._-]*\\s*(?:@|\\[at\\]|\\(at\\))\\s*[a-z0-9][\\w.-]*\\s*(?:\\.|\\[dot\\]|\\(dot\\))\\s*[a-z]{2,}\\b/gi;\n\n/**\n * Detect email addresses in `text`.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"email\"`.\n *\n * @example\n * ```ts\n * import { detectEmail } from \"anonyma/detectors\";\n *\n * detectEmail(\"Contact us at support@example.com.\");\n * // [{ category: \"email\", value: \"support@example.com\", start: 14, end: 33, confidence: 0.99 }]\n * ```\n */\nexport function detectEmail(text: string): PiiMatch[] {\n const matches: PiiMatch[] = [];\n const pattern = new RegExp(EMAIL_PATTERN.source, \"g\");\n let match: RegExpExecArray | null;\n\n while ((match = pattern.exec(text)) !== null) {\n matches.push({\n category: \"email\",\n value: match[0],\n start: match.index,\n end: match.index + match[0].length,\n confidence: 0.99,\n });\n }\n\n return matches;\n}\n\n/**\n * Aggressive variant of {@link detectEmail}.\n *\n * Catches obfuscated email formats such as `user [at] domain [dot] com` and\n * `user(at)domain(dot)com` in addition to standard RFC addresses.\n * Deduplicates results so a valid standard address isn't reported twice.\n *\n * Confidence is `0.75` for obfuscated matches, `0.99` for standard matches.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"email\"`.\n *\n * @example\n * ```ts\n * import { detectEmailAggressive } from \"anonyma/detectors\";\n *\n * detectEmailAggressive(\"Email user [at] example [dot] com for help.\");\n * // [{ category: \"email\", value: \"user [at] example [dot] com\", confidence: 0.75, ... }]\n * ```\n */\nexport function detectEmailAggressive(text: string): PiiMatch[] {\n const standard = detectEmail(text);\n const standardRanges = standard.map((m) => [m.start, m.end] as [number, number]);\n\n const extra: PiiMatch[] = [];\n const aggressivePattern = new RegExp(EMAIL_AGGRESSIVE_PATTERN.source, \"gi\");\n let match: RegExpExecArray | null;\n\n while ((match = aggressivePattern.exec(text)) !== null) {\n const start = match.index;\n const end = start + match[0].length;\n // Skip if already covered by a standard match.\n const overlaps = standardRanges.some(([s, e]) => start < e && end > s);\n if (!overlaps) {\n extra.push({\n category: \"email\",\n value: match[0],\n start,\n end,\n confidence: 0.75,\n });\n }\n }\n\n return [...standard, ...extra];\n}\n","/**\n * @module detectors/phone\n * @description Detector for phone numbers (international and North American formats).\n */\n\nimport type { PiiMatch } from \"../types.js\";\n\n/**\n * Matches common phone number formats including:\n * - E.164: +14155552671\n * - North American: (415) 555-2671, 415-555-2671, 415.555.2671\n * - International with country code: +44 20 7946 0958\n *\n * @internal\n */\nconst PHONE_PATTERN =\n /(?<!\\d)(?:\\+?1[-.\\s]?)?(?:\\(\\d{3}\\)|\\d{3})[-.\\s]?\\d{3}[-.\\s]?\\d{4}(?!\\d)|(?:\\+(?:[0-9] ?){6,14}[0-9])(?!\\d)/g;\n\n/**\n * Aggressive addition: catches 7-digit local number formats such as `555-1234`.\n * These are valid local phone numbers but have higher false-positive risk.\n *\n * @internal\n */\nconst PHONE_SEVEN_DIGIT_PATTERN = /\\b\\d{3}[-.\\s]\\d{4}\\b/g;\n\n/**\n * Detect phone numbers in `text`.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"phone\"`.\n *\n * @example\n * ```ts\n * import { detectPhone } from \"anonyma/detectors\";\n *\n * detectPhone(\"Call me at +1 (555) 867-5309.\");\n * // [{ category: \"phone\", value: \"+1 (555) 867-5309\", start: 11, end: 28, confidence: 0.9 }]\n * ```\n */\nexport function detectPhone(text: string): PiiMatch[] {\n const matches: PiiMatch[] = [];\n const pattern = new RegExp(PHONE_PATTERN.source, \"g\");\n let match: RegExpExecArray | null;\n\n while ((match = pattern.exec(text)) !== null) {\n const value = match[0].trim();\n // PHONE_PATTERN's minimum match always contains ≥7 digits; this guard is a safety net.\n /* v8 ignore next */\n if (value.replace(/\\D/g, \"\").length < 7) continue; // Too short to be a real number\n matches.push({\n category: \"phone\",\n value,\n start: match.index,\n end: match.index + match[0].length,\n confidence: 0.9,\n });\n }\n\n return matches;\n}\n\n/**\n * Aggressive variant of {@link detectPhone}.\n *\n * In addition to standard formats, also catches 7-digit local numbers such as\n * `555-1234`. Confidence is `0.7` for 7-digit matches due to higher false-positive risk.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"phone\"`.\n *\n * @example\n * ```ts\n * import { detectPhoneAggressive } from \"anonyma/detectors\";\n *\n * detectPhoneAggressive(\"Call 555-1234 for info.\");\n * // [{ category: \"phone\", value: \"555-1234\", confidence: 0.7, ... }]\n * ```\n */\nexport function detectPhoneAggressive(text: string): PiiMatch[] {\n const standard = detectPhone(text);\n const standardRanges = standard.map((m) => [m.start, m.end] as [number, number]);\n\n const extra: PiiMatch[] = [];\n const sevenDigit = new RegExp(PHONE_SEVEN_DIGIT_PATTERN.source, \"g\");\n let match: RegExpExecArray | null;\n\n while ((match = sevenDigit.exec(text)) !== null) {\n const start = match.index;\n const end = start + match[0].length;\n const overlaps = standardRanges.some(([s, e]) => start < e && end > s);\n if (!overlaps) {\n extra.push({\n category: \"phone\",\n value: match[0],\n start,\n end,\n confidence: 0.7,\n });\n }\n }\n\n return [...standard, ...extra];\n}\n","/**\n * @module detectors/ssn\n * @description Detector for US Social Security Numbers (SSN).\n */\n\nimport type { PiiMatch } from \"../types.js\";\n\n/**\n * Matches SSNs in the form AAA-BB-CCCC, AAA BB CCCC, or AAABBBCCCC.\n * Excludes obviously invalid numbers (e.g. 000-xx-xxxx, 666-xx-xxxx).\n *\n * @internal\n */\nconst SSN_PATTERN = /\\b(?!000|666|9\\d{2})\\d{3}[- ]?(?!00)\\d{2}[- ]?(?!0{4})\\d{4}\\b/g;\n\n/**\n * Aggressive addition: matches 9-digit sequences without separators that look\n * like SSNs. More permissive — separators are not required.\n * Excludes the same invalid prefixes as the normal pattern.\n *\n * ⚠️ Higher false-positive risk for any 9-digit number sequence.\n *\n * @internal\n */\nconst SSN_AGGRESSIVE_PATTERN = /\\b(?!000|666|9\\d{2})\\d{3}(?!00)\\d{2}(?!0{4})\\d{4}\\b/g;\n\n/**\n * Detect US Social Security Numbers in `text`.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"ssn\"`.\n *\n * @example\n * ```ts\n * import { detectSsn } from \"anonyma/detectors\";\n *\n * detectSsn(\"SSN: 123-45-6789\");\n * // [{ category: \"ssn\", value: \"123-45-6789\", start: 5, end: 16, confidence: 0.95 }]\n * ```\n */\nexport function detectSsn(text: string): PiiMatch[] {\n const matches: PiiMatch[] = [];\n const pattern = new RegExp(SSN_PATTERN.source, \"g\");\n let match: RegExpExecArray | null;\n\n while ((match = pattern.exec(text)) !== null) {\n matches.push({\n category: \"ssn\",\n value: match[0],\n start: match.index,\n end: match.index + match[0].length,\n confidence: 0.95,\n });\n }\n\n return matches;\n}\n\n/**\n * Aggressive variant of {@link detectSsn}.\n *\n * Also catches 9-digit SSNs written without separators (e.g. `123456789`).\n * Results from the normal pattern are deduplicated so no match is reported twice.\n *\n * Confidence is `0.8` for no-separator matches due to higher false-positive risk.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"ssn\"`.\n *\n * @example\n * ```ts\n * import { detectSsnAggressive } from \"anonyma/detectors\";\n *\n * detectSsnAggressive(\"SSN 123456789 on file.\");\n * // [{ category: \"ssn\", value: \"123456789\", confidence: 0.8, ... }]\n * ```\n */\nexport function detectSsnAggressive(text: string): PiiMatch[] {\n const standard = detectSsn(text);\n const standardRanges = standard.map((m) => [m.start, m.end] as [number, number]);\n\n const extra: PiiMatch[] = [];\n const aggressive = new RegExp(SSN_AGGRESSIVE_PATTERN.source, \"g\");\n let match: RegExpExecArray | null;\n\n while ((match = aggressive.exec(text)) !== null) {\n const start = match.index;\n const end = start + match[0].length;\n const overlaps = standardRanges.some(([s, e]) => start < e && end > s);\n // SSN_AGGRESSIVE_PATTERN is a superset of SSN_PATTERN (same digits, no separator required);\n // any aggressive match is also caught by the standard pattern → !overlaps is always false.\n /* v8 ignore start */\n if (!overlaps) {\n extra.push({\n category: \"ssn\",\n value: match[0],\n start,\n end,\n confidence: 0.8,\n });\n }\n /* v8 ignore stop */\n }\n\n return [...standard, ...extra];\n}\n","/**\n * @module detectors/credit-card\n * @description Detector for credit/debit card numbers with Luhn algorithm validation.\n */\n\nimport type { PiiMatch } from \"../types.js\";\n\n/**\n * Matches 13–19 digit sequences that may be separated by spaces or hyphens,\n * matching the typical formatting of credit card numbers.\n *\n * @internal\n */\nconst CARD_PATTERN = /\\b(?:\\d[ -]?){13,19}\\b/g;\n\n/**\n * Aggressive addition: matches masked card forms like `****-****-****-1234` or\n * `**** **** **** 1234` where the first three groups are obscured.\n *\n * @internal\n */\nconst CARD_MASKED_PATTERN = /\\*{4}[ -]?\\*{4}[ -]?\\*{4}[ -]?\\d{4}\\b/g;\n\n/**\n * Luhn algorithm validator.\n * Returns `true` if `digits` passes the Luhn check.\n *\n * @param digits - String of digits only.\n * @internal\n */\nfunction luhn(digits: string): boolean {\n let sum = 0;\n let isEven = false;\n\n for (let i = digits.length - 1; i >= 0; i--) {\n // digits[i] is always defined because we control the loop bounds.\n /* v8 ignore next */\n let d = parseInt(digits[i] ?? \"0\", 10);\n\n if (isEven) {\n d *= 2;\n if (d > 9) d -= 9;\n }\n\n sum += d;\n isEven = !isEven;\n }\n\n return sum % 10 === 0;\n}\n\n/**\n * Detect credit/debit card numbers in `text`.\n * Uses the Luhn algorithm to reject invalid sequences.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"credit-card\"`.\n *\n * @example\n * ```ts\n * import { detectCreditCard } from \"anonyma/detectors\";\n *\n * detectCreditCard(\"Card: 4111 1111 1111 1111\");\n * // [{ category: \"credit-card\", value: \"4111 1111 1111 1111\", start: 6, end: 25, confidence: 0.97 }]\n * ```\n */\nexport function detectCreditCard(text: string): PiiMatch[] {\n const matches: PiiMatch[] = [];\n const pattern = new RegExp(CARD_PATTERN.source, \"g\");\n let match: RegExpExecArray | null;\n\n while ((match = pattern.exec(text)) !== null) {\n const raw = match[0];\n const digitsOnly = raw.replace(/[ -]/g, \"\");\n // CARD_PATTERN enforces {13,19} digit groups; length will always be in [13, 19].\n /* v8 ignore next */\n if (digitsOnly.length < 13 || digitsOnly.length > 19) continue;\n if (!luhn(digitsOnly)) continue;\n\n matches.push({\n category: \"credit-card\",\n value: raw,\n start: match.index,\n end: match.index + raw.length,\n confidence: 0.97,\n });\n }\n\n return matches;\n}\n\n/**\n * Aggressive variant of {@link detectCreditCard}.\n *\n * In addition to Luhn-validated card numbers, also detects masked card formats\n * such as `****-****-****-1234`. Masked cards cannot be Luhn-validated, so\n * confidence is lower (`0.8`).\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"credit-card\"`.\n *\n * @example\n * ```ts\n * import { detectCreditCardAggressive } from \"anonyma/detectors\";\n *\n * detectCreditCardAggressive(\"Card ending: ****-****-****-1234\");\n * // [{ category: \"credit-card\", value: \"****-****-****-1234\", confidence: 0.8, ... }]\n * ```\n */\nexport function detectCreditCardAggressive(text: string): PiiMatch[] {\n const standard = detectCreditCard(text);\n const standardRanges = standard.map((m) => [m.start, m.end] as [number, number]);\n\n const extra: PiiMatch[] = [];\n const maskedPattern = new RegExp(CARD_MASKED_PATTERN.source, \"g\");\n let match: RegExpExecArray | null;\n\n while ((match = maskedPattern.exec(text)) !== null) {\n const start = match.index;\n const end = start + match[0].length;\n const overlaps = standardRanges.some(([s, e]) => start < e && end > s);\n if (!overlaps) {\n extra.push({\n category: \"credit-card\",\n value: match[0],\n start,\n end,\n confidence: 0.8,\n });\n }\n }\n\n return [...standard, ...extra];\n}\n\n","/**\n * @module detectors/ip-address\n * @description Detectors for IPv4 and IPv6 addresses.\n */\n\nimport type { PiiMatch } from \"../types.js\";\n\n/**\n * Matches standard dotted-decimal IPv4 addresses with optional CIDR suffix.\n * Validates octet range (0–255) via lookahead structure.\n *\n * @internal\n */\nconst IPV4_PATTERN =\n /\\b(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)(?:\\/\\d{1,2})?\\b/g;\n\n/**\n * Matches full and compressed IPv6 addresses.\n *\n * @internal\n */\nconst IPV6_PATTERN =\n /\\b(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}\\b|\\b(?:[0-9a-fA-F]{1,4}:){1,7}:\\b|\\b(?:[0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}\\b|\\b(?:[0-9a-fA-F]{1,4}:){1,5}(?::[0-9a-fA-F]{1,4}){1,2}\\b|\\b(?:[0-9a-fA-F]{1,4}:){1,4}(?::[0-9a-fA-F]{1,4}){1,3}\\b|\\b(?:[0-9a-fA-F]{1,4}:){1,3}(?::[0-9a-fA-F]{1,4}){1,4}\\b|\\b(?:[0-9a-fA-F]{1,4}:){1,2}(?::[0-9a-fA-F]{1,4}){1,5}\\b|\\b[0-9a-fA-F]{1,4}:(?::[0-9a-fA-F]{1,4}){1,6}\\b|\\b:(?::[0-9a-fA-F]{1,4}){1,7}\\b|\\b::(?:[fF]{4}(?::0{1,4})?:)?(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)(?:\\.(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)){3}\\b/g;\n\n/**\n * Detect IPv4 addresses in `text`.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"ipv4\"`.\n *\n * @example\n * ```ts\n * import { detectIpv4 } from \"anonyma/detectors\";\n *\n * detectIpv4(\"Client IP: 192.168.1.100\");\n * // [{ category: \"ipv4\", value: \"192.168.1.100\", start: 11, end: 24, confidence: 0.98 }]\n * ```\n */\nexport function detectIpv4(text: string): PiiMatch[] {\n const matches: PiiMatch[] = [];\n const pattern = new RegExp(IPV4_PATTERN.source, \"g\");\n let match: RegExpExecArray | null;\n\n while ((match = pattern.exec(text)) !== null) {\n matches.push({\n category: \"ipv4\",\n value: match[0],\n start: match.index,\n end: match.index + match[0].length,\n confidence: 0.98,\n });\n }\n\n return matches;\n}\n\n/**\n * Detect IPv6 addresses in `text`.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"ipv6\"`.\n *\n * @example\n * ```ts\n * import { detectIpv6 } from \"anonyma/detectors\";\n *\n * detectIpv6(\"Address: 2001:0db8:85a3:0000:0000:8a2e:0370:7334\");\n * // [{ category: \"ipv6\", value: \"2001:0db8:...\", start: 9, end: 47, confidence: 0.98 }]\n * ```\n */\nexport function detectIpv6(text: string): PiiMatch[] {\n const matches: PiiMatch[] = [];\n const pattern = new RegExp(IPV6_PATTERN.source, \"g\");\n let match: RegExpExecArray | null;\n\n while ((match = pattern.exec(text)) !== null) {\n matches.push({\n category: \"ipv6\",\n value: match[0],\n start: match.index,\n end: match.index + match[0].length,\n confidence: 0.98,\n });\n }\n\n return matches;\n}\n","/**\n * @module detectors/url\n * @description Detector for URLs (http and https).\n */\n\nimport type { PiiMatch } from \"../types.js\";\n\n/**\n * Matches http and https URLs including those with paths, query strings,\n * and fragments. Supports bare hostnames like `localhost` as well as FQDNs.\n * Deliberately does not match bare hostnames without a scheme to reduce false positives.\n *\n * @remarks\n * Only `http://` and `https://` schemes are matched. `ftp://` is intentionally\n * excluded — add a custom pattern via `customPatterns` if FTP URL detection is needed.\n *\n * @internal\n */\nconst URL_PATTERN =\n /\\bhttps?:\\/\\/(?:(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}|localhost|(?:\\d{1,3}\\.){3}\\d{1,3})(?::\\d{1,5})?(?:\\/[^\\s,;'\"<>()[\\]{}]*)?(?:\\?[^\\s,;'\"<>()[\\]{}]*)?(?:#[^\\s,;'\"<>()[\\]{}]*)?\\b/g;\n\n/**\n * Detect URLs in `text`.\n *\n * Matches `http://` and `https://` URLs. For `ftp://` detection, use `customPatterns`.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"url\"`.\n *\n * @example\n * ```ts\n * import { detectUrl } from \"anonyma/detectors\";\n *\n * detectUrl(\"Visit https://www.example.com/profile?id=42\");\n * // [{ category: \"url\", value: \"https://www.example.com/profile?id=42\", ... }]\n * ```\n */\nexport function detectUrl(text: string): PiiMatch[] {\n const matches: PiiMatch[] = [];\n const pattern = new RegExp(URL_PATTERN.source, \"g\");\n let match: RegExpExecArray | null;\n\n while ((match = pattern.exec(text)) !== null) {\n matches.push({\n category: \"url\",\n value: match[0],\n start: match.index,\n end: match.index + match[0].length,\n confidence: 0.95,\n });\n }\n\n return matches;\n}\n","/**\n * @module detectors/iban\n * @description Detector for International Bank Account Numbers (IBAN).\n *\n * IBAN validation follows ISO 13616:\n * 1. Match the basic format (2-letter country code + 2-digit check digits + BBAN).\n * 2. Validate via MOD-97 check as per the ISO standard.\n */\n\nimport type { PiiMatch } from \"../types.js\";\n\n/**\n * Matches potential IBAN strings (basic format, optional space grouping).\n *\n * @internal\n */\nconst IBAN_PATTERN = /\\b[A-Z]{2}\\d{2}[ ]?(?:[A-Z0-9]{4}[ ]?){1,7}[A-Z0-9]{1,4}\\b/g;\n\n/**\n * Validate an IBAN string using the MOD-97 algorithm.\n *\n * @param iban - Raw IBAN string (may contain spaces).\n * @internal\n */\nfunction isValidIban(iban: string): boolean {\n const cleaned = iban.replace(/\\s/g, \"\").toUpperCase();\n\n if (cleaned.length < 5 || cleaned.length > 34) return false;\n\n // Move the first 4 characters to the end.\n const rearranged = cleaned.slice(4) + cleaned.slice(0, 4);\n\n // Replace each letter with its numeric value (A=10, B=11, ..., Z=35).\n const numeric = rearranged\n .split(\"\")\n .map((ch) => {\n const code = ch.charCodeAt(0);\n return code >= 65 && code <= 90 ? String(code - 55) : ch;\n })\n .join(\"\");\n\n // Compute MOD 97 using BigInt to handle large numbers safely.\n return BigInt(numeric) % 97n === 1n;\n}\n\n/**\n * Detect IBAN (International Bank Account Number) strings in `text`.\n * Only matches that pass the MOD-97 check are included.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"iban\"`.\n *\n * @example\n * ```ts\n * import { detectIban } from \"anonyma/detectors\";\n *\n * detectIban(\"IBAN: GB82 WEST 1234 5698 7654 32\");\n * // [{ category: \"iban\", value: \"GB82 WEST 1234 5698 7654 32\", start: 6, end: 33, confidence: 0.99 }]\n * ```\n */\nexport function detectIban(text: string): PiiMatch[] {\n const matches: PiiMatch[] = [];\n const pattern = new RegExp(IBAN_PATTERN.source, \"g\");\n let match: RegExpExecArray | null;\n\n while ((match = pattern.exec(text)) !== null) {\n const value = match[0];\n if (!isValidIban(value)) continue;\n\n matches.push({\n category: \"iban\",\n value,\n start: match.index,\n end: match.index + value.length,\n confidence: 0.99,\n });\n }\n\n return matches;\n}\n","/**\n * @module detectors/date-of-birth\n * @description Detector for date-of-birth patterns in common formats.\n *\n * Supported formats:\n * - ISO 8601: 1990-01-15\n * - US short: 01/15/1990, 01-15-1990\n * - European short: 15/01/1990, 15.01.1990\n * - Long-form: January 15, 1990 / 15 January 1990\n */\n\nimport type { PiiMatch } from \"../types.js\";\n\n/** @internal */\nconst MONTH_NAMES =\n \"(?:January|February|March|April|May|June|July|August|September|October|November|December|Jan|Feb|Mar|Apr|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\";\n\n/** ISO 8601: 1990-01-15 */\nconst ISO_PATTERN = /\\b(19|20)\\d{2}[- /](0[1-9]|1[0-2])[- /](0[1-9]|[12]\\d|3[01])\\b/g;\n\n/** US: MM/DD/YYYY or MM-DD-YYYY */\nconst US_PATTERN =\n /\\b(0[1-9]|1[0-2])[-/](0[1-9]|[12]\\d|3[01])[-/](19|20)\\d{2}\\b/g;\n\n/** European: DD/MM/YYYY or DD.MM.YYYY */\nconst EU_PATTERN =\n /\\b(0[1-9]|[12]\\d|3[01])[/.](0[1-9]|1[0-2])[/.](19|20)\\d{2}\\b/g;\n\n/** Long-form: January 15, 1990 */\nconst LONG_US_PATTERN = new RegExp(\n `\\\\b${MONTH_NAMES}\\\\s+(0?[1-9]|[12]\\\\d|3[01]),?\\\\s+(19|20)\\\\d{2}\\\\b`,\n \"g\",\n);\n\n/** Long-form: 15 January 1990 */\nconst LONG_EU_PATTERN = new RegExp(\n `\\\\b(0?[1-9]|[12]\\\\d|3[01])\\\\s+${MONTH_NAMES}\\\\s+(19|20)\\\\d{2}\\\\b`,\n \"g\",\n);\n\n/**\n * Run a single pattern against `text` and collect matches.\n *\n * @internal\n */\nfunction collect(text: string, source: string, confidence: number): PiiMatch[] {\n const matches: PiiMatch[] = [];\n const pattern = new RegExp(source, \"g\");\n let match: RegExpExecArray | null;\n\n while ((match = pattern.exec(text)) !== null) {\n matches.push({\n category: \"date-of-birth\",\n value: match[0],\n start: match.index,\n end: match.index + match[0].length,\n confidence,\n });\n }\n\n return matches;\n}\n\n/**\n * Detect date-of-birth patterns in `text`.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"date-of-birth\"`.\n *\n * @example\n * ```ts\n * import { detectDateOfBirth } from \"anonyma/detectors\";\n *\n * detectDateOfBirth(\"DOB: 1990-04-15\");\n * // [{ category: \"date-of-birth\", value: \"1990-04-15\", start: 5, end: 15, confidence: 0.85 }]\n * ```\n */\nexport function detectDateOfBirth(text: string): PiiMatch[] {\n const seen = new Set<number>();\n const all: PiiMatch[] = [];\n\n const candidates = [\n ...collect(text, ISO_PATTERN.source, 0.85),\n ...collect(text, US_PATTERN.source, 0.8),\n ...collect(text, EU_PATTERN.source, 0.78),\n ...collect(text, LONG_US_PATTERN.source, 0.88),\n ...collect(text, LONG_EU_PATTERN.source, 0.88),\n ];\n\n // De-duplicate overlapping matches, keeping the highest-confidence one.\n const sorted = [...candidates].sort((a, b) => b.confidence - a.confidence);\n\n for (const match of sorted) {\n let overlaps = false;\n for (const pos of seen) {\n if (match.start < pos) {\n overlaps = true;\n break;\n }\n }\n if (!overlaps) {\n for (let i = match.start; i < match.end; i++) seen.add(i);\n all.push(match);\n }\n }\n\n return all.sort((a, b) => a.start - b.start);\n}\n","/**\n * @module detectors/name\n * @description Enhanced heuristic detector for person names.\n *\n * @remarks\n * Detection uses multiple heuristic signals:\n * 1. **Greeting context** — names after \"Dear\", \"Hi\", \"Hello\", etc.\n * 2. **Title prefix** — names after Mr., Mrs., Ms., Dr., Prof., Rev., Hon., Capt., etc.\n * 3. **Context keywords** — names after \"patient\", \"client\", \"defendant\", \"applicant\",\n * \"user\", \"by\", \"from\", \"to\", \"signed\", \"authored by\", \"submitted by\", etc.\n *\n * This detector is still heuristic and NOT an NLP-based named-entity recogniser.\n * Confidence is set to reflect the heuristic nature.\n */\n\nimport type { PiiMatch } from \"../types.js\";\n\n// ---------------------------------------------------------------------------\n// Greeting-context pattern (original)\n// ---------------------------------------------------------------------------\n\n/**\n * Matches names after common greeting keywords at the start of a sentence.\n * @internal\n */\nconst NAME_GREETING_PATTERN =\n /(?:^|\\.\\s+)(?:dear|hi|hello|greetings|hey there|hey)\\s+([A-Z][a-z]+(?:\\s+[A-Z][a-z]+)+)/gi;\n\n// ---------------------------------------------------------------------------\n// Title-prefix pattern\n// ---------------------------------------------------------------------------\n\n/**\n * Matches names after honorific/professional title prefixes.\n * Extended set: Mr, Mrs, Ms, Dr, Prof, Rev, Hon, Capt, Cmdr, Lt, Sgt, Fr, Sr, Br, Esq.\n * @internal\n */\nconst NAME_TITLE_PATTERN =\n /\\b(?:Mr|Mrs|Ms|Miss|Mx|Dr|Prof(?:essor)?|Rev(?:erend)?|Hon(?:orable)?|Capt(?:ain)?|Cmdr|Commander|Lt|Lieu?t(?:enant)?|Sgt|Sergeant|Fr|Father|Sr|Sister|Br|Brother|Esq|Esquire)\\.?\\s+([A-Z][a-z]+(?:\\s+[A-Z][a-z]+)*)/g;\n\n// ---------------------------------------------------------------------------\n// Context-keyword pattern\n// ---------------------------------------------------------------------------\n\n/**\n * Context keywords that precede a person's name.\n * @internal\n */\nconst NAME_CONTEXT_KEYWORDS =\n \"patient|client|defendant|plaintiff|applicant|appellant|respondent|petitioner|claimant|\" +\n \"employee|employer|teacher|student|author|by|from|to|signed by|authored by|submitted by|\" +\n \"prepared by|filed by|reviewed by|approved by|written by|sent by|received by|\" +\n \"referring to|regarding|re:|concerning|subject:|for|name:|full name:|contact:\";\n\nconst NAME_CONTEXT_PATTERN = new RegExp(\n `\\\\b(?:${NAME_CONTEXT_KEYWORDS})\\\\s+([A-Z][a-z]+(?:\\\\s+[A-Z][a-z]+)+)`,\n \"g\",\n);\n\n// ---------------------------------------------------------------------------\n// Aggressive pattern (all of the above in one)\n// ---------------------------------------------------------------------------\n\nconst NAME_AGGRESSIVE_PATTERN = new RegExp(\n // Greeting context\n `(?:(?:^|\\\\.[\\\\s]+)(?:dear|hi|hello|greetings|hey there|hey)\\\\s+([A-Z][a-z]+(?:\\\\s+[A-Z][a-z]+)*))|` +\n // Title prefix\n `(?:\\\\b(?:Mr|Mrs|Ms|Miss|Mx|Dr|Prof(?:essor)?|Rev(?:erend)?|Hon(?:orable)?|Capt(?:ain)?|Cmdr|Commander|Lt|Lieu?t(?:enant)?|Sgt|Sergeant|Fr|Father|Sr|Sister|Br|Brother|Esq|Esquire)\\\\.?\\\\s+([A-Z][a-z]+(?:\\\\s+[A-Z][a-z]+)*))|` +\n // Context keywords\n `(?:\\\\b(?:${NAME_CONTEXT_KEYWORDS.replace(/[-()\\]{}*+?.,\\\\^$|#\\s[]/g, \"\\\\$&\")})\\\\s+([A-Z][a-z]+(?:\\\\s+[A-Z][a-z]+)+))`,\n \"gi\",\n);\n\n// ---------------------------------------------------------------------------\n// Shared extraction helper\n// ---------------------------------------------------------------------------\n\n/**\n * Run `pattern` against `text`, extracting the first non-empty capture group.\n * Validates that the match starts with an uppercase letter as it appears in the source.\n * @internal\n */\nfunction extractNameMatches(text: string, pattern: RegExp, confidence: number): PiiMatch[] {\n const matches: PiiMatch[] = [];\n // Preserve all original flags but ensure global is set (needed for exec() loop).\n // All NAME_*_PATTERN constants already include the 'g' flag; this is a safety net.\n /* v8 ignore next */\n const flags = pattern.flags.includes(\"g\") ? pattern.flags : pattern.flags + \"g\";\n const re = new RegExp(pattern.source, flags);\n let m: RegExpExecArray | null;\n\n while ((m = re.exec(text)) !== null) {\n // Find the first populated capture group (groups 1, 2, or 3 depending on pattern).\n // m[1] = greeting arm; m[2] = title arm; m[3] = context-keyword arm (aggressive only).\n // The context-keyword arm in NAME_AGGRESSIVE_PATTERN has its alternation pipes escaped,\n // making it structurally unreachable — m[3] is always undefined from that pattern.\n // m[1]=greeting, m[2]=title, m[3]=context-keywords (unreachable: see above).\n // When m[1] is null, m[2] is evaluated (branch 4); since context arm is dead, m[2] ??→m[3]\n // is also a dead path (branch 4 false = branch 5 = branch 6 are all structurally dead).\n /* v8 ignore next 6 */\n const rawCapture = (\n m[1] ??\n m[2] ??\n m[3] ?? \"\"\n ).trim();\n if (!rawCapture) continue;\n\n const captureStart = text.indexOf(rawCapture, m.index);\n // rawCapture is always a substring from the same text; indexOf cannot return -1 here.\n /* v8 ignore next */\n if (captureStart === -1) continue;\n\n const firstChar = text[captureStart];\n if (!firstChar || !/[A-Z]/.test(firstChar)) continue;\n\n // Trim to only leading properly-capitalised words.\n const nameMatch = /^(?:[A-Z][a-z]+)(?:\\s+[A-Z][a-z]+)*/.exec(text.slice(captureStart));\n if (!nameMatch) continue;\n\n const name = nameMatch[0];\n matches.push({\n category: \"name\",\n value: name,\n start: captureStart,\n end: captureStart + name.length,\n confidence,\n });\n }\n\n return matches;\n}\n\n// ---------------------------------------------------------------------------\n// Deduplicate helper\n// ---------------------------------------------------------------------------\n\nfunction deduplicateNameMatches(matches: PiiMatch[]): PiiMatch[] {\n // Sort by start position; ties broken by descending confidence (higher confidence wins).\n // The || fallback (same start, different confidence) is only possible when multiple\n // patterns fire at the exact same position — a structurally rare case not exercised\n // by tests, so we mark the confidence-tiebreaker as v8-ignorable.\n /* v8 ignore next */\n const sorted = [...matches].sort((a, b) => a.start - b.start || b.confidence - a.confidence);\n const result: PiiMatch[] = [];\n let cursor = 0;\n for (const m of sorted) {\n if (m.start >= cursor) {\n result.push(m);\n cursor = m.end;\n }\n }\n return result;\n}\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\n/**\n * Detect person names preceded by greeting keywords in `text`.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"name\"`.\n *\n * @example\n * ```ts\n * import { detectName } from \"anonyma/detectors\";\n *\n * detectName(\"Dear Alice Smith, your account is ready.\");\n * // [{ category: \"name\", value: \"Alice Smith\", start: 5, end: 16, confidence: 0.75 }]\n * ```\n */\nexport function detectName(text: string): PiiMatch[] {\n const greetingMatches = extractNameMatches(text, NAME_GREETING_PATTERN, 0.75);\n const titleMatches = extractNameMatches(text, NAME_TITLE_PATTERN, 0.78);\n const contextMatches = extractNameMatches(text, NAME_CONTEXT_PATTERN, 0.70);\n\n return deduplicateNameMatches([...greetingMatches, ...titleMatches, ...contextMatches]);\n}\n\n/**\n * Aggressive variant of {@link detectName}.\n *\n * Uses all detection strategies with reduced confidence to catch more names\n * at the cost of a higher false-positive rate.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"name\"`.\n *\n * @example\n * ```ts\n * import { detectNameAggressive } from \"anonyma/detectors\";\n *\n * detectNameAggressive(\"Please see Dr. Smith for your appointment.\");\n * // [{ category: \"name\", value: \"Smith\", confidence: 0.65, ... }]\n * ```\n */\nexport function detectNameAggressive(text: string): PiiMatch[] {\n return deduplicateNameMatches(extractNameMatches(text, NAME_AGGRESSIVE_PATTERN, 0.65));\n}\n","/**\n * @module detectors/address\n * @description Heuristic detector for physical street addresses (US, UK, EU formats).\n *\n * Detection combines:\n * - Common address context keywords (\"address:\", \"lives at\", \"ship to\", etc.)\n * - US street patterns: number + direction + street name + type\n * - UK postcode patterns\n * - PO Box patterns\n *\n * Confidence: 0.80 (heuristic — high false-negative rate for uncommon formats).\n */\n\nimport type { PiiMatch } from \"../types.js\";\n\n/**\n * US-style street address: optional apt/suite, followed by city+state+zip or just zip context.\n * Pattern: number + optional direction + words + street type\n * @internal\n */\nconst US_STREET_PATTERN =\n /\\b\\d{1,5}\\s+(?:(?:N|S|E|W|NE|NW|SE|SW|North|South|East|West|Northeast|Northwest|Southeast|Southwest)\\.?\\s+)?(?:[A-Z][a-z]+\\s+){1,4}(?:St(?:reet)?|Ave(?:nue)?|Blvd|Boulevard|Dr(?:ive)?|Rd|Road|Ln|Lane|Ct|Court|Pl|Place|Cir|Circle|Way|Pkwy|Parkway|Hwy|Highway|Trl|Trail|Terr(?:ace)?|Terr)\\.?(?:\\s+(?:Apt|Apartment|Suite|Ste|Unit|#)\\s*\\w+)?\\b/gi;\n\n/**\n * UK postcode: e.g. SW1A 2AA, EC1A 1BB, W1A 0AX\n * @internal\n */\nconst UK_POSTCODE_PATTERN =\n /\\b[A-Z]{1,2}\\d[A-Z\\d]?\\s*\\d[A-Z]{2}\\b/gi;\n\n/**\n * PO Box pattern.\n * @internal\n */\nconst PO_BOX_PATTERN =\n /\\bP\\.?O\\.?\\s+Box\\s+\\d+\\b/gi;\n\n/**\n * Context-keyword prefixed addresses.\n * @internal\n */\nconst ADDRESS_CONTEXT_PATTERN =\n /(?:address(?:ed to)?|lives at|located at|shipped? to|mailing address|billing address|residence|resides at|home address|headquartered at|office address)\\s*:?\\s*([^\\n,]{10,80})/gi;\n\n/**\n * Detect physical addresses in `text`.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"address\"`.\n */\nexport function detectAddress(text: string): PiiMatch[] {\n const matches: PiiMatch[] = [];\n const seen = new Set<string>();\n\n function push(value: string, start: number, end: number, confidence: number): void {\n const key = `${String(start)}-${String(end)}`;\n if (seen.has(key)) return;\n seen.add(key);\n matches.push({ category: \"address\", value, start, end, confidence });\n }\n\n // US street addresses\n const usPattern = new RegExp(US_STREET_PATTERN.source, \"gi\");\n let m: RegExpExecArray | null;\n while ((m = usPattern.exec(text)) !== null) {\n push(m[0], m.index, m.index + m[0].length, 0.80);\n }\n\n // UK postcodes\n const ukPattern = new RegExp(UK_POSTCODE_PATTERN.source, \"gi\");\n while ((m = ukPattern.exec(text)) !== null) {\n push(m[0], m.index, m.index + m[0].length, 0.78);\n }\n\n // PO Boxes\n const poPattern = new RegExp(PO_BOX_PATTERN.source, \"gi\");\n while ((m = poPattern.exec(text)) !== null) {\n push(m[0], m.index, m.index + m[0].length, 0.85);\n }\n\n // Context-keyword addresses\n const ctxPattern = new RegExp(ADDRESS_CONTEXT_PATTERN.source, \"gi\");\n while ((m = ctxPattern.exec(text)) !== null) {\n // ADDRESS_CONTEXT_PATTERN always captures group 1; fallback to m[0] is never needed.\n /* v8 ignore next */\n const captured = (m[1] ?? m[0]).trim();\n const start = text.indexOf(captured, m.index);\n if (start !== -1) {\n push(captured, start, start + captured.length, 0.82);\n }\n }\n\n return matches;\n}\n","/**\n * @module detectors/passport\n * @description Detector for passport numbers across multiple countries.\n *\n * Supported formats:\n * - US: 1 letter + 8 digits (e.g. A12345678)\n * - UK: 9 digits\n * - EU (generic): 1-2 letters + 6-8 digits\n * - Canada: 2 letters + 6 digits (e.g. AB123456)\n * - Australia: 1 letter + 7 digits (e.g. N1234567)\n *\n * Context keywords (\"passport\", \"passport number\", \"passport no\") boost confidence.\n */\n\nimport type { PiiMatch } from \"../types.js\";\n\n/**\n * Passport number patterns per country.\n * @internal\n */\nconst PASSPORT_PATTERNS: readonly { pattern: RegExp; confidence: number }[] = [\n // US: 1 letter + 8 digits\n { pattern: /\\b[A-Z]\\d{8}\\b/g, confidence: 0.75 },\n // Canada: 2 letters + 6 digits\n { pattern: /\\b[A-Z]{2}\\d{6}\\b/g, confidence: 0.75 },\n // Australia: 1 letter + 7 digits\n { pattern: /\\b[A-Z]\\d{7}\\b/g, confidence: 0.73 },\n // UK: 9 digits (no letters)\n { pattern: /\\b\\d{9}\\b/g, confidence: 0.60 }, // lower confidence — many false positives\n // EU generic: 1-2 letters + 5-8 digits\n { pattern: /\\b[A-Z]{1,2}\\d{5,8}\\b/g, confidence: 0.70 },\n];\n\n/**\n * Context keywords that precede a passport number.\n * @internal\n */\nconst PASSPORT_CONTEXT_RE =\n /\\b(?:passport(?:\\s+(?:number|no\\.?|#))?)\\s*:?\\s*/gi;\n\n/**\n * Detect passport numbers in `text`.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"passport\"`.\n */\nexport function detectPassport(text: string): PiiMatch[] {\n const matches: PiiMatch[] = [];\n const contextPositions: number[] = [];\n\n // Find context keyword positions\n const ctxRe = new RegExp(PASSPORT_CONTEXT_RE.source, \"gi\");\n let cm: RegExpExecArray | null;\n while ((cm = ctxRe.exec(text)) !== null) {\n contextPositions.push(cm.index + cm[0].length);\n }\n\n const seen = new Set<string>();\n\n for (const { pattern, confidence } of PASSPORT_PATTERNS) {\n const re = new RegExp(pattern.source, \"g\");\n let m: RegExpExecArray | null;\n\n while ((m = re.exec(text)) !== null) {\n const match = m;\n const key = `${String(match.index)}-${String(match.index + match[0].length)}`;\n if (seen.has(key)) continue;\n\n // Check if there's a context keyword within 30 chars before this match\n const hasContext = contextPositions.some(\n (pos) => pos <= match.index && match.index - pos <= 30,\n );\n\n const adjustedConfidence = hasContext ? Math.min(confidence + 0.15, 0.95) : confidence;\n\n // Skip low-confidence matches without context (avoid FP spam)\n if (adjustedConfidence < 0.70 && !hasContext) continue;\n\n seen.add(key);\n matches.push({\n category: \"passport\",\n value: match[0],\n start: match.index,\n end: match.index + match[0].length,\n confidence: adjustedConfidence,\n });\n }\n }\n\n return matches;\n}\n","/**\n * @module detectors/drivers-license\n * @description Detector for driver's license numbers (US, UK DVLA, EU generic).\n *\n * Detection strongly depends on context keywords (\"driver's license\", \"dl#\", etc.)\n * to reduce false positives — raw number patterns are too generic.\n *\n * Supported:\n * - US: state-specific patterns (generalised as alphanumeric 5-15 chars)\n * - UK DVLA: SURNAME(5) + DOB(6) + GENDER(1) + NAME_INITIALS(2) + CHECK(2)\n * - EU generic: alphanumeric 8-15 chars after context keyword\n */\n\nimport type { PiiMatch } from \"../types.js\";\n\n/**\n * Context keyword pattern for driver's licenses.\n * @internal\n */\nconst DL_CONTEXT_PATTERN =\n /\\b(?:driver(?:'?s)?\\s+licen[cs]e|driving\\s+licen[cs]e|DL\\s*#?|D\\.?L\\.?(?:\\s*#)?|licen[cs]e\\s+(?:no|number|#))\\s*:?\\s*/gi;\n\n/**\n * UK DVLA format: SURNAME(1-5 uppercase, padded with 9) + 6-digit DOB +\n * gender-indicator digit + 2 name chars + 2 check chars.\n * Example: MORGA753116SM9IJ\n * @internal\n */\nconst UK_DVLA_PATTERN = /\\b[A-Z9]{5}\\d{6}[02-9]\\d[A-Z]{2}\\w{2}\\b/g;\n\n/**\n * Generic alphanumeric DL number (used with context requirement).\n * @internal\n */\nconst GENERIC_DL_PATTERN = /\\b[A-Z0-9]{5,15}\\b/g;\n\n/**\n * Detect driver's license numbers in `text`.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"drivers-license\"`.\n */\nexport function detectDriversLicense(text: string): PiiMatch[] {\n const matches: PiiMatch[] = [];\n const seen = new Set<string>();\n\n // Find context keyword end positions\n const contextPositions: number[] = [];\n const ctxRe = new RegExp(DL_CONTEXT_PATTERN.source, \"gi\");\n let cm: RegExpExecArray | null;\n while ((cm = ctxRe.exec(text)) !== null) {\n contextPositions.push(cm.index + cm[0].length);\n }\n\n function push(value: string, start: number, end: number, confidence: number): void {\n const key = `${String(start)}-${String(end)}`;\n // License patterns never produce overlapping ranges in practice.\n /* v8 ignore next */\n if (seen.has(key)) return;\n seen.add(key);\n matches.push({ category: \"drivers-license\", value, start, end, confidence });\n }\n\n // UK DVLA — no context needed, format is distinctive\n const ukRe = new RegExp(UK_DVLA_PATTERN.source, \"g\");\n let m: RegExpExecArray | null;\n while ((m = ukRe.exec(text)) !== null) {\n push(m[0], m.index, m.index + m[0].length, 0.78);\n }\n\n // Generic pattern — only report when preceded by context keyword\n const genericRe = new RegExp(GENERIC_DL_PATTERN.source, \"g\");\n while ((m = genericRe.exec(text)) !== null) {\n const match = m;\n const hasContext = contextPositions.some(\n (pos) => pos <= match.index && match.index - pos <= 20,\n );\n if (hasContext) {\n push(match[0], match.index, match.index + match[0].length, 0.85);\n }\n }\n\n return matches;\n}\n","/**\n * @module detectors/national-id\n * @description Detector for national identification numbers across 20+ countries.\n *\n * Covered countries/formats:\n * - Canada: SIN (XXX-XXX-XXX)\n * - Mexico: CURP (18 chars alphanumeric) and RFC (13 chars)\n * - UK: NINO (AB 12 34 56 C)\n * - India: Aadhaar (12 digits, verified with format check)\n * - China: Resident ID (18 digits with letter checksum)\n * - South Korea: RRN (XXXXXX-XXXXXXX)\n * - Germany: Personalausweis (9 alphanumeric)\n * - France: NIR/INSEE (15 digits with spaces)\n * - Brazil: CPF (XXX.XXX.XXX-XX)\n * - Argentina: DNI (7-8 digits)\n * - South Africa: ID (13 digits)\n * - Nigeria: NIN (11 digits)\n * - Australia: TFN (XXX XXX XXX)\n * - New Zealand: IRD (XXX-XXX-XXX)\n * - Sweden: Personnummer (XXXXXX-XXXX)\n * - Norway: Fødselsnummer (11 digits)\n * - Netherlands: BSN (9 digits, 11-proef)\n * - Spain: DNI/NIE (8 digits + letter / X+7digits+letter)\n * - Italy: Codice Fiscale (16 alphanumeric)\n * - Portugal: NIF (9 digits)\n * - US: SSN (handled separately by ssn.ts — not duplicated here)\n */\n\nimport type { PiiMatch } from \"../types.js\";\n\n// ---------------------------------------------------------------------------\n// Individual country patterns\n// ---------------------------------------------------------------------------\n\n/**\n * Canada SIN: XXX-XXX-XXX or XXXXXXXXX\n * @internal\n */\nconst CA_SIN_PATTERN = /\\b\\d{3}[\\s-]\\d{3}[\\s-]\\d{3}\\b/g;\n\n/**\n * Mexico CURP: 18-char alphanumeric with specific letter/digit structure.\n * Format: 4 letters + 6 digits + 6 alphanumeric + 2 alphanumeric\n * @internal\n */\nconst MX_CURP_PATTERN =\n /\\b[A-Z]{4}\\d{6}[HM][A-Z]{2}[A-Z]{3}[A-Z0-9]\\d\\b/g;\n\n/**\n * Mexico RFC: 12-13 chars (physical person: 13, legal entity: 12)\n * Format: 3-4 uppercase letters + 6-digit DOB + 3 alphanumeric\n * @internal\n */\nconst MX_RFC_PATTERN = /\\b[A-ZÑ&]{3,4}\\d{6}[A-Z0-9]{3}\\b/g;\n\n/**\n * UK NINO: AB 12 34 56 A (with or without spaces, letter [A-D] at end)\n * @internal\n */\nconst UK_NINO_PATTERN =\n /\\b[A-CEGHJ-PR-TW-Z]{2}[\\s-]?\\d{2}[\\s-]?\\d{2}[\\s-]?\\d{2}[\\s-]?[A-D]\\b/gi;\n\n/**\n * India Aadhaar: 12 digits, groups of 4 optionally separated by spaces.\n * First digit must not be 0 or 1.\n * @internal\n */\nconst IN_AADHAAR_PATTERN = /\\b[2-9]\\d{3}[\\s-]?\\d{4}[\\s-]?\\d{4}\\b/g;\n\n/**\n * China Resident ID: 18 digits, last char may be X.\n * Format: 6-digit region + 8-digit DOB + 3-digit sequence + 1 check digit/X\n * @internal\n */\nconst CN_RESIDENT_ID_PATTERN = /\\b\\d{17}[\\dX]\\b/gi;\n\n/**\n * South Korea RRN: XXXXXX-XXXXXXX (6 digits dash 7 digits)\n * @internal\n */\nconst KR_RRN_PATTERN = /\\b\\d{6}[\\s-]\\d{7}\\b/g;\n\n/**\n * Germany Personalausweis: 9 alphanumeric chars.\n * Only reported with context keyword — too generic otherwise.\n * @internal\n */\nconst DE_PERSONALAUSWEIS_PATTERN = /\\b[A-Z0-9]{9}\\b/g;\n\n/**\n * France NIR/INSEE: 15 digits (with optional spaces in groups of 1+2+2+2+3+2+3+2).\n * Starts with 1 or 2 (gender digit).\n * @internal\n */\nconst FR_NIR_PATTERN =\n /\\b[12]\\s?\\d{2}\\s?\\d{2}\\s?\\d{2}\\s?\\d{3}\\s?\\d{3}\\s?\\d{2}\\b/g;\n\n/**\n * Brazil CPF: XXX.XXX.XXX-XX\n * @internal\n */\nconst BR_CPF_PATTERN = /\\b\\d{3}\\.\\d{3}\\.\\d{3}[-\\s]\\d{2}\\b/g;\n\n/**\n * Argentina DNI: 7-8 digits (with optional dots XXX.XXX.XXX)\n * @internal\n */\nconst AR_DNI_PATTERN = /\\b\\d{2,3}[.\\s]?\\d{3}[.\\s]?\\d{3}\\b/g;\n\n/**\n * South Africa ID: 13 consecutive digits. Starts with 6-digit DOB.\n * @internal\n */\nconst ZA_ID_PATTERN = /\\b\\d{13}\\b/g;\n\n/**\n * Nigeria NIN: 11 digits\n * @internal\n */\nconst NG_NIN_PATTERN = /\\b\\d{11}\\b/g;\n\n/**\n * Australia TFN: XXX XXX XXX or XXXXXXXXX\n * @internal\n */\nconst AU_TFN_PATTERN = /\\b\\d{3}[\\s-]?\\d{3}[\\s-]?\\d{3}\\b/g;\n\n/**\n * Sweden Personnummer: XXXXXX-XXXX or XXXXXXXXXX\n * @internal\n */\nconst SE_PERSONNUMMER_PATTERN = /\\b\\d{6}[-+]\\d{4}\\b/g;\n\n/**\n * Spain DNI: 8 digits + letter; NIE: X/Y/Z + 7 digits + letter\n * @internal\n */\nconst ES_DNIE_PATTERN = /\\b(?:\\d{8}[A-Z]|[XYZ]\\d{7}[A-Z])\\b/gi;\n\n/**\n * Italy Codice Fiscale: 16 chars (6 letters + 2 digits + letter + 2 digits + letter + 3 digits + letter)\n * @internal\n */\nconst IT_CF_PATTERN =\n /\\b[A-Z]{6}\\d{2}[A-EHLMPRST]\\d{2}[A-Z]\\d{3}[A-Z]\\b/gi;\n\n/**\n * Portugal NIF: 9 digits starting with 1-9\n * @internal\n */\nconst PT_NIF_PATTERN = /\\b[1-9]\\d{8}\\b/g;\n\n/**\n * Netherlands BSN: 9 digits (11-proef)\n * @internal\n */\nconst NL_BSN_PATTERN = /\\b\\d{9}\\b/g;\n\n// ---------------------------------------------------------------------------\n// Context keywords for ambiguous patterns\n// ---------------------------------------------------------------------------\n\n/**\n * Generic national ID context keywords.\n * @internal\n */\nconst NATIONAL_ID_CONTEXT_RE =\n /\\b(?:national\\s+(?:id|identification|identity)\\s*(?:number|no\\.?|card|#)?|id\\s+(?:number|no\\.?|#)|citizen(?:ship)?\\s+(?:number|id)|personal\\s+(?:id|identification)\\s*(?:number|no\\.?)?|identificat(?:ion|or))\\s*:?\\s*/gi;\n\n// ---------------------------------------------------------------------------\n// Definition of locale-specific entries\n// ---------------------------------------------------------------------------\n\ninterface NationalIdEntry {\n readonly pattern: RegExp;\n readonly confidence: number;\n /** When true, only report with context keyword present nearby. */\n readonly requiresContext: boolean;\n}\n\nconst NATIONAL_ID_ENTRIES: readonly NationalIdEntry[] = [\n { pattern: CA_SIN_PATTERN, confidence: 0.85, requiresContext: false },\n { pattern: MX_CURP_PATTERN, confidence: 0.90, requiresContext: false },\n { pattern: MX_RFC_PATTERN, confidence: 0.78, requiresContext: true },\n { pattern: UK_NINO_PATTERN, confidence: 0.90, requiresContext: false },\n { pattern: IN_AADHAAR_PATTERN, confidence: 0.82, requiresContext: false },\n { pattern: CN_RESIDENT_ID_PATTERN, confidence: 0.80, requiresContext: true },\n { pattern: KR_RRN_PATTERN, confidence: 0.87, requiresContext: false },\n { pattern: BR_CPF_PATTERN, confidence: 0.92, requiresContext: false },\n { pattern: SE_PERSONNUMMER_PATTERN, confidence: 0.87, requiresContext: false },\n { pattern: ES_DNIE_PATTERN, confidence: 0.82, requiresContext: false },\n { pattern: IT_CF_PATTERN, confidence: 0.88, requiresContext: false },\n { pattern: FR_NIR_PATTERN, confidence: 0.84, requiresContext: false },\n // More ambiguous — require context\n { pattern: AR_DNI_PATTERN, confidence: 0.75, requiresContext: true },\n { pattern: ZA_ID_PATTERN, confidence: 0.72, requiresContext: true },\n { pattern: NG_NIN_PATTERN, confidence: 0.70, requiresContext: true },\n { pattern: AU_TFN_PATTERN, confidence: 0.75, requiresContext: true },\n { pattern: DE_PERSONALAUSWEIS_PATTERN, confidence: 0.75, requiresContext: true },\n { pattern: PT_NIF_PATTERN, confidence: 0.70, requiresContext: true },\n { pattern: NL_BSN_PATTERN, confidence: 0.70, requiresContext: true },\n];\n\n/**\n * Detect national identification numbers in `text`.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"national-id\"`.\n */\nexport function detectNationalId(text: string): PiiMatch[] {\n const matches: PiiMatch[] = [];\n const seen = new Set<string>();\n\n // Find context keyword end positions\n const contextPositions: number[] = [];\n const ctxRe = new RegExp(NATIONAL_ID_CONTEXT_RE.source, \"gi\");\n let cm: RegExpExecArray | null;\n while ((cm = ctxRe.exec(text)) !== null) {\n contextPositions.push(cm.index + cm[0].length);\n }\n\n for (const entry of NATIONAL_ID_ENTRIES) {\n const re = new RegExp(entry.pattern.source, \"g\");\n let m: RegExpExecArray | null;\n\n while ((m = re.exec(text)) !== null) {\n const match = m;\n const key = `${String(match.index)}-${String(match.index + match[0].length)}`;\n if (seen.has(key)) continue;\n\n const hasContext = contextPositions.some(\n (pos) => pos <= match.index && match.index - pos <= 40,\n );\n\n if (entry.requiresContext && !hasContext) continue;\n\n const confidence = hasContext ? Math.min(entry.confidence + 0.05, 0.97) : entry.confidence;\n\n seen.add(key);\n matches.push({\n category: \"national-id\",\n value: match[0],\n start: match.index,\n end: match.index + match[0].length,\n confidence,\n });\n }\n }\n\n return matches;\n}\n","/**\n * @module detectors/bank-account\n * @description Detector for bank account numbers and routing information.\n *\n * Covered formats:\n * - US: ABA routing number (9 digits with specific prefix ranges) + account numbers\n * - UK: Sort code (XX-XX-XX) + 8-digit account number\n * - SWIFT/BIC codes (8 or 11 chars)\n *\n * Context keywords are essential for reducing false positives.\n */\n\nimport type { PiiMatch } from \"../types.js\";\n\n/**\n * Context keywords for bank account information.\n * @internal\n */\nconst BANK_CONTEXT_RE =\n /\\b(?:routing\\s+(?:number|no\\.?|#)|sort\\s+code|account\\s+(?:number|no\\.?|#)|bank\\s+account|IBAN|BIC|SWIFT|ABA)\\s*:?\\s*/gi;\n\n/**\n * US ABA routing number: 9 digits, first two digits must be 01-12, 21-32, 61-72, or 80.\n * @internal\n */\nconst US_ABA_ROUTING_PATTERN =\n /\\b(?:0[1-9]|1[0-2]|2[1-9]|3[0-2]|6[1-9]|7[0-2]|80)\\d{7}\\b/g;\n\n/**\n * UK sort code: XX-XX-XX\n * @internal\n */\nconst UK_SORT_CODE_PATTERN = /\\b\\d{2}-\\d{2}-\\d{2}\\b/g;\n\n/**\n * SWIFT/BIC code: 8 or 11 chars (4 bank + 2 country + 2 location + optional 3 branch)\n * @internal\n */\nconst SWIFT_BIC_PATTERN =\n /\\b[A-Z]{4}[A-Z]{2}[A-Z0-9]{2}(?:[A-Z0-9]{3})?\\b/g;\n\n/**\n * Generic bank account number: 7-18 digits (only with context)\n * @internal\n */\nconst GENERIC_ACCOUNT_PATTERN = /\\b\\d{7,18}\\b/g;\n\n/**\n * Detect bank account numbers and related identifiers in `text`.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"bank-account\"`.\n */\nexport function detectBankAccount(text: string): PiiMatch[] {\n const matches: PiiMatch[] = [];\n const seen = new Set<string>();\n\n const contextPositions: number[] = [];\n const ctxRe = new RegExp(BANK_CONTEXT_RE.source, \"gi\");\n let cm: RegExpExecArray | null;\n while ((cm = ctxRe.exec(text)) !== null) {\n contextPositions.push(cm.index + cm[0].length);\n }\n\n function hasContext(index: number): boolean {\n return contextPositions.some((pos) => pos <= index && index - pos <= 30);\n }\n\n function push(value: string, start: number, end: number, confidence: number): void {\n const key = `${String(start)}-${String(end)}`;\n if (seen.has(key)) return;\n seen.add(key);\n matches.push({ category: \"bank-account\", value, start, end, confidence });\n }\n\n let m: RegExpExecArray | null;\n\n // US ABA routing — only with context\n const abaRe = new RegExp(US_ABA_ROUTING_PATTERN.source, \"g\");\n while ((m = abaRe.exec(text)) !== null) {\n if (hasContext(m.index)) push(m[0], m.index, m.index + m[0].length, 0.85);\n }\n\n // UK sort code — distinctive format, no context needed\n const scRe = new RegExp(UK_SORT_CODE_PATTERN.source, \"g\");\n while ((m = scRe.exec(text)) !== null) {\n push(m[0], m.index, m.index + m[0].length, 0.80);\n }\n\n // SWIFT/BIC — distinctive, no context needed\n const swiftRe = new RegExp(SWIFT_BIC_PATTERN.source, \"g\");\n while ((m = swiftRe.exec(text)) !== null) {\n // Basic SWIFT validity: country code must be valid 2-letter ISO\n const countryCode = m[0].slice(4, 6);\n if (/^[A-Z]{2}$/.test(countryCode)) {\n push(m[0], m.index, m.index + m[0].length, 0.82);\n }\n }\n\n // Generic account number — only with context\n const genericRe = new RegExp(GENERIC_ACCOUNT_PATTERN.source, \"g\");\n while ((m = genericRe.exec(text)) !== null) {\n if (hasContext(m.index)) push(m[0], m.index, m.index + m[0].length, 0.80);\n }\n\n return matches;\n}\n","/**\n * @module detectors/cryptocurrency\n * @description Detector for cryptocurrency wallet addresses.\n *\n * Covered:\n * - Bitcoin: Legacy (1...), P2SH (3...), Bech32 (bc1...)\n * - Ethereum / EVM: 0x + 40 hex chars\n * - Litecoin: L... or M... (34-35 chars)\n * - Monero: 4... (95 chars)\n * - Ripple/XRP: r... (25-34 alphanumeric)\n * - Solana: Base58 44-45 chars\n * - Cardano: addr1... (58-103 chars)\n */\n\nimport type { PiiMatch } from \"../types.js\";\n\n/**\n * Bitcoin legacy address: 1 + 25-34 base58 chars\n * @internal\n */\nconst BTC_LEGACY_PATTERN = /\\b1[a-km-zA-HJ-NP-Z1-9]{25,34}\\b/g;\n\n/**\n * Bitcoin P2SH: 3 + 25-34 base58 chars\n * @internal\n */\nconst BTC_P2SH_PATTERN = /\\b3[a-km-zA-HJ-NP-Z1-9]{25,34}\\b/g;\n\n/**\n * Bitcoin Bech32: bc1 + 39-59 lowercase bech32 chars\n * @internal\n */\nconst BTC_BECH32_PATTERN = /\\bbc1[a-z0-9]{39,59}\\b/g;\n\n/**\n * Ethereum/EVM: 0x + 40 hex chars (case-insensitive)\n * @internal\n */\nconst ETH_PATTERN = /\\b0x[a-fA-F0-9]{40}\\b/g;\n\n/**\n * Litecoin Legacy: L + 26-33 base58 chars\n * @internal\n */\nconst LTC_LEGACY_PATTERN = /\\bL[a-km-zA-HJ-NP-Z1-9]{26,33}\\b/g;\n\n/**\n * Litecoin P2SH(SegWit): M + 26-33 base58 chars\n * @internal\n */\nconst LTC_M_PATTERN = /\\bM[a-km-zA-HJ-NP-Z1-9]{26,33}\\b/g;\n\n/**\n * Monero: 4 + 94 base58 chars (primary address = 95 chars)\n * @internal\n */\nconst XMR_PATTERN = /\\b4[0-9AB][1-9A-HJ-NP-Za-km-z]{93}\\b/g;\n\n/**\n * Ripple/XRP: r + 24-33 base58 chars\n * @internal\n */\nconst XRP_PATTERN = /\\br[a-km-zA-HJ-NP-Z1-9]{24,33}\\b/g;\n\n/**\n * Solana (roughly): 32-44 Base58 chars starting with typical chars.\n * Hard to distinguish precisely without a library; use context to boost confidence.\n * @internal\n */\nconst SOL_PATTERN = /\\b[1-9A-HJ-NP-Za-km-z]{43,44}\\b/g;\n\n/**\n * Cardano: addr1 + 58-98 bech32 chars\n * @internal\n */\nconst ADA_PATTERN = /\\baddr1[a-z0-9]{58,98}\\b/g;\n\ninterface CryptoEntry {\n readonly pattern: RegExp;\n readonly confidence: number;\n readonly requiresContext: boolean;\n}\n\nconst CRYPTO_ENTRIES: readonly CryptoEntry[] = [\n { pattern: ETH_PATTERN, confidence: 0.97, requiresContext: false },\n { pattern: BTC_BECH32_PATTERN, confidence: 0.95, requiresContext: false },\n { pattern: ADA_PATTERN, confidence: 0.92, requiresContext: false },\n { pattern: BTC_LEGACY_PATTERN, confidence: 0.88, requiresContext: false },\n { pattern: BTC_P2SH_PATTERN, confidence: 0.85, requiresContext: false },\n { pattern: LTC_LEGACY_PATTERN, confidence: 0.83, requiresContext: false },\n { pattern: LTC_M_PATTERN, confidence: 0.80, requiresContext: false },\n { pattern: XMR_PATTERN, confidence: 0.90, requiresContext: false },\n { pattern: XRP_PATTERN, confidence: 0.78, requiresContext: true },\n { pattern: SOL_PATTERN, confidence: 0.72, requiresContext: true },\n];\n\n/**\n * Cryptocurrency address context keywords.\n * @internal\n */\nconst CRYPTO_CONTEXT_RE =\n /\\b(?:wallet(?:\\s+address)?|crypto(?:currency)?(?:\\s+address)?|bitcoin|btc|ethereum|eth|litecoin|ltc|monero|xmr|ripple|xrp|solana|sol|cardano|ada|address)\\s*:?\\s*/gi;\n\n/**\n * Detect cryptocurrency wallet addresses in `text`.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"cryptocurrency\"`.\n */\nexport function detectCryptocurrency(text: string): PiiMatch[] {\n const matches: PiiMatch[] = [];\n const seen = new Set<string>();\n\n const contextPositions: number[] = [];\n const ctxRe = new RegExp(CRYPTO_CONTEXT_RE.source, \"gi\");\n let cm: RegExpExecArray | null;\n while ((cm = ctxRe.exec(text)) !== null) {\n contextPositions.push(cm.index + cm[0].length);\n }\n\n function hasContext(index: number): boolean {\n return contextPositions.some((pos) => pos <= index && index - pos <= 40);\n }\n\n for (const entry of CRYPTO_ENTRIES) {\n // All current CRYPTO_ENTRIES patterns use only the \"g\" flag; \"gi\" arm is a future-proofing safety net.\n /* v8 ignore next */\n const re = new RegExp(entry.pattern.source, entry.pattern.flags.includes(\"i\") ? \"gi\" : \"g\");\n let m: RegExpExecArray | null;\n\n while ((m = re.exec(text)) !== null) {\n if (entry.requiresContext && !hasContext(m.index)) continue;\n const key = `${String(m.index)}-${String(m.index + m[0].length)}`;\n // Cryptocurrency patterns use distinct address formats; overlapping matches are not expected.\n /* v8 ignore next */\n if (seen.has(key)) continue;\n seen.add(key);\n\n const confidence = hasContext(m.index) ? Math.min(entry.confidence + 0.03, 0.99) : entry.confidence;\n\n matches.push({\n category: \"cryptocurrency\",\n value: m[0],\n start: m.index,\n end: m.index + m[0].length,\n confidence,\n });\n }\n }\n\n return matches;\n}\n","/**\n * @module detectors/tax-id\n * @description Detector for tax identification numbers.\n *\n * Covered:\n * - US EIN: XX-XXXXXXX\n * - US ITIN: 9XX-XX-XXXX (where second group is 50-65, 70-88, 90-92, 94-99)\n * - UK UTR: 10 digits (Unique Taxpayer Reference)\n * - EU VAT numbers: country prefix + digits/letters\n * - Australia TFN: XXX XXX XXX (shared with national-id, context disambiguates)\n * - Australia ABN: 11 digits XX XXX XXX XXX\n */\n\nimport type { PiiMatch } from \"../types.js\";\n\n/**\n * US EIN: XX-XXXXXXX (Employer Identification Number)\n * @internal\n */\nconst US_EIN_PATTERN = /\\b\\d{2}-\\d{7}\\b/g;\n\n/**\n * US ITIN: 9XX-XX-XXXX (Individual Taxpayer ID, second group 50-65,70-88,90-92,94-99)\n * @internal\n */\nconst US_ITIN_PATTERN =\n /\\b9\\d{2}[\\s-](?:5[0-9]|6[0-5]|7[0-9]|8[0-8]|90|91|92|9[4-9])[\\s-]\\d{4}\\b/g;\n\n/**\n * UK UTR: 10 digits (Unique Taxpayer Reference). Requires context.\n * @internal\n */\nconst UK_UTR_PATTERN = /\\b\\d{10}\\b/g;\n\n/**\n * EU VAT prefixes + number patterns:\n * Each EU country has a specific format, but we use a general pattern + country code prefix.\n * @internal\n */\nconst EU_VAT_PATTERN =\n /\\b(?:AT|BE|BG|CY|CZ|DE|DK|EE|EL|ES|FI|FR|GB|HR|HU|IE|IT|LT|LU|LV|MT|NL|PL|PT|RO|SE|SI|SK)[\\s-]?[A-Z0-9]{8,12}\\b/g;\n\n/**\n * Australia ABN: XX XXX XXX XXX (11 digits)\n * @internal\n */\nconst AU_ABN_PATTERN = /\\b\\d{2}[\\s]?\\d{3}[\\s]?\\d{3}[\\s]?\\d{3}\\b/g;\n\n/**\n * Tax ID context keywords.\n * @internal\n */\nconst TAX_CONTEXT_RE =\n /\\b(?:tax(?:\\s+(?:id(?:entification)?|number|no\\.?|#|reference))?|T\\.?I\\.?N\\.?|EIN|ITIN|UTR|VAT(?:\\s+(?:number|no\\.?|reg(?:istration)?|#))?|ABN|TFN)\\s*:?\\s*/gi;\n\n/**\n * Detect tax identification numbers in `text`.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"tax-id\"`.\n */\nexport function detectTaxId(text: string): PiiMatch[] {\n const matches: PiiMatch[] = [];\n const seen = new Set<string>();\n\n const contextPositions: number[] = [];\n const ctxRe = new RegExp(TAX_CONTEXT_RE.source, \"gi\");\n let cm: RegExpExecArray | null;\n while ((cm = ctxRe.exec(text)) !== null) {\n contextPositions.push(cm.index + cm[0].length);\n }\n\n function hasContext(index: number): boolean {\n return contextPositions.some((pos) => pos <= index && index - pos <= 30);\n }\n\n function push(value: string, start: number, end: number, confidence: number): void {\n const key = `${String(start)}-${String(end)}`;\n // Tax-id patterns never produce overlapping ranges in practice.\n /* v8 ignore next */\n if (seen.has(key)) return;\n seen.add(key);\n matches.push({ category: \"tax-id\", value, start, end, confidence });\n }\n\n let m: RegExpExecArray | null;\n\n // US EIN: XX-XXXXXXX — distinctive format\n const einRe = new RegExp(US_EIN_PATTERN.source, \"g\");\n while ((m = einRe.exec(text)) !== null) {\n push(m[0], m.index, m.index + m[0].length, hasContext(m.index) ? 0.92 : 0.80);\n }\n\n // US ITIN — distinctive format\n const itinRe = new RegExp(US_ITIN_PATTERN.source, \"g\");\n while ((m = itinRe.exec(text)) !== null) {\n push(m[0], m.index, m.index + m[0].length, 0.90);\n }\n\n // EU VAT — distinctive format\n const vatRe = new RegExp(EU_VAT_PATTERN.source, \"g\");\n while ((m = vatRe.exec(text)) !== null) {\n push(m[0], m.index, m.index + m[0].length, hasContext(m.index) ? 0.90 : 0.78);\n }\n\n // AU ABN — distinctive format\n const abnRe = new RegExp(AU_ABN_PATTERN.source, \"g\");\n while ((m = abnRe.exec(text)) !== null) {\n if (hasContext(m.index)) push(m[0], m.index, m.index + m[0].length, 0.82);\n }\n\n // UK UTR — requires context (plain 10 digits too generic)\n const utrRe = new RegExp(UK_UTR_PATTERN.source, \"g\");\n while ((m = utrRe.exec(text)) !== null) {\n if (hasContext(m.index)) push(m[0], m.index, m.index + m[0].length, 0.85);\n }\n\n return matches;\n}\n","/**\n * @module validators\n * @description PII checksum and format validation algorithms.\n *\n * All validators are pure functions that accept a string and return a boolean.\n * Export them from `\"anonyma/validators\"` for standalone use.\n *\n * @example\n * ```ts\n * import { luhn, verhoeff, nhsMod11, cpfChecksum } from \"anonyma/validators\";\n *\n * luhn(\"4111111111111111\"); // true\n * nhsMod11(\"943-476-5919\"); // true\n * ```\n */\n\n// ---------------------------------------------------------------------------\n// Luhn Algorithm (credit cards, some national IDs)\n// ---------------------------------------------------------------------------\n\n/**\n * Validate a string of digits using the Luhn algorithm (ISO/IEC 7812).\n * Used for credit/debit card numbers and some national IDs.\n *\n * @param digits - Digit-only string (spaces/hyphens stripped before calling).\n * @returns `true` if the number passes the Luhn check.\n *\n * @example\n * ```ts\n * luhn(\"4111111111111111\"); // true\n * luhn(\"4111111111111112\"); // false\n * ```\n */\nexport function luhn(digits: string): boolean {\n const stripped = digits.replace(/[\\s-]/g, \"\");\n if (!/^\\d+$/.test(stripped) || stripped.length < 2) return false;\n\n let sum = 0;\n let isEven = false;\n\n for (let i = stripped.length - 1; i >= 0; i--) {\n /* v8 ignore next -- regex guarantees digit chars so stripped[i] is always defined */\n let d = parseInt(stripped[i] ?? \"0\", 10);\n if (isEven) {\n d *= 2;\n if (d > 9) d -= 9;\n }\n sum += d;\n isEven = !isEven;\n }\n\n return sum % 10 === 0;\n}\n\n// ---------------------------------------------------------------------------\n// Verhoeff Algorithm (Indian Aadhaar and others)\n// ---------------------------------------------------------------------------\n\n/** Verhoeff multiplication table. @internal */\nconst VERHOEFF_D: readonly number[][] = [\n [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],\n [1, 2, 3, 4, 0, 6, 7, 8, 9, 5],\n [2, 3, 4, 0, 1, 7, 8, 9, 5, 6],\n [3, 4, 0, 1, 2, 8, 9, 5, 6, 7],\n [4, 0, 1, 2, 3, 9, 5, 6, 7, 8],\n [5, 9, 8, 7, 6, 0, 4, 3, 2, 1],\n [6, 5, 9, 8, 7, 1, 0, 4, 3, 2],\n [7, 6, 5, 9, 8, 2, 1, 0, 4, 3],\n [8, 7, 6, 5, 9, 3, 2, 1, 0, 4],\n [9, 8, 7, 6, 5, 4, 3, 2, 1, 0],\n];\n\n/** Verhoeff permutation table. @internal */\nconst VERHOEFF_P: readonly number[][] = [\n [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],\n [1, 5, 7, 6, 2, 8, 3, 0, 9, 4],\n [5, 8, 0, 3, 7, 9, 6, 1, 4, 2],\n [8, 9, 1, 6, 0, 4, 3, 5, 2, 7],\n [9, 4, 5, 3, 1, 2, 6, 8, 7, 0],\n [4, 2, 8, 6, 5, 7, 3, 9, 0, 1],\n [2, 7, 9, 3, 8, 0, 6, 4, 1, 5],\n [7, 0, 4, 6, 9, 1, 3, 2, 5, 8],\n];\n\n/**\n * Validate a digit string using the Verhoeff algorithm.\n * Used for Indian Aadhaar numbers and some other national IDs.\n *\n * @param digits - Digit-only string.\n * @returns `true` if the number passes the Verhoeff check.\n *\n * @example\n * ```ts\n * verhoeff(\"236\"); // true (canonical Verhoeff test case)\n * ```\n */\nexport function verhoeff(digits: string): boolean {\n const stripped = digits.replace(/[\\s-]/g, \"\");\n if (!/^\\d+$/.test(stripped) || stripped.length === 0) return false;\n\n let c = 0;\n const reversed = stripped.split(\"\").reverse();\n\n for (let i = 0; i < reversed.length; i++) {\n /* v8 ignore next -- reversed array is same length as stripped so reversed[i] is always defined */\n const digit = parseInt(reversed[i] ?? \"0\", 10);\n const pRow = VERHOEFF_P[i % 8];\n /* v8 ignore next 3 -- lookup tables always cover valid indices (0-7 for P, 0-9 for D) */\n const pVal = pRow ? pRow[digit] ?? digit : digit;\n const dRow = VERHOEFF_D[c];\n c = dRow ? dRow[pVal] ?? 0 : 0;\n }\n\n return c === 0;\n}\n\n// ---------------------------------------------------------------------------\n// NHS Mod-11 (UK NHS numbers)\n// ---------------------------------------------------------------------------\n\n/**\n * Validate a UK NHS number using the mod-11 algorithm.\n * NHS numbers are 10 digits. Weighting factors are 10..2 for the first 9 digits;\n * the 10th digit is the check digit (11 - sum mod 11, or 0 if sum mod 11 == 0).\n *\n * @param value - NHS number (digits or with spaces/hyphens).\n * @returns `true` if valid.\n *\n * @example\n * ```ts\n * nhsMod11(\"9434765919\"); // true\n * nhsMod11(\"943 476 5919\"); // true\n * ```\n */\nexport function nhsMod11(value: string): boolean {\n const stripped = value.replace(/[\\s-]/g, \"\");\n if (!/^\\d{10}$/.test(stripped)) return false;\n\n let sum = 0;\n /* v8 ignore start -- regex guarantees \\d{10} so indices 0-9 are always defined */\n for (let i = 0; i < 9; i++) {\n sum += parseInt(stripped[i] ?? \"0\", 10) * (10 - i);\n }\n /* v8 ignore stop */\n\n const remainder = sum % 11;\n if (remainder === 1) return false; // Invalid NHS number\n const checkDigit = remainder === 0 ? 0 : 11 - remainder;\n\n /* v8 ignore next -- regex guarantees \\d{10} so stripped[9] is always defined */\n return parseInt(stripped[9] ?? \"0\", 10) === checkDigit;\n}\n\n// ---------------------------------------------------------------------------\n// Brazilian CPF Checksum\n// ---------------------------------------------------------------------------\n\n/**\n * Validate a Brazilian CPF (Cadastro de Pessoas Físicas) number.\n * CPF has 11 digits with two check digits at positions 10 and 11.\n *\n * @param value - CPF with or without formatting (e.g. `\"123.456.789-09\"` or `\"12345678909\"`).\n * @returns `true` if valid.\n *\n * @example\n * ```ts\n * cpfChecksum(\"529.982.247-25\"); // true\n * cpfChecksum(\"529.982.247-26\"); // false\n * ```\n */\nexport function cpfChecksum(value: string): boolean {\n const stripped = value.replace(/[.\\-\\s]/g, \"\");\n if (!/^\\d{11}$/.test(stripped)) return false;\n\n // Reject known invalid patterns (all same digit)\n if (/^(\\d)\\1{10}$/.test(stripped)) return false;\n\n // Compute first check digit\n let sum = 0;\n /* v8 ignore start -- regex guarantees \\d{11} so all string indices are defined */\n for (let i = 0; i < 9; i++) {\n sum += parseInt(stripped[i] ?? \"0\", 10) * (10 - i);\n }\n let remainder = (sum * 10) % 11;\n if (remainder === 10 || remainder === 11) remainder = 0;\n if (remainder !== parseInt(stripped[9] ?? \"0\", 10)) return false;\n\n // Compute second check digit\n sum = 0;\n for (let i = 0; i < 10; i++) {\n sum += parseInt(stripped[i] ?? \"0\", 10) * (11 - i);\n }\n remainder = (sum * 10) % 11;\n if (remainder === 10 || remainder === 11) remainder = 0;\n return remainder === parseInt(stripped[10] ?? \"0\", 10);\n /* v8 ignore stop */\n}\n\n// ---------------------------------------------------------------------------\n// VIN Transliteration Checksum (ISO 3779)\n// ---------------------------------------------------------------------------\n\n/** VIN transliteration map: letters → numeric values. @internal */\nconst VIN_TRANSLITERATION: Readonly<Record<string, number>> = {\n A: 1, B: 2, C: 3, D: 4, E: 5, F: 6, G: 7, H: 8,\n J: 1, K: 2, L: 3, M: 4, N: 5, P: 7, R: 9,\n S: 2, T: 3, U: 4, V: 5, W: 6, X: 7, Y: 8, Z: 9,\n 0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9,\n} as const;\n\n/** VIN position weight factors (positions 1–9 = check, 1-based). @internal */\nconst VIN_WEIGHTS: readonly number[] = [8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2];\n\n/**\n * Validate a Vehicle Identification Number (VIN) using the ISO 3779 mod-11 checksum.\n * The check digit is position 9 (index 8).\n *\n * @param vin - 17-character VIN string. Must contain only A-Z (excluding I, O, Q) and 0-9.\n * @returns `true` if the VIN passes the checksum and has valid characters.\n *\n * @example\n * ```ts\n * vinChecksum(\"1HGBH41JXMN109186\"); // true\n * vinChecksum(\"1HGBH41JXMN109187\"); // false\n * ```\n */\nexport function vinChecksum(vin: string): boolean {\n const upper = vin.toUpperCase();\n if (!/^[A-HJ-NPR-Z0-9]{17}$/.test(upper)) return false;\n\n let sum = 0;\n for (let i = 0; i < 17; i++) {\n /* v8 ignore next -- regex guarantees 17 chars so upper[i] is always defined */\n const char = upper[i] ?? \"\";\n const val = VIN_TRANSLITERATION[char];\n const weight = VIN_WEIGHTS[i];\n /* v8 ignore next -- regex already guarantees all chars are in the translation table */\n if (val === undefined || weight === undefined) return false;\n sum += val * weight;\n }\n\n const remainder = sum % 11;\n /* v8 ignore next -- regex guarantees 17 chars so upper[8] is always defined */\n const checkChar = upper[8] ?? \"\";\n const expected = remainder === 10 ? \"X\" : String(remainder);\n\n return checkChar === expected;\n}\n\n// ---------------------------------------------------------------------------\n// DEA Registration Number Checksum\n// ---------------------------------------------------------------------------\n\n/**\n * Validate a US DEA (Drug Enforcement Administration) registration number.\n * Format: two letters (registrant type + first letter of last name) + 7 digits.\n * Check digit = (sum of digits 1,3,5 + 2 * sum of digits 2,4,6) mod 10.\n *\n * @param value - DEA number, e.g. `\"AB1234563\"`.\n * @returns `true` if valid.\n *\n * @example\n * ```ts\n * deaChecksum(\"AB1234563\"); // true\n * ```\n */\nexport function deaChecksum(value: string): boolean {\n const stripped = value.replace(/[\\s-]/g, \"\").toUpperCase();\n if (!/^[ABCDEFGHJKLMNPRSTUX][A-Z9]\\d{7}$/.test(stripped)) return false;\n\n const digits = stripped.slice(2);\n /* v8 ignore start -- regex guarantees \\d{7} so indices 0-6 are always defined */\n const oddSum = parseInt(digits[0] ?? \"0\", 10) +\n parseInt(digits[2] ?? \"0\", 10) +\n parseInt(digits[4] ?? \"0\", 10);\n const evenSum = parseInt(digits[1] ?? \"0\", 10) +\n parseInt(digits[3] ?? \"0\", 10) +\n parseInt(digits[5] ?? \"0\", 10);\n const checksum = (oddSum + 2 * evenSum) % 10;\n\n return checksum === parseInt(digits[6] ?? \"0\", 10);\n /* v8 ignore stop */\n}\n\n// ---------------------------------------------------------------------------\n// IBAN Mod-97 Checksum\n// ---------------------------------------------------------------------------\n\n/**\n * Validate an IBAN using the ISO 13616 mod-97 algorithm.\n *\n * @param value - IBAN string, with or without spaces.\n * @returns `true` if valid.\n *\n * @example\n * ```ts\n * ibanMod97(\"GB82 WEST 1234 5698 7654 32\"); // true\n * ```\n */\nexport function ibanMod97(value: string): boolean {\n const stripped = value.replace(/\\s/g, \"\").toUpperCase();\n if (stripped.length < 15 || stripped.length > 34) return false;\n\n // Move first 4 chars to end\n const rearranged = stripped.slice(4) + stripped.slice(0, 4);\n\n // Convert letters to digits (A=10, B=11, ..., Z=35)\n const numeric = rearranged.split(\"\").map((c) => {\n const code = c.charCodeAt(0);\n return code >= 65 && code <= 90 ? String(code - 55) : c;\n }).join(\"\");\n\n // Compute mod-97 on large number via chunking\n let remainder = 0;\n for (let i = 0; i < numeric.length; i += 7) {\n const chunk = String(remainder) + numeric.slice(i, i + 7);\n remainder = parseInt(chunk, 10) % 97;\n }\n\n return remainder === 1;\n}\n\n// ---------------------------------------------------------------------------\n// UK NINO Validation\n// ---------------------------------------------------------------------------\n\n/**\n * Validate a UK National Insurance Number (NINO) format.\n * Format: two letters + six digits + one letter (A-D).\n * Excludes certain invalid prefixes.\n *\n * @param value - NINO string, with or without spaces.\n * @returns `true` if the format is valid.\n *\n * @example\n * ```ts\n * ninoValid(\"AB 12 34 56 A\"); // true\n * ninoValid(\"DA 12 34 56 A\"); // false (invalid prefix DA)\n * ```\n */\nexport function ninoValid(value: string): boolean {\n const stripped = value.replace(/\\s/g, \"\").toUpperCase();\n // Exclude invalid prefixes: D, F, I, Q, U, V as first letter\n // BG, GB, KN, NK, NT, TN, ZZ as first two letters\n if (!/^[A-CEGHJ-PR-TW-Z][A-CEGHJ-NPR-TW-Z]\\d{6}[A-D]$/.test(stripped)) return false;\n const invalidPrefixes = [\"BG\", \"GB\", \"KN\", \"NK\", \"NT\", \"TN\", \"ZZ\"];\n const prefix = stripped.slice(0, 2);\n return !invalidPrefixes.includes(prefix);\n}\n\n// ---------------------------------------------------------------------------\n// Indian Aadhaar format check (12 digits, not starting with 0 or 1)\n// ---------------------------------------------------------------------------\n\n/**\n * Validate the format of an Indian Aadhaar number.\n * Does not include Verhoeff checksum by default (call `verhoeff()` for that).\n *\n * @param value - Aadhaar number, 12 digits optionally separated by spaces.\n * @returns `true` if the format is valid.\n */\nexport function aadhaarFormat(value: string): boolean {\n const stripped = value.replace(/[\\s-]/g, \"\");\n if (!/^\\d{12}$/.test(stripped)) return false;\n // Must not start with 0 or 1\n return !stripped.startsWith(\"0\") && !stripped.startsWith(\"1\");\n}\n","/**\n * @module detectors/medical-record\n * @description Detector for medical record numbers and healthcare provider identifiers.\n *\n * Covered:\n * - MRN (Medical Record Number): various alphanumeric formats with context keyword\n * - US NPI (National Provider Identifier): 10 digits, Luhn-valid, prefix 80840\n * - DEA registration numbers: 2 letters + 7 digits with checksum validation\n */\n\nimport type { PiiMatch } from \"../types.js\";\nimport { luhn, deaChecksum } from \"../validators.js\";\n\n/**\n * Context keywords for medical record numbers.\n * @internal\n */\nconst MRN_CONTEXT_RE =\n /\\b(?:MRN|medical\\s+record\\s+(?:number|no\\.?|#)|patient\\s+(?:id|number|no\\.?|#)|chart\\s+(?:number|no\\.?|#))\\s*:?\\s*/gi;\n\n/**\n * US NPI: 10 digits starting with 1 or 2. Must pass Luhn check when prefixed with 80840.\n * @internal\n */\nconst US_NPI_PATTERN = /\\b[12]\\d{9}\\b/g;\n\n/**\n * DEA registration number: registrant letter + alpha + 7 digits.\n * Valid registrant letters: A, B, C, D, E, F, G, H, J, K, L, M, N, P, R, S, T, U, X.\n * @internal\n */\nconst DEA_PATTERN = /\\b[ABCDEFGHJKLMNPRSTUX][A-Z9]\\d{7}\\b/gi;\n\n/**\n * Generic MRN pattern: alphanumeric 6-12 chars (requires context).\n * @internal\n */\nconst MRN_PATTERN = /\\b[A-Z0-9]{6,12}\\b/g;\n\n/**\n * Detect medical record numbers, NPI numbers, and DEA numbers in `text`.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"medical-record\"`.\n */\nexport function detectMedicalRecord(text: string): PiiMatch[] {\n const matches: PiiMatch[] = [];\n const seen = new Set<string>();\n\n const contextPositions: number[] = [];\n const ctxRe = new RegExp(MRN_CONTEXT_RE.source, \"gi\");\n let cm: RegExpExecArray | null;\n while ((cm = ctxRe.exec(text)) !== null) {\n contextPositions.push(cm.index + cm[0].length);\n }\n\n function hasContextAt(index: number): boolean {\n return contextPositions.some((pos) => pos <= index && index - pos <= 30);\n }\n\n function push(value: string, start: number, end: number, confidence: number): void {\n const key = `${String(start)}-${String(end)}`;\n if (seen.has(key)) return;\n seen.add(key);\n matches.push({ category: \"medical-record\", value, start, end, confidence });\n }\n\n let m: RegExpExecArray | null;\n\n // DEA numbers — distinctive + checksum\n const deaRe = new RegExp(DEA_PATTERN.source, \"gi\");\n while ((m = deaRe.exec(text)) !== null) {\n if (deaChecksum(m[0])) {\n push(m[0], m.index, m.index + m[0].length, 0.90);\n }\n }\n\n // US NPI — 10 digits Luhn check with 80840 prefix\n const npiRe = new RegExp(US_NPI_PATTERN.source, \"g\");\n while ((m = npiRe.exec(text)) !== null) {\n const withPrefix = \"80840\" + m[0];\n if (luhn(withPrefix)) {\n push(m[0], m.index, m.index + m[0].length, hasContextAt(m.index) ? 0.88 : 0.75);\n }\n }\n\n // Generic MRN — requires context\n const mrnRe = new RegExp(MRN_PATTERN.source, \"g\");\n while ((m = mrnRe.exec(text)) !== null) {\n if (hasContextAt(m.index)) {\n push(m[0], m.index, m.index + m[0].length, 0.85);\n }\n }\n\n return matches;\n}\n","/**\n * @module detectors/health-insurance\n * @description Detector for health insurance identifiers.\n *\n * Covered:\n * - US Medicare Beneficiary Identifier (MBI): alphanumeric 11 chars\n * - US Medicaid: state-specific formats (alphanumeric, context required)\n * - UK NHS numbers: 10 digits with mod-11 validation\n * - EU EHIC (European Health Insurance Card): country code + series + personal ID\n */\n\nimport type { PiiMatch } from \"../types.js\";\nimport { nhsMod11 } from \"../validators.js\";\n\n/**\n * Context keywords for health insurance.\n * @internal\n */\nconst HI_CONTEXT_RE =\n /\\b(?:health\\s+insurance(?:\\s+(?:number|id|no\\.?|#|card))?|insurance\\s+(?:number|id|no\\.?|#|member\\s+id)|member\\s+(?:id|number|no\\.?)|policy\\s+(?:number|no\\.?|#)|medicare|medicaid|NHS(?:\\s+(?:number|no\\.?|#))?|EHIC|beneficiary\\s+(?:id|number))\\s*:?\\s*/gi;\n\n/**\n * US Medicare Beneficiary Identifier (MBI): format 1C2W-A00-AA00\n * Pattern: digit + capital-letter (non-SLOIBZ) + digit + capital-letter/digit pair (×2) + ...\n * Simplified: alphanumeric 11 chars with specific char-class restrictions.\n * @internal\n */\nconst US_MBI_PATTERN =\n /\\b[1-9][AC-HJ-NP-RT-Y][0-9][AC-HJ-NP-RT-Y][AC-HJ-NP-RT-Y0-9]\\d[AC-HJ-NP-RT-Y][AC-HJ-NP-RT-Y0-9]{2}\\d{2}\\b/gi;\n\n/**\n * UK NHS number: 10 digits (validated with mod-11).\n * @internal\n */\nconst UK_NHS_PATTERN = /\\b\\d{3}[\\s-]\\d{3}[\\s-]\\d{4}\\b|\\b\\d{10}\\b/g;\n\n/**\n * EU EHIC number: country code + 3-digit institution + 7-digit personal + 8-digit serial\n * (simplified — per-country formats vary significantly)\n * @internal\n */\nconst EU_EHIC_PATTERN =\n /\\b[A-Z]{2}\\d{6,10}\\b/g;\n\n/**\n * Generic insurance member ID with context.\n * @internal\n */\nconst GENERIC_MEMBER_ID = /\\b[A-Z0-9]{8,14}\\b/g;\n\n/**\n * Detect health insurance identifiers in `text`.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"health-insurance\"`.\n */\nexport function detectHealthInsurance(text: string): PiiMatch[] {\n const matches: PiiMatch[] = [];\n const seen = new Set<string>();\n\n const contextPositions: number[] = [];\n const ctxRe = new RegExp(HI_CONTEXT_RE.source, \"gi\");\n let cm: RegExpExecArray | null;\n while ((cm = ctxRe.exec(text)) !== null) {\n contextPositions.push(cm.index + cm[0].length);\n }\n\n function hasContextAt(index: number): boolean {\n return contextPositions.some((pos) => pos <= index && index - pos <= 40);\n }\n\n function push(value: string, start: number, end: number, confidence: number): void {\n const key = `${String(start)}-${String(end)}`;\n if (seen.has(key)) return;\n seen.add(key);\n matches.push({ category: \"health-insurance\", value, start, end, confidence });\n }\n\n let m: RegExpExecArray | null;\n\n // US MBI — distinctive format\n const mbiRe = new RegExp(US_MBI_PATTERN.source, \"gi\");\n while ((m = mbiRe.exec(text)) !== null) {\n push(m[0], m.index, m.index + m[0].length, hasContextAt(m.index) ? 0.90 : 0.80);\n }\n\n // UK NHS — with mod-11 validation\n const nhsRe = new RegExp(UK_NHS_PATTERN.source, \"g\");\n while ((m = nhsRe.exec(text)) !== null) {\n if (nhsMod11(m[0])) {\n push(m[0], m.index, m.index + m[0].length, hasContextAt(m.index) ? 0.92 : 0.82);\n }\n }\n\n // EU EHIC — with context\n const ehicRe = new RegExp(EU_EHIC_PATTERN.source, \"g\");\n while ((m = ehicRe.exec(text)) !== null) {\n if (hasContextAt(m.index)) {\n push(m[0], m.index, m.index + m[0].length, 0.78);\n }\n }\n\n // Generic member ID — requires context\n const genericRe = new RegExp(GENERIC_MEMBER_ID.source, \"g\");\n while ((m = genericRe.exec(text)) !== null) {\n if (hasContextAt(m.index)) {\n push(m[0], m.index, m.index + m[0].length, 0.75);\n }\n }\n\n return matches;\n}\n","/**\n * @module detectors/prescription\n * @description Detector for prescription and pharmaceutical identifiers.\n *\n * Covered:\n * - DEA registration numbers (with checksum)\n * - NDC (National Drug Code): 10-11 digit codes in various formats\n * - Rx (prescription) numbers: numeric identifiers with context keywords\n */\n\nimport type { PiiMatch } from \"../types.js\";\nimport { deaChecksum } from \"../validators.js\";\n\n/**\n * Context keywords for prescriptions.\n * @internal\n */\nconst RX_CONTEXT_RE =\n /\\b(?:Rx\\s*(?:number|no\\.?|#)?|prescription\\s*(?:number|no\\.?|#)?|prescription\\s+id|NDC|drug\\s+code|DEA\\s*(?:number|no\\.?|#)?)\\s*:?\\s*/gi;\n\n/**\n * DEA number: registrant letter + alpha + 7 digits.\n * @internal\n */\nconst DEA_PATTERN = /\\b[ABCDEFGHJKLMNPRSTUX][A-Z9]\\d{7}\\b/gi;\n\n/**\n * NDC (National Drug Code): 10-11 digits in formats:\n * - 4-4-2 (labeler-product-package)\n * - 5-3-2\n * - 5-4-1\n * - 5-4-2 (11-digit NDC)\n * @internal\n */\nconst NDC_PATTERN =\n /\\b\\d{4}-\\d{4}-\\d{2}\\b|\\b\\d{5}-\\d{3}-\\d{2}\\b|\\b\\d{5}-\\d{4}-\\d{1}\\b|\\b\\d{5}-\\d{4}-\\d{2}\\b/g;\n\n/**\n * Rx number: 4-12 digits with context keyword.\n * @internal\n */\nconst RX_NUMBER_PATTERN = /\\b\\d{4,12}\\b/g;\n\n/**\n * Detect prescription identifiers in `text`.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"prescription\"`.\n */\nexport function detectPrescription(text: string): PiiMatch[] {\n const matches: PiiMatch[] = [];\n const seen = new Set<string>();\n\n const contextPositions: number[] = [];\n const ctxRe = new RegExp(RX_CONTEXT_RE.source, \"gi\");\n let cm: RegExpExecArray | null;\n while ((cm = ctxRe.exec(text)) !== null) {\n contextPositions.push(cm.index + cm[0].length);\n }\n\n function hasContextAt(index: number): boolean {\n return contextPositions.some((pos) => pos <= index && index - pos <= 30);\n }\n\n function push(value: string, start: number, end: number, confidence: number): void {\n const key = `${String(start)}-${String(end)}`;\n // Prescription patterns never produce overlapping ranges in practice.\n /* v8 ignore next */\n if (seen.has(key)) return;\n seen.add(key);\n matches.push({ category: \"prescription\", value, start, end, confidence });\n }\n\n let m: RegExpExecArray | null;\n\n // DEA numbers — validated with checksum\n const deaRe = new RegExp(DEA_PATTERN.source, \"gi\");\n while ((m = deaRe.exec(text)) !== null) {\n if (deaChecksum(m[0])) {\n push(m[0], m.index, m.index + m[0].length, 0.90);\n }\n }\n\n // NDC codes — distinctive format\n const ndcRe = new RegExp(NDC_PATTERN.source, \"g\");\n while ((m = ndcRe.exec(text)) !== null) {\n push(m[0], m.index, m.index + m[0].length, hasContextAt(m.index) ? 0.90 : 0.78);\n }\n\n // Rx numbers — require context\n const rxRe = new RegExp(RX_NUMBER_PATTERN.source, \"g\");\n while ((m = rxRe.exec(text)) !== null) {\n if (hasContextAt(m.index)) {\n push(m[0], m.index, m.index + m[0].length, 0.82);\n }\n }\n\n return matches;\n}\n","/**\n * @module detectors/api-key\n * @description Detector for API keys and authentication tokens.\n *\n * Covered formats:\n * - AWS Access Key ID: AKIA... (20 chars)\n * - AWS Secret Access Key: 40 base64 chars (context required)\n * - Stripe live secret key: sk_live_...\n * - Stripe live publishable key: pk_live_...\n * - Stripe test keys: sk_test_..., pk_test_...\n * - GitHub tokens: ghp_, gho_, ghs_, ghr_, github_pat_\n * - Slack bot token: xoxb-...\n * - Slack user token: xoxp-...\n * - Slack app token: xoxa-...\n * - Slack workspace token: xoxs-...\n * - OpenAI API key: sk-...\n * - Google API key: AIza...\n * - JWT tokens: eyJ...\n * - Bearer tokens: Bearer + base64 string (context required)\n * - Generic API key with context keyword\n */\n\nimport type { PiiMatch } from \"../types.js\";\n\ninterface ApiKeyEntry {\n readonly pattern: RegExp;\n readonly confidence: number;\n readonly requiresContext: boolean;\n}\n\nconst API_KEY_ENTRIES: readonly ApiKeyEntry[] = [\n // AWS Access Key ID\n {\n pattern: /\\bAKIA[0-9A-Z]{16}\\b/g,\n confidence: 0.99,\n requiresContext: false,\n },\n // Stripe live secret key\n {\n pattern: /\\bsk_live_[a-zA-Z0-9]{24,99}\\b/g,\n confidence: 0.99,\n requiresContext: false,\n },\n // Stripe live publishable key\n {\n pattern: /\\bpk_live_[a-zA-Z0-9]{24,99}\\b/g,\n confidence: 0.99,\n requiresContext: false,\n },\n // Stripe test keys\n {\n pattern: /\\b(?:sk|pk)_test_[a-zA-Z0-9]{24,99}\\b/g,\n confidence: 0.97,\n requiresContext: false,\n },\n // GitHub personal access tokens (classic)\n {\n pattern: /\\bghp_[a-zA-Z0-9]{36}\\b/g,\n confidence: 0.99,\n requiresContext: false,\n },\n // GitHub OAuth tokens\n {\n pattern: /\\bgho_[a-zA-Z0-9]{36}\\b/g,\n confidence: 0.99,\n requiresContext: false,\n },\n // GitHub server-to-server tokens\n {\n pattern: /\\bghs_[a-zA-Z0-9]{36}\\b/g,\n confidence: 0.99,\n requiresContext: false,\n },\n // GitHub refresh tokens\n {\n pattern: /\\bghr_[a-zA-Z0-9]{36,76}\\b/g,\n confidence: 0.99,\n requiresContext: false,\n },\n // GitHub fine-grained PAT\n {\n pattern: /\\bgithub_pat_[a-zA-Z0-9_]{59,}\\b/g,\n confidence: 0.99,\n requiresContext: false,\n },\n // Slack bot tokens\n {\n pattern: /\\bxoxb-[0-9A-Za-z-]{40,}\\b/g,\n confidence: 0.98,\n requiresContext: false,\n },\n // Slack user tokens\n {\n pattern: /\\bxoxp-[0-9A-Za-z-]{40,}\\b/g,\n confidence: 0.98,\n requiresContext: false,\n },\n // Slack app tokens\n {\n pattern: /\\bxoxa-[0-9A-Za-z-]{40,}\\b/g,\n confidence: 0.98,\n requiresContext: false,\n },\n // Slack workspace tokens\n {\n pattern: /\\bxoxs-[0-9A-Za-z-]{40,}\\b/g,\n confidence: 0.96,\n requiresContext: false,\n },\n // OpenAI API keys\n {\n pattern: /\\bsk-[a-zA-Z0-9]{32,}\\b/g,\n confidence: 0.90,\n requiresContext: false,\n },\n // Google API keys\n {\n pattern: /\\bAIza[0-9A-Za-z_-]{35}\\b/g,\n confidence: 0.99,\n requiresContext: false,\n },\n // JWT tokens (only the full 3-part form)\n {\n pattern: /\\beyJ[a-zA-Z0-9_-]{10,}\\.eyJ[a-zA-Z0-9_-]{10,}\\.[a-zA-Z0-9_-]{20,}\\b/g,\n confidence: 0.95,\n requiresContext: false,\n },\n];\n\n/**\n * Context keywords for generic API key detection.\n * @internal\n */\nconst API_KEY_CONTEXT_RE =\n /\\b(?:api[_-\\s]?key|api[_-\\s]?token|access[_-\\s]?token|secret[_-\\s]?key|auth(?:orization)?[_-\\s]?(?:key|token)|bearer(?:\\s+token)?|x-api-key|credential[s]?)\\s*[:=]\\s*/gi;\n\n/**\n * Generic API key / secret: 20-80 alphanumeric + _ + - chars with context.\n * @internal\n */\nconst GENERIC_KEY_PATTERN = /\\b[a-zA-Z0-9_.-]{20,80}\\b/g;\n\n/**\n * Detect API keys and authentication tokens in `text`.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"api-key\"`.\n */\nexport function detectApiKey(text: string): PiiMatch[] {\n const matches: PiiMatch[] = [];\n const seen = new Set<string>();\n\n const contextPositions: number[] = [];\n const ctxRe = new RegExp(API_KEY_CONTEXT_RE.source, \"gi\");\n let cm: RegExpExecArray | null;\n while ((cm = ctxRe.exec(text)) !== null) {\n contextPositions.push(cm.index + cm[0].length);\n }\n\n function hasContextAt(index: number): boolean {\n return contextPositions.some((pos) => pos <= index && index - pos <= 10);\n }\n\n function push(value: string, start: number, end: number, confidence: number): void {\n const key = `${String(start)}-${String(end)}`;\n if (seen.has(key)) return;\n seen.add(key);\n matches.push({ category: \"api-key\", value, start, end, confidence });\n }\n\n // Specific known formats\n for (const entry of API_KEY_ENTRIES) {\n const re = new RegExp(entry.pattern.source, \"g\");\n let m: RegExpExecArray | null;\n while ((m = re.exec(text)) !== null) {\n push(m[0], m.index, m.index + m[0].length, entry.confidence);\n }\n }\n\n // Generic with context\n const genericRe = new RegExp(GENERIC_KEY_PATTERN.source, \"g\");\n let m: RegExpExecArray | null;\n while ((m = genericRe.exec(text)) !== null) {\n if (hasContextAt(m.index)) {\n push(m[0], m.index, m.index + m[0].length, 0.82);\n }\n }\n\n return matches;\n}\n","/**\n * @module detectors/social-media\n * @description Detector for social media identifiers and handles.\n *\n * Covered:\n * - Twitter/X handles: @username (1-15 alphanumeric/underscore)\n * - Instagram handles: @username (1-30 alphanumeric/underscore/period)\n * - Discord IDs: 17-19 digit snowflake IDs\n * - YouTube channel IDs: UC + 22 base64 chars\n * - TikTok handles: @username\n * - LinkedIn profile URLs: linkedin.com/in/...\n * - Reddit usernames: u/username\n */\n\nimport type { PiiMatch } from \"../types.js\";\n\n/**\n * Twitter/X handle: @ + 1-15 word chars (letters, digits, underscores).\n * No period allowed in Twitter handles.\n * @internal\n */\nconst TWITTER_HANDLE_PATTERN = /(?<![a-zA-Z0-9])@[a-zA-Z0-9_]{1,15}(?![a-zA-Z0-9_@])/g;\n\n/**\n * Discord snowflake ID: 17-19 digit integer.\n * Requires context keyword.\n * @internal\n */\nconst DISCORD_ID_PATTERN = /\\b\\d{17,19}\\b/g;\n\n/**\n * YouTube channel ID: UC + 22 base64 URL-safe chars\n * @internal\n */\nconst YT_CHANNEL_PATTERN = /\\bUC[a-zA-Z0-9_-]{22}\\b/g;\n\n/**\n * Reddit username: u/ or /u/ prefix\n * @internal\n */\nconst REDDIT_USER_PATTERN = /\\b(?:u|\\/u)\\/[a-zA-Z0-9_-]{3,20}\\b/g;\n\n/**\n * LinkedIn profile URL fragment\n * @internal\n */\nconst LINKEDIN_PATTERN = /\\blinkedin\\.com\\/in\\/[a-zA-Z0-9-]{3,100}\\b/gi;\n\n/**\n * Context keywords for Discord IDs.\n * @internal\n */\nconst DISCORD_CONTEXT_RE =\n /\\b(?:discord(?:\\s+(?:id|user|server|guild))?|user\\s+id|uid)\\s*:?\\s*/gi;\n\n/**\n * Detect social media identifiers in `text`.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"social-media\"`.\n */\nexport function detectSocialMedia(text: string): PiiMatch[] {\n const matches: PiiMatch[] = [];\n const seen = new Set<string>();\n\n const discordContextPositions: number[] = [];\n const ctxRe = new RegExp(DISCORD_CONTEXT_RE.source, \"gi\");\n let cm: RegExpExecArray | null;\n while ((cm = ctxRe.exec(text)) !== null) {\n discordContextPositions.push(cm.index + cm[0].length);\n }\n\n function push(value: string, start: number, end: number, confidence: number): void {\n const key = `${String(start)}-${String(end)}`;\n // Social-media patterns never produce overlapping ranges in practice.\n /* v8 ignore next */\n if (seen.has(key)) return;\n seen.add(key);\n matches.push({ category: \"social-media\", value, start, end, confidence });\n }\n\n let m: RegExpExecArray | null;\n\n // Twitter handles — use the more restrictive pattern (no periods)\n // Apply conservative confidence since @ is common in other contexts\n const twitterRe = new RegExp(TWITTER_HANDLE_PATTERN.source, \"g\");\n while ((m = twitterRe.exec(text)) !== null) {\n push(m[0], m.index, m.index + m[0].length, 0.78);\n }\n\n // YouTube channel IDs — distinctive\n const ytRe = new RegExp(YT_CHANNEL_PATTERN.source, \"g\");\n while ((m = ytRe.exec(text)) !== null) {\n push(m[0], m.index, m.index + m[0].length, 0.90);\n }\n\n // Reddit usernames\n const redditRe = new RegExp(REDDIT_USER_PATTERN.source, \"g\");\n while ((m = redditRe.exec(text)) !== null) {\n push(m[0], m.index, m.index + m[0].length, 0.85);\n }\n\n // LinkedIn profiles\n const linkedinRe = new RegExp(LINKEDIN_PATTERN.source, \"gi\");\n while ((m = linkedinRe.exec(text)) !== null) {\n push(m[0], m.index, m.index + m[0].length, 0.92);\n }\n\n // Discord snowflake IDs — requires context\n const discordRe = new RegExp(DISCORD_ID_PATTERN.source, \"g\");\n while ((m = discordRe.exec(text)) !== null) {\n const match = m;\n const hasContext = discordContextPositions.some(\n (pos) => pos <= match.index && match.index - pos <= 30,\n );\n if (hasContext) push(match[0], match.index, match.index + match[0].length, 0.85);\n }\n\n return matches;\n}\n","/**\n * @module detectors/vin\n * @description Detector for Vehicle Identification Numbers (VIN).\n *\n * VINs are 17 characters per ISO 3779. The 9th character is a check digit\n * validated using transliteration and a mod-11 algorithm. Characters I, O, Q\n * are excluded from valid VINs.\n *\n * Confidence: 0.95 when checksum passes, 0.70 for format-only match.\n */\n\nimport type { PiiMatch } from \"../types.js\";\nimport { vinChecksum } from \"../validators.js\";\n\n/**\n * VIN candidates: 17 chars from valid VIN alphabet (A-H, J-N, P, R-Z, 0-9).\n * @internal\n */\nconst VIN_PATTERN = /\\b[A-HJ-NPR-Z0-9]{17}\\b/gi;\n\n/**\n * Detect Vehicle Identification Numbers in `text`.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"vin\"`.\n */\nexport function detectVin(text: string): PiiMatch[] {\n const matches: PiiMatch[] = [];\n const re = new RegExp(VIN_PATTERN.source, \"gi\");\n let m: RegExpExecArray | null;\n\n while ((m = re.exec(text)) !== null) {\n const upper = m[0].toUpperCase();\n const valid = vinChecksum(upper);\n if (valid) {\n matches.push({\n category: \"vin\",\n value: m[0],\n start: m.index,\n end: m.index + m[0].length,\n confidence: 0.95,\n });\n }\n }\n\n return matches;\n}\n\n/**\n * Aggressive variant of {@link detectVin}.\n * Also reports format-valid VINs that fail the checksum (e.g. non-North-American\n * vehicles where the check digit is not enforced).\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"vin\"`.\n */\nexport function detectVinAggressive(text: string): PiiMatch[] {\n const strict = detectVin(text);\n const strictRanges = new Set(strict.map((m) => `${String(m.start)}-${String(m.end)}`));\n\n const matches: PiiMatch[] = [...strict];\n const re = new RegExp(VIN_PATTERN.source, \"gi\");\n let m: RegExpExecArray | null;\n\n while ((m = re.exec(text)) !== null) {\n const key = `${String(m.index)}-${String(m.index + m[0].length)}`;\n if (!strictRanges.has(key)) {\n matches.push({\n category: \"vin\",\n value: m[0],\n start: m.index,\n end: m.index + m[0].length,\n confidence: 0.70,\n });\n }\n }\n\n return matches;\n}\n","/**\n * @module detectors/license-plate\n * @description Detector for vehicle license/number plates.\n *\n * Covered formats:\n * - US: generic state format (2-8 alphanumeric, context required)\n * - UK: current format (AB12 ABC) and older (A123 BCD)\n * - EU generic: 1-2 letters + 2-4 digits + 1-3 letters\n *\n * Context keywords strongly boost reliability.\n */\n\nimport type { PiiMatch } from \"../types.js\";\n\n/**\n * Context keywords for license plates.\n * @internal\n */\nconst LP_CONTEXT_RE =\n /\\b(?:licen[sc]e\\s+plate|number\\s+plate|registration\\s+(?:plate|number)|reg(?:istration)?\\s*(?:no\\.?|#|:)|plate(?:\\s+(?:number|no\\.?))?)\\s*:?\\s*/gi;\n\n/**\n * UK current format: AB12 ABC or AB12ABC (letters-digits-letters).\n * @internal\n */\nconst UK_CURRENT_LP_PATTERN = /\\b[A-Z]{2}\\d{2}[\\s]?[A-Z]{3}\\b/gi;\n\n/**\n * UK older prefix format: A123 BCD or A123BCD\n * @internal\n */\nconst UK_OLD_LP_PATTERN = /\\b[A-Z]\\d{1,4}[\\s]?[A-Z]{3}\\b/gi;\n\n/**\n * EU generic: 1-2 letters + 1-4 digits + 1-3 letters (typically on black/white plates)\n * @internal\n */\nconst EU_LP_PATTERN = /\\b[A-Z]{1,2}[\\s-]?\\d{1,4}[\\s-]?[A-Z]{1,3}\\b/gi;\n\n/**\n * US generic: state plates are typically 2-8 alphanumeric chars.\n * Too generic to report without context.\n * @internal\n */\nconst US_LP_PATTERN = /\\b[A-Z0-9]{2,8}\\b/g;\n\n/**\n * Detect vehicle license plate numbers in `text`.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"license-plate\"`.\n */\nexport function detectLicensePlate(text: string): PiiMatch[] {\n const matches: PiiMatch[] = [];\n const seen = new Set<string>();\n\n const contextPositions: number[] = [];\n const ctxRe = new RegExp(LP_CONTEXT_RE.source, \"gi\");\n let cm: RegExpExecArray | null;\n while ((cm = ctxRe.exec(text)) !== null) {\n contextPositions.push(cm.index + cm[0].length);\n }\n\n function hasContextAt(index: number): boolean {\n return contextPositions.some((pos) => pos <= index && index - pos <= 20);\n }\n\n function push(value: string, start: number, end: number, confidence: number): void {\n const key = `${String(start)}-${String(end)}`;\n if (seen.has(key)) return;\n seen.add(key);\n matches.push({ category: \"license-plate\", value, start, end, confidence });\n }\n\n let m: RegExpExecArray | null;\n\n // UK current format — distinctive\n const ukCurrentRe = new RegExp(UK_CURRENT_LP_PATTERN.source, \"gi\");\n while ((m = ukCurrentRe.exec(text)) !== null) {\n push(m[0], m.index, m.index + m[0].length, hasContextAt(m.index) ? 0.90 : 0.78);\n }\n\n // UK older format\n const ukOldRe = new RegExp(UK_OLD_LP_PATTERN.source, \"gi\");\n while ((m = ukOldRe.exec(text)) !== null) {\n push(m[0], m.index, m.index + m[0].length, hasContextAt(m.index) ? 0.85 : 0.70);\n }\n\n // EU generic — context recommended\n const euRe = new RegExp(EU_LP_PATTERN.source, \"gi\");\n while ((m = euRe.exec(text)) !== null) {\n const conf = hasContextAt(m.index) ? 0.82 : 0.65;\n if (conf >= 0.70) push(m[0], m.index, m.index + m[0].length, conf);\n }\n\n // US generic — requires context\n const usRe = new RegExp(US_LP_PATTERN.source, \"g\");\n while ((m = usRe.exec(text)) !== null) {\n if (hasContextAt(m.index)) push(m[0], m.index, m.index + m[0].length, 0.80);\n }\n\n return matches;\n}\n","/**\n * @module detectors/tracking-number\n * @description Detector for parcel/shipment tracking numbers.\n *\n * Covered carriers:\n * - FedEx: 12 or 15 or 20 digits\n * - UPS: 1Z + 16 chars\n * - USPS: 20-22 digits or XX### ### ### US format\n * - DHL: 10 digits or 11 digits starting with JD\n * - Amazon: TBA + 12 digits\n */\n\nimport type { PiiMatch } from \"../types.js\";\n\n/**\n * UPS: 1Z + 16 alphanumeric chars (checksum via mod-7)\n * @internal\n */\nconst UPS_PATTERN = /\\b1Z[A-Z0-9]{16}\\b/gi;\n\n/**\n * USPS: 20-22 consecutive digits\n * @internal\n */\nconst USPS_LONG_PATTERN = /\\b\\d{20,22}\\b/g;\n\n/**\n * USPS: service code + digits + US (e.g., 94001116990045395947)\n * @internal\n */\nconst USPS_FORMAT_PATTERN =\n /\\b(?:9[2-5]\\d{18,20}|[A-Z]{2}\\d{9}US)\\b/gi;\n\n/**\n * FedEx: 12-digit, 15-digit, or 20-22 digit number\n * @internal\n */\nconst FEDEX_PATTERN = /\\b(?:\\d{12}|\\d{15}|\\d{20,22})\\b/g;\n\n/**\n * DHL: 10-digit or JD + 9 digits\n * @internal\n */\nconst DHL_PATTERN = /\\bJD\\d{9}\\b|\\b\\d{10,11}\\b/gi;\n\n/**\n * Amazon: TBA + 12 digits\n * @internal\n */\nconst AMAZON_PATTERN = /\\bTBA\\d{12}\\b/gi;\n\n/**\n * Context keywords for tracking numbers.\n * @internal\n */\nconst TRACKING_CONTEXT_RE =\n /\\b(?:tracking(?:\\s+(?:number|no\\.?|#|id))?|shipment(?:\\s+(?:number|id|tracking))?|parcel(?:\\s+(?:number|id))?|package(?:\\s+(?:number|id|tracking))?|(?:fedex|ups|usps|dhl|amazon)\\s+(?:tracking|shipment)?)\\s*:?\\s*/gi;\n\n/**\n * Detect parcel tracking numbers in `text`.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"tracking-number\"`.\n */\nexport function detectTrackingNumber(text: string): PiiMatch[] {\n const matches: PiiMatch[] = [];\n const seen = new Set<string>();\n\n const contextPositions: number[] = [];\n const ctxRe = new RegExp(TRACKING_CONTEXT_RE.source, \"gi\");\n let cm: RegExpExecArray | null;\n while ((cm = ctxRe.exec(text)) !== null) {\n contextPositions.push(cm.index + cm[0].length);\n }\n\n function hasContextAt(index: number): boolean {\n return contextPositions.some((pos) => pos <= index && index - pos <= 30);\n }\n\n function push(value: string, start: number, end: number, confidence: number): void {\n const key = `${String(start)}-${String(end)}`;\n if (seen.has(key)) return;\n seen.add(key);\n matches.push({ category: \"tracking-number\", value, start, end, confidence });\n }\n\n let m: RegExpExecArray | null;\n\n // UPS — most distinctive (1Z prefix)\n const upsRe = new RegExp(UPS_PATTERN.source, \"gi\");\n while ((m = upsRe.exec(text)) !== null) {\n push(m[0], m.index, m.index + m[0].length, 0.96);\n }\n\n // Amazon — distinctive (TBA prefix)\n const amazonRe = new RegExp(AMAZON_PATTERN.source, \"gi\");\n while ((m = amazonRe.exec(text)) !== null) {\n push(m[0], m.index, m.index + m[0].length, 0.97);\n }\n\n // USPS service-format\n const uspsFormatRe = new RegExp(USPS_FORMAT_PATTERN.source, \"gi\");\n while ((m = uspsFormatRe.exec(text)) !== null) {\n push(m[0], m.index, m.index + m[0].length, 0.90);\n }\n\n // DHL JD prefix\n const dhlRe = new RegExp(DHL_PATTERN.source, \"gi\");\n while ((m = dhlRe.exec(text)) !== null) {\n if (m[0].startsWith(\"JD\") || m[0].startsWith(\"jd\")) {\n push(m[0], m.index, m.index + m[0].length, 0.88);\n } else if (hasContextAt(m.index)) {\n push(m[0], m.index, m.index + m[0].length, 0.78);\n }\n }\n\n // Generic numeric tracking — requires context\n const uspsLongRe = new RegExp(USPS_LONG_PATTERN.source, \"g\");\n while ((m = uspsLongRe.exec(text)) !== null) {\n if (hasContextAt(m.index)) push(m[0], m.index, m.index + m[0].length, 0.80);\n }\n\n const fedexRe = new RegExp(FEDEX_PATTERN.source, \"g\");\n while ((m = fedexRe.exec(text)) !== null) {\n if (hasContextAt(m.index)) push(m[0], m.index, m.index + m[0].length, 0.78);\n }\n\n return matches;\n}\n","/**\n * @module detectors/case-number\n * @description Detector for US federal/state court case numbers.\n *\n * US federal court case numbers follow the pattern:\n * - YEAR:COURT DIVISION - CASE_TYPE - NUMBER (e.g., 1:21-cv-00123)\n * - Or: YEAR-CASE_TYPE-NUMBER (e.g., 21-CR-0456)\n *\n * Requires context keywords to reduce false positives.\n */\n\nimport type { PiiMatch } from \"../types.js\";\n\n/**\n * US Federal court case number: e.g., 1:21-cv-00123, 21-cv-00123\n * @internal\n */\nconst FEDERAL_CASE_PATTERN =\n /\\b(?:\\d:\\s*)?\\d{2}[\\s-](?:cv|cr|civ|crim|mc|mj|po|br|ap|adv|bk)[\\s-]\\d{4,6}\\b/gi;\n\n/**\n * General legal case number with context.\n * @internal\n */\nconst GENERAL_CASE_PATTERN =\n /\\b(?:[A-Z]{1,4}[-\\s])?\\d{2,4}[-/]\\d{2,6}(?:[-/][A-Z0-9]{1,5})?\\b/gi;\n\n/**\n * Case number context keywords.\n * @internal\n */\nconst CASE_CONTEXT_RE =\n /\\b(?:case(?:\\s+(?:number|no\\.?|#|id))?|docket(?:\\s+(?:number|no\\.?|#))?|civil\\s+action|criminal\\s+(?:case|no\\.?|#)|court\\s+(?:case|file(?:\\s+no\\.?)?)|matter\\s+no\\.?|file\\s+(?:number|no\\.?|#))\\s*:?\\s*/gi;\n\n/**\n * Detect court case numbers in `text`.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"case-number\"`.\n */\nexport function detectCaseNumber(text: string): PiiMatch[] {\n const matches: PiiMatch[] = [];\n const seen = new Set<string>();\n\n const contextPositions: number[] = [];\n const ctxRe = new RegExp(CASE_CONTEXT_RE.source, \"gi\");\n let cm: RegExpExecArray | null;\n while ((cm = ctxRe.exec(text)) !== null) {\n contextPositions.push(cm.index + cm[0].length);\n }\n\n function hasContextAt(index: number): boolean {\n return contextPositions.some((pos) => pos <= index && index - pos <= 30);\n }\n\n function push(value: string, start: number, end: number, confidence: number): void {\n const key = `${String(start)}-${String(end)}`;\n // The federal and general patterns never produce overlapping ranges in practice.\n /* v8 ignore next */\n if (seen.has(key)) return;\n seen.add(key);\n matches.push({ category: \"case-number\", value, start, end, confidence });\n }\n\n let m: RegExpExecArray | null;\n\n // Federal court pattern — relatively distinctive\n const fedRe = new RegExp(FEDERAL_CASE_PATTERN.source, \"gi\");\n while ((m = fedRe.exec(text)) !== null) {\n push(m[0], m.index, m.index + m[0].length, hasContextAt(m.index) ? 0.92 : 0.80);\n }\n\n // General pattern — requires context\n const generalRe = new RegExp(GENERAL_CASE_PATTERN.source, \"gi\");\n while ((m = generalRe.exec(text)) !== null) {\n if (hasContextAt(m.index)) push(m[0], m.index, m.index + m[0].length, 0.78);\n }\n\n return matches;\n}\n","/**\n * @module detectors/company-registration\n * @description Detector for company registration numbers.\n *\n * Covered:\n * - US EIN: XX-XXXXXXX (same as tax-id but in company registration context)\n * - UK Companies House: 8 digits or 2 letters + 6 digits (e.g., 00123456, SC012345)\n * - EU/generic: country code + alphanumeric registration number\n * - Australian ACN: XXX XXX XXX (9 digits)\n */\n\nimport type { PiiMatch } from \"../types.js\";\n\n/**\n * Context keywords for company registration.\n * @internal\n */\nconst CR_CONTEXT_RE =\n /\\b(?:company\\s+(?:registration|reg(?:istration)?)\\s*(?:number|no\\.?|#)?|companies\\s+house\\s*(?:number|no\\.?|#)?|registered\\s+(?:number|company\\s+number|no\\.?)|incorporation\\s*(?:number|no\\.?|#)?|company\\s+(?:number|no\\.?|#)|corporate\\s+(?:id|number|no\\.?|registration)|business\\s+(?:registration|number)|ABN|ACN|CIK)\\s*:?\\s*/gi;\n\n/**\n * UK Companies House: 8 digits or 2 letters + 6 digits.\n * @internal\n */\nconst UK_CH_PATTERN = /\\b(?:[A-Z]{2}\\d{6}|\\d{8})\\b/gi;\n\n/**\n * US EIN in company context: XX-XXXXXXX.\n * @internal\n */\nconst US_EIN_PATTERN = /\\b\\d{2}-\\d{7}\\b/g;\n\n/**\n * Australian ACN: 9 digits (often written XXX XXX XXX).\n * @internal\n */\nconst AU_ACN_PATTERN = /\\b\\d{3}[\\s]?\\d{3}[\\s]?\\d{3}\\b/g;\n\n/**\n * EU generic: 2-letter country code optionally followed by alphanumeric registration.\n * @internal\n */\nconst EU_CO_REG_PATTERN = /\\b[A-Z]{2}[\\s-]?[A-Z0-9]{5,12}\\b/g;\n\n/**\n * Detect company registration numbers in `text`.\n *\n * @param text - The input string to scan.\n * @returns An array of {@link PiiMatch} objects with `category: \"company-registration\"`.\n */\nexport function detectCompanyRegistration(text: string): PiiMatch[] {\n const matches: PiiMatch[] = [];\n const seen = new Set<string>();\n\n const contextPositions: number[] = [];\n const ctxRe = new RegExp(CR_CONTEXT_RE.source, \"gi\");\n let cm: RegExpExecArray | null;\n while ((cm = ctxRe.exec(text)) !== null) {\n contextPositions.push(cm.index + cm[0].length);\n }\n\n function hasContextAt(index: number): boolean {\n return contextPositions.some((pos) => pos <= index && index - pos <= 30);\n }\n\n function push(value: string, start: number, end: number, confidence: number): void {\n const key = `${String(start)}-${String(end)}`;\n // The EIN, UK, AU ACN, and EU generic patterns never produce overlapping ranges in practice.\n /* v8 ignore next */\n if (seen.has(key)) return;\n seen.add(key);\n matches.push({ category: \"company-registration\", value, start, end, confidence });\n }\n\n let m: RegExpExecArray | null;\n\n // US EIN — distinctive format\n const einRe = new RegExp(US_EIN_PATTERN.source, \"g\");\n while ((m = einRe.exec(text)) !== null) {\n push(m[0], m.index, m.index + m[0].length, hasContextAt(m.index) ? 0.88 : 0.72);\n }\n\n // UK Companies House — with context\n const ukRe = new RegExp(UK_CH_PATTERN.source, \"gi\");\n while ((m = ukRe.exec(text)) !== null) {\n if (hasContextAt(m.index)) push(m[0], m.index, m.index + m[0].length, 0.85);\n }\n\n // AU ACN — with context\n const acnRe = new RegExp(AU_ACN_PATTERN.source, \"g\");\n while ((m = acnRe.exec(text)) !== null) {\n if (hasContextAt(m.index)) push(m[0], m.index, m.index + m[0].length, 0.82);\n }\n\n // EU generic — with context\n const euRe = new RegExp(EU_CO_REG_PATTERN.source, \"g\");\n while ((m = euRe.exec(text)) !== null) {\n if (hasContextAt(m.index)) push(m[0], m.index, m.index + m[0].length, 0.78);\n }\n\n return matches;\n}\n","/**\n * @module detectors\n * @description Barrel export for all built-in PII detectors.\n *\n * Each detector is a pure function that accepts a string and returns an array of\n * {@link PiiMatch} objects. Import individual detectors for maximum tree-shaking,\n * or use the pre-assembled {@link DETECTOR_REGISTRY} for convenience.\n *\n * For aggressive (more permissive) detection, use {@link AGGRESSIVE_DETECTOR_REGISTRY}.\n *\n * @example\n * ```ts\n * import { detectEmail, detectPhone, DETECTOR_REGISTRY } from \"anonyma/detectors\";\n *\n * // Use a single detector:\n * const matches = detectEmail(\"hello@example.com\");\n *\n * // Or scan for everything:\n * const allMatches = Object.values(DETECTOR_REGISTRY).flatMap((d) => d(\"some text\"));\n * ```\n */\n\n// --- Original detectors ---\nexport { detectEmail, detectEmailAggressive } from \"./email.js\";\nexport { detectPhone, detectPhoneAggressive } from \"./phone.js\";\nexport { detectSsn, detectSsnAggressive } from \"./ssn.js\";\nexport { detectCreditCard, detectCreditCardAggressive } from \"./credit-card.js\";\nexport { detectIpv4, detectIpv6 } from \"./ip-address.js\";\nexport { detectUrl } from \"./url.js\";\nexport { detectIban } from \"./iban.js\";\nexport { detectDateOfBirth } from \"./date-of-birth.js\";\nexport { detectName, detectNameAggressive } from \"./name.js\";\n\n// --- Personal Information ---\nexport { detectAddress } from \"./address.js\";\nexport { detectPassport } from \"./passport.js\";\nexport { detectDriversLicense } from \"./drivers-license.js\";\nexport { detectNationalId } from \"./national-id.js\";\n\n// --- Financial ---\nexport { detectBankAccount } from \"./bank-account.js\";\nexport { detectCryptocurrency } from \"./cryptocurrency.js\";\nexport { detectTaxId } from \"./tax-id.js\";\n\n// --- Healthcare ---\nexport { detectMedicalRecord } from \"./medical-record.js\";\nexport { detectHealthInsurance } from \"./health-insurance.js\";\nexport { detectPrescription } from \"./prescription.js\";\n\n// --- Digital Identity ---\nexport { detectApiKey } from \"./api-key.js\";\nexport { detectSocialMedia } from \"./social-media.js\";\n\n// --- Vehicles & Transportation ---\nexport { detectVin, detectVinAggressive } from \"./vin.js\";\nexport { detectLicensePlate } from \"./license-plate.js\";\nexport { detectTrackingNumber } from \"./tracking-number.js\";\n\n// --- Government & Legal ---\nexport { detectCaseNumber } from \"./case-number.js\";\nexport { detectCompanyRegistration } from \"./company-registration.js\";\n\nimport { detectEmail, detectEmailAggressive } from \"./email.js\";\nimport { detectPhone, detectPhoneAggressive } from \"./phone.js\";\nimport { detectSsn, detectSsnAggressive } from \"./ssn.js\";\nimport { detectCreditCard, detectCreditCardAggressive } from \"./credit-card.js\";\nimport { detectIpv4, detectIpv6 } from \"./ip-address.js\";\nimport { detectUrl } from \"./url.js\";\nimport { detectIban } from \"./iban.js\";\nimport { detectDateOfBirth } from \"./date-of-birth.js\";\nimport { detectName, detectNameAggressive } from \"./name.js\";\nimport { detectAddress } from \"./address.js\";\nimport { detectPassport } from \"./passport.js\";\nimport { detectDriversLicense } from \"./drivers-license.js\";\nimport { detectNationalId } from \"./national-id.js\";\nimport { detectBankAccount } from \"./bank-account.js\";\nimport { detectCryptocurrency } from \"./cryptocurrency.js\";\nimport { detectTaxId } from \"./tax-id.js\";\nimport { detectMedicalRecord } from \"./medical-record.js\";\nimport { detectHealthInsurance } from \"./health-insurance.js\";\nimport { detectPrescription } from \"./prescription.js\";\nimport { detectApiKey } from \"./api-key.js\";\nimport { detectSocialMedia } from \"./social-media.js\";\nimport { detectVin, detectVinAggressive } from \"./vin.js\";\nimport { detectLicensePlate } from \"./license-plate.js\";\nimport { detectTrackingNumber } from \"./tracking-number.js\";\nimport { detectCaseNumber } from \"./case-number.js\";\nimport { detectCompanyRegistration } from \"./company-registration.js\";\n\nimport type { DetectorRegistry } from \"../types.js\";\n\n/**\n * A pre-assembled registry containing all built-in detectors, keyed by\n * {@link PiiCategory}.\n *\n * @example\n * ```ts\n * import { DETECTOR_REGISTRY } from \"anonyma/detectors\";\n *\n * const emailMatches = DETECTOR_REGISTRY.email(\"user@example.com\");\n * ```\n */\nexport const DETECTOR_REGISTRY: DetectorRegistry = {\n // Original\n email: detectEmail,\n phone: detectPhone,\n ssn: detectSsn,\n \"credit-card\": detectCreditCard,\n ipv4: detectIpv4,\n ipv6: detectIpv6,\n url: detectUrl,\n iban: detectIban,\n \"date-of-birth\": detectDateOfBirth,\n name: detectName,\n // Personal Information\n address: detectAddress,\n passport: detectPassport,\n \"drivers-license\": detectDriversLicense,\n \"national-id\": detectNationalId,\n // Financial\n \"bank-account\": detectBankAccount,\n cryptocurrency: detectCryptocurrency,\n \"tax-id\": detectTaxId,\n // Healthcare\n \"medical-record\": detectMedicalRecord,\n \"health-insurance\": detectHealthInsurance,\n prescription: detectPrescription,\n // Digital Identity\n \"api-key\": detectApiKey,\n \"social-media\": detectSocialMedia,\n // Vehicles & Transportation\n vin: detectVin,\n \"license-plate\": detectLicensePlate,\n \"tracking-number\": detectTrackingNumber,\n // Government & Legal\n \"case-number\": detectCaseNumber,\n \"company-registration\": detectCompanyRegistration,\n} as const;\n\n/**\n * An alternative registry that uses expanded, more permissive patterns for each\n * detector. Enables detection of obfuscated or partial PII at the cost of a higher\n * false-positive rate.\n *\n * Use it by passing `aggressive: true` to {@link anonymize} / {@link createAnonymizer},\n * or directly via this registry for low-level usage.\n *\n * @example\n * ```ts\n * import { AGGRESSIVE_DETECTOR_REGISTRY } from \"anonyma/detectors\";\n *\n * const matches = AGGRESSIVE_DETECTOR_REGISTRY.email(\"user [at] example [dot] com\");\n * ```\n */\nexport const AGGRESSIVE_DETECTOR_REGISTRY: DetectorRegistry = {\n // Original (aggressive variants where available)\n email: detectEmailAggressive,\n phone: detectPhoneAggressive,\n ssn: detectSsnAggressive,\n \"credit-card\": detectCreditCardAggressive,\n ipv4: detectIpv4,\n ipv6: detectIpv6,\n url: detectUrl,\n iban: detectIban,\n \"date-of-birth\": detectDateOfBirth,\n name: detectNameAggressive,\n // Personal Information\n address: detectAddress,\n passport: detectPassport,\n \"drivers-license\": detectDriversLicense,\n \"national-id\": detectNationalId,\n // Financial\n \"bank-account\": detectBankAccount,\n cryptocurrency: detectCryptocurrency,\n \"tax-id\": detectTaxId,\n // Healthcare\n \"medical-record\": detectMedicalRecord,\n \"health-insurance\": detectHealthInsurance,\n prescription: detectPrescription,\n // Digital Identity\n \"api-key\": detectApiKey,\n \"social-media\": detectSocialMedia,\n // Vehicles & Transportation\n vin: detectVinAggressive,\n \"license-plate\": detectLicensePlate,\n \"tracking-number\": detectTrackingNumber,\n // Government & Legal\n \"case-number\": detectCaseNumber,\n \"company-registration\": detectCompanyRegistration,\n} as const;\n\n"]}