How are weapons sorted in breath of the wild?

I believe it's sorted by weapon type (one-handed, two-handed, other?), and damage. Sorting a second time alternates between ascending and descending damage.

The Master Sword appears to be an exception. It seems like it is sorted as 60 damage, regardless of whether it's glowing, regular, or depleted at the time.

Edit: Since a recent update (likely 1.3.0+), the Master Sword now sorts appropriately based on its current damage rating. This includes changes from energy depletion, glowing status, and Trial of the Sword DLC completion.

Edit 2: After some experimentation I have also determined durability also plays a role in sorting. Given two or more weapons of the same type with the same damage value, the one with a lower durability will appear to the right, regardless of the current sort order.