I’m not sure whether this is a cocoon or an egg sac. I know spiders spin cocoons for molting and other reasons. I also know they spin silk around their captives and also protect their eggs in silk. In the brief time I researched, I didn’t find any conclusive evidence for what this was. My guess is that it is a cocoon.
I did not even see the spider when I took the first photo of the cocoon. After I noticed the spider, I was stunned by its web.
Not like most I have seen, this intricate web was fascinating to me.