Does wash sale rule apply to RSU? How to determine cost basis

I get conflicting answers about whether IRS' wash sale rule applies to RSU. Some say the rule does not because RSU is not "purchased" while some say the rule applies as it covers all forms of securities, options etc. Which is correct?  

 

Second, if wash sale rule does apply to RSU, can anyone explain to me which of the following two transactions triggers a wash sale condition and the cost basis for each transaction with disallowed capital loss deduction considered (if there is any)?  Thank you.

 

Lot 1: 90 RSU vested on 12/17/2021, sold on 08/19/2022 at a loss; vested price $40/share, sold price $30/share

Lot 2: 150 RSU vested on 08/17/2022, sold on 09/27/2022 at a loss; vested price $25/share, sold price $20/share