type BPJSType = 'kesehatan' | 'ketenagakerjaan'; interface BPJSInfo { type: BPJSType; /** Digits-only string, no separators */ raw: string; /** Formatted with standard separators */ formatted: string; } interface BPJSMaskOptions { /** Characters to keep visible at start. Default: 4 */ visibleStart?: number; /** Characters to keep visible at end. Default: 2 */ visibleEnd?: number; /** Replacement character. Default: '*' */ maskChar?: string; } declare class InvalidBPJSError extends Error { readonly code: "INVALID_BPJS"; constructor(message?: string); } /** * Validates a BPJS number for the given type. * Cleans non-numeric characters before validating. * * @param number - BPJS number (raw or formatted) * @param type - 'kesehatan' (13 digits) or 'ketenagakerjaan' (11 digits) * @returns true if valid, false otherwise — never throws * * @example * validateBPJS('0001234567890', 'kesehatan') // true * validateBPJS('0001-2345-67890', 'kesehatan') // true (cleans first) * validateBPJS('12345678901', 'ketenagakerjaan') // true * validateBPJS('123456789', 'kesehatan') // false */ declare function validateBPJS(number: string, type: BPJSType): boolean; /** * Validates a BPJS Kesehatan number (13 numeric digits). * * @example * validateBPJSKesehatan('0001234567890') // true * validateBPJSKesehatan('000123456789') // false — 12 digits */ declare function validateBPJSKesehatan(number: string): boolean; /** * Validates a BPJS Ketenagakerjaan number (11 numeric digits). * * @example * validateBPJSKetenagakerjaan('12345678901') // true * validateBPJSKetenagakerjaan('1234567890') // false — 10 digits */ declare function validateBPJSKetenagakerjaan(number: string): boolean; /** * Detects BPJS type from digit length. * Returns null if the cleaned input length matches neither type. * * @example * detectBPJSType('0001234567890') // 'kesehatan' * detectBPJSType('12345678901') // 'ketenagakerjaan' * detectBPJSType('123456789') // null */ declare function detectBPJSType(number: string): BPJSType | null; /** * Formats a BPJS number with standard separators. * * - kesehatan: XXXX-XXXX-XXXXX (4-4-5 groups) * - ketenagakerjaan: XXXX-XXX-XXXX (4-3-4 groups) * * Accepts pre-formatted input (idempotent). * * @throws {InvalidBPJSError} if the cleaned number fails validation for the given type * * @example * formatBPJS('0001234567890', 'kesehatan') // '0001-2345-67890' * formatBPJS('12345678901', 'ketenagakerjaan') // '1234-567-8901' * formatBPJS('0001-2345-67890', 'kesehatan') // '0001-2345-67890' (idempotent) */ declare function formatBPJS(number: string, type: BPJSType): string; /** * Parses a BPJS number of either type. Auto-detects type from digit length. * Returns null if the number is invalid for both types. * * @example * parseBPJS('0001234567890') * // { type: 'kesehatan', raw: '0001234567890', formatted: '0001-2345-67890' } * * parseBPJS('0001-2345-67890') * // { type: 'kesehatan', raw: '0001234567890', formatted: '0001-2345-67890' } * * parseBPJS('12345678901') * // { type: 'ketenagakerjaan', raw: '12345678901', formatted: '1234-567-8901' } * * parseBPJS('12345') * // null */ declare function parseBPJS(number: string): BPJSInfo | null; /** * Masks a BPJS number for privacy-safe display. * Always operates on the raw (digits-only) string. * * Defaults: visibleStart=4, visibleEnd=2, maskChar='*' * * If visibleStart + visibleEnd >= raw.length, returns the full raw string unmasked. * * @example * maskBPJS('0001234567890') * // '0001*******90' * * maskBPJS('0001234567890', { visibleStart: 4, visibleEnd: 4, maskChar: 'X' }) * // '0001XXXXXR7890' — note: 13 - 4 - 4 = 5 mask chars * * maskBPJS('0001-2345-67890') // accepts formatted input * // '0001*******90' * * maskBPJS('') * // '' */ declare function maskBPJS(number: string, options?: BPJSMaskOptions): string; /** * Strips all non-numeric characters from a BPJS number string. * * @param number - Raw input string * @returns Digits-only string, or empty string for null/empty input * * @example * cleanBPJS('0001-2345-67890') // '0001234567890' * cleanBPJS('BPJS: 12345678901') // '12345678901' * cleanBPJS('') // '' */ declare function cleanBPJS(number: string): string; export { type BPJSInfo, type BPJSMaskOptions, type BPJSType, InvalidBPJSError, cleanBPJS, detectBPJSType, formatBPJS, maskBPJS, parseBPJS, validateBPJS, validateBPJSKesehatan, validateBPJSKetenagakerjaan };