Please help me create a Power Query function.
I have a table (list of employees), for each row of which there is a list of date intervals (periods of work in different positions). There is a reference interval (a given year). It is necessary for each line to determine the list of missing intervals that are necessary to fill the reference interval. If the initial interval begins before the start of the reference interval, and ends after its start, then the initial interval at the initial interval must be adjusted by placing it at the beginning of the reference interval.
Similarly with the ending. If the initial interval ends after the end of the reference interval, then its end must be adjusted by limiting the date of the end of the reference interval. Next, for each interval (originally available and added), specify the attribute - "source" or "added." If the original interval intersected with the beginning or end of the reference interval and was adjusted, it is considered to be "source".
For example (MM.DD.YYYY):
1) reference interval {01/01/2019, 12/31/2019}.
2) a list of intervals filled for the line
{{02/20/2018, 01/31/2019},
{05/01/2019, 09/30/2019},
{10/01/2019, 02/09/2020}}
3) the following intervals should be obtained with their signs:
{{01/01/2019, 01/31/2019, "source"},
{02/01/2019, 04/30/2019, "added"},
{05/01/2019, 09/30/2019, "source"},
{10/01/2019, 12/31/2019, "source"}}

The first interval {02/20/2018, 01/31/2019} has been adjusted, because it begins on February 20, 2018, before the reference interval on January 1, 2019, and it turns out that on {01/01/2019, 01/31/2019, “source”}.
The second interval was added as missing.
The third interval without changes in emergency is supplemented by the sign of "source".
The fourth interval {10/01/2019, 02/09/2020} has been adjusted since it ends on 02/09/2020 after the end of the reference interval 12/31/2019 and it turns out {01/10/2019, 12/31/2019, "source"}.