{"version":3,"file":"_isFormatIdnHostname.mjs","names":[],"sources":["../../src/internal/_isFormatIdnHostname.ts"],"sourcesContent":["/**\n * Checks the internationalized hostname spelling of the `idn-hostname` format.\n *\n * Accepts the hostname structure with label characters extended to the code\n * units from U+00A1 to U+FFFF. It checks characters and lengths only: IDNA\n * mapping, Punycode and the contextual and bidirectional rules are not applied.\n * Surrogate pairs are accepted as two label code units, so astral characters\n * consume two units of the label and hostname length limits.\n *\n * @evidence contracts/common.md#principled-implementation The ASCII hostname structure is reused with the label class widened to code units from U+00A1 to U+FFFF, so every valid hostname is also a valid IDN hostname as the comment records. Without the `u` flag, both units of a surrogate pair match separately and consume two units of the length limits; this also admits unpaired surrogates. IDNA mapping, Punycode and contextual and bidirectional rules are not applied, so this spelling check is an approximation rather than IDNA validation.\n * @evidence contracts/common.md#clear-and-simple-design One predicate and one private pattern, identical to the copy in @typia/utils.\n * @evidence contracts/common.md#prohibited-implementation-shortcuts The widening is a stated approximation of IDNA, not a fixture accommodation.\n * @evidence contracts/common.md#meaningful-documentation The doc states the character range and the checks that are absent.\n */\nexport const _isFormatIdnHostname = (str: string): boolean => PATTERN.test(str);\n\n// The ASCII `hostname` structure with the label character class extended by the\n// non-ASCII range: every valid host name is a valid IDN host name, so this must\n// accept a single label, a one-to-63-character label in any position, and a\n// name up to 253 characters, exactly as `_isFormatHostname` does (issue #2317).\nconst PATTERN =\n  /^(?=.{1,253}\\.?$)[a-z0-9\\u00a1-\\uffff](?:[a-z0-9\\u00a1-\\uffff-]{0,61}[a-z0-9\\u00a1-\\uffff])?(?:\\.[a-z0-9\\u00a1-\\uffff](?:[a-z0-9\\u00a1-\\uffff-]{0,61}[a-z0-9\\u00a1-\\uffff])?)*\\.?$/i;\n"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAa,wBAAwB,QAAyB,QAAQ,KAAK,GAAG;AAM9E,MAAM,UACJ"}