import { WINDOWS_TO_IANA_MAP } from './data' ; import type { IanaName , Territory , WindowsZoneName } from './data' ; import { findIanaAliases } from './findIanaAliases' ; export function findIana ( windowsTimeZone , territory ? ) ; export function findIana ( windowsTimeZone , territory ? ) ; export function findIana ( windowsTimeZone , territory ? ) ; export function findIana ( windowsTimeZone , territory ? ) ; export function findIana ( windowsTimeZone , territory ? ) { const set = new Set < IanaName > ( ) ; WINDOWS_TO_IANA_MAP . filter ( ( it ) => { if ( typeof territory === 'undefined' ) { return it . windowsName === windowsTimeZone ; } return it . windowsName === windowsTimeZone && it . territory === territory ; } ) . map ( ( it ) => it . iana ) . flat ( ) . map ( findIanaAliases ) . flat ( ) . forEach ( ( alias ) => { set . add ( alias ) ; } ) ; return Array . from ( set ) ; }