Ken Shirriff @ righto.com has a detailed teardown of a macbook charger explaining the various components used in it:
Have you ever wondered what’s inside your Macbook’s charger? There’s a lot more circuitry crammed into the compact power adapter than you’d expect, including a microprocessor. This charger teardown looks at the numerous components in the charger and explains how they work together to power your laptop.
Macbook charger teardown – [Link]