function Agent(global, capabilities) {
	    _classCallCheck(this, Agent);

	    var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Agent).call(this));

	    _this.global = global;
	    _this.reactElements = new Map();
	    _this.ids = new WeakMap();
	    _this.renderers = new Map();
	    _this.elementData = new Map();
	    _this.roots = new Set();
	    _this.reactInternals = {};
	    _this.on('selected', function (id) {
	      var data = _this.elementData.get(id);
	      if (data && data.publicInstance) {
	        _this.global.$r = data.publicInstance;
	      }
	    });
	    _this._prevSelected = null;
	    var isReactDOM = window.document && typeof window.document.createElement === 'function';
	    _this.capabilities = assign({
	      scroll: isReactDOM && typeof window.document.body.scrollIntoView === 'function',
	      dom: isReactDOM,
	      editTextContent: false
	    }, capabilities);
	    return _this;
	  }
The agent lives on the page in the same context as React, observes events
from the `backend`, and communicates (via a `Bridge`) with the frontend.

It is responsible for generating string IDs (ElementID) for each react
element, maintaining a mapping of those IDs to elements, handling messages
from the frontend, and translating between react elements and native
handles.


  React
    |
    v
 backend
    |
    v
 -----------
| **Agent** |
 -----------
    ^
    |
    v
 (Bridge)
    ^
    |
serialization
    |
    v
 (Bridge)
    ^
    |
    v
 ----------------
| Frontend Store |
 ----------------


Events from the `backend`:
- root (got a root)
- mount (a component mounted)
- update (a component updated)
- unmount (a component mounted)

Events from the `frontend` Store:
- see `addBridge` for subscriptions

Events that Agent fires:
- selected
- hideHighlight
- startInspecting
- stopInspecting
- shutdown
- highlight /highlightMany
- setSelection
- root
- mount
- update
- unmount