Find anagrams of a string in another string

Given a string (haystack) and a pattern (needle). Find all the anagrams of the pattern that are contained in the string.

For example: str = “abateatas” and pattern = “tea”. Then output should be the anagrams of “tea” contained as a substring in str. So, the desired output = {“ate”, “eat”, “tea”}.