Exact Mean-Field Theory Explains the Dual Role of Electrical Synapses in Collective Synchronization.