How is the «Image Detail» popup implemented on the backend product view?

Magento_Catalog/product-gallery::_initDialog()

«productGallery» widget

Magento_Catalog::catalog/product/helper/gallery.phtml

Image roles

How is the «Role» list implemented in the «Image Detail» popup on the backend product view?

See also:

backend-product-image-detail-tagged articles